ZHANGYUXUAN-zR commited on
Commit
f345089
·
verified ·
1 Parent(s): e4ee801

Add files using upload-large-folder tool

Browse files
Files changed (50) hide show
  1. md/dev/157Usp_kbi/157Usp_kbi.md +298 -0
  2. md/dev/2jUKhUrBxP/2jUKhUrBxP.md +377 -0
  3. md/dev/3itjR9QxFw/3itjR9QxFw.md +433 -0
  4. md/dev/6NT1a56mNim/6NT1a56mNim.md +286 -0
  5. md/dev/716PvHoDct/716PvHoDct.md +367 -0
  6. md/dev/7UmjRGzp-A/7UmjRGzp-A.md +0 -0
  7. md/dev/8FhxBtXSl0/8FhxBtXSl0.md +0 -0
  8. md/dev/9U4gLR_lRP/9U4gLR_lRP.md +439 -0
  9. md/dev/Fn17vlng9pD/Fn17vlng9pD.md +445 -0
  10. md/dev/GoOuIrDHG_Y/GoOuIrDHG_Y.md +262 -0
  11. md/dev/I59qJ0sJ2nh/I59qJ0sJ2nh.md +390 -0
  12. md/dev/JVzeOYEx6d/JVzeOYEx6d.md +0 -0
  13. md/dev/K2OixmPDou3/K2OixmPDou3.md +0 -0
  14. md/dev/Mspk_WYKoEH/Mspk_WYKoEH.md +0 -0
  15. md/dev/QFQoxCFYEkA/QFQoxCFYEkA.md +380 -0
  16. md/dev/R9KnuFlvnU/R9KnuFlvnU.md +240 -0
  17. md/dev/RhB1AdoFfGE/RhB1AdoFfGE.md +312 -0
  18. md/dev/RriDjddCLN/RriDjddCLN.md +291 -0
  19. md/dev/SfXjt1FtMQ/SfXjt1FtMQ.md +424 -0
  20. md/dev/TW7d65uYu5M/TW7d65uYu5M.md +447 -0
  21. md/dev/UVtVRcurOYv/UVtVRcurOYv.md +208 -0
  22. md/dev/VppWsjXgBY6/VppWsjXgBY6.md +374 -0
  23. md/dev/WSIHedvwmru/WSIHedvwmru.md +445 -0
  24. md/dev/XDJwuEYHhme/XDJwuEYHhme.md +0 -0
  25. md/dev/YPpSngE-ZU/YPpSngE-ZU.md +351 -0
  26. md/dev/arg1dQSS6Mh/arg1dQSS6Mh.md +341 -0
  27. md/dev/cBu4ElJfneV/cBu4ElJfneV.md +297 -0
  28. md/dev/cZAi1yWpiXQ/cZAi1yWpiXQ.md +404 -0
  29. md/dev/eYfIM88MTUE/eYfIM88MTUE.md +293 -0
  30. md/dev/fT9W53lLxNS/fT9W53lLxNS.md +268 -0
  31. md/dev/fwzUgo0FM9v/fwzUgo0FM9v.md +476 -0
  32. md/dev/gERv_uy69IA/gERv_uy69IA.md +349 -0
  33. md/dev/ggTNeg2fem/ggTNeg2fem.md +483 -0
  34. md/dev/gmL46YMpu2J/gmL46YMpu2J.md +410 -0
  35. md/dev/iMSjopcOn0p/iMSjopcOn0p.md +414 -0
  36. md/dev/jowVZoitZYu/jowVZoitZYu.md +552 -0
  37. md/dev/kDEL91Dufpa/kDEL91Dufpa.md +0 -0
  38. md/dev/ktrw68Cmu9c/ktrw68Cmu9c.md +296 -0
  39. md/dev/pd1P2eUBVfq/pd1P2eUBVfq.md +711 -0
  40. md/dev/plKu2GByCNW/plKu2GByCNW.md +0 -0
  41. md/dev/qHGCH75usg/qHGCH75usg.md +348 -0
  42. md/dev/qQuzhbU3Gto/qQuzhbU3Gto.md +322 -0
  43. md/dev/qf12cWVSksq/qf12cWVSksq.md +305 -0
  44. md/dev/r5hq-Ooh_Ba/r5hq-Ooh_Ba.md +373 -0
  45. md/dev/sP1fo2K9DFG/sP1fo2K9DFG.md +544 -0
  46. md/dev/t877958UGZ/t877958UGZ.md +465 -0
  47. md/dev/um2BxfgkT2_/um2BxfgkT2_.md +316 -0
  48. md/dev/vhFu1Acb0xb/vhFu1Acb0xb.md +438 -0
  49. md/dev/vruwp11pWnO/vruwp11pWnO.md +285 -0
  50. md/dev/zDbsSscmuj/zDbsSscmuj.md +250 -0
md/dev/157Usp_kbi/157Usp_kbi.md ADDED
@@ -0,0 +1,298 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Knowledge Distillation from A Stronger Teacher
2
+
3
+ Tao Huang1,2 Shan You1∗ Fei Wang3 Chen Qian1 Chang Xu2 1SenseTime Research 2School of Computer Science, Faculty of Engineering, The University of Sydney 3University of Science and Technology of China
4
+
5
+ # Abstract
6
+
7
+ Unlike existing knowledge distillation methods focus on the baseline settings, where the teacher models and training strategies are not that strong and competing as state-of-the-art approaches, this paper presents a method dubbed DIST to distill better from a stronger teacher. We empirically find that the discrepancy of predictions between the student and a stronger teacher may tend to be fairly severer. As a result, the exact match of predictions in KL divergence would disturb the training and make existing methods perform poorly. In this paper, we show that simply preserving the relations between the predictions of teacher and student would suffice, and propose a correlation-based loss to capture the intrinsic inter-class relations from the teacher explicitly. Besides, considering that different instances have different semantic similarities to each class, we also extend this relational match to the intra-class level. Our method is simple yet practical, and extensive experiments demonstrate that it adapts well to various architectures, model sizes and training strategies, and can achieve state-of-the-art performance consistently on image classification, object detection, and semantic segmentation tasks. Code is available at: https://github.com/hunto/DIST_KD.
8
+
9
+ # 1 Introduction
10
+
11
+ The advent of automatic feature engineering fuels deep neural networks to achieve remarkable success in a plethora of computer vision tasks, such as image classification [17, 19, 38, 48, 53], object detection [2, 23], and semantic segmentation [5, 54]. In the path of pursuing better performance, current deep learning models generally grow deeper and wider [13, 45]. However, such heavy models are clumsy to deploy in practice due to the limitations of computational and memory resources. For an efficient model with competitive performance to those larger models, knowledge distillation (KD) [16] has been proposed to boost the performance of the efficient model (student) by distilling the knowledge of a larger model (teacher) during training.
12
+
13
+ The essence of knowledge distillation relies on how to formulate and transfer the knowledge from teacher to student. The most intuitive yet effective approach is to match the probabilistic prediction (response) scores between the teacher and student via Kullback–Leibler (KL) divergence [16]. In this way, the student can be guided with more informative signals during training, and is thus expected to have more promising performance than that being trained stand-alone. Besides this vanilla prediction match, other works [11, 14, 34, 41] also investigate the knowledge within intermediate representations to further boost the distillation performance, but this usually induces additional training cost as a consequence. For example, OFD [14] proposes to distill the information via multiple intermediate layers, but requires additional convolutions for feature alignments; CRD [41] introduces a contrastive loss to transfer pair-wise relationships, but it needs to hold a memory bank for all 128-d features of ImageNet images, and produces additional 260M FLOPs of computation cost.
14
+
15
+ ![](images/3c98d691bf1e5ddef9f2ca4076934e2f714fa5c37330374aaa209dc25b59e6bb.jpg)
16
+ Figure 1: Comparisons of KD and our proposed DIST on ImageNet with different teachers. (a) The ResNet-18 students are trained using baseline strategy with different model sizes of the teacher. (b) The ResNet-18 students are trained using different strategies with ResNet-50 teachers.
17
+
18
+ Recently, a few studies [8, 29, 39] have been performed to address the poor learning issue of the student network when the student and teacher model sizes significantly differ. For example, TAKD [29] proposes to reduce the discrepancy of teacher and student by resorting to an additional teaching assistant of moderate model size; DGKD [39] further improves TAKD by densely gathering all the assistant models to guide the student. However, increasing the model size is only one of the popular approaches to have a stronger teacher. There lacks a thorough analysis on the training strategies to derive a stronger teacher and their effect on KD. Most importantly, a generic enough solution is preferred to address the difficulty of KD brought by stronger teachers, rather than struggling to deal with different types of stronger teachers (with larger model size or stronger training strategy) individually.
19
+
20
+ To understand what makes a stronger teacher and their effect on KD, we systematically study the prevalent strategies for designing and training deep neural networks, and show that:
21
+
22
+ • Beyond scaling up the model size, a stronger teacher can also be derived through advanced training strategies, e.g., label smoothing and data augmentation [51]. However, given a stronger teacher, the student’s performance on the vanilla KD could be dropped, even worse than training from scratch without KD, as shown in Figure 1. • The discrepancy between teacher and student tends to get fairly larger when we switch their training strategy to a stronger one (see Figure 2). In this case, an exact recovery of predictions via KL divergence could be challenging and lead to the failure of vanilla KD. • Preserving the relation of predictions between teacher and student is sufficient and effective. When transferring the knowledge from teacher to student, what we really care about is preserving the preference (relative ranks of predictions) by the teacher, instead of recovering the absolute values accurately. Correlation between teacher and student predictions could be favored to relax the exact match of KL divergence and distill the intrinsic relations.
23
+
24
+ In this paper, we thus leverage the Pearson correlation coefficient [33] as a new match manner to replace the KL divergence. In addition, besides the inter-class relations in prediction vector (see Figure 3), with the intuition that different instances have different spectrum of similarities with respect to each class, we also propose to distill the intra-class relations for further boosting the performance as Figure 3. Concretely, for each class, we gather its corresponding predicted probabilities of all instances in a batch, then transfer this relation from teacher to student. Our proposed method (dubbed DIST) is super simple, efficient, and practical, which can be implemented with only several lines of code (see Appendix A.1) and has almost the same training cost as the vanilla KD. As a result, the student can be liberated from the burden of matching the exact output of a strong teacher, but only be guided appropriately to distill those truly informative relations.
25
+
26
+ Extensive experiments are conducted on benchmark datasets to verify our effectiveness on various tasks, including image classification, object detection, and semantic segmentation. Experimental results show that our DIST significantly outperforms vanilla KD and those sophisticatedly-designed state-of-the-art KD methods. For example, with the same baseline settings on ImageNet, our DIST achieves the highest $7 2 . 0 7 \%$ accuracy on ResNet-18. With the stronger strategy, our method obtains $8 2 . 3 \%$ accuracy on the recent transformer Swin-T [27], improving KD by $1 \%$ .
27
+
28
+ ![](images/f3f3dab51630049eab346bb9d566a7028a1d93061af433377c97d78cb92e8c8f.jpg)
29
+ Figure 2: Discrepancy between the predictions of models trained standalone with different strategies on ImageNet validation set. R18B1 represents ResNet-18 trained with strategy B1 for instance. Details of training strategies B1 and B2 refer to Table 1.
30
+
31
+ # 2 Revisiting Prediction Match of KD
32
+
33
+ In vanilla knowledge distillation [16], the knowledge is transferred from a pre-trained teacher model to a student model by minimizing the discrepancy between the prediction scores of the teacher and student models.
34
+
35
+ Formally, with the logits $Z ^ { ( \mathrm { s } ) } \in \mathbb { R } ^ { B \times C }$ and $Z ^ { ( \mathrm { t } ) } \in \mathbb { R } ^ { B \times C }$ of student and teacher networks, where $B$ and $C$ denote batch size and the number of classes, respectively, the vanilla KD loss [16] is represented as
36
+
37
+ $$
38
+ \mathcal { L } _ { \mathrm { K D } } : = \frac { \tau ^ { 2 } } { B } \sum _ { i = 1 } ^ { B } \mathrm { K L } ( Y _ { i , : } ^ { ( \mathrm { t } ) } , Y _ { i , : } ^ { ( \mathrm { s } ) } ) = \frac { \tau ^ { 2 } } { B } \sum _ { i = 1 } ^ { B } \sum _ { j = 1 } ^ { C } Y _ { i , j } ^ { ( \mathrm { t } ) } \log \left( \frac { Y _ { i , j } ^ { ( \mathrm { t } ) } } { Y _ { i , j } ^ { ( \mathrm { s } ) } } \right) ,
39
+ $$
40
+
41
+ where $\mathrm { K L }$ refers to Kullback–Leibler divergence with
42
+
43
+ $$
44
+ Y _ { i , : } ^ { \mathrm { ( s ) } } = s o f t m a x ( Z _ { i , : } ^ { \mathrm { ( s ) } } / \tau ) , \quad Y _ { i , : } ^ { \mathrm { ( t ) } } = s o f t m a x ( Z _ { i , : } ^ { \mathrm { ( t ) } } / \tau ) ,
45
+ $$
46
+
47
+ being the probabilistic prediction vectors, and $\tau$ is the temperature factor to control the softness of logits.
48
+
49
+ In addition to the teacher’s soft targets in Eq.(1), KD [16] stated that it is beneficial to train the student together with ground-truth labels, and the overall training loss is composed of the original classification loss $\mathcal { L } _ { \mathrm { c l s } }$ and KD loss ${ \mathcal { L } } _ { \mathrm { K D } }$ , i.e.,
50
+
51
+ $$
52
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { t r } } = \alpha \mathcal { L } _ { \mathrm { c l s } } + \beta \mathcal { L } _ { \mathrm { K D } } , } \end{array}
53
+ $$
54
+
55
+ where $\mathcal { L } _ { \mathrm { c l s } }$ is usually the cross-entropy loss between the predictions of student network and groundtruth labels, $\alpha$ and $\beta$ are factors for balancing the losses.
56
+
57
+ # 2.1 Catastrophic discrepancy with a stronger teacher
58
+
59
+ As illustrated in Section 1, the effect of a teacher on KD has not been sufficiently investigated, especially when the performance of pre-trained teacher grows stronger, such as with larger model size or being trained with more advanced and competing strategies, e.g., label smoothing, mix-up [51], auto augmentations [9], etc. With this regard, as Figure 2, we train ResNet-18 and ResNet-50 standalone with strategy B1 and strategy $\bar { \mathbf { B } \bar { 2 } }$ , and obtain 4 trained models (R18B1, R18B2, R50B1, and R50B2 with accuracies $6 9 . 7 6 \%$ , $7 3 . 4 \%$ , $7 6 . 1 3 \%$ , and $78 . 5 \%$ , respectively), then compare their discrepancy using KL divergence ( $\mathit { \check { \tau } } = 1$ and $\tau = 4$ ) on the predicted probabilities $\mathbf { Y }$ . We have the following observations:
60
+
61
+ ![](images/2bd1eb75068dbf9263a14589f57b9fc951fe07021affa3ae30f02f0e7cd2010b.jpg)
62
+ Figure 3: Difference between our DIST and existing KD methods. Conventional KD matches the outputs of student $( s \in \mathbb { R } ^ { 5 } )$ ) to teacher $( t \in \mathbb { R } ^ { 5 } )$ ) point-wisely; instance relation methods operate on the feature level and measure the internal correlations (corr.) between instances in student and teacher separately, then transfer the teacher’s correlations to student. Our DIST proposes to maintain the inter-class and intra-class relations between student and teacher. Inter-class relation: correlation between the predicted probabilistic distributions on each instance of teacher and student. Intra-class relation: correlation of the probabilities of all the instances on each class.
63
+
64
+ • The outputs of ResNet-18 do not change much with the stronger strategy compared to ResNet-50. This implies that the representational capacity limits the student’s performance, and it tends to be fairly challenging for the student to exactly match the teacher’s outputs as their discrepancy becomes larger.
65
+ When the teacher and student models are trained with a stronger strategy, the discrepancy between teacher and student would be larger. This indicates that when we adopt KD with a stronger training strategy, the misalignment between KD loss and classification loss would be severer, thus disturbing the student’s training.
66
+
67
+ As a result, the exact match (i.e., the loss reaches the minimal if and only if the teacher and student outputs are exactly identical) with KL divergence seems way too overambitious and demanding since the discrepancy between student and teacher can be considerably huge. Since the exact match can be detrimental with a stronger teacher, our intuition is to develop a relaxed manner for matching the predictions between the teacher and student.
68
+
69
+ # 3 DIST: Distillation from A Stronger Teacher
70
+
71
+ # 3.1 Relaxed match with relations
72
+
73
+ The prediction scores indicate the teacher’s confidence (or preference) over all classes. For a relaxed match of predictions between the teacher and student, we are motivated to consider what we really care about for the teacher’s output. Instead of the exact probabilistic values, actually, during inference, we are only concerned about their relations, i.e., relative ranks of predictions of teacher.
74
+
75
+ In this way, for some metric $d ( \cdot , \cdot )$ with $\mathbb { R } ^ { C } \times \mathbb { R } ^ { C } \mathbb { R } ^ { + }$ , the exact match can be formulated that $d ( { \pmb a } , { \pmb b } ) = 0$ if ${ \pmb a } = { \pmb b }$ for any two prediction vector as $Y _ { i , : } ^ { ( \mathrm { s } ) }$ and $Y _ { i , : } ^ { ( \mathrm { t } ) }$ in the KL divergence of Eq.(1). Then as a relaxed match, we can introduce additional mappings $\phi ( \cdot )$ and $\psi ( \cdot )$ with $\mathbb { R } ^ { C } \to \mathbb { R } ^ { C }$ such that
76
+
77
+ $$
78
+ d ( \phi ( \mathbf { a } ) , \psi ( \pmb { b } ) ) = d ( \mathbf { a } , \pmb { b } ) , \forall \mathbf { a } , \pmb { b }
79
+ $$
80
+
81
+ Therefore, $d ( { \pmb a } , { \pmb b } ) = 0$ does not necessarily require $\textbf { \em a }$ and $^ { b }$ should be exactly the same. Nevertheless, since we care about the relation within $\textbf { \em a }$ or $^ { b }$ , the mappings $\phi$ and $\psi$ should be isotone and do not affect the semantic information and inference result of the prediction vector.
82
+
83
+ With this regard, a simple yet effective choice for the isotone mapping is the positive linear transformation, namely,
84
+
85
+ $$
86
+ d ( m _ { 1 } { \pmb a } + n _ { 1 } , m _ { 2 } { \pmb b } + n _ { 2 } ) = d ( { \pmb a } , { \pmb b } ) ,
87
+ $$
88
+
89
+ where $m _ { 1 }$ $_ { \cdot 1 } , m _ { 2 } , n _ { 1 }$ , and $n _ { 2 }$ are constants with $m _ { 1 } \times m _ { 2 } > 0$ . As a result, this match could be invariant under separate changes in scale and shift for the predictions. Actually, to satisfy the property Eq.(5), we can thus adopt the widely-used Pearson’s distance as the metric, i.e.,
90
+
91
+ $$
92
+ \begin{array} { r } { d _ { \mathrm { p } } ( \pmb { u } , \pmb { v } ) : = 1 - \rho _ { \mathrm { p } } ( \pmb { u } , \pmb { v } ) . } \end{array}
93
+ $$
94
+
95
+ $\rho _ { \mathrm { p } } ( { \pmb u } , { \pmb v } )$ is the Pearson correlation coefficient between two random variables $\textbf { \em u }$ and $\textbf { { v } }$
96
+
97
+ $$
98
+ \rho _ { \mathrm { p } } ( { \pmb u } , { \pmb v } ) : = \frac { \mathrm { C o v } ( { \pmb u } , { \pmb v } ) } { \mathrm { S t d } ( { \pmb u } ) \mathrm { S t d } ( { \pmb v } ) } = \frac { \sum _ { i = 1 } ^ { C } ( u _ { i } - \bar { u } ) ( v _ { i } - \bar { v } ) } { \sqrt { \sum _ { i = 1 } ^ { C } ( u _ { i } - \bar { u } ) ^ { 2 } \sum _ { i = 1 } ^ { C } ( v _ { i } - \bar { v } ) ^ { 2 } } }
99
+ $$
100
+
101
+ where $\operatorname { C o v } ( u , v )$ is the covariance of $\textbf { \em u }$ and $v , { \bar { u } }$ and $\operatorname { S t d } ( { \pmb u } )$ denote the mean and standard derivation of $\textbf { \em u }$ , respectively.
102
+
103
+ In this way, we can define the relation as correlation. More specifically, and the original exact match in vanilla KD [16] can thus be relaxed and replaced by maximizing the linear correlation to preserve the relation of teacher and student on the probabilistic distribution of each instance, which we call inter-class relation. Formally, for each pair of prediction vector ${ Y } _ { i , : } ^ { ( \mathrm { s } ) }$ ) and Y (t)i,: , the inter-relation loss can be formulated as
104
+
105
+ $$
106
+ \mathcal { L } _ { \mathrm { i n t e r } } : = \frac { 1 } { B } \sum _ { i = 1 } ^ { B } d _ { \mathrm { p } } ( Y _ { i , : } ^ { ( \mathrm { s } ) } , Y _ { i , : } ^ { ( \mathrm { t } ) } ) .
107
+ $$
108
+
109
+ Some isotone mappings or metrics can also be used to relax the match as Eq.(4), such as cosine similarity investigated empirically in Section 4.5; other more advanced and delicate choices could be left as future work.
110
+
111
+ # 3.2 Better distillation with intra-relations
112
+
113
+ Besides the inter-class relation, where we transfer the relation of multiple classes in each instance, the prediction scores of multiple instances in each class are also informative and useful. This scores indicate the similarities of multiple instances to one class. For instance, suppose we have three images containing “cat”, “dog”, and “plane”, respectively, and they have three prediction scores on the ‘cat’ class, denoted as $e$ , $f$ , and $g$ . Generally, the picture “cat” should have the largest score to the “cat” class, while the “plane” should have the smallest score since it is inanimate. This relation of $^ { \bullet } e > f > g ^ { , \bullet }$ could also be transferred to the student. Besides, even for the images from the same class, the intrinsic intra-class variance of the semantic similarities is actually also informative. It indicates the prior from the teacher that which one is more reliable to cast in this class.
114
+
115
+ Therefore, we also encourage to distill this intra-relation for better performance. Actually, define prediction matrix Y (s) and Y (t) with each row as Y (si,: ) and Y (t)i,: , then the above inter-relation is to maximize the correlation row-wisely (see Figure 3). In contrast, for intra-relation, the corresponding loss is thus to maximize the correlation column-wisely, i.e.,
116
+
117
+ $$
118
+ \mathcal { L } _ { \mathrm { \mathrm { i n t r a } } } : = \frac { 1 } { C } \sum _ { j = 1 } ^ { C } d _ { \mathrm { p } } ( Y _ { : , j } ^ { ( \mathrm { s } ) } , Y _ { : , j } ^ { ( \mathrm { t } ) } ) .
119
+ $$
120
+
121
+ As a result, the overall training loss $\mathcal { L } _ { \mathrm { t r } }$ can be composed of the classification loss, inter-class KD loss, and intra-class KD loss, i.e.,
122
+
123
+ $$
124
+ \mathcal { L } _ { \mathrm { t r } } = \alpha \mathcal { L } _ { \mathrm { c l s } } + \beta \mathcal { L } _ { \mathrm { i n t e r } } + \gamma \mathcal { L } _ { \mathrm { i n t r a } } ,
125
+ $$
126
+
127
+ where $\alpha , \beta$ , and $\gamma$ are factors for balancing the losses. In this way, via the relation loss, we have endowed the student with freedom more or less to match the teacher network’s output adaptively, thus boosting the distillation performance to a great extent.
128
+
129
+ Table 1: Training strategies on image classification tasks. BS: batch size; $L R$ : learning rate; WD: weight decay; LS: label smoothing; EMA: model exponential moving average; RA: RandAugment [9]; $R E$ : random erasing; CJ: color jitter.
130
+
131
+ <table><tr><td>Strategy</td><td>Dataset</td><td>Epochs</td><td>Total Initial BS</td><td>LR</td><td>Optimizer</td><td>WD</td><td></td><td></td><td>LS EMA LR scheduler</td><td></td><td>Data augmentation</td></tr><tr><td>A1</td><td>CIFAR-100</td><td>240</td><td>64</td><td>0.05</td><td>SGD</td><td>5×10-4</td><td></td><td></td><td></td><td>×0.1 at 150,180,210 epochs crop + flip</td><td></td></tr><tr><td>B1</td><td>ImageNet</td><td>100</td><td>256</td><td>0.1</td><td>SGD</td><td>1×10-4</td><td></td><td>1</td><td>-</td><td>×0.1 every 30 epochs</td><td>crop + flip</td></tr><tr><td>B2</td><td>ImageNet</td><td>450</td><td>768</td><td>0.048</td><td>3RMSProp</td><td>1×10-5</td><td></td><td></td><td></td><td>0.10.9999 ×0.97 every 2.4 epochs</td><td>{Bl} +RA + RE</td></tr><tr><td>B3</td><td>ImageNet</td><td>300</td><td>1024</td><td>5e-4</td><td>AdamW</td><td>5×10-²</td><td>0.1</td><td></td><td>1 cosine</td><td></td><td>{B2} +CJ+ Mixup +CutMix</td></tr></table>
132
+
133
+ Table 2: Evaluation results of baseline settings on ImageNet. We use ResNet-34 and ResNet-50 released by Torchvision [28] as our teacher networks, and follow the standard training strategy (B1). Student (teacher) Teacher Student KD [16] OFD [14] CRD [41] SRRL [47] Review [7] DIST
134
+
135
+ <table><tr><td>ResNet-18 (ResNet-34)</td><td>Top-1 Top-5</td><td>73.31 91.42</td><td>69.76 89.08</td><td>70.66 89.88</td><td>71.08 90.07</td><td>71.17 90.13</td><td>71.73 90.60</td><td>71.61 90.51</td><td>72.07 90.42</td></tr><tr><td>MobileNet (ResNet-50)</td><td>Top-1 Top-5</td><td>76.16 92.86</td><td>70.13 89.49</td><td>70.68 90.30</td><td>71.25 90.34</td><td>71.37 90.41</td><td>72.49 90.92</td><td>72.56 91.00</td><td>73.24 91.12</td></tr></table>
136
+
137
+ # 4 Experiments
138
+
139
+ # 4.1 Experimental settings
140
+
141
+ Training strategies. The training strategies of image classification task are summarized in Table 1. CIFAR-100. For fair comparisons, we use the same training strategies (referred to $A l$ in Table 1) and pretrained models following CRD [41]. ImageNet. B1: for comparisons with previous KD methods, we train our baselines with the same simple training strategy as CRD [41]. B2: to validate the effectiveness of KD methods on modern training strategies, we follow EfficientNet [40] and design a training strategy B2, which can significantly improve the performance compared to B1. B3: the strategy B3 is used for training Swin-Transformers [27], and contains even more stronger data augmentations and regularization.
142
+
143
+ Loss weights. On CIFAR-100 and ImageNet, we set $\alpha = 1$ , $\beta = 2$ , and $\gamma = 2$ in Eq.(10). On object detection and semantic segmentation, these three factors are all equal to 1. For KD [16], we set $\alpha = 0 . 9$ , $\beta = 1$ in Eq.(3), and use a default temperature $\tau = 4$ . Specifically, instead of using $\tau = 1$ on ImageNet, we choose a larger temperature $\tau = 4$ on CIFAR-100, as it is easy to get overfit and the learned probabilistic distribution is sharp on CIFAR-100.
144
+
145
+ # 4.2 Image Classification
146
+
147
+ Baseline results on ImageNet. We first compare our method with prior works using the baseline settings. As shown in Table 2, our DIST significantly outperforms prior KD methods. Note that our method is only conducted on the outputs of models, and has a similar computational cost as KD [16]. Nevertheless, it even achieves better performance compared to those sophisticatedlydesigned methods. For example, CRD [41] needs to preserve a memory bank for all 128-d features of ImageNet images, and produces additional 260M FLOPs of computation cost; SRRL [47] and Review [7] require additional convolutions for feature alignments. The implementation of DIST can be found in Appendix A.1, which is quite simple compared to these methods.
148
+
149
+ Distillation from stronger teacher models. As the stronger teachers come from larger model sizes and stronger strategies, we here first conduct experiments to compare our DIST with the vanilla KD on different scales (model sizes) of ResNets with baseline strategy B1. As shown in Table 3, when the teacher goes larger, the ResNet-18 students perform even worse than that with a medium-sized ResNet-50 teacher. Nevertheless, our DIST shows an upward trend with larger teachers, and the improvements compared to KD also become more significant, indicating that our DIST tackles better on the large discrepancy between the student and larger teacher.
150
+
151
+ Distillation from stronger training strategies. Recently, the performance of models on ImageNet has been significantly improved by the sophisticated training strategies and strong data augmentations (e.g., TIMM [44] achieves $8 0 . 4 \%$ accuracy on ResNet-50 while the baseline strategy B1 only obtains $7 6 . 1 \%$ . However, most of the KD methods still conduct experiments with simple training settings. It is seldomly investigated whether the KD methods are suitable to the advanced strategies. In this way, we conduct experiments with advanced training strategies and compare our method with vanilla KD, instance relation-based RKD [30], and SRRL [47].
152
+
153
+ Table 3: Performance of ResNet-18 and ResNet-34 on ImageNet with different sizes of teachers.
154
+
155
+ <table><tr><td rowspan="2">Student</td><td rowspan="2">Teacher</td><td colspan="4">Top-1 ACC (%)</td></tr><tr><td> student</td><td>teacher</td><td>KD</td><td>DIST</td></tr><tr><td rowspan="4">ResNet-18</td><td>ResNet-34</td><td rowspan="4">69.76</td><td>73.31</td><td>71.21</td><td>72.07 (+0.86)</td></tr><tr><td>ResNet-50</td><td>76.13</td><td>71.35</td><td>72.12 (+0.77)</td></tr><tr><td>ResNet-101</td><td>77.37</td><td>71.09</td><td>72.08 (+0.99)</td></tr><tr><td>ResNet-152</td><td>78.31</td><td>71.12</td><td>72.24 (+1.12)</td></tr><tr><td rowspan="4">ResNet-34</td><td>ResNet-50</td><td rowspan="2">73.31</td><td>76.13</td><td>74.73</td><td>75.06 (+0.33)</td></tr><tr><td>ResNet-101</td><td>77.37</td><td>74.89</td><td>75.36 (+0.47)</td></tr><tr><td>ResNet-152</td><td>78.31</td><td>74.87</td><td>75.42 (+0.55)</td></tr><tr><td></td><td></td><td></td><td></td></tr></table>
156
+
157
+ Table 4: Performance of students trained with strong strategies on ImageNet. The Swin- $T$ is trained with strategy B3 in Table 1, others are trained with B2. †: trained by [44]. ‡: Pretrained on ImageNet-22K.
158
+
159
+ <table><tr><td rowspan="2">Teacher</td><td rowspan="2">Student</td><td colspan="4">Top-1 ACC (%)</td></tr><tr><td>teacher student</td><td>KD[16] RKD[30]</td><td>SRRL [47]</td><td>DIST</td></tr><tr><td rowspan="4">ResNet-50t</td><td>ResNet-18</td><td rowspan="4">80.1</td><td>73.4</td><td>72.6 72.9 71.2</td><td>74.5</td></tr><tr><td>ResNet-34</td><td>76.8</td><td>77.2 76.6 76.7</td><td> 77.8</td></tr><tr><td>MobileNetV2</td><td>73.6</td><td>71.7 73.1 69.2</td><td> 74.4</td></tr><tr><td>EfficientNet-B0</td><td>78.0 77.4</td><td>77.5 77.3</td><td>78.6</td></tr><tr><td rowspan="2">Swin-L</td><td>ResNet-50</td><td rowspan="2">86.3</td><td>78.5</td><td>80.0 78.9 78.6</td><td>80.2</td></tr><tr><td>Swin-T</td><td>81.3 81.5</td><td>81.2 81.5</td><td> 82.3</td></tr></table>
160
+
161
+ We first train traditional CNNs with strong strategies, and also use a strong ResNet-50 with $8 0 . 1 \%$ accuracy trained by [44] as the teacher. As results shown in Table 4, on both similar architectures (ResNet-18, ResNet-34) and dissimilar architectures (MobileNetV2, EfficientNet-B0), our DIST can achieve the best performance. Note that RKD and SRRL can perform worse than training from scratch, especially when the students are small (ResNet-18 and MobileNet) or the architectures of teacher and student are fairly different (ResNet-50 and Swin-L), this might be because they focus on the intermediate features, which can be more challenging for the student to recover teacher’s features compared to predictions.
162
+
163
+ Furthermore, we experiment on the recent state-of-the-art Swin-Transformer [27]. The results show that our DIST gains improvements on even more stronger models and strategies. For example, with Swin-L teacher, our method improves ResNet-50 and Swin-T by $1 . 7 \%$ and $1 . 0 \%$ , respectively.
164
+
165
+ CIFAR-100. The results on CIFAR-100 dataset in Table 5 show that, by distilling on the predicted logits, our method even outperforms those sophisticatedly-designed feature distillation methods.
166
+
167
+ # 4.3 Object Detection
168
+
169
+ We further investigate the effectiveness of DIST on downstream tasks. We conduct experiments on MS COCO object detection dataset [25], and simply leverage our DIST as an additional supervision on the final predictions of classes. Following [37, 52], we use the same standard training strategies and utilize Cascade Mask R-CNN [2] with ResNeXt-101 backbone as the teacher for two-stage student of Faster R-CNN [23] with ResNet-50 backbone; while for one-stage RetinaNet [24] with ResNet-50 backbone, the RetinaNet with ResNeXt-101 backbone is utilized as the teacher.
170
+
171
+ As shown in Table 6, our DIST achieves competitive results on COCO validation set. For comparisons, we train the vanilla KD under the same settings as our DIST, the results show that our DIST significantly outperforms vanilla KD by simply replacing the loss functions. Moreover, by combining
172
+
173
+ Table 5: Evaluation results on CIFAR-100 dataset. The upper and lower models denote teacher and student, respectively.
174
+
175
+ <table><tr><td rowspan="2">Method</td><td colspan="3">Same architecture style</td><td colspan="3">Different architecture style</td></tr><tr><td>WRN-40-2 WRN-40-1</td><td>ResNet-56 ResNet-20</td><td>ResNet-32x4 ResNet-8x4</td><td>ResNet-50 MobileNetV2 ShuffleNetV1 ShuffleNetV2</td><td>ResNet-32x4 ResNet-32x4</td><td></td></tr><tr><td>Teacher</td><td>75.61</td><td>72.34</td><td>79.42</td><td>79.34</td><td>79.42</td><td>79.42</td></tr><tr><td>Student</td><td>71.98</td><td>69.06</td><td>72.50</td><td>64.6</td><td>70.5</td><td>71.82</td></tr><tr><td colspan="7">Feature-based methods</td></tr><tr><td>FitNet [35]</td><td>72.24±0.24 69.21±0.36</td><td></td><td>73.50±0.28</td><td>63.16±0.47</td><td>73.59±0.15</td><td>73.54±0.22</td></tr><tr><td>VID [1]</td><td>73.30±0.13</td><td>70.38±0.14</td><td>73.09±0.21</td><td>67.57±0.28</td><td>73.38±0.09</td><td>73.40±0.17</td></tr><tr><td>RKD [30]</td><td>72.22±0.20</td><td>69.61±0.06</td><td>71.90±0.11</td><td>64.43±0.42</td><td>72.28±0.39</td><td>73.21±0.28</td></tr><tr><td>PKT [31]</td><td>73.45±0.19</td><td>70.34±0.04</td><td>73.64±0.18</td><td>66.52±0.33</td><td>74.10±0.25</td><td>74.69±0.34</td></tr><tr><td>CRD [41]</td><td>74.14±0.22</td><td>71.16±0.17</td><td>75.51±0.18</td><td>69.11±0.28</td><td>75.11±0.32</td><td>75.65±0.10</td></tr><tr><td colspan="7">Logits-based methods</td></tr><tr><td>KD [16]</td><td>73.54±0.20 70.66±0.24 73.33±0.25</td><td></td><td></td><td>67.35±0.32</td><td>74.07±0.19</td><td>74.45±0.27</td></tr><tr><td> DIST</td><td></td><td>74.73±0.24 71.75±0.30 76.31±0.19</td><td></td><td>68.66±0.23</td><td>76.34±0.18</td><td>77.35±0.25</td></tr></table>
176
+
177
+ Table 6: Results on COCO validation set. T: teacher; S: student. \*: We implement KD using $\tau = 1$ and other settings are the same as DIST.
178
+
179
+ <table><tr><td>Method</td><td colspan="5">AP AP50 AP75 APs APM APL</td></tr><tr><td>T: Cascade Mask RCNN-X101</td><td>Two-stage detectors</td><td>45.6 64.1 49.7</td><td>26.2</td><td>49.6 42.1</td><td>60.0 50.3</td></tr><tr><td>S: Faster RCNN-R50 KD [16]* FKD [52]</td><td>38.4 39.7 41.5</td><td>59.0 61.2 62.2</td><td>42.0 43.0 45.1</td><td>21.5 23.2 23.5</td><td>43.3 51.7 45.0 55.3</td></tr><tr><td>CWD [37] DIST DIST + mimic</td><td>41.7 40.4 61.7</td><td>62.0 45.5 43.8</td><td>23.3 23.9</td><td>45.5 44.6 41.8 62.4 45.6 23.4 46.1</td><td>55.5 52.6 55.0</td></tr><tr><td>T: RetinaNet-X101 S:RetinaNet-R50 KD [16]*</td><td>One-stage detectors 41.0 37.2 56.5</td><td>60.944.0 37.4 56.739.6</td><td>39.3 20.4</td><td>23.9 45.2 20.0 40.7 40.4</td><td>54.0 49.7 49.5</td></tr><tr><td>FKD [52] CWD [37]</td><td>39.6 40.8</td><td>558.8 60.4 59.5</td><td>42.1 43.4</td><td>22.7 43.3 22.7 44.5</td><td>52.5 55.3</td></tr><tr><td>DIST DIST + mimic</td><td>39.8 40.1 59.4</td><td>42.5 43.0</td><td>22.0</td><td>43.7 23.2 44.0</td><td>53.0 53.6</td></tr></table>
180
+
181
+ Table 7: Results on Cityscapes val dataset. All models are pretrained on ImageNet.
182
+
183
+ <table><tr><td rowspan=1 colspan=3>Method</td><td rowspan=1 colspan=1>mIoU (%)</td></tr><tr><td rowspan=1 colspan=3>T: DeepLabV3-R101</td><td rowspan=1 colspan=1>78.07</td></tr><tr><td rowspan=1 colspan=3>S: DeepLabV3-R18</td><td rowspan=1 colspan=1>74.21</td></tr><tr><td rowspan=1 colspan=3>SKD [26]</td><td rowspan=3 colspan=1>75.4275.59</td></tr><tr><td rowspan=2 colspan=2>IFVD [43]</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=2 colspan=3>CWD [37]</td></tr><tr><td rowspan=1 colspan=1>75.55</td></tr><tr><td rowspan=1 colspan=3>CIRKD [46]</td><td rowspan=1 colspan=1>76.38</td></tr><tr><td rowspan=1 colspan=3>DIST</td><td rowspan=1 colspan=1>77.10</td></tr><tr><td rowspan=1 colspan=3>S: PSPNet-R18</td><td rowspan=1 colspan=1>72.55</td></tr><tr><td rowspan=1 colspan=3>SKD [26]</td><td rowspan=3 colspan=1>73.2973.7174.36</td></tr><tr><td rowspan=1 colspan=3>IFVD [43]</td></tr><tr><td rowspan=1 colspan=3>CWD [37]</td></tr><tr><td rowspan=1 colspan=3>CIRKD [46]</td><td rowspan=1 colspan=1>74.73</td></tr><tr><td rowspan=1 colspan=3> DIST</td><td rowspan=1 colspan=1>76.31</td></tr></table>
184
+
185
+ DIST with mimic, which minimizes the mean square error between FPN features of teacher and student, we can even outperform the state-of-the-art KD methods designed for object detection.
186
+
187
+ # 4.4 Semantic Segmentation
188
+
189
+ We also perform experiments on semantic segmentation, a challenging dense prediction task. Following [37, 43, 46], we train DeepLabV3 [6] and PSPNet [54] with ResNet-18 backbone on Cityscapes dataset, and adopt our DIST on the predictions of classification head using a teacher with ResNet101 backbone of DeepLabV3. As the results summarized in Table 7, with only the supervision of class predictions, our DIST can significantly outperform existing knowledge distillation methods on semantic segmentation task. For example, our DIST outperforms recent state-of-the-art method CIRKD [46] by $1 . 5 8 \%$ on PSPNet-R18. This demonstrate our effectiveness on relation modeling.
190
+
191
+ # 4.5 Ablation studies
192
+
193
+ Effects of inter-class and intra-class correlations. This paper proposes two types of relations: interclass and intra-class relations. To validate the effectiveness of each relation, we conduct experiments to train students with these relations separately. The results on Table 8 verify that, both inter-class and intra-class relations can outperform the vanilla KD; also, the performance could be further boosted by combining them together.
194
+
195
+ Table 8: Ablation of inter-class and intra-class relations on ImageNet. The student and teacher models are ResNet-18 and ResNet-34, respectively.
196
+
197
+ <table><tr><td>Method</td><td>Inter</td><td>Intra</td><td>ACC (%)</td></tr><tr><td>KD</td><td>-</td><td>1</td><td>71.21</td></tr><tr><td>DIST (KL div.) DIST (KL div.)</td><td>× √</td><td>√ &lt;</td><td>70.61 71.62</td></tr><tr><td>DIST</td><td>√</td><td>×</td><td>71.63</td></tr><tr><td>DIST</td><td>×</td><td>√</td><td>71.55</td></tr><tr><td>DIST</td><td>√</td><td>√</td><td></td></tr><tr><td></td><td></td><td></td><td>72.07</td></tr></table>
198
+
199
+ Effect of intra-class relation in vanilla KD. To investigate the effectiveness of intra-class relation in vanilla KD, we adopt experiments to train our DIST using KL divergence as the relation metric, denoted as $D I S T ( K L { \dot { d } } i \nu . ) ^ { 3 }$ . As the results summarized in Table 8, adding intra-class relation in the vanilla KD can also improve the performance (from $7 1 . 2 1 \%$ to $7 1 . 6 2 \%$ ). However, when the student is trained with intra-class relation only, the improvement of using KL divergence is less significant than using Pearson correlation $7 0 . 6 1 \%$ vs. $7 1 . 5 5 \%$ ), since the means and variances of intra-class distributions could be varied.
200
+
201
+ Effect of training students with KD loss only. Training student with only the KD loss can better reflect the distillation ability and the information richness of supervision signals. As results in Table 9 show that, when the student is trained with only the KD loss, our DIST significantly outperforms the vanilla KD. Without using the ground-truth labels, it can even outperform the standalone training accuracy, which indicates the effectiveness of our DIST in distilling those truly-beneficial relations.
202
+
203
+ Table 9: Comparisons of training KD with or without the classification loss on ImageNet. The student and teacher models are ResNet-18 and ResNet-34, respectively. The original accuracy of ResNet-18 without KD is $6 9 . 7 6 \%$ .
204
+
205
+ <table><tr><td>Method</td><td>w/ cls. loss</td><td>w/o cls. loss</td></tr><tr><td>KD</td><td>71.21</td><td>68.12</td></tr><tr><td>DIST</td><td>72.07</td><td>70.65</td></tr></table>
206
+
207
+ More ablation studies can be found in Section A.3.
208
+
209
+ # 5 Conclusion
210
+
211
+ This paper presents a new knowledge distillation (KD) method named DIST to implement better distillation from a stronger teacher. We empirically study the catastrophic discrepancy problem between the student and a stronger teacher, and propose a relation-based loss to relax the exact match of KL divergence in a linear sense. Our method DIST is simple yet effective in handling strong teachers. Extensive experiments show our superiority in various benchmark tasks. For example, DIST even outperforms state-of-the-art KD methods designed specifically for object detection and semantic segmentation.
212
+
213
+ # Acknowledgements
214
+
215
+ This work was supported in part by the Australian Research Council under Project DP210101859 and the University of Sydney Research Accelerator (SOAR) Prize.
216
+
217
+ # References
218
+
219
+ [1] knowledge transfer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 9163–9171, 2019. 8 [2] Z. Cai and N. Vasconcelos. Cascade r-cnn: High quality object detection and instance segmentation. IEEE Transactions on Pattern Analysis and Machine Intelligence, page 1–1, 2019. 1, 7 [3] K. Chandrasegaran, N.-T. Tran, Y. ZHAO, and N. man Cheung. To smooth or not to smooth? on compatibility between label smoothing and knowledge distillation, 2022. 14 [4] H. Chen, Y. Wang, C. Xu, C. Xu, and D. Tao. Learning student networks via feature embedding. IEEE Transactions on Neural Networks and Learning Systems, 32(1):25–35, 2020. 13 [5] L.-C. Chen, G. Papandreou, F. Schroff, and H. Adam. Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587, 2017. 1 [6] L.-C. Chen, Y. Zhu, G. Papandreou, F. Schroff, and H. Adam. Encoder-decoder with atrous separable convolution for semantic image segmentation. In Proceedings of the European conference on computer vision (ECCV), pages 801–818, 2018. 8 [7] P. Chen, S. Liu, H. Zhao, and J. Jia. Distilling knowledge via knowledge review. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5008–5017, 2021. 6 [8] J. H. Cho and B. Hariharan. On the efficacy of knowledge distillation. In Proceedings of the IEEE/CVF international conference on computer vision, pages 4794–4802, 2019. 2 [9] E. D. Cubuk, B. Zoph, J. Shlens, and Q. 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, pages 702–703, 2020. 3, 6
220
+ [10] Y. Dodge. The concise encyclopedia of statistics. Springer Science & Business Media, 2008. 13
221
+ [11] S. Du, S. You, X. Li, J. Wu, F. Wang, C. Qian, and C. Zhang. Agree to disagree: Adaptive ensemble knowledge distillation in gradient space. advances in neural information processing systems, 33:12345– 12355, 2020. 1
222
+ [12] J. Gou, B. Yu, S. J. Maybank, and D. Tao. Knowledge distillation: A survey. International Journal of Computer Vision, 129(6):1789–1819, 2021.
223
+ [13] 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. 1
224
+ [14] B. Heo, J. Kim, S. Yun, H. Park, N. Kwak, and J. Y. Choi. A comprehensive overhaul of feature distillation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1921–1930, 2019. 1, 6
225
+ [15] B. Heo, M. Lee, S. Yun, and J. Y. Choi. Knowledge transfer via distillation of activation boundaries formed by hidden neurons. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3779–3787, 2019.
226
+ [16] G. Hinton, O. Vinyals, and J. Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015. 1, 3, 5, 6, 7, 8, 14
227
+ [17] A. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017. 1
228
+ [18] T. Huang, Z. Li, H. Lu, Y. Shan, S. Yang, Y. Feng, F. Wang, S. You, and C. Xu. Relational surrogate loss learning. In International Conference on Learning Representations, 2022.
229
+ [19] T. Huang, S. You, B. Zhang, Y. Du, F. Wang, C. Qian, and C. Xu. Dyrep: Bootstrapping training with dynamic re-parameterization. arXiv preprint arXiv:2203.12868, 2022. 1
230
+ [20] M. G. Kendall. A new measure of rank correlation. Biometrika, 30(1/2):81–93, 1938. 13
231
+ [21] J. Kim, S. Park, and N. Kwak. Paraphrasing complex network: Network compression via factor transfer. arXiv preprint arXiv:1802.04977, 2018.
232
+ [22] S. Kong, T. Guo, S. You, and C. Xu. Learning student networks with few data. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 4469–4476, 2020.
233
+ [23] T.-Y. Lin, P. Dollár, R. Girshick, K. He, B. Hariharan, and S. Belongie. Feature pyramid networks for object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2117–2125, 2017. 1, 7
234
+ [24] T.-Y. Lin, P. Goyal, R. Girshick, K. He, and P. Dollár. Focal loss for dense object detection. In Proceedings of the IEEE international conference on computer vision, pages 2980–2988, 2017. 7
235
+ [25] T.-Y. Lin, M. Maire, S. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014. 7
236
+ [26] Y. Liu, C. Shu, J. Wang, and C. Shen. Structured knowledge distillation for dense prediction. IEEE transactions on pattern analysis and machine intelligence, 2020. 8
237
+ [27] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo. Swin transformer: Hierarchical vision transformer using shifted windows. arXiv preprint arXiv:2103.14030, 2021. 3, 6, 7
238
+ [28] S. Marcel and Y. Rodriguez. Torchvision the machine-vision package of torch. In Proceedings of the 18th ACM international conference on Multimedia, pages 1485–1488, 2010. 6
239
+ [29] S. I. Mirzadeh, M. Farajtabar, A. Li, N. Levine, A. Matsukawa, and H. Ghasemzadeh. Improved knowledge distillation via teacher assistant. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 5191–5198, 2020. 2
240
+ [30] W. Park, D. Kim, Y. Lu, and M. Cho. Relational knowledge distillation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3967–3976, 2019. 7, 8, 13, 14
241
+ [31] N. Passalis, M. Tzelepi, and A. Tefas. Probabilistic knowledge transfer for lightweight deep representation learning. IEEE Transactions on Neural Networks and Learning Systems, 32(5):2030–2039, 2020. 8
242
+ [32] A. Paszke, S. Gross, F. Massa, A. Lerer, J. Bradbury, G. Chanan, T. Killeen, Z. Lin, N. Gimelshein, L. Antiga, et al. Pytorch: An imperative style, high-performance deep learning library. Advances in neural information processing systems, 32:8026–8037, 2019. 13
243
+ [33] K. Pearson. Vii. mathematical contributions to the theory of evolution.—iii. regression, heredity, and panmixia. Philosophical Transactions of the Royal Society of London. Series A, containing papers of a mathematical or physical character, (187):253–318, 1896. 2
244
+ [34] B. Peng, X. Jin, J. Liu, D. Li, Y. Wu, Y. Liu, S. Zhou, and Z. Zhang. Correlation congruence for knowledge distillation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5007–5016, 2019. 1, 13
245
+ [35] A. Romero, N. Ballas, S. E. Kahou, A. Chassang, C. Gatta, and Y. Bengio. Fitnets: Hints for thin deep nets. arXiv preprint arXiv:1412.6550, 2014. 8
246
+ [36] Z. Shen, Z. Liu, D. Xu, Z. Chen, K.-T. Cheng, and M. Savvides. Is label smoothing truly incompatible with knowledge distillation: An empirical study. In International Conference on Learning Representations, 2020. 14
247
+ [37] C. Shu, Y. Liu, J. Gao, Z. Yan, and C. Shen. Channel-wise knowledge distillation for dense prediction. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 5311–5320, 2021. 7, 8
248
+ [38] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014. 1
249
+ [39] W. Son, J. Na, J. Choi, and W. Hwang. Densely guided knowledge distillation using multiple teacher assistants. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9395– 9404, 2021. 2
250
+ [40] M. Tan and Q. Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning, pages 6105–6114. PMLR, 2019. 6
251
+ [41] Y. Tian, D. Krishnan, and P. Isola. Contrastive representation distillation. In International Conference on Learning Representations, 2019. 1, 6, 8, 14
252
+ [42] F. Tung and G. Mori. Similarity-preserving knowledge distillation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1365–1374, 2019.
253
+ [43] Y. Wang, W. Zhou, T. Jiang, X. Bai, and Y. Xu. Intra-class feature variation distillation for semantic segmentation. In European Conference on Computer Vision, pages 346–362. Springer, 2020. 8
254
+ [44] R. Wightman, H. Touvron, and H. Jégou. Resnet strikes back: An improved training procedure in timm. arXiv preprint arXiv:2110.00476, 2021. 7
255
+ [45] S. Xie, R. Girshick, P. Dollár, Z. Tu, and K. He. Aggregated residual transformations for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1492–1500, 2017. 1
256
+ [46] C. Yang, H. Zhou, Z. An, X. Jiang, Y. Xu, and Q. Zhang. Cross-image relational knowledge distillation for semantic segmentation. arXiv preprint arXiv:2204.06986, 2022. 8
257
+ [47] J. Yang, B. Martinez, A. Bulat, and G. Tzimiropoulos. Knowledge distillation via softmax regression representation learning. In International Conference on Learning Representations, 2020. 6, 7, 14
258
+ [48] S. You, T. Huang, M. Yang, F. Wang, C. Qian, and C. Zhang. Greedynas: Towards fast one-shot nas with greedy supernet. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 1999–2008, 2020. 1
259
+ [49] S. You, C. Xu, C. Xu, and D. Tao. Learning from multiple teacher networks. In Proceedings of the 23rd ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pages 1285–1294, 2017.
260
+ [50] S. Zagoruyko and N. Komodakis. Paying more attention to attention: Improving the performance of convolutional neural networks via attention transfer. arXiv preprint arXiv:1612.03928, 2016.
261
+ [51] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz. mixup: Beyond empirical risk minimization. In International Conference on Learning Representations, 2018. 2, 3
262
+ [52] L. Zhang and K. Ma. Improve object detection with feature-based knowledge distillation: Towards accurate and efficient detectors. In International Conference on Learning Representations, 2020. 7, 8
263
+ [53] X. Zhang, X. Zhou, M. Lin, and J. Sun. Shufflenet: An extremely efficient convolutional neural network for mobile devices. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 6848–6856, 2018. 1
264
+ [54] H. Zhao, J. Shi, X. Qi, X. Wang, and J. Jia. Pyramid scene parsing network. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2881–2890, 2017. 1, 8
265
+
266
+ # Checklist
267
+
268
+ 1. For all authors...
269
+
270
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
271
+ (b) Did you describe the limitations of your work? [Yes] See Appendix.
272
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] See Appendix.
273
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
274
+
275
+ 2. If you are including theoretical results...
276
+
277
+ (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]
278
+
279
+ 3. If you ran experiments...
280
+
281
+ (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] Training details are provided in the paper. Training code and logs are released at GitHub: https://github.com/hunto/DIST_KD.
282
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
283
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Standard deviations on CIFAR-100 are reported.
284
+ (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]
285
+
286
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
287
+
288
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
289
+ (b) Did you mention the license of the assets? [Yes]
290
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Code and training logs are included.
291
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
292
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
293
+
294
+ 5. If you used crowdsourcing or conducted research with human subjects...
295
+
296
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
297
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
298
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/2jUKhUrBxP/2jUKhUrBxP.md ADDED
@@ -0,0 +1,377 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Memory-Efficient Fine-Tuning of Compressed Large Language Models via sub-4-bit Integer Quantization
2
+
3
+ Jeonghoon Kim∗ NAVER Cloud jeonghoon.samuel@gmail.com
4
+
5
+ Jung Hyun Lee∗ NAVER Cloud onliwad101@gmail.com
6
+
7
+ Sungdong Kim NAVER Cloud, KAIST AI sungdong.kim@navercorp.com
8
+
9
+ Joonsuk Park NAVER Cloud, NAVER AI Lab, University of Richmond park@joonsuk.org
10
+
11
+ Kang Min Yoo NAVER Cloud, SNU AI Center kangmin.yoo@gmail.com
12
+
13
+ Se Jung Kwon NAVER Cloud sejung.kwon@navercorp.com
14
+
15
+ Dongsoo Lee NAVER Cloud dongsoo.lee@navercorp.com
16
+
17
+ # Abstract
18
+
19
+ Large language models (LLMs) face the challenges in fine-tuning and deployment due to their high memory demands and computational costs. While parameterefficient fine-tuning (PEFT) methods aim to reduce the memory usage of the optimizer state during fine-tuning, the inherent size of pre-trained LLM weights continues to be a pressing concern. Even though quantization techniques are widely proposed to ease memory demands and accelerate LLM inference, most of these techniques are geared towards the deployment phase. To bridge this gap, this paper presents Parameter-Efficient and Quantization-aware Adaptation (PEQA) – a simple yet effective method that combines the advantages of PEFT with quantized LLMs. By updating solely the quantization scales, PEQA can be directly applied to quantized LLMs, ensuring seamless task transitions. Parallel to existing PEFT methods, PEQA significantly reduces the memory overhead associated with the optimizer state. Furthermore, it leverages the advantages of quantization to substantially reduce model sizes. Even after fine-tuning, the quantization structure of a PEQA-tuned LLM remains intact, allowing for accelerated inference on the deployment stage. We employ PEQA-tuning for task-specific adaptation on LLMs with up to 65 billion parameters. To assess the logical reasoning and language comprehension of PEQA-tuned LLMs, we fine-tune low-bit quantized LLMs using a instruction dataset. Our results show that even when LLMs are quantized to below 4-bit precision, their capabilities in language modeling, few-shot in-context learning, and comprehension can be resiliently restored to (or even improved over) their full-precision original performances with PEQA.
20
+
21
+ ![](images/c6597cfef9015347c41f4440e445cb25da68bff3d2ba7355747c52bf6aebd785.jpg)
22
+ Figure 1: Illustration of our proposed PEQA scheme where $A \cdot B$ indicates the element-wise product of $A$ and $B$ . PEQA is memory-efficient fine-tuning method for quantized large language models that updates only the quantization scale while keeping the integer matrix frozen. Notice a significant reduction in memory footprint when full-precision weights are converted into sub-4-bit integers.
23
+
24
+ # 1 Introduction
25
+
26
+ Large language models (LLMs) such as PaLM, LLaMA, and the GPT-series [1–7] have demonstrated unprecedented levels of task-generalization ability in various applications, including dialogue systems, question answering, summarization, and translation [8, 9]. While they can follow instructions and learn to solve tasks via in-context task descriptions or few-shot examples [10], fine-tuning allows LLMs to align their behavior with desirable traits, such as following instructions more precisely [11] or adhering to certain principles [12]. Additionally, fine-tuning can improve the scaling curve by exposing the model to large collections of task-specific instruction datasets, leading to significant performance enhancements in various unseen downstream tasks [13–17]. However, the immense computational cost of fully fine-tuning large-scale models presents challenges for researchers and developers, especially given that LLMs have billions or even trillions of parameters [18].
27
+
28
+ In response, several parameter-efficient fine-tuning (PEFT) methods have been introduced [19–21], which only update a small number of parameters compared to the pre-trained weights of LLMs. PEFT notably reduces the number of learnable parameters, making the fine-tuning of pre-trained LLMs viable by ensuring that the optimizer states’ memory usage becomes negligible. These strategies lead to decreased memory usage during training and more efficient storage and seamless transitions of task-specifically fine-tuned parameters during deployment. Nonetheless, LLMs as a whole still demand significant memory, and further reductions are attainable through model compression. As outlined in Hu et al. [21], for instance, LoRA can cut the memory usage during the fine-tuning of GPT-3 175B from $1 . 2 \mathrm { T B }$ to 350GB. However, the model still requires approximately 350GB of memory for parameters in half-precision floating-point format.
29
+
30
+ Quantization is a favorable method for both compressing and accelerating neural networks by discretizing parameters into low-bit integers while maintaining a shared high-precision scale within each parameter group (e.g., channel or layer). However, during training phases, quantization-aware training (QAT) [22–25] mandates updates for all parameters, rendering it not parameter-efficient. Since post-training quantization (PTQ) [26–29] is executed after training, most existing quantization schemes primarily target the deployment phases. Although PTQ can be integrated with PEFT, when PTQ follows PEFT, the model remains intact during fine-tuning, not decreasing the memory usage. Conversely, if PTQ precedes PEFT, while there’s a reduction in memory usage during fine-tuning, no inference acceleration can be achieved due to the PEFT parameters during deployment.
31
+
32
+ To bridge the gap between PEFT and quantization, we introduce the Parameter-Efficient and Quantization-aware Adaptation (PEQA), a simple yet effective quantization-aware PEFT method. As illustrated in Figure 1, PEQA encompasses two steps: (a) Decomposition (Quantization) where the parameter matrix of each fully-connected layer is decomposed into a matrix of low-bit integers and quantization scales; and (b) Fine-tuning wherein, for each downstream task, the quantization scale is fine-tuned while the integer matrix remains unchanged. For the quantized LLMs, merely updating the quantization scale leverages the advantages of PEQA. As a result, PEQA maintains the merits of PEFT, such as fewer trainable parameters, along with efficient storage and swift switching of task-specific parameters. Concurrently, it provides the benefits of quantization, including reduced
33
+
34
+ DRAM usage during both training and deployment, and inference acceleration due to fewer memory accesses at deployment.
35
+
36
+ Through this, we highlight the following:
37
+
38
+ • We introduce PEQA, a method that fine-tunes only the quantization scales of quantized LLMs, keeping the integer matrix frozen. It bridges the gap between PEFT and quantization, offering advantages such as reduced memory consumption during both training and deployment phases, seamless task transitions, and faster inference. To empirically validate the approach of solely fine-tuning the quantization scale while freezing the integer matrix, we compare the perplexity of LLMs fine-tuned with QAT, PEFT $\left( + \mathrm { P T Q } \right)$ , and PEQA. The results indicate that PEQA delivers competitive performance in comparison to QAT and PEFT $+$ PTQ, even at sub-4-bit precision.
39
+ To assess the scalability and comprehension performance of PEQA, we apply PEQA to taskspecific adaptation and instruction-tuning. Despite the reduction in model size by a factor of 4 to 5, PEQA demonstrates competitive performance up to a 65B LLM when compared to full-precision baselines. The results suggest that even when LLMs are quantized into low-bit precision, the overall comprehension capability of quantized LLMs can be effectively restored to their original performance using PEQA.
40
+
41
+ # 2 Related Work
42
+
43
+ Large Language Models and Alignment Learning. Although LLMs have demonstrated great generalization capabilities through their sheer scales [2, 6, 30] and the emergent mechanism known as in-context learning [1], they still require significant alignment to follow natural language instructions [13], adhere to ethical guidelines or steer towards harmlessness [12], utilize external tools [31], and to be grounded in knowledge to generate truthful answers [16, 32]. In particular, instruction-tuning has been pivotal in enabling LLMs to generalize instruction-following abilities, enabling them to solve seemingly any NLP task with only the description of the task in natural text [13, 33, 34], allowing the models to be accessed in an interactive manner.
44
+
45
+ Parameter-Efficient Fine-Tuning. Fine-tuning leverages the generalization capabilities elicited from the general pretraining to specialize in specific domains and tasks [35, 36] or align the LLM with target behaviors [13]. However, updating parameters in LLMs comes with a high computation cost and minimal compute environment required for gradient computation. As the hyper-scale era makes fine-tuning for LLMs prohibitively expensive, both efficient and effective alternatives to fine-tuning have received considerable attention. Specifically, inspired by the sensitivity of LLMs to prompts [37], a line of works has proposed introducing trainable prompt embeddings prepended to the input text while freezing the original LLM parameters [19, 38, 39]. As another approach, adapter modules [20] introduce task-specific parameters, which are inserted between the pre-existing layers of the model Extending on this adapter-based approach, LoRA [21] employs the concept of low-rank bottleneck modules while demonstrating comparable performance to full fine-tuning. Subsequent works have unified the various versions and diverging approaches to PEFT [40, 41] by formulating them in a single mathematical framework. These parameter-efficient methods have shown comparable performance to full model fine-tuning, presenting a cost-effective and efficient avenue for tailoring LLMs to specific tasks.
46
+
47
+ However, even with the adoption of PEFT, the inherent model size of the LLM remains a challenge to handle. One immediate solution is to apply post-training quantization (PTQ), but its interaction with task-specific parameters is still an area of active research.There have been attempts to integrate PEFT and neural network quantization, including methods like Quadapter [42] and AlphaTuning [43]. Yet, these methods have primarily been explored in smaller models of 1.3B or fewer parameters. Appendix J delineates the distinctions between our method and AlphaTuning.
48
+
49
+ Neural Network Quantization. Neural network quantization consists largely of quantizationaware training (QAT) and PTQ. QAT methods [22–25] basically train not only quantization scales but all the parameters of a full-precision neural network to narrow the performance gap between the full-precision model and its quantized counterpart. Unfortunately, since QAT involves training all the weights of a full-precision network, it is not feasible to apply QAT to LLMs. To quantize LLMs, PTQ techniques tailored to LLMs [26–29, 44, 45] have been presented. Although such PTQ approaches do not require learning all the parameters of an LLM at all, as PTQ occurs after training/fine-tuning LLMs, PTQ cannot allow for compressing the model size during training/fine-tuning LLMs. To reduce the model size even during training/fine-tuning LLMs, researchers have recently focused on combining PEFT with quantization.
50
+
51
+ ![](images/7df181b8c63472039d556a92ba3c3dd756dcd6dd16c76308bb377290ea96fee0.jpg)
52
+ Figure 2: (a) DRAM usage comparison of LLaMA-65B on various tuning methods and (b) perplexity over model size when tuning LLaMA models with LoRA and PEQA on Wikitext2 dataset. The size of a circle indicates the number of trainable parameters. For instance, the LLaMA-65B model with LoRA has a size of 131GB and 10.49M trainable parameters. Otherwise, LLaMA-65B with 4-bit PEQA has a model size of 33GB and $6 . 8 \mathbf { M }$ trainable parameters.
53
+
54
+ # 3 Methodology
55
+
56
+ # 3.1 Problem Setup
57
+
58
+ Memory Demands in Fine-tuning. Given the significant computational demands associated with fully fine-tuning large language models, parameter-efficient fine-tuning (PEFT) methods have been introduced [19–21, 46]. One of the primary goals of PEFT methods is to reduce memory usage of the optimizer state during training, specifically by reducing the number of learnable parameters. While existing PEFT techniques do decrease memory consumption of the optimizer state and also narrow the accuracy gap between full fine-tuning and PEFT, the pre-trained weights of large language models still demand substantial memory space. When applying LoRA [21] to LLaMA-65B, for instance, even though storing optimizer states for trainable parameters consumes only 52MB (only query and value matrices are adapted with a LoRA rank of 4), the model size still occupies a huge portion of DRAM usage due to the frozen FP16 weights of a pre-trained model. To make PEFT more efficient, reducing the model size is an indispensable requisite. Given that LLMs mostly consist of fully-connected layers, compressing the weights of fully-connected layers is a key factor in compressing the model size and thus leading to more efficient PEFT.
59
+
60
+ Inference Latency of Large Language Models. During text generation inference, an autoregressive LLM generates tokens sequentially. A significant portion of the inference latency arises from matrix-vector multiplications, as opposed to matrix-matrix multiplications. Given that the batch size during inference is typically small [27, 28], matrix-vector multiplications tend to be memory-bound. Specifically, accessing global memory, such as DRAM, is expensive on contemporary high-end GPUs. Thus, the number of weights loaded into registers profoundly impacts the speed of multiplication between a matrix and a vector. To decrease the number of weights (subsequently increasing the weights loaded into registers), quantization is a widely researched method for both compressing and speeding up neural networks [29, 44, 47]. While quantization-aware training (QAT) imposes a significant load on both computation and memory, post-training quantization (PTQ) is often viewed as a fallback strategy among traditional quantization techniques to enhance the generation latency of LLMs. To both accelerate LLM inference and retain all advantages of PEFT, an innovative alternative approach should be pursued.
61
+
62
+ Table 1: Comparison of PEQA with other methods using LLaMA 65B on the DRAM usage and training time during fine-tuning, the DRAM storage for deployment, the inference acceleration, and task-switching efficiency. The DRAM usage estimation for PEFT is based on LoRA. PEFT $+$ PTQ denotes PTQ after PEFT and $\mathrm { P T Q + P E F T }$ denotes PTQ before PEFT.
63
+
64
+ <table><tr><td>Method</td><td>DRAM (Fine-Tuning)</td><td>DRAM (Deployment)</td><td>Inference Speed</td><td>Task- Switching</td></tr><tr><td>Full Fine-Tuning</td><td>457GB</td><td>131GB</td><td>Slow</td><td>Slow</td></tr><tr><td>PEFT</td><td>131GB</td><td>131GB</td><td>Slow</td><td>Fast</td></tr><tr><td>PEFT+PTQ</td><td>131GB</td><td>33GB</td><td>Fast</td><td>Slow</td></tr><tr><td>PTQ+PEFT</td><td>33GB</td><td>33GB</td><td>Slow</td><td>Fast</td></tr><tr><td>PEQA (Ours)</td><td>33GB</td><td>33GB</td><td>Fast</td><td>Fast</td></tr></table>
65
+
66
+ # 3.2 Parameter-Efficient and Quantization-aware Adaptation (PEQA)
67
+
68
+ Quantization reduces bit-precision for inference acceleration, less storage and increasing throughput. INT8 quantization, which lower the bit-precision for both activations and weights, utilize dedicated engine to effectively accelerate arithmetic computation [48]. This is effective for large batches where computing speed matters but less so for smaller batches constrained by memory. To tackle this memory issue, weight-only quantization keeps high precision for activations (e.g., FP16) but compresses weights to 4-bit or less, targeting memory I/O enhancement in modern GPUs [28, 47]. For simplicity, we mainly focus on low-bit weight-only quantization in a linear asymmetric per-channel context in this paper.
69
+
70
+ For pre-trained weights of a fully-connected layer $W _ { 0 } \in \mathbb { R } ^ { n \times m }$ , while PEQA can be applied to quantized LLMs, we first quantize $W _ { 0 }$ . In other words, for a given bit-width $b$ , quantized pre-trained weights $\widehat { W } _ { 0 }$ can be written as
71
+
72
+ $$
73
+ \widehat { W } _ { 0 } = s _ { 0 } \cdot \overline { { W } } _ { 0 } = s _ { 0 } \cdot \Big ( \mathrm { c l a m p } \Big ( \Big \lfloor \frac { W _ { 0 } } { s _ { 0 } } \Big \rceil + z _ { 0 } , 0 , 2 ^ { b } - 1 \Big ) - z _ { 0 } \Big ) ,
74
+ $$
75
+
76
+ where $A \cdot B , \lfloor \cdot \rceil$ , and $\mathrm { c l a m p } ( \cdot , a , b )$ indicate the element-wise product of $A$ and $B$ , the rounding function, and the clamping function into the range $[ a , b ]$ , respectively, while per-channel scales and zero-points (namely, $\pmb { s } _ { 0 } , \pmb { z } _ { 0 } \in \mathbb { R } ^ { n \times 1 } )$ are initialized to minimize $\| \boldsymbol { W } _ { 0 } - \widehat { \boldsymbol { W } } _ { 0 } \| _ { F } ^ { 2 }$ . Notice that $s _ { 0 }$ and $z _ { \mathrm { 0 } }$ are not related to any downstream task. Here, we freeze $\begin{array} { r } { \overline { { W } } _ { 0 } = \mathrm { c l a m p } ( \lfloor \frac { W _ { 0 } } { s _ { 0 } } \rceil + z _ { 0 } , 0 , 2 ^ { b } - 1 ) - z _ { 0 } ) } \end{array}$ , which is the integer quantization indices of $W _ { 0 }$ , for every full-connected layer in a pre-trained LLM. And then we fine-tune only $s _ { 0 }$ (residing outside the clamp function in Eq. 1) while sharing $\overline { { \boldsymbol { W } } } _ { 0 }$ across all downstream tasks. Consequently, quantized pre-trained weights $\widehat { W } _ { 0 }$ are adapted to a downstream task as follows:
77
+
78
+ $$
79
+ \widehat { W } = \left( s _ { 0 } + \Delta s \right) \cdot \overline { { W } } _ { 0 } = \left( s _ { 0 } + \Delta s \right) \cdot \Big ( \mathrm { c l a m p } \Big ( \Big \lfloor \frac { W _ { 0 } } { s _ { 0 } } \Big \rceil + z _ { 0 } , 0 , 2 ^ { b } - 1 \Big ) - z _ { 0 } \Big ) ,
80
+ $$
81
+
82
+ where $\Delta s \in \mathbb { R } ^ { n \times 1 }$ represents the gradient update of $s _ { 0 }$ obtained by adaptation to a downstream task. We dub Eq. 2 as Parameter-Efficient and Quantization-aware Adaptation (PEQA). PEQA is a memory-efficient fine-tuning method dedicated to quantized LLMs by solely updating quantization scales $\scriptstyle { \pmb { s } } _ { 0 }$ . With $\overline { { \boldsymbol { W } } } _ { 0 }$ being frozen and shared for all downstream tasks, $s _ { 0 } + \Delta s$ are task-specific parameters in PEQA, which can be quickly and easily swapped when it is needed to switch to a different downstream task. Note that, PEQA can be seamlessly applied not only to weight-only quantized LLMs but also to weight-activation quantized ones. The overall procedure of PEQA is described in Figure 1 in detail.
83
+
84
+ # 3.3 Benefits of PEQA Inherited from Bridging the Gap between PEFT and Quantization
85
+
86
+ PEQA is designed to have the advantages of both existing PEFT methods [19, 21, 46] and quantized LLM [28, 44, 47, 49]. We summarize the benefits of PEQA in this subsection.
87
+
88
+ Table 2: To empirically confirm the validity of PEQA’s approach, we compare the perplexity (PPL) of fine-tuned LLMs through QAT, PEFT $+$ PTQ, and PEQA on Wikitext2 [51] for GPT-Neo 2.7B, GPT-J 6B, LLaMA 7B, and LLaMA 13B. Weights are quantized into either 3-bit or 4-bit per channel, without a group size [28, 49]. LoRA configuration is set to QV4. The lower PPL, the better.
89
+
90
+ <table><tr><td>Method</td><td>W Bits</td><td>GPT-Neo 2.7B</td><td>GPT-J 6B</td><td>LLaMA 7B</td><td>LLaMA 13B</td></tr><tr><td>QAT</td><td>4</td><td>11.07</td><td>8.81</td><td>5.76</td><td>5.26</td></tr><tr><td>LoRA + OPTQ</td><td>4</td><td>12.09</td><td>8.91</td><td>7.13</td><td>5.31</td></tr><tr><td>PEQA (Ours)</td><td>4</td><td>11.38</td><td>8.84</td><td>5.84</td><td>5.30</td></tr><tr><td>QAT</td><td>3</td><td>12.37</td><td>9.60</td><td>6.14</td><td>5.59</td></tr><tr><td>LoRA+ OPTQ</td><td>3</td><td>21.93</td><td>11.22</td><td>19.47</td><td>7.33</td></tr><tr><td>PEQA (Ours)</td><td>3</td><td>12.54</td><td>9.36</td><td>6.19</td><td>5.54</td></tr></table>
91
+
92
+ Benefits of PEFT. By solely updating the quantization scales, PEQA substantially reduces the memory overhead associated with optimizer state, a feature consistent with other PEFT approaches. Notably, the utilization of quantization scales $s _ { 0 } + \Delta s$ allows PEQA to swiftly and effortlessly switch between task-specific parameters. This capability positions PEQA as ideally suited for deployment of quantized LLMs as a service, mirroring another key advantage of earlier PEFT methods. Note, however, that such a capability is not present in PEFT $^ +$ PTQ (i.e., the case where PTQ is applied after PEFT) due to the non-reversible quantizers, such as the rounding function.
93
+
94
+ Benefits of Quantization. Previous PEFT methods freeze the pre-trained weights $W _ { 0 }$ and utilize additional learnable parameters to reduce the memory usage of optimizer state. Similarly, PEQA freezes quantized pre-trained weights $\overline { { W } } _ { 0 }$ (which are the integer quantization values of $W _ { 0 }$ ) and fine-tunes quantization scales $s _ { 0 }$ . Since $\overline { { \boldsymbol { W } } } _ { 0 }$ is a $b$ -bit integer matrix, not only can PEQA reduce the optimizer states’ size but also the model size, leading to even greater efficiency in the PEFT scheme, as illustrated in Figure 2a. In addition, since $\widehat { W }$ is a $b$ -bit quantized matrix, PEQA can speed up token generation process at inference through dedicated kernels that accelerate the multiplication between a quantized weight matrix and a half-precision activation vector, as described by Frantar et al. [28], Lin et al. [47], and Park et al. [49]. It is worth noticing that employing PTQ before fine-tuning $( { \mathrm { P T Q } } \small { + } { \mathrm { P E F T } }$ ) [50] allows for memory-efficient fine-tuning and seamless task transition for the quantized LLM; however, $\mathrm { P T Q + P E F T }$ is not able to inherit from inference acceleration of quantization. As a result, PEQA can achieve both model compression in the process of fine-tuning and inference acceleration for fine-tuned models with marginal performance degradation compared to LoRA, one of the state-of-the-art PEFT techniques, as shown in Figure 2b.
95
+
96
+ The comparison of PEQA with other methods using the LLaMA 65B is summarized in Table 1.
97
+
98
+ # 4 Experiments
99
+
100
+ In this section, we empirically validate the effectiveness of our proposed PEQA method by examining its performance in both parameter-efficient fine-tuning (PEFT) and as a quantization method. We achieve this goal by using a series of benchmarks [52–57], datasets [51, 58, 59], and LLMs [4, 6, 60, 61] that have been publicly introduced. In Section 4.1, to empirically confirm the validity of fine-tuning only the quantization scale while freezing the integer matrix, we compare the perplexity of fine-tuned LLMs through quantization-aware training (QAT), PEFT $\left( + \mathrm { P T Q } \right)$ , and PEQA. In Section 4.2, to evaluate PEQA’s scalability and task-specific adaptation performance, we fine-tune and assess LLMs on the Wikitext2 [51] and PennTreeBank [58] datasets using PEQA and LoRA [21]. Section 4.3 is dedicated to showcasing PEQA’s performance-restoring capability through instruction-tuning on the Alpaca [59] dataset after round-to-nearest (RTN) quantization over the full-precision original model.
101
+
102
+ To assess PEQA’s performance as a PEFT method, we contrast PEQA with LoRA, which is currently recognized as one of the leading PEFT methods. As discussed in 3.1, we employ a baseline case that merges OPTQ [28], the state-of-the-art weight-only post-training quantization (PTQ) method for LLMs, with LoRA in order to evaluate PEQA’s quantization capabilities. In the context of LoRA, QV4 signifies the application of query and value layer weights with a LoRA rank of 4, while QKVO16 indicates the application of query, key, value, and output projection layer weights with a LoRA rank of 16. For PEQA, we utilize round-to-nearest (RTN) for the initialization method of quantized LLM.
103
+
104
+ Table 3: To show scalability of PEQA, the perplexity (PPL) on Wikitext2 and PennTreeBank (PTB) was compared with LoRA and PEQA. In this comparison, only the weights were quantized into 3-bit and 4-bit per-channel without group size. LoRA configuration is set to QV4. A lower PPL value indicates better performance.
105
+
106
+ <table><tr><td>Method</td><td>W Bits</td><td>GPT-Neo 2.7B</td><td>GPT-J 6B</td><td>LLaMA 7B</td><td>LLaMA 13B</td><td>LLaMA 30B</td><td>LLaMA 65B</td></tr><tr><td colspan="8">Wikitext2</td></tr><tr><td>LoRA</td><td>16</td><td>10.63</td><td>8.50</td><td>5.53</td><td>5.06</td><td>4.06</td><td>3.82</td></tr><tr><td>LoRA+OPTQ</td><td>4</td><td>12.09</td><td>8.91</td><td>7.13</td><td>5.31</td><td>4.39</td><td>4.10</td></tr><tr><td>PEQA (Ours)</td><td>4</td><td>11.38</td><td>8.84</td><td>5.84</td><td>5.30</td><td>4.36</td><td>4.02</td></tr><tr><td>LoRA+OPTQ</td><td>3</td><td>21.93</td><td>11.22</td><td>19.47</td><td>7.33</td><td>5.94</td><td>5.32</td></tr><tr><td>PEQA (Ours)</td><td>3</td><td>12.54</td><td>9.36</td><td>6.19</td><td>5.54</td><td>4.58</td><td>4.27</td></tr><tr><td colspan="8">PTB</td></tr><tr><td>LoRA</td><td>16</td><td>15.92</td><td>12.92</td><td>9.14</td><td>8.52</td><td>7.21</td><td>7.11</td></tr><tr><td>LoRA+OPTQ</td><td>4</td><td>18.83</td><td>13.46</td><td>11.22</td><td>8.83</td><td>7.55</td><td>7.46</td></tr><tr><td>PEQA (Ours)</td><td>4</td><td>16.55</td><td>13.30</td><td>9.69</td><td>8.64</td><td>7.68</td><td>7.36</td></tr></table>
107
+
108
+ # 4.1 Comparing Quantization Capabilities: PEQA vs. QAT vs. PEFT+PTQ
109
+
110
+ Table 2 presents the perplexity when various quantized LLMs are fine-tuned using QAT, PEFT $\left( + \mathrm { P T Q } \right)$ , and PEQA. To validate our approach, PEQA, which solely fine-tunes the quantization scale as outlined in Eq. 2 while simultaneously maintaining the integer matrix in a frozen state, we use QAT as an upper bound and PEFT $+$ PTQ as a lower bound. Note that QAT, unlike PEQA, updates all parameters including pre-trained weights as well as quantization scales. Table 2 reveals the competitive performance of PEQA compared to QAT. Furthermore, our observations indicate that PEQA consistently outperforms the combination of LoRA and OPTQ for any selected model, regardless of whether a 3-bit or 4-bit setting is employed. Such superior performance can be attributed to PEQA’s method of fine-tuning quantized LLMs, which minimizes the final task loss on the full training data, a capability that OPTQ lacks. Detailed settings are in Appendix B.
111
+
112
+ Diving deeper into the comparison between QAT and PEQA, it is important to note that QAT minimizes the final task loss computed from a weight-only quantized model, as described in Eq. 1, with respect to both $W _ { 0 }$ and $s _ { 0 }$ . Note that QAT includes all pre-trained weights for training, resulting in the practical model size limitation of LLMs under investigation being capped at 13B in our experiments. Despite the fact that QAT also updates $W _ { 0 }$ in Eq. 1, which is one of the most simple and straightforward approach though, we observe that the performance gap between QAT and PEQA narrows when the 4-bit association is introduced, especially as the size of LLMs increases. Impressively, PEQA can even outperform QAT in a 3-bit setting, a notably low-bit setting that challenges OPTQ in terms of quantizing LLMs. These findings suggest that the approach of PEQA, solely updating quantization scales while freezing the integer quantization values of pre-trained weights, can achieve performance comparable to that of QAT.
113
+
114
+ # 4.2 Task-specific Adaptation with Wikitext2 and PennTreeBank Datasets
115
+
116
+ Task-specific Adaptation and Scalability. We evaluate the task-specific adaptation performance and scalability of PEQA by employing GPT-Neo, GPT-J, and LLaMA models (up to 65B) on the Wikitext2 [51] and PennTreeBank (PTB) [58] datasets. The adaptation performance of PEQA is compared with LoRA, with its configuration set to QV4. As depicted in Table 3, we note a gradual convergence of PEQA’s perplexity to that of full-precision LoRA, with only marginal PPL degradation as the model size expands. Thus, Table 3 demonstrates that PEQA, compared to a prominent PEFT technique that utilizes full-precision pre-trained language model (PLM), can maintain a competitive perplexity level in LLMs while concurrently reducing DRAM usage through low-bit quantized weights. Notably, for a 3-bit quantization, PEQA experiences less performance degradation as the model size decreases due to extreme low-bit quantization compared to the combined LoRA and OPTQ. To further elucidate our findings, we have provided figures illustrating the results of 3-bit and 4-bit PEQA in the Appendix D. The comprehensive results indicate that for the deployment stage, PEQA allows models with larger parameters to operate under DRAM usage constraints, outperforming full-precision PEFT methods. For instance, under a restricted DRAM footprint, large LLaMA models can be explored using PEQA, while full-precision LoRA permits only smaller LLaMA models. Additional results with OPT [4], ranging from 1.3B to 66B models are included in the Appendix E. The detailed experimental settings are also included in the Appendix C.
117
+
118
+ Table 4: Number of learnable parameters and model size of GPT-Neo, GPT-J and LLaMAs. PEQA configuration is set to 4-bit or 3-bit channel-wise quantization.
119
+
120
+ <table><tr><td></td><td>Method</td><td>GPT-Neo 2.7B</td><td>GPT-J 6B</td><td>LLaMA 7B</td><td>LLaMA 13B</td><td>LLaMA 30B</td><td>LLaMA 65B</td></tr><tr><td>#of</td><td>LoRA (QV4)</td><td>1.31</td><td>1.84</td><td>2.10</td><td>3.28</td><td>6.39</td><td>10.49</td></tr><tr><td>Learnable</td><td>LoRA (QKV016)</td><td>5.24</td><td>7.34</td><td>8.39</td><td>13.11</td><td>25.56</td><td>41.94</td></tr><tr><td>Param. (M)</td><td>PEQA (Ours)</td><td>0.74</td><td>1.03</td><td>1.36</td><td>2.13</td><td>4.15</td><td>6.80</td></tr><tr><td>Model</td><td>LoRA (QV4)</td><td>5.30</td><td>12.10</td><td>13.48</td><td>26.03</td><td>65.06</td><td>130.57</td></tr><tr><td>Size</td><td>PEQA (Ours, 4-bit)</td><td>1.53</td><td>3.65</td><td>3.77</td><td>7.01</td><td>16.92</td><td>33.45</td></tr><tr><td>(GB)</td><td>PEQA (Ours, 3-bit)</td><td>1.21</td><td>2.94</td><td>2.96</td><td>5.42</td><td>12.90</td><td>25.35</td></tr></table>
121
+
122
+ Table 5: Multi-scale (grouping) performance with PEQA-tuned LLaMA 7B and 13B on Wikitext2 where $g$ indicates the group size [49]. The perplexity consistently increases as PEQA take on more learnable parameters.
123
+
124
+ <table><tr><td>Model</td><td>W Bits</td><td>Channel-Wise</td><td>g256</td><td>g128</td><td>g64</td></tr><tr><td>LLaMA 7B</td><td>4</td><td>5.84</td><td>5.69</td><td>5.66</td><td>5.64</td></tr><tr><td></td><td>3</td><td>6.19</td><td>5.96</td><td>5.91</td><td>5.89</td></tr><tr><td>LLaMA13B</td><td>4</td><td>5.30</td><td>5.18</td><td>5.16</td><td>5.16</td></tr><tr><td></td><td>3</td><td>5.54</td><td>5.40</td><td>5.37</td><td>5.34</td></tr></table>
125
+
126
+ Model Size and Number of Learnable Parameters. In an effort to estimate the DRAM usage necessitated by PEQA and LoRA during training and deployment, we outline the number of learnable parameters (for training) and the model size (expressed in gigabytes, GB, for deployment) in Table 4. As demonstrated in Table 4, PEQA involves fewer learnable parameters than LoRA when a quantization scale is assigned to each channel of pre-trained weights. For instance, PEQA has approximately 1.54 times fewer learnable parameters for LLaMA models than LoRA (QV4). In addition to having fewer learnable parameters, PEQA, through low-bit weight quantization, can also reduce the model size, which captures a huge amount of the DRAM footprint in fine-tuning LLMs. Remarkably, when fine-tuning LLaMA 30B using PEQA with 4-bit precision, the resulting model size is significantly smaller than that obtained by adapting 13B through LoRA, and slightly larger than the model adapted from LLaMA 7B using LoRA. Additionally, a comparison of the memory peak during training between PEQA and LoRA is provided in Appendix L.
127
+
128
+ Group-wise Quantization. Group-wise per-channel quantization [49], where weight groups in channels share quantization parameters, maintains accuracy at lower bits. In Table 5, we present that the performance incrementally improves as more learnable parameters are incorporated into PEQA. In particular, for Table 5, we examine various group sizes (denoted by $g$ ) when quantizing the weights [49, 62]. Through relatively straightforward grouping (employed to regulate the number of learnable parameters for PEQA), the perplexity incrementally decreases as more learnable parameters are utilized. Detailed settings are in Appendix G.
129
+
130
+ Table 6: Common-sense reasoning and in-context learning performance of parameter-efficient instruction-tuned LLaMAs [6] using Alpaca datasets. LoRA configuration is set to QKVO16. Quantization precision of PEQA is set to 4-bit per-channel without group size. Note that ARC-C, ARC-E and OBQA stands for ARC-Challenge, ARC-Easy, and OpenBookQA respectively.
131
+
132
+ <table><tr><td>Method</td><td># Params</td><td>Model Size (GB)</td><td>PIQA</td><td>HellaSwag</td><td>ARC-C</td><td>ARC-E</td><td>OBQA</td><td>Average</td></tr><tr><td colspan="9">Zero-Shot</td></tr><tr><td rowspan="3">LLaMA</td><td>7B</td><td>13.5GB</td><td>77.3</td><td>73.0</td><td>41.4</td><td>52.5</td><td>42.4</td><td>57.3</td></tr><tr><td>13B</td><td>26.1GB</td><td>79.1</td><td>76.2</td><td>44.5</td><td>59.9</td><td>42.2</td><td>60.4</td></tr><tr><td>30B</td><td>65.1GB</td><td>80.1</td><td>79.2</td><td>45.5</td><td>58.9</td><td>42.0</td><td>61.1</td></tr><tr><td rowspan="3">+LoRA</td><td>7B</td><td>13.5GB</td><td>78.6</td><td>73.3</td><td>43.7</td><td>55.8</td><td>43.0</td><td>58.9(+1.6)</td></tr><tr><td>13B</td><td>26.1GB</td><td>79.6</td><td>76.7</td><td>46.3</td><td>62.0</td><td>43.2</td><td>61.5(+1.1)</td></tr><tr><td>30B</td><td>65.1GB</td><td>81.8</td><td>80.3</td><td>48.2</td><td>61.6</td><td>42.8</td><td>62.9(+1.8)</td></tr><tr><td rowspan="3">+ PEQA</td><td>7B</td><td>3.8GB</td><td>77.9</td><td>71.4</td><td>42.4</td><td>57.2</td><td>42.0</td><td>58.2(+0.9)</td></tr><tr><td>13B</td><td>7.0GB</td><td>78.9</td><td>74.0</td><td>46.4</td><td>62.5</td><td>42.8</td><td>60.9(+0.5)</td></tr><tr><td>30B</td><td>16.9GB</td><td>80.3</td><td>78.4</td><td>49.8</td><td>63.3</td><td>42.8</td><td>62.9(+1.8)</td></tr><tr><td colspan="9">Five-Shot</td></tr><tr><td rowspan="3">LLaMA</td><td>7B</td><td>13.5GB</td><td>79.4</td><td>75.3</td><td>45.6</td><td>65.8</td><td>44.0</td><td>62.0</td></tr><tr><td>13B</td><td>26.1GB</td><td>80.0</td><td>78.4</td><td>50.4</td><td>70.8</td><td>47.2</td><td>65.4</td></tr><tr><td>30B</td><td>65.1GB</td><td>82.5</td><td>82.2</td><td>56.2</td><td>74.9</td><td>47.0</td><td>68.6</td></tr><tr><td rowspan="3">+LoRA</td><td>7B</td><td>13.5GB</td><td>79.9</td><td>75.2</td><td>46.4</td><td>66.5</td><td>47.2</td><td>63.0(+1.0)</td></tr><tr><td>13B</td><td>26.1GB</td><td>81.1</td><td>78.8</td><td>53.5</td><td>72.4</td><td>47.0</td><td>66.6(+1.1)</td></tr><tr><td>30B</td><td>65.1GB</td><td>84.1</td><td>83.3</td><td>59.5</td><td>79.2</td><td>50.6</td><td>71.4(+2.8)</td></tr><tr><td rowspan="3">+ PEQA</td><td>7B</td><td>3.8GB</td><td>78.9</td><td>73.2</td><td>45.1</td><td>65.4</td><td>44.0</td><td>61.3(-0.7)</td></tr><tr><td>13B</td><td>7.0GB</td><td>80.7</td><td>76.0</td><td>50.9</td><td>71.6</td><td>48.0</td><td>65.5(+0.1)</td></tr><tr><td>30B</td><td>16.9GB</td><td>82.7</td><td>80.2</td><td>56.8</td><td>75.5</td><td>47.6</td><td>68.6(+0.0)</td></tr></table>
133
+
134
+ # 4.3 Instruction-tuning with the Alpaca Dataset
135
+
136
+ Although inference cost and training efficiency are crucial, the methods of PEFT and quantization have not been extensively explored. While LoRA and PEQA have been evaluated on adaptation performance for task-specific purposes as discussed in Section 4.2, it has not been widely corroborated that fine-tuning via PEFT can retain the performance for unseen tasks. Thus, given that RTN quantization results in a non-negligible performance degradation in LLMs, it is important to assess how much the performance of low-bit quantized LLMs is degraded on comprehensive tasks. To address these concerns, we conduct comprehensive experiments, benchmarking our techniques on prevalent instruction-following datasets and assessing the response quality of PEQA-tuned LLMs. Furthermore, to determine if PEQA can regain the performance of full-precision LLMs, we employ RTN quantization in conjunction with PEQA instruction-tuning across LLaMAs.
137
+
138
+ Experimental Settings. We train LLaMAs [6, 7] in various sizes on the Alpaca dataset [59], which is one of the popular instruction-following datasets generated from outputs of InstructGPT [11]. Then, we test the models on other downstream tasks such as common-sense reasoning tasks [52–55] and massive multitask language understanding (MMLU) [56]. Due to limited time and resources, we could not conduct an exhaustive search over hyper-parameters such as the learning rate or epoch. Instead, we followed the training recipe from Taori et al. [59]. The LoRA configuration is set to QKVO16. Detailed settings can be found in Appendix H.
139
+
140
+ Common-Sense Reasoning. We conducted an experiment on five tasks [52–55] to assess whether the performance of common-sense reasoning and in-context learning can be sustained even after instruction-tuning LLMs on the Alpaca dataset via LoRA or PEQA. As depicted in Table 6, the results show that LLMs fine-tuned with LoRA or PEQA maintain a consistent trend in common-sense reasoning tasks. Furthermore, since PEQA’s performance aligns closely with that of full-precision adaptation, this consistency is observed even when the model size has been reduced through low-bit weight quantization. We utilized the evaluation code from Eleuther AI’s lm-evaluation-harness [63].
141
+
142
+ Table 7: Massive Multitask Language Understanding (MMLU) benchmark performance of PEQAtuned LLaMAs using Alpaca datasets. Five-shot accuracy is reported for the MMLU. Quantization precision of PEQA is set to 4-bit. When we quantize LLaMA [6] into 4-bit precision using the RTN method, no group size is applied. For LLaMA2 [7], a group size of 256 is used with the RTN method. Note that RTN stands for round-to-nearest in the table.
143
+
144
+ <table><tr><td></td><td># Params</td><td>Model Size</td><td>Humanities</td><td>STEM</td><td>Social Sciences</td><td>Other</td><td>Average</td></tr><tr><td>LLaMA [6]</td><td>7B</td><td>13.5GB</td><td>32.6</td><td>29.6</td><td>38.0</td><td>37.9</td><td>34.4</td></tr><tr><td></td><td>13B</td><td>26.1GB</td><td>42.8</td><td>36.1</td><td>53.3</td><td>53.2</td><td>46.1</td></tr><tr><td></td><td>30B</td><td>65.1GB</td><td>54.6</td><td>46.5</td><td>66.1</td><td>63.4</td><td>57.4</td></tr><tr><td>+RTN</td><td>7B</td><td>3.8GB</td><td>28.4</td><td>25.6</td><td>26.9</td><td>31.8</td><td>28.3</td></tr><tr><td>(w/o group size)</td><td>13B</td><td>7.0GB</td><td>30.5</td><td>27.2</td><td>35.5</td><td>38.8</td><td>32.8</td></tr><tr><td></td><td>30B</td><td>16.9GB</td><td>39.6</td><td>34.0</td><td>46.1</td><td>49.7</td><td>42.1</td></tr><tr><td>+ PEQA</td><td>7B</td><td>3.8GB</td><td>35.7</td><td>30.9</td><td>38.2</td><td>40.0</td><td>35.8</td></tr><tr><td></td><td>13B</td><td>7.0GB</td><td>42.8</td><td>37.7</td><td>53.6</td><td>49.0</td><td>45.0</td></tr><tr><td></td><td>30B</td><td>16.9GB</td><td>51.1</td><td>44.1</td><td>62.4</td><td>60.7</td><td>54.3</td></tr><tr><td>LLaMA2[7]</td><td>7B</td><td>13.5GB</td><td>43.3</td><td>37.0</td><td>51.8</td><td>52.4</td><td>45.9</td></tr><tr><td></td><td>13B</td><td>26.0GB</td><td>54.4</td><td>44.2</td><td>63.4</td><td>60.8</td><td>55.7</td></tr><tr><td></td><td>70B</td><td>138.0GB</td><td>65.2</td><td>57.9</td><td>80.3</td><td>74.7</td><td>69.1</td></tr><tr><td>+RTN</td><td>7B</td><td>3.8GB</td><td>39.5</td><td>35.5</td><td>49.3</td><td>49.9</td><td>43.2</td></tr><tr><td>(g256)</td><td>13B</td><td>7.0GB</td><td>50.2</td><td>42.6</td><td>61.3</td><td>59.7</td><td>53.2</td></tr><tr><td></td><td>70B</td><td>35.3GB</td><td>63.7</td><td>55.9</td><td>78.4</td><td>71.6</td><td>67.0</td></tr><tr><td>+ PEQA</td><td>7B</td><td>3.8GB</td><td>52.0</td><td>38.4</td><td>54.1</td><td>52.0</td><td>48.1</td></tr><tr><td></td><td>13B</td><td>7.0GB</td><td>60.5</td><td>45.0</td><td>63.3</td><td>57.0</td><td>55.3</td></tr><tr><td></td><td>70B</td><td>35.3GB</td><td>73.9</td><td>55.3</td><td>77.8</td><td>68.2</td><td>67.5</td></tr></table>
145
+
146
+ Massive Multitask Language Understanding. To assess whether the performance of PEQAtuned models can be restored to the levels of full-precision model’s performance, starting from RTN performance, we test our models on the MMLU benchmark containing 57 multiple-choice problems across various domains and levels of knowledge [56]. In this experiment, we utilize the RTN results as a baseline to determine the extent of degradation on quantized LLM. As shown in Table 7, instruction-tuning with PEQA boosts the performance of RTN quantized models. This observation supports our claim that our approach enables LLMs to regain their few-shot in-context learning and understanding capabilities, even though they are significantly smaller than their original model size through quantization. Unfortunately, it seems that the PEQA-tuning does not achieve the best performance in fine-tuning larger models. This might be because PEQA-tuning did not been sufficiently explored different epochs or learning rates. Nonetheless, the observation that the performance of the quantized LLaMAs is restored through PEQA-tuning using an instructionfollowing dataset highlights the potential to further enhance the accuracy of PTQ methods.
147
+
148
+ # 5 Conclusion
149
+
150
+ Fine-tuning aligns large language models (LLMs) with specific purposes. To maintain the comprehensive capabilities of LLMs while effectively aligning them, we introduce PEQA, a method that seamlessly combines the advantages of parameter-efficient fine-tuning (PEFT) and quantization in LLMs. PEQA not only reduces DRAM consumption during fine-tuning but also accelerates inference latency for deployment by retaining weights in a low-bit quantized format. Through rigorous testing across various datasets and LLMs, we have found that PEQA can match the performance of fullprecision baselines in task-specific adaptations, even with a significant reduction in model size. When combined with instruction-tuning, PEQA’s performance demonstrates its ability to both preserve and enhance comprehensive knowledge after the inherent compromises of quantization, recovering the performance of original model by simply updating the quantization scales of the quantized LLM.
151
+
152
+ # References
153
+
154
+ [1] 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. volume 33, pages 1877–1901, 2020.
155
+
156
+ [2] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, Parker Schuh, Kensen Shi, Sasha Tsvyashchenko, Joshua Maynez, Abhishek Rao, Parker Barnes, Yi Tay, Noam Shazeer, Vinodkumar Prabhakaran, Emily Reif, Nan Du, Ben Hutchinson, Reiner Pope, James Bradbury, Jacob Austin, Michael Isard, Guy Gur-Ari, Pengcheng Yin, Toju Duke, Anselm Levskaya, Sanjay Ghemawat, Sunipa Dev, Henryk Michalewski, Xavier Garcia, Vedant Misra, Kevin Robinson, Liam Fedus, Denny Zhou, Daphne Ippolito, David Luan, Hyeontaek Lim, Barret Zoph, Alexander Spiridonov, Ryan Sepassi, David Dohan, Shivani Agrawal, Mark Omernick, Andrew M. Dai, Thanumalayan Sankaranarayana Pillai, Marie Pellat, Aitor Lewkowycz, Erica Moreira, Rewon Child, Oleksandr Polozov, Katherine Lee, Zongwei Zhou, Xuezhi Wang, Brennan Saeta, Mark Diaz, Orhan Firat, Michele Catasta, Jason Wei, Kathy Meier-Hellstern, Douglas Eck, Jeff Dean, Slav Petrov, and Noah Fiedel. Palm: Scaling language modeling with pathways, 2022.
157
+
158
+ [3] Alex Andonian, Quentin Anthony, Stella Biderman, Sid Black, Preetham Gali, Leo Gao, Eric Hallahan, Josh Levy-Kramer, Connor Leahy, Lucas Nestler, Kip Parker, Michael Pieler, Shivanshu Purohit, Tri Songz, Wang Phil, and Samuel Weinbach. GPT-NeoX: Large Scale Autoregressive Language Modeling in PyTorch, 8 2021. URL https://www.github.com/ eleutherai/gpt-neox.
159
+
160
+ [4] 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.
161
+
162
+ [5] OpenAI. Gpt-4 technical report, 2023.
163
+
164
+ [6] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, Aurelien Rodriguez, Armand Joulin, Edouard Grave, and Guillaume Lample. Llama: Open and efficient foundation language models, 2023.
165
+
166
+ [7] Hugo Touvron, Louis Martin, Kevin Stone, Peter Albert, Amjad Almahairi, Yasmine Babaei, Nikolay Bashlykov, Soumya Batra, Prajjwal Bhargava, Shruti Bhosale, et al. Llama 2: Open foundation and fine-tuned chat models. arXiv preprint arXiv:2307.09288, 2023.
167
+
168
+ [8] Nisan Stiennon, Long Ouyang, Jeffrey Wu, Daniel Ziegler, Ryan Lowe, Chelsea Voss, Alec Radford, Dario Amodei, and Paul F Christiano. Learning to summarize with human feedback. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 3008–3021. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper_files/paper/2020/file/ 1f89885d556929e98d3ef9b86448f951-Paper.pdf.
169
+
170
+ [9] Luciano Floridi and Massimo Chiriatti. Gpt-3: Its nature, scope, limits, and consequences. Minds Mach., 30(4):681–694, dec 2020. ISSN 0924-6495. doi: 10.1007/s11023-020-09548-1. URL https://doi.org/10.1007/s11023-020-09548-1.
171
+
172
+ [10] Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. Rethinking the role of demonstrations: What makes in-context learning work? In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 11048–11064, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. URL https://aclanthology.org/2022.emnlp-main.759.
173
+
174
+ [11] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730–27744, 2022.
175
+
176
+ [12] Yuntao Bai, Saurav Kadavath, Sandipan Kundu, Amanda Askell, Jackson Kernion, Andy Jones, Anna Chen, Anna Goldie, Azalia Mirhoseini, Cameron McKinnon, et al. Constitutional ai: Harmlessness from ai feedback. arXiv preprint arXiv:2212.08073, 2022.
177
+
178
+ [13] Jason Wei, Maarten Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V Le. Finetuned language models are zero-shot learners. In International Conference on Learning Representations, 2022. URL https://openreview. net/forum?id=gEZrGCozdqR.
179
+
180
+ [14] Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Fevry, Jason Alan Fries, Ryan Teehan, Teven Le Scao, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M Rush. Multitask prompted training enables zero-shot task generalization. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\underset { . } { = }$ 9Vrb9D0WI4.
181
+
182
+ [15] Thomas Scialom, Tuhin Chakrabarty, and Smaranda Muresan. Fine-tuned language models are continual learners. In Proceedings of the 2022 Conference on Empirical Methods in Natural Language Processing, pages 6107–6122, Abu Dhabi, United Arab Emirates, December 2022. Association for Computational Linguistics. URL https://aclanthology.org/2022. emnlp-main.410.
183
+
184
+ [16] Tianbao Xie, Chen Henry Wu, Peng Shi, Ruiqi Zhong, Torsten Scholak, Michihiro Yasunaga, Chien-Sheng Wu, Ming Zhong, Pengcheng Yin, Sida I Wang, et al. Unifiedskg: Unifying and multi-tasking structured knowledge grounding with text-to-text language models. arXiv preprint arXiv:2201.05966, 2022.
185
+
186
+ [17] Yi Tay, Jason Wei, Hyung Won Chung, Vinh Q Tran, David R So, Siamak Shakeri, Xavier Garcia, Huaixiu Steven Zheng, Jinfeng Rao, Aakanksha Chowdhery, et al. Transcending scaling laws with $0 . 1 \%$ extra compute. arXiv preprint arXiv:2210.11399, 2022.
187
+
188
+ [18] William Fedus, Barret Zoph, and Noam Shazeer. Switch transformers: Scaling to trillion parameter models with simple and efficient sparsity. J. Mach. Learn. Res., 23(1), jan 2022. ISSN 1532-4435.
189
+
190
+ [19] Xiao Liu, Yanan Zheng, Zhengxiao Du, Ming Ding, Yujie Qian, Zhilin Yang, and Jie Tang. Gpt understands, too, 2021.
191
+
192
+ [20] 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 Kamalika Chaudhuri and Ruslan Salakhutdinov, editors, Proceedings of the 36th International Conference on Machine Learning, volume 97 of Proceedings of Machine Learning Research, pages 2790–2799. PMLR, 09–15 Jun 2019. URL https://proceedings.mlr. press/v97/houlsby19a.html.
193
+
194
+ [21] Edward J Hu, yelong shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In International Conference on Learning Representations, 2022. URL https://openreview. net/forum?id $\equiv$ nZeVKeeFYf9.
195
+
196
+ [22] Sangil Jung, Changyong Son, Seohyung Lee, Jinwoo Son, Jae-Joon Han, Youngjun Kwak, Sung Ju Hwang, and Changkyu Choi. Learning to quantize deep networks by optimizing quantization intervals with task loss. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 4350–4359, 2019.
197
+
198
+ [23] Steven K. Esser, Jeffrey L. McKinstry, Deepika Bablani, Rathinakumar Appuswamy, and Dharmendra S. Modha. Learned step size quantization. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id=rkgO66VKDS.
199
+
200
+ [24] Xiandong Zhao, Ying Wang, Xuyi Cai, Cheng Liu, and Lei Zhang. Linear symmetric quantization of neural networks for low-precision integer hardware. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underset { . } { = }$ H1lBj2VFPS.
201
+
202
+ [25] Jung Hyun Lee, Jihun Yun, Sung Ju Hwang, and Eunho Yang. Cluster-promoting quantization with bit-drop for minimizing network quantization loss, 2021.
203
+
204
+ [26] Tim Dettmers, Mike Lewis, Younes Belkada, and Luke Zettlemoyer. Llm. int8 (): 8-bit matrix multiplication for transformers at scale. arXiv preprint arXiv:2208.07339, 2022.
205
+
206
+ [27] Zhewei Yao, Reza Yazdani Aminabadi, Minjia Zhang, Xiaoxia Wu, Conglong Li, and Yuxiong He. Zeroquant: Efficient and affordable post-training quantization for large-scale transformers. arXiv preprint arXiv:2206.01861, 2022.
207
+
208
+ [28] Elias Frantar, Saleh Ashkboos, Torsten Hoefler, and Dan Alistarh. OPTQ: Accurate quantization for generative pre-trained transformers. In The Eleventh International Conference on Learning Representations, 2023. URL https://openreview.net/forum?id=tcbBPnfwxS.
209
+
210
+ [29] Guangxuan Xiao, Ji Lin, Mickael Seznec, Julien Demouth, and Song Han. Smoothquant: Accurate and efficient post-training quantization for large language models. arXiv preprint arXiv:2211.10438, 2022.
211
+
212
+ [30] 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.
213
+
214
+ [31] Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools. arXiv preprint arXiv:2302.04761, 2023.
215
+
216
+ [32] Reiichiro Nakano, Jacob Hilton, Suchir Balaji, Jeff Wu, Long Ouyang, Christina Kim, Christopher Hesse, Shantanu Jain, Vineet Kosaraju, William Saunders, Xu Jiang, Karl Cobbe, Tyna Eloundou, Gretchen Krueger, Kevin Button, Matthew Knight, Benjamin Chess, and John Schulman. Webgpt: Browser-assisted question-answering with human feedback. CoRR, abs/2112.09332, 2021. URL https://arxiv.org/abs/2112.09332.
217
+
218
+ [33] 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. CoRR, abs/2212.10560, 2022. doi: 10.48550/arXiv.2212.10560. URL https: //doi.org/10.48550/arXiv.2212.10560.
219
+
220
+ [34] Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% *$ chatgpt quality, March 2023. URL https://lmsys.org/blog/2023-03-30-vicuna/.
221
+
222
+ [35] 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.
223
+
224
+ [36] 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.
225
+
226
+ [37] Timo Schick and Hinrich Schütze. Exploiting cloze questions for few shot text classification and natural language inference. arXiv preprint arXiv:2001.07676, 2020.
227
+
228
+ [38] Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 4582–4597, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.353. URL https://aclanthology.org/2021.acl-long.353.
229
+
230
+ [39] Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 3045–3059, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.243. URL https://aclanthology.org/2021.emnlp-main.243.
231
+
232
+ [40] Junxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick, and Graham Neubig. Towards a unified view of parameter-efficient transfer learning. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\underset { . } { = }$ 0RDcd5Axok.
233
+
234
+ [41] Yuning Mao, Lambert Mathias, Rui Hou, Amjad Almahairi, Hao Ma, Jiawei Han, Scott Yih, and Madian Khabsa. UniPELT: A unified framework for parameter-efficient language model tuning. In Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 6253–6264, Dublin, Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.acl-long.433. URL https://aclanthology.org/2022.acl-long.433.
235
+
236
+ [42] Minseop Park, Jaeseong You, Markus Nagel, and Simyung Chang. Quadapter: Adapter for GPT-2 quantization. In Yoav Goldberg, Zornitsa Kozareva, and Yue Zhang, editors, Findings of the Association for Computational Linguistics: EMNLP 2022, Abu Dhabi, United Arab Emirates, December 7-11, 2022, pages 2510–2517. Association for Computational Linguistics, 2022. URL https://aclanthology.org/2022.findings-emnlp.185.
237
+
238
+ [43] Se Jung Kwon, Jeonghoon Kim, Jeongin Bae, Kang Min Yoo, Jin-Hwa Kim, Baeseong Park, Byeongwook Kim, Jung-Woo Ha, Nako Sung, and Dongsoo Lee. Alphatuning: Quantization-aware parameter-efficient adaptation of large-scale pre-trained language models. In Yoav Goldberg, Zornitsa Kozareva, and Yue Zhang, editors, Findings of the Association for Computational Linguistics: EMNLP 2022, Abu Dhabi, United Arab Emirates, December 7-11, 2022, pages 3288–3305. Association for Computational Linguistics, 2022. URL https://aclanthology.org/2022.findings-emnlp.240.
239
+
240
+ [44] Jung Hyun Lee, Jeonghoon Kim, Se Jung Kwon, and Dongsoo Lee. FlexRound: Learnable rounding based on element-wise division for post-training quantization. In Proceedings of the 40th International Conference on Machine Learning, volume 202 of Proceedings of Machine Learning Research, pages 18913–18939. PMLR, 23–29 Jul 2023. URL https://proceedings.mlr.press/v202/lee23h.html.
241
+
242
+ [45] Jung Hwan Heo, Jeonghoon Kim, Beomseok Kwon, Byeongwook Kim, Se Jung Kwon, and Dongsoo Lee. Rethinking channel dimensions to isolate outliers for low-bit weight quantization of large language models. arXiv preprint arXiv:2309.15531, 2023.
243
+
244
+ [46] Sourab Mangrulkar, Sylvain Gugger, Lysandre Debut, Younes Belkada, and Sayak Paul. Peft: State-of-the-art parameter-efficient fine-tuning methods. https://github.com/ huggingface/peft, 2022.
245
+
246
+ [47] Ji Lin, Jiaming Tang, Haotian Tang, Shang Yang, Xingyu Dang, and Song Han. Awq: Activation-aware weight quantization for llm compression and acceleration. arXiv preprint arXiv:2306.00978, 2023.
247
+
248
+ [48] Guangxuan Xiao, Ji Lin, Mickael Seznec, Hao Wu, Julien Demouth, and Song Han. SmoothQuant: Accurate and efficient post-training quantization for large language models. In Proceedings of the 40th International Conference on Machine Learning, 2023.
249
+
250
+ [49] Gunho Park, Baeseong Park, Minsub Kim, Sungjae Lee, Jeonghoon Kim, Beomseok Kwon, Se Jung Kwon, Byeongwook Kim, Youngjoo Lee, and Dongsoo Lee. Lut-gemm: Quantized matrix multiplication based on luts for efficient inference in large-scale generative language models, 2023.
251
+
252
+ [50] Tim Dettmers, Artidoro Pagnoni, Ari Holtzman, and Luke Zettlemoyer. Qlora: Efficient finetuning of quantized llms. arXiv preprint arXiv:2305.14314, 2023.
253
+
254
+ [51] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models, 2016.
255
+
256
+ [52] Peter Clark, Isaac Cowhey, Oren Etzioni, Tushar Khot, Ashish Sabharwal, Carissa Schoenick, and Oyvind Tafjord. Think you have solved question answering? try arc, the ai2 reasoning challenge. arXiv preprint arXiv:1803.05457, 2018.
257
+
258
+ [53] Yonatan Bisk, Rowan Zellers, Jianfeng Gao, Yejin Choi, et al. Piqa: Reasoning about physical commonsense in natural language. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 7432–7439, 2020.
259
+
260
+ [54] 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.
261
+
262
+ [55] Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. Can a suit of armor conduct electricity? a new dataset for open book question answering. In EMNLP, 2018.
263
+
264
+ [56] Dan Hendrycks, Collin Burns, Steven Basart, Andy Zou, Mantas Mazeika, Dawn Song, and Jacob Steinhardt. Measuring massive multitask language understanding. arXiv preprint arXiv:2009.03300, 2020.
265
+
266
+ [57] Swaroop Mishra, Daniel Khashabi, Chitta Baral, and Hannaneh Hajishirzi. Cross-task generalization via natural language crowdsourcing instructions. In ACL, 2022.
267
+
268
+ [58] Mitchell P. Marcus, Beatrice Santorini, and Mary Ann Marcinkiewicz. Building a large annotated corpus of English: The Penn Treebank. Computational Linguistics, 19(2):313–330, 1993. URL https://www.aclweb.org/anthology/J93-2004.
269
+
270
+ [59] Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github.com/tatsu-lab/stanford_alpaca, 2023.
271
+
272
+ [60] Sid Black, Leo Gao, Phil Wang, Connor Leahy, and Stella Biderman. GPT-Neo: Large Scale Autoregressive Language Modeling with Mesh-Tensorflow, March 2021. URL https: //doi.org/10.5281/zenodo.5297715. If you use this software, please cite it using these metadata.
273
+
274
+ [61] Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023.
275
+
276
+ [62] Dan Alistarh, Demjan Grubic, Jerry Li, Ryota Tomioka, and Milan Vojnovic. QSGD: communication-efficient SGD via gradient quantization and encoding. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, editors, Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 1709–1720, 2017. URL https://proceedings.neurips.cc/paper/2017/ hash/6c340f25839e6acdc73414517203f5f0-Abstract.html.
277
+
278
+ [63] Leo Gao, Jonathan Tow, Stella Biderman, Sid Black, Anthony DiPofi, Charles Foster, Laurence Golding, Jeffrey Hsu, Kyle McDonell, Niklas Muennighoff, Jason Phang, Laria Reynolds, Eric Tang, Anish Thite, Ben Wang, Kevin Wang, and Andy Zou. A framework for few-shot language model evaluation, September 2021. URL https://doi.org/10.5281/zenodo.5371628.
279
+
280
+ [64] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019. OpenReview.net, 2019. URL https://openreview.net/forum?id $\ c =$ Bkg6RiCqY7.
281
+
282
+ [65] Jeff Rasley, Samyam Rajbhandari, Olatunji Ruwase, and Yuxiong He. Deepspeed: System optimizations enable training deep learning models with over 100 billion parameters. In Rajesh Gupta, Yan Liu, Jiliang Tang, and B. Aditya Prakash, editors, KDD ’20: The 26th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, Virtual Event, CA, USA, August 23-27, 2020, pages 3505–3506. ACM, 2020. doi: 10.1145/3394486.3406703. URL https://doi.org/10.1145/3394486.3406703.
283
+
284
+ [66] Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, Joe Davison, Sam Shleifer, Patrick von Platen, Clara Ma, Yacine Jernite, Julien Plu, Canwen Xu, Teven Le Scao, Sylvain Gugger, Mariama Drame, Quentin Lhoest, and Alexander Rush. Transformers: State-of-the-art natural language processing. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pages 38–45, Online, October 2020. Association for Computational Linguistics. doi: 10.18653/v1/2020.emnlp-demos.6. URL https://aclanthology.org/2020.emnlp-demos.6.
285
+
286
+ # A Common Experimental Settings
287
+
288
+ For the common experimental settings, AdamW [64] optimizer and linear-decaying learning rate scheduler were used. We use Deepspeed repository [65] 2 for FP16 and BF16 training. Additionally, we utilize Huggingface repository $[ \dot { 6 } 6 ] ^ { 3 }$ for training, evaluation code and dataset.
289
+
290
+ # B Experimental Settings of Section 4.1
291
+
292
+ We compare the perplexity when weights are quantized and adapted by quantization-aware training (QAT), LoRA with post-training quantization (PTQ), and PEQA, using the Wikitext2 dataset in Section 4.1. The LoRA configuration is set to QV4. For PTQ method, we utilize OPTQ [28] 4 which is state-of-the-art low-bit weight-only PTQ method. We set the model’s maximum sequence length to 1024. Batch size and epoch for all experiments are set to 128 and 15 respectively. The learning rates for the experiments of Table 2 are displayed in Table 8. Learning rates for LoRA and PEQA are shown in Appendix C.
293
+
294
+ Table 8: Learning rates of QAT in Table 2.
295
+
296
+ <table><tr><td>Method</td><td>W Bits</td><td>GPT-Neo 2.7B</td><td>GPT-J 6B</td><td>LLaMA 7B</td><td>LLaMA 13B</td></tr><tr><td>QAT</td><td>4</td><td>4e-5</td><td>5e-6</td><td>1e-5</td><td>3e-5</td></tr><tr><td>QAT</td><td>3</td><td>6e-5</td><td>1e-5</td><td>2e-5</td><td>1e-5</td></tr></table>
297
+
298
+ # C Experimental settings of Table 3
299
+
300
+ In Section 4.2, Table 3 show the scalability and task-specific adaptation performance of PEQA by comparing with LoRA and $\mathrm { L o R A * O P T Q }$ on Wikitext2 [51] and PennTreeBank (PTB) [58] datasets. Detailed experimental settings are as follows. LoRA configuration is set to QV4. For PTQ method, we utilize OPTQ [28] which is state-of-the-art low-bit weight-only PTQ method. We set input sequence length after tokenization (block size) to 1024 for under 65B models. For LLaMA 65B, input sequence length after tokenization is set to 768 due to memory issue. Batch size and epoch for all experiments are set to 128 and 15 respectively. Learning rates for Table 3 experiments are shown in Table 9.
301
+
302
+ Table 9: Learning rate of LoRA and PEQA in Table 3 on Wikitext2 and PTB datasets.
303
+
304
+ <table><tr><td>Method</td><td>W Bits</td><td>GPT-Neo 2.7B</td><td>GPT-J 6B</td><td>LLaMA 7B</td><td>LLaMA 13B</td><td>LLaMA 30B</td><td>LLaMA 65B</td></tr><tr><td colspan="8">Wikitext2</td></tr><tr><td>LoRA</td><td>16</td><td>5e-4</td><td>6e-4</td><td>1e-4</td><td>1e-4</td><td>2e-4</td><td>4e-5</td></tr><tr><td>PEQA (Ours)</td><td>4</td><td>5e-5</td><td>6e-6</td><td>6e-6</td><td>1e-5</td><td>1e-5</td><td>1e-5</td></tr><tr><td>PEQA (Ours)</td><td>3</td><td>6e-5</td><td>5e-5</td><td>2e-5</td><td>6e-5</td><td>3e-5</td><td>3e-5</td></tr><tr><td colspan="8">PTB</td></tr><tr><td>LoRA</td><td>16</td><td>2e-3</td><td>1e-3</td><td>8e-4</td><td>5e-4</td><td>4e-4</td><td>6e-4</td></tr><tr><td>PEQA (Ours)</td><td>4</td><td>3e-4</td><td>5e-5</td><td>5e-5</td><td>5e-5</td><td>3e-5</td><td>6e-5</td></tr></table>
305
+
306
+ # D The Perplexity of 3-bit and 4-bit PEQA on Wikitext2 Dataset
307
+
308
+ Figure 3 illustrates the results of 3-bit and 4-bit PEQA’s next token prediction performance on the Wikitext2 dataset. As shown in Figure 3, 3-bit performance of PEQA shows lower perplexity than 3-bit post-training quantized LoRA. The results from the 3-bit PEQA show that PEQA allows for continuity in model size options under DRAM usage constraints.
309
+
310
+ ![](images/306f8a7e99b5229e68617861b164a7779025b9c708acc33b7052c1df52278a1e.jpg)
311
+ Figure 3: The perplexity over model size of 3/4-bit performance of PEQA and LoRA $. +$ OPTQ
312
+
313
+ # E OPT Models Adapted with PEQA and LoRA on Wikitext2 Dataset
314
+
315
+ Table 10 shows the perplexity of OPT[4] models adapted with PEQA and LoRA on the Wikitext2 dataset. The perplexity gap between LoRA and PEQA becomes smaller as the model size increases.
316
+
317
+ Table 10: The perplexity (PPL) on Wikitext2 for OPT 1.3B to 66B. In this comparison, only the weights were quantized into 4-bit. A lower PPL value indicates better performance.
318
+
319
+ <table><tr><td>Method</td><td>W Bits</td><td>OPT 1.3B</td><td>OPT 2.7B</td><td>OPT 6.7B</td><td>OPT13B</td><td>OPT 30B</td><td>OPT 66B</td></tr><tr><td>LoRA(QV4)</td><td>16</td><td>11.58</td><td>10.25</td><td>8.96</td><td>8.44</td><td>7.93</td><td>7.64</td></tr><tr><td>PEQA(Ours)</td><td>4</td><td>12.40</td><td>10.78</td><td>9.34</td><td>8.74</td><td>8.11</td><td>7.86</td></tr></table>
320
+
321
+ # F LoRA Configuration Comparison on Wikitext2 Dataset
322
+
323
+ As shown in Table 11, the LoRA target module configuration of QV4 and QKVO16 has not much effect on perplexity on Wikitext2 experimental results. Table 11 shows equal tendency as mentioned in [21]. We utilize QV4 configuration for Section 4.2 and QKVO16 configuration for Section 4.3 respectively.
324
+
325
+ Table 11: The perplexity (PPL) on Wikitext2 was compared with LoRA QV4 and QKVO16. A lower PPL value indicates better performance.
326
+
327
+ <table><tr><td>Method</td><td>#Bits</td><td>GPT-Neo 2.7B</td><td>GPT-J 6B</td><td>LLaMA 7B</td><td>LLaMA 13B</td><td>LLaMA 30B</td><td>LLaMA 65B</td></tr><tr><td>LoRA(QV4)</td><td>16</td><td>10.63</td><td>8.50</td><td>5.53</td><td>5.06</td><td>4.06</td><td>3.82</td></tr><tr><td>LoRA(QKVO16)</td><td>16</td><td>10.67</td><td>8.50</td><td>5.50</td><td>5.06</td><td>4.06</td><td>3.81</td></tr></table>
328
+
329
+ # G Experimental Settings of Multi-scale Performance
330
+
331
+ In Section 4.2, Table 5 shows the perplexity of PEQA with grouping learnable parameters. We set model maximum sequence length to 1024. Batch size and epoch for all experiments are set to 128 and 15 respectively. Learning rates for experiments are shown in Table 12.
332
+
333
+ Table 12: Learning rate for Table 5.
334
+
335
+ <table><tr><td>Model</td><td>W Bits</td><td>g-1</td><td>g256</td><td>g128</td><td>g64</td></tr><tr><td>LLaMA 13B</td><td>4</td><td>1e-5</td><td>4e-5</td><td>4e-5</td><td>3e-5</td></tr><tr><td></td><td>3</td><td>6e-5</td><td>9e-5</td><td>9e-5</td><td>5e-5</td></tr><tr><td>LLaMA 7B</td><td>4</td><td>6e-6</td><td>2e-5</td><td>2e-5</td><td>1e-5</td></tr><tr><td></td><td>3</td><td>2e-5</td><td>6e-5</td><td>4e-5</td><td>7e-5</td></tr></table>
336
+
337
+ # H Experimental Settings of Section 4.3
338
+
339
+ In Section 4.3, we use the Alpaca dataset [59] for instruction-tuning. We set learning rate, epoch, and quantization group size as in Table 13. The batch size is set to 128 for all experiments in this subsection. As mentioned in Section 4.3, due to limited time and resources, we couldn’t conduct an exhaustive search over hyper-parameters such as learning rate or epoch. We believe that there are hyper-parameters that can perform better. For LLaMA 1 series (LLaMA 7, 13, and 30B), we truncate the prompt to the length of 2024 since their maximum sequence length is 2024 when evaluating the massive multitask lanugage understanding (MMLU) benchmark. Thus, for LLaMA2-70B, we set the tokenizer max length to 1024 on fine-tuning due to the resource limit. Otherwise, we use default max length of tokenizer5 on training. For the evaluation, we use default tokenizer setting. For every experiment in this section, the configuration of PEQA is set to 4-bit RTN quantization.
340
+
341
+ Table 13: The learning rate, epoch, quantization group size [49] for experiments on Section 4.3. the weights were quantized into 4-bit.
342
+
343
+ <table><tr><td>Hyper-parameter</td><td>LLaMA7B</td><td>LLaMA 13B</td><td>LLaMA 30B</td><td>LLaMA2 7B</td><td>LLaMA2 13B</td><td>LLaMA2 70B</td></tr><tr><td>Epoch</td><td>3</td><td>3</td><td>5</td><td>3</td><td>3</td><td>5</td></tr><tr><td>Learning rate</td><td>2e-5</td><td>2e-5</td><td>5e-6</td><td>5e-6</td><td>5e-6</td><td>5e-6</td></tr><tr><td>Group size</td><td>Per-channel</td><td>Per-channel</td><td>Per-channel</td><td>256</td><td>256</td><td>256</td></tr></table>
344
+
345
+ # I LLaMA 7B and 13B on Natural Instruction
346
+
347
+ To evaluate the instruction-following ability of instruct-tuned models, we test them on another instruction-following dataset, Natural Instruction (NI) [57]. Different from the Alpaca dataset, instructions of NI were collected by humans for existing 61 NLP tasks. For simplicity, we utilize evaluation splits consisting of 12 subtasks and restrict the maximum number of instances for each task to 200. At test time, the model should generate proper output for the given input with instruction for the target unseen task. As shown in Table 14, we find LLaMAs trained with PEQA show consistently better zero-shot task generalization performance (ROUGE-L) in NI for all parameter sizes compared to those from LoRA.
348
+
349
+ Table 14: Natural Instruction benchmark performance of parameter-efficient instruction-tuned LLaMAs using Alpaca datasets. Zero-shot performance (ROUGE-L) is reported for the NI. LoRA configuration is set to QKVO16. Quantization precisions of LoRA w/ OPTQ and PEQA are set to 4-bit.
350
+
351
+ <table><tr><td># Params</td><td>LLaMA</td><td>+LoRA</td><td>+LoRA w/OPTQ</td><td>+PEQA</td></tr><tr><td>7B</td><td>9.4</td><td>24.4</td><td>25.0</td><td>27.1</td></tr><tr><td>13B</td><td>8.9</td><td>31.3</td><td>29.2</td><td>34.1</td></tr></table>
352
+
353
+ # J Comparison with AlphaTuning
354
+
355
+ When diving deeper into quantization scales, learnable parameters for both PEQA and AlphaTuning, it’s worth noting that PEQA’s adherence to uniform quantization means there’s only one shared quantization scale for integer weight. Conversely, AlphaTuning’s non-uniform approach means that for a $b$ -bit quantization, there are $b$ individual quantization scales for each weight matrix. Despite having multiple scales, AlphaTuning only fine-tunes one, leaving the rest static. As such, the number of trainable parameters are identical and AlphaTuning seems to offer a larger potential for a well-fitted model, but it can be easily seen that $b - 1$ rest static scales introduced in AlphaTuning have limited usability, and thus the method may be prone to overfitting as evident through empirical results.
356
+
357
+ In Table 15, we conducted training on GPT-Neo and OPT 1.3B using the Wikitext2 dataset. Interestingly, PEQA, drawing from its methodological advantages, consistently demonstrates superior performance to AlphaTuning by at least $0 . 7 \mathrm { p p l }$ on the Wikitext2 dataset. Both AlphaTuning and PEQA used channel-wise trainable parameters. Batch size of AlphaTuning is set to 32.
358
+
359
+ Table 15: The perplexity (PPL) of AlphaTuning and PEQA on Wikitext2 with OPT and GPT-Neo 1.3B. The lower PPL, the better.
360
+
361
+ <table><tr><td>Method</td><td>#Bits</td><td>OPT 1.3B</td><td>GPT-Neo 1.3B</td></tr><tr><td>AlphaTuning</td><td>4</td><td>13.15</td><td>15.03</td></tr><tr><td>PEQA (Ours)</td><td>4</td><td>12.40</td><td>14.22</td></tr><tr><td>AlphaTuning</td><td>3</td><td>14.00</td><td>17.25</td></tr><tr><td>PEQA (Ours)</td><td>3</td><td>13.40</td><td>15.16</td></tr></table>
362
+
363
+ Table 16: Learning rate of AlphaTuning in Table 15.
364
+
365
+ <table><tr><td>Method</td><td>W Bits</td><td>OPT 1.3B</td><td>GPT-Neo 1.3B</td></tr><tr><td>AlphaTuning</td><td>4</td><td>1e-4</td><td>5e-4</td></tr><tr><td>AlphaTuning</td><td>3</td><td>1e-4</td><td>1e-3</td></tr></table>
366
+
367
+ # K Choice of Updating Quantization Scales or Zero-Points
368
+
369
+ Uniform quantization can represent both asymmetric and symmetric quantizations, hence it’s not always necessary to mandate the use of zero-points. This is why adopting a strategy of only learning the scale factor serves as a fundamental and scalable baseline. We opted for this approach to clearly establish its advantages. To determine the efficacy of learning only the scaling factors, we have incorporated additional experiments. By referring to the table below, it’s evident that merely optimizing zero-points does not yield effective learning outcomes. Moreover, simultaneously optimizing both zero-points and quantization scales does not present any significant improvement in accuracy either.
370
+
371
+ Table 17: Perplexity (PPL) of PEQA on the Wikitext2 dataset for LLaMA 7B and LLaMA 13B with weights quantized into 4-bit.
372
+
373
+ <table><tr><td>Method</td><td>Zero-points only</td><td>Quantization scales only (PEQA)</td><td>Both zero-points and quantization scales</td></tr><tr><td>LLaMA 7B</td><td>11.56</td><td>5.84</td><td>5.86</td></tr><tr><td>LLaMA 13B</td><td>9.83</td><td>5.30</td><td>5.34</td></tr></table>
374
+
375
+ # L Memory Peak on Training
376
+
377
+ The memory consumption is not solely dictated by the model size but is also influenced by various other factors6. Our approach with PEQA inherently offers memory advantages during fine-tuning by striving to minimize both the model size and the number of training parameters. To provide a clear understanding of these benefits, we conducted tests using a single NVIDIA A100-80GB GPU and the causal language modeling code from the HuggingFace repository7. Both LoRA and PEQA fine-tuned the LLaMA-7B on the Wikitext2 dataset with a batch size of 2 without gradient accumulation. Our findings indicated that while LoRA peaked at a memory usage of 59GB during optimization, PEQA used just 43GB. Remarkably, this disparity (16GB, 7B) escalates as the model size increases; for instance, a 65B full-precision model under LoRA occupies 130GB, whereas PEQA remarkably uses just 33GB. Additionally, LoRA encountered Out-Of-Memory (OOM) issues at a batch size of 4, whereas PEQA, due to its efficiency, continued training seamlessly.
md/dev/3itjR9QxFw/3itjR9QxFw.md ADDED
@@ -0,0 +1,433 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ANALOG BITS: GENERATING DISCRETE DATA USING DIFFUSION MODELS WITH SELF-CONDITIONING
2
+
3
+ Ting Chen, Ruixiang Zhang†, Geoffrey Hinton
4
+
5
+ Google Research, Brain Team {iamtingchen,ruixiangz,geoffhinton}@google.com
6
+
7
+ # ABSTRACT
8
+
9
+ We present Bit Diffusion: a simple and generic approach for generating discrete data with continuous state and continuous time diffusion models. The main idea behind our approach is to first represent the discrete data as binary bits, and then train a continuous diffusion model to model these bits as real numbers which we call analog bits. To generate samples, the model first generates the analog bits, which are then thresholded to obtain the bits that represent the discrete variables. We further propose two simple techniques, namely Self-Conditioning and Asymmetric Time Intervals, which lead to a significant improvement in sample quality. Despite its simplicity, the proposed approach can achieve strong performance in both discrete image generation and image captioning tasks. For discrete/categorical image generation, we significantly improve previous state-of-the-art on both CIFAR10 (which has $3 K$ discrete 8-bit tokens) and IMAGENET $6 4 \times 6 4$ (which has $1 2 K$ discrete 8-bit tokens), outperforming the best autoregressive model in both sample quality (measured by FID) and efficiency. For image captioning on MS-COCO dataset, our approach achieves competitive results compared to autoregressive models.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ State-of-the-art generative models for discrete data, such as discrete images and text, are based on autoregressive modeling (Van den Oord et al., 2016; Salimans et al., 2017; Parmar et al., 2018; Child et al., 2019; Roy et al., 2021; Jun et al., 2020; Sutskever et al., 2014; Brown et al., 2020; Chowdhery et al., 2022), where the networks, often Transformers (Vaswani et al., 2017), are trained to predict each token given its preceding ones in a sequential manner or with causal attention masks. One major drawback of such approaches is that they typically require computation and memory that is quadratic to the dimension of data (e.g., sequence length or image size), leading to difficulties in modeling large images or sequences. Another drawback is that, during generation, autoregressive models generate one token at a time so the total number of sequential sampling steps is often the same as the dimension of data, making it slow in generating large images or long sequences.
14
+
15
+ In contrast, diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020; Song et al., 2020), or score-based generative models (Song & Ermon, 2019; 2020; Song et al., 2021), can model much higher dimensional data without running into computation and memory issues. During generation, diffusion models iteratively refine samples with a high degree of parallelism, so the total number of sequential sampling steps can be much less than the dimension of data. However, state-of-the-art diffusion models (Dhariwal & Nichol, 2021; Ho et al., 2022; Nichol et al., 2021; Ramesh et al., 2022; Saharia et al., 2022) can only generate continuous data (mainly real valued pixels), and have not yet achieved results competitive with autoregressive models in generating discrete/categorical data, such as generating discrete/categorical images (Hoogeboom et al., 2021; Austin et al., 2021).
16
+
17
+ In this work, we propose a simple and generic approach for enabling continuous state diffusion models to generate discrete data. The key ingredient in our approach is analog bits: real numbers used to model the bits that represent the discrete data. Analog bits can be directly modeled by continuous state diffusion models, without requiring a discrete state space or re-formulation of the continuous diffusion process. At sampling time, the generated analog bits can be decoded into discrete variables by a simple thresholding operation. Our approach, as illustrated in Figure 1, is based on the following high-level conjecture. With strong continuous generative models (diffusion models in particular), it should not be too difficult to generate highly concentrated bimodal data where each real-valued analog bit is close to a binary bit. To reduce the prediction loss (such as negative log likelihood), the network has to model structures among analog bits that can actually lead to meaningful discrete variables after thresholding.
18
+
19
+ ![](images/c0ed764f9997aa81e12b49cd8179d3850e34208d49de4be3680434adec455e9c.jpg)
20
+ Figure 1: Bit Diffusion: modeling discrete data using continuous diffusion models with analog bits.
21
+
22
+ Besides analog bits, we further propose two simple techniques, namely Self-Conditioning and Asymmetric Time Intervals that greatly improve the sample quality. We evaluate the proposed approach on both discrete image generation, and image-conditional text / caption generation. On discrete CIFAR-10 and IMAGENET $6 4 \times 6 4$ , the proposed Bit Diffusion model significantly improves both existing discrete diffusion models but also the best autoregressive model. For example, on categorical CIFAR-10, the best autoregressive model (Jun et al., 2020) obtains a FID of 12.75, while our model (with $^ 1 / 3$ of the model size of the autoregressive model, using 100 instead of 3072 sequential inference steps) achieves a much better 6.93. For image captioning on MS-COCO dataset, our model achieves a result competitive with a strong autoregressive captioner based on a Transformer.
23
+
24
+ # 2 METHOD
25
+
26
+ Preliminaries We start with a short introduction to diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020; Song et al., 2020; 2021). Diffusion models learn a series of state transitions to map noise $\epsilon$ from a known prior distribution to $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ from the data distribution. To learn this (reverse) transition from the noise distribution to the data distribution, a forward transition from $\scriptstyle { \pmb x } _ { 0 }$ to $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ is first defined:
27
+
28
+ $$
29
+ { \pmb x } _ { t } = \sqrt { \gamma ( t ) } { \pmb x } _ { 0 } + \sqrt { 1 - \gamma ( t ) } { \pmb \epsilon } ,
30
+ $$
31
+
32
+ where $\epsilon \sim \mathcal { N } ( 0 , I )$ , $t \sim \mathcal { U } ( 0 , T )$ is a continuous variable, and $\gamma ( t )$ is a monotonically decreasing function from 1 to 0. Instead of directly learning a neural net to model the transition from $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ to $\pmb { x } _ { t - \Delta }$ , one can learn a neural net $f ( \boldsymbol { x } _ { t } , \dot { t } )$ to predict $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ (or $\epsilon$ ) from $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ , and estimate $\pmb { x } _ { t - \Delta }$ from $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ and estimated $\tilde { \mathbf { x } } _ { 0 }$ (or $\tilde { \epsilon }$ ). This training of $f ( \pmb { x } _ { t } , t )$ is based on denoising with a $\ell _ { 2 }$ regression loss:
33
+
34
+ $$
35
+ \begin{array} { r } { \mathcal { L } _ { { \pmb x } _ { 0 } } = \mathbb { E } _ { t \sim \mathcal { U } ( 0 , T ) , { \epsilon } \sim \mathcal { N } ( { \mathbf 0 } , { \mathbf 1 } ) } \| f ( \sqrt { \gamma ( t ) } { \pmb x } _ { 0 } + \sqrt { 1 - \gamma ( t ) } { \pmb \epsilon } , t ) - { \pmb x } _ { 0 } \| ^ { 2 } . } \end{array}
36
+ $$
37
+
38
+ To generate samples from a learned model, it follows a series of (reverse) state transition $\mathbf { \delta } _ { \mathbf { x } _ { T } } \to \mathbf { \delta } $ ${ \pmb x } _ { T - \Delta } \cdot \cdot \cdot { \pmb x } _ { 0 }$ . This can be achieved by iteratively applying denoising function $f$ on each state $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ to estimate $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ , and then make a transition to $\mathbf { \delta x } _ { t - \Delta }$ with the estimated $\tilde { \mathbf { x } } _ { 0 }$ (using transition rules such as those specified in DDPM (Ho et al., 2020) or DDIM (Song et al., 2020)). Note that state transitions in these diffusion models assume a continuous data space and state space. Therefore, one cannot directly apply it to model and generate discrete/categorical data.
39
+
40
+ Analog Bits A discrete data variable from an alphabet of size $K$ can be represented using $n =$ $\lceil \log _ { 2 } K \rceil$ bits, as $\{ 0 , 1 \} ^ { n }$ . Due to the discreteness, existing work has to re-formulate continuous diffusion models by adopting a discrete data space and state space (Sohl-Dickstein et al., 2015; Hoogeboom et al., 2021; Austin et al., 2021). In contrast, we propose to simply cast the binary bits $\{ 0 , \bar 1 \} ^ { n }$ into real numbers $\mathbb { R } ^ { n }$ for the continuous diffusion models 1. We term these real numbers analog bits since they learn to share the same bimodal values as binary bits but are modeled as real numbers. To draw samples, we follow the same procedure as sampling in a continuous diffusion model, except that we apply a quantization operation at the end by simply thresholding the generated analog bits. This yields binary bits which can be then converted into original discrete/categorical variables. Notably, there is no hard constraint to force the model to generate exact binary bits, but we expect a strong continuous generative model to generate real numbers that exhibit very clear bimodal concentrations and this is what happens in our experiments.
41
+
42
+ ![](images/6db7425edf9e8249ebde61d2284a0730646c07a01b44aa9f2ca88cdf548a8357.jpg)
43
+ (a) Standard reverse diffusion steps.
44
+
45
+ ![](images/f737574d4fc79cdf05a4a018341a712d2e29771633a9a7a0ad5b245f095afdb3.jpg)
46
+ (b) Self-Conditioning on the previous $\scriptstyle \mathbf { { \vec { x } } } 0$ estimate.
47
+ Figure 2: An illustration of reverse diffusion sampling steps (a) without or (b) with Self-Conditioning. $\tilde { \mathbf { x } } _ { 0 }$ denotes the estimation of data sample by the denoising network $f$ at a sampling step. We propose to condition the network directly on its previously generated/estimated samples.
48
+
49
+ For simplicity, we use the same regression loss function (Eq. 2) for modeling analog bits. However, it is possible to use other loss functions such as the cross entropy loss. We also note that the binary encoding mechanism for constructing analog bits is extensible as well (e.g., one-hot encoding). Extensions of loss functions and binary encoding are described in the appendix B.
50
+
51
+ Self-Conditioning Conditioning is a useful technique for improving diffusion models (Nichol & Dhariwal, 2021; Ho et al., 2022). However, a typical conditioning variable is either from some external sources, such as class labels (Nichol & Dhariwal, 2021) or low-resolution images from another network (Nichol & Dhariwal, 2021; Saharia et al., 2021; Ho et al., 2022). Here we propose a technique for the model to directly condition on previously generated samples of its own during the iterative sampling process, which can significantly improve the sample quality of diffusion models.
52
+
53
+ In a typical diffusion sampling process, the model iteratively predicts $\scriptstyle { \mathbf { { \vec { x } } } } _ { 0 }$ (or $\epsilon$ ) in order to progress the chain of mapping noise into data. However, as shown in Figure 2a, the previously estimated $\tilde { \mathbf { x } } _ { 0 }$ is simply discarded when estimating $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ from a new time step, i.e. the denoising function $f ( \pmb { x } _ { t } , t )$ does not directly depend on a previously estimated $\tilde { \mathbf { x } } _ { 0 }$ . Here we consider a slightly different denoising function of $f ( \pmb { x } _ { t } , \tilde { \pmb { x } } _ { 0 } , t )$ that also takes previous generated samples as its input, illustrated in Figure 2b. A simple implementation of Self-Conditioning is to concatenate $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ with previously estimated $\tilde { \mathbf { x } } _ { 0 }$ . Given that $\tilde { \mathbf { x } } _ { 0 }$ is from the earlier prediction of the model in the sampling chain, this comes at a negligible extra cost during sampling. In order to train the denoising function $f ( \pmb { x } _ { t } , \tilde { \pmb { x } } _ { 0 } , t )$ , we make some small changes to the training. With some probability (e.g., $5 0 \%$ ), we set $\tilde { \pmb { x } } _ { 0 } = { \bf 0 }$ which falls back to modeling without Self-Conditioning. At other times, we first estimate $\tilde { \pmb { x } } _ { 0 } = f ( \pmb { x } _ { t } , \mathbf { 0 } , t )$ and then use it for Self-Conditioning. Note that we do not backpropagate through the estimated $\tilde { \mathbf { x } } _ { 0 }$ so the overall increase of training time is small (e.g., less than $2 5 \%$ ).
54
+
55
+ Asymmetric Time Intervals Besides Self-Conditioning, we identify another factor, time step $t$ , that can also impact Bit Diffusion models. Time step $t$ is an integral part of both denoising network $f ( \pmb { x } _ { t } , t )$ as well as the state transitions. During a typical reverse diffusion process, the model takes symmetric time intervals (i.e., $\Delta$ as in $t \to t - \Delta _ { * }$ ) for both the state transition and time reduction itself, resulting in the same/shared $t$ for both arguments of $f ( \pmb { x } _ { t } , t )$ . However, we find that, when taking large reverse steps, using asymmetric time intervals, implemented via a simple manipulation of time scheduling at generation, can lead to improved sampling quality for Bit Diffusion models.
56
+
57
+ More specially, with asymmetric time intervals during the sampling process, we have $f ( \pmb { x } _ { t } , t ^ { \prime } )$ , where $t ^ { \prime } = t + \xi$ and $\xi$ is a small non-negative time difference parameter. Note that training remains unchanged, and the same/shared $t$ is used for both arguments of the $f ( \pmb { x } _ { t } , t )$ . Figure 3 illustrates the effect with a trained Bit Diffusion model, where it is asked to take two reversing steps from a state $x _ { t }$ constructed using the forward diffusion, and it shows that asymmetric time intervals reduce the number of noisy pixels (after thresholding and converting back to discrete variables).
58
+
59
+ ![](images/f72c43281e8ed1f0ec8e1e837f38cc9b0d83da14b82d3a69ed816260e93c9399.jpg)
60
+ Figure 3: When taking a large reverse step from ${ \bf { x } } _ { t = 0 . 6 }$ to ${ \bf { x } } _ { t = 0 . 1 }$ in Bit Diffusion with maximum time $T = 1 . 0$ , we see that asymmetric time intervals with a positive time difference $\xi$ improve the denoising quality of ${ \mathbf { \mathcal { x } } } _ { t = 0 . 1 }$ (by reducing the number of noisy pixels).
61
+
62
+ Putting it together Algorithm 1 and 2 summarize the training and sampling algorithms for the proposed Bit Diffusion model with Analog Bits, Self-Conditioning, and Asymmetric Time Intervals (via the td parameter). The proposed changes to the existing diffusion models are highlighted in blue. Note that unlike standard diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020; Nichol & Dhariwal, 2021), we use a continuous time parameterization between 0 and 1 instead of a fixed discrete time for maximal flexibility but they perform similarly. More details of the algorithm (including some important functions) can be found in Appendix A.
63
+
64
+ # Algorithm 1 Bit Diffusion training algorithm.
65
+
66
+ # Algorithm 2 Bit Diffusion sampling algorithm.
67
+
68
+ def train_loss(x): # Binary encoding: discrete to analog bits. x_bits $=$ int2bit(x).astype(float) x_bits $=$ (x_bits \* 2 - 1) \* scale # Corrupt data. t $=$ uniform(0, 1) eps $=$ normal(mean ${ } = 0$ , std $= 1$ ) x_crpt $=$ sqrt(gamma(t)) \* x_bits + sqrt(1 - gamma(t)) \* eps # Compute self-cond estimate. x_pred $=$ zeros_like(x_crpt) if self_cond and uniform(0, 1) > 0.5: x_pred $=$ net(cat([x_crpt, x_pred], -1), t) x_pred $=$ stop_gradient(x_pred) # Predict and compute loss. x_pred $=$ net(cat([x_crpt, x_pred], -1), t) loss $=$ (x_pred - x_bits)\*\*2 return loss.mean()
69
+
70
+ def generate(steps, td=0): x_t $=$ normal(mean=0, std=1) x_pred $=$ zeros_like(x_t) for step in range(steps): # Get time for current and next states. t_now $\ c = ~ 1$ - step / steps t_next $=$ max(1 - (step+1+td) / steps, 0) # Predict x_0. if not self_cond: x_pred $=$ zeros_like $( \mathrm { x \_ t } )$ ) x_pred $=$ net(cat([x_t,x_pred],-1), t_now) # Estimate x at t_next. x_t $=$ ddim_or_ddpm_step( x_t, x_pred, t_now, t_next) # Binary decoding to discrete data. return bit2int(x_pred $> 0$ )
71
+
72
+ # 3 EXPERIMENTS
73
+
74
+ We experiment with two different discrete data generation tasks, namely discrete/categorical image generation, and image captioning (image-conditional text generation).
75
+
76
+ # 3.1 EXPERIMENTAL SETUP AND IMPLEMENTATION DETAILS
77
+
78
+ Datasets We use CIFAR-10 (Krizhevsky et al., 2009) and IMAGENET $6 4 \times 6 4$ (Deng et al., 2009) 2 for image generation experiments. We adopt widely used FID (Heusel et al., 2017) as the main evaluation metric, and it is computed between 50K generated samples and the whole training set. For image captioning, following (Chen et al., 2022), we use MS-COCO 2017 captioning dataset (Lin et al., 2014).
79
+
80
+ Binary encoding Each pixel consists of 3 sub-pixels (RGB channels), and each sub-pixel is an integer in [0, 256) representing the intensity. Standard continuous generative models cast RGB channels as real numbers and normalize them in $[ - 1 , 1 ]$ . For discrete image generation, we consider three discrete encoding for sub-pixels, namely UINT8, GRAY CODE, and UINT8 (RAND). In UINT8, we use 8-bit binary codes converted from the corresponding sub-pixel integer in [0, 256). In GRAY CODE, we assign 8-bit binary codes uniquely to each sub-pixel integer such that two adjacent integers only differ by 1 bit. And in UINT8 (RAND), we assign 8-bit binary codes to every sub-pixel integer by randomly shuffling the integer-to-bits mapping in UINT8. The binary codes in UINT8 and GRAY CODE are loosely correlated with its original sub-pixel intensities, while UINT8 (RAND) has no correlation so each sub-pixel is a categorical variable. The details of the binary codes and their correlations with sub-pixel intensity can be found in the appendix C. We shift and scale the binary bits from $0 , 1$ to $- 1 , 1$ for the analog bits.
81
+
82
+ For image captioning, we follow (Chen et al., 2022), and use sentencepiece (Kudo & Richardson, 2018) with a vocabulary of size 32K to tokenize the captions. After tokenization, we encode each token into 15 analog bits using the binary codes converted from the corresponding integer. We set the maximum number of tokens to 64 so the total sequence length is 960 bits. Since we directly model bits, it is also possible to directly work with their byte representations without a tokenizer, but we leave this for future work.
83
+
84
+ Table 1: Comparison of FIDs on unconditional and class-conditional CIFAR-10. Note that both UINT8 and GRAY CODE are only partial/weakly ordinal (see Appendix C). Our Bit Diffusion achieves state-of-the-art FIDs in generating discrete images, beating the best autoregressive model.
85
+
86
+ <table><tr><td>Method</td><td>State space</td><td>FID (Unconditional)</td><td>FID (Conditional)</td></tr><tr><td>On continuous pixels (as reference):</td><td></td><td></td><td></td></tr><tr><td>DDPM (Ho et al., 2020)</td><td>Continuous</td><td>3.17</td><td></td></tr><tr><td>DDPM (our reproduction)</td><td>Continuous</td><td>3.14</td><td>2.95</td></tr><tr><td>On discrete (partial) ordinal pixels:</td><td></td><td></td><td></td></tr><tr><td>D3PM Gauss+Logistic (Austin et al., 2021)</td><td>Discrete</td><td>7.34</td><td></td></tr><tr><td>TLDR-10 (Campbell et al., 2022)</td><td>Discrete</td><td>3.74</td><td></td></tr><tr><td>Bit Diffusion on UINT8</td><td>Continuous</td><td>3.48</td><td>2.72</td></tr><tr><td>Bit Diffusion on GRAY CODE</td><td>Continuous</td><td>3.86</td><td>2.94</td></tr><tr><td>On categorical pixels:</td><td></td><td></td><td></td></tr><tr><td>D3PM uniform (Austin et al., 2021)</td><td>Discrete</td><td>51.27</td><td></td></tr><tr><td>D3PM absorbing (Austin et al.,2021)</td><td>Discrete</td><td>30.97</td><td></td></tr><tr><td>Autoregressive Transformer (Jun et al.,2020)</td><td>Discrete</td><td>12.75</td><td></td></tr><tr><td>Bit Diffusion on UINT8 (RAND)</td><td>Continuous</td><td>6.93</td><td>6.43</td></tr></table>
87
+
88
+ Table 2: Comparison of FIDs on class-conditional IMAGENET $6 4 \times 6 4$ . The corresponding samples can be found in Figure 4 and 11.
89
+
90
+ <table><tr><td>DDPM (our repo.) on continuous pixels</td><td>Bit Diffusion on UINT8</td><td>Bit Diffusion On GRAY CODE</td><td>Bit Diffusion On UINT8 (RAND)</td></tr><tr><td>3.43</td><td>4.84</td><td>5.14</td><td>8.76</td></tr></table>
91
+
92
+ Architecture We use the U-Net architecture (Ho et al., 2020; Nichol & Dhariwal, 2021; Ronneberger et al., 2015) for image generation. For CIFAR-10, we use a single channel dimension of 256, 3 stages and 3 residual blocks (He et al., 2016) per stage, with a total of 51M parameters. We only use dropout (Srivastava et al., 2014) of 0.3 for continuous diffusion models on CIFAR-10. For IMAGENET $6 4 \times 6 4$ , following (Nichol & Dhariwal, 2021), we use a base channel dimension of 192, multiplied by 1,2,3,4 in 4 stages and 3 residual blocks per stage, which account for a total of 240M parameters 3. For UINT8 (RAND) encoding, we find the following “softmax factorization” architectural tweak on the final output layer can lead to a better performance. Instead of using a linear output layer to predict analog bits directly, we first predict a probability distribution over 256 classes per sub-pixel (with each class corresponds to one of the 256 different 8-bit codes), and then map class distribution into analog bits by taking weighted average over all 256 different 8-bit codes.
93
+
94
+ For image captioning, we follow the architecture used in (Chen et al., 2021; 2022), with a pre-trained image encoder using the object detection task, for both autoregressive baseline as well as the proposed method. Both decoders are randomly initialized 6-layer Transformer (Vaswani et al., 2017) decoder with 512 dimension per layer. For the autoregressive decoder, the token attention matrix is offset by the causal masks, but it is non-masked all-to-all attention for our Bit Diffusion.
95
+
96
+ Other settings We train our models with the Adam optimizer (Kingma & Ba, 2014). For CIFAR-10, we train the model for $1 . 5 { \bf M }$ steps with a constant learning rate of 0.0001 and batch size of 128. For IMAGENET $6 4 \times 6 4$ , we train the model for 500K steps with a constant learning rate of 0.0002 4 and batch size of 1024. For Bit Diffusion, we use Self-Conditioning by default, unless otherwise specified. We use an exponential moving average of the weights during training with a decay factor of 0.9999. For our best image generation results, we sweep over a few sampling hyper-parameters, such as sampler (DDIM vs DDPM), sampling steps in $\{ 1 0 0 , 2 5 0 , 4 0 0 , 1 0 0 0 \}$ , and time difference in $\{ 0 . , 0 . 0 1 , 0 . { \overset { \cdot } { 1 } } , 0 . 2 , 0 . 5 \}$ .
97
+
98
+ # 3.2 DISCRETE IMAGE GENERATION
99
+
100
+ We compare our model against state-of-the-art generative models (Ho et al., 2020; Austin et al., 2021; Campbell et al., 2022; Jun et al., 2020) on generating discrete CIFAR-10 images in Table 1. Our model achieves better results compared to both existing discrete diffusion models and the best autoregressive model. When compared to continuous diffusion models (i.e., DDPM), our Bit Diffusion models on UINT8 and GRAY CODE can achieve similar performance.
101
+
102
+ ![](images/07c841d2d466ccb4fe24e93ec5f8d90ad34328248073fe60f875375244969167.jpg)
103
+ Figure 4: Class-conditional generations on continuous v.s. discrete ImageNet $6 4 \times 6 4$ . Each row represents random samples conditioned on a class, and the classes are adopted from (Nichol & Dhariwal, 2021), namely, 9: ostrich, 11: goldfinch, 130: flamingo, 141: redshank, 154: pekinese, 157: papillon, 97: drake and 28: spotted salamander. More samples from random classes are shown in Figure 11.
104
+
105
+ Discrete generation of IMAGENET $6 4 \times 6 4$ is significantly harder than CIFAR-10, and we have not found other competing methods that report FIDs, so we only compare the proposed method against DDPM on continuous pixels. Results are shown in Table 2. We find that the diffusion model on continuous pixels has the best FID while the diffusion model on UINT8 (RAND), i.e., categorical data, has the worst FID, indicating the increase of hardness when removing intensity/order information in sub-pixels. Note that, in these experiments, there is no extra model capacity to compensate for the loss of intensity/order information since the model sizes are the same. Figure 4 shows generated images of different diffusion models on continuous and discrete IMAGENET $6 4 \times 6 4$ . Despite the differences in FIDs, visually these samples look similar.
106
+
107
+ Ablation of Self-Conditioning Figure 5 shows the effectiveness of the Self-Conditioning technique in both Bit Diffusion and continuous diffusion models. Note that the experiments are performed in three settings, namely CIFAR-10 with UINT8, CIFAR-10 with UINT8 (RAND), and IMAGENET
108
+
109
+ ![](images/f1829098c0e53d5b75d339e11962393f4d8d156eddb8d59297c587f22cdabe85.jpg)
110
+ Figure 5: Self-conditioning is a generic technique that not only greatly improves Bit Diffusion but also leads to improved results for continuous diffusion models.
111
+
112
+ ![](images/a222e73539e23289a138d993c86b82a68f7a1323b7a8eec48d0c2856682e5f18.jpg)
113
+ Figure 6: Effect of time difference in class-conditional IMAGENET $6 4 \times 6 4$ . Optimal time difference shrinks to zero as the number of sampling steps increases. For 100 sampling steps, non-zero time difference leads to improved FIDs.
114
+
115
+ $6 4 \times 6 4$ with continuous pixels, where the only difference for pairs in each setting is whether the Self-Conditioning is used. For CIFAR-10, we find that Self-Conditioning greatly improves the performance across different binary encodings. We also notice that for Bit Diffusion, predicting $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ is much more effective than predicting . For IMAGENET $6 4 \times 6 4$ , we find that the proposed Self-Conditioning also leads to improved FIDs for continuous diffusion (i.e., DDPM). Therefore, we conclude that Self-Conditioning by itself is a generic technique that can benefit diffusion models on both continuous and discrete data.
116
+
117
+ Ablation of asymmetric time intervals Figure 6 shows the FID on generated IMAGENET $6 4 \times 6 4$ samples as we vary the time difference parameter during the sampling process. We find that as the number of steps increases (from 100 to 400), the optimal time difference shrinks to 0. For 100 steps, a non-zero time difference leads to a significant improvement of FID. We also note that for Bit Diffusion on UINT8 (RAND), using 400 sampling steps actually leads to a drastically worse sample quality than using 100 steps. This is related to how the Self-Conditioning is applied and we present alternative Self-Conditioning sampling strategies in the Appendix G, some of which lead to improved FIDs at a cost of longer sampling time.
118
+
119
+ Concentration of generated analog bits Figure 7 visualizes the distribution of generated analog bits from 64 generated images on IMAGENET $6 4 \times 6 4$ . Although there is no hard constraint on the analog bits being binary / bimodal, the generated ones are highly concentrated on two modes, which makes the thresholding / quantization easy and robust.
120
+
121
+ ![](images/2711cf1eb2ef77e5962d7c44640a23d9e8daf8fe2b1b075ac8e049e8405a0470.jpg)
122
+ Figure 7: Histogram distribution (50 bins) of the analog bits from 64 randomly generated IMAGENET $6 4 \times 6 4$ samples at $\tilde { { \boldsymbol { x } } } _ { 0 }$ , with 100 DDIM steps. Most of the generated analog bits are very concentrated.
123
+
124
+ # 3.3 IMAGE CAPTIONING
125
+
126
+ We compare our Bit Diffusion model with an autoregressive Transformer baseline (Chen et al., 2022). As mentioned, both models have similar architectures, with an object detection pretrained (Chen et al., 2021) image encoder, and a randomly initialized Transformer (Vaswani et al., 2017) decoder. Table 3 presents the main comparison. Overall, our model achieves similar performance as the autoregressive model. We find that generally it only needs about 10 steps for the model to achieve good results, despite that there are a total of maximum 960 bits for caption that the model has to model. We find that the asymmetric time intervals play an important role in the final performance of our model, as demonstrated in Table 4, especially when sampling steps are fewer.
127
+
128
+ Table 3: Image captioning results on MS-COCO dataset with a randomly initialized text decoder.
129
+
130
+ <table><tr><td>Method</td><td>BLEU-4</td><td>CIDEr</td><td>ROUGE-L</td></tr><tr><td>Autoregressive Transformer</td><td>33.9</td><td>1.18</td><td>0.57</td></tr><tr><td>Bit Diffusion (5 steps)</td><td>31.5</td><td>1.00</td><td>0.55</td></tr><tr><td>Bit Diffusion (10 steps)</td><td>34.5</td><td>1.13</td><td>0.57</td></tr><tr><td>Bit Diffusion (20 steps)</td><td>34.7</td><td>1.15</td><td>0.58</td></tr><tr><td>Bit Diffusion (40 steps)</td><td>34.4</td><td>1.15</td><td>0.57</td></tr></table>
131
+
132
+ Table 4: Asymmetric time intervals significantly improves the performance of Bit Diffusion.
133
+ Table 5: Generated image captions under different number of sampling steps.
134
+
135
+ <table><tr><td rowspan="2"></td><td colspan="9">Time difference</td></tr><tr><td>0.0</td><td>1.0</td><td>2.0</td><td>3.0</td><td>4.0</td><td>5.0</td><td>6.0</td><td>7.0</td><td>8.0</td></tr><tr><td>5 steps</td><td>17.1</td><td>27.8</td><td>30.8</td><td>31.5</td><td>31.6</td><td>31.5</td><td>31.5</td><td>31.5</td><td>31.6</td></tr><tr><td>10 steps</td><td>17.6</td><td>26.3</td><td>30.7</td><td>32.6</td><td>33.4</td><td>34.0</td><td>34.3</td><td>34.5</td><td>34.6</td></tr><tr><td>20 steps</td><td>20.0</td><td>27.9</td><td>30.6</td><td>32.0</td><td>32.3</td><td>33.9</td><td>34.4</td><td>34.7</td><td>34.5</td></tr><tr><td>40 steps</td><td>20.7</td><td>27.5</td><td>30.7</td><td>32.2</td><td>32.9</td><td>33.2</td><td>33.8</td><td>34.4</td><td>34.4</td></tr></table>
136
+
137
+ Table 5 provides some generated samples of our model when different inference steps are used. The model makes mistakes when the sampling steps are too few, and the mistakes may not always be interpretable due to that the model directly predicts the bits behind the tokenized word pieces and a small difference in bits can lead to total different words.
138
+
139
+ ![](images/9aac52c53817dd45cbdf8027351f9eb9775cd9bd356b23f8455de14c97f024e6.jpg)
140
+
141
+ # 4 RELATED WORK
142
+
143
+ Autoregressive models for discrete data Autoregressive models have demonstrated state-of-the-art results when it comes to generating discrete data. In particular, text generation, or language modeling, is dominated by autoregressive approaches (Sutskever et al., 2014; Brown et al., 2020; Chowdhery et al., 2022). Autoregressive models are also applied to discrete/categorical image generation (Van den Oord et al., 2016; Salimans et al., 2017; Parmar et al., 2018; Child et al., 2019; Roy et al., 2021; Jun et al., 2020; Chen et al., 2020a), where they work well on small image resolutions. However, the computation cost and memory requirement increase drastically (typically in a quadratic relation) as the size of sequence or the image resolution increase, so it becomes very challenging to scale these approaches to data with large dimensions.
144
+
145
+ Diffusion models for discrete data State-of-the-art diffusion models (Dhariwal & Nichol, 2021; Ho et al., 2022; Nichol et al., 2021; Ramesh et al., 2022; Saharia et al., 2022) cannot generate discrete or categorical data. Existing extensions of these continuous diffusion models to discrete data are based on both discrete data space and state space (Sohl-Dickstein et al., 2015; Hoogeboom et al., 2021; Austin et al., 2021; Campbell et al., 2022). Compared to discrete state space, continuous state space is more flexible and potentially more efficient. Our approach is also compatible with both discrete and continuous time, and does not require re-formulation of existing continuous models, thus it is simpler and can potentially be plugged into a broader family of generative models.
146
+
147
+ Another line of discrete diffusion models is based on the embedding of discrete data (Li et al., 2022). One can also consider our binary encoding with analog bits as a simple fixed encoder, and the decoding / quantization of bimodal analog bits is easy and robust via a simple thresholding operation. In contrast, the quantization of real numbers in generated continuous embedding vectors may contain multiple modes per dimension, leading to potential difficulty in thresholding/quantization.
148
+
149
+ Normalizing Flows for discrete data Normalizing Flows (Rezende & Mohamed, 2015; Dinh et al., 2017; Kingma & Dhariwal, 2018) are a powerful family of generative models for high-dimensional continuous distributions based on some invertible mapping. However, straightforward application of flow-based models on categorical data is limited due to the inherent challenges on discrete support. Discrete flows (Tran et al., 2019; Hoogeboom et al., 2019; Lindt & Hoogeboom, 2021) introduce invertible transformations of random variables in discrete space without the need of computing the log-determinant of Jacobian. Other works (Lippe & Gavves, 2021; Hoogeboom et al., 2021; Tan et al., 2021) introduce various embedding methods for transforming discrete data into continuous space with disjoint support, which can be interpreted as a variational inference problem (Theis et al., 2015) with different dequantization distribution families. Several works (Kingma et al., 2016; Ziegler & Rush, 2019; Zhang et al., 2020) also explore normalizing flows on discrete data under the Variational Autoencoders (Kingma & Welling, 2013) framework by enriching the prior. Compared to our diffusion-based approach, these models suffer from strict invertible restrictions on network architecture, thus limiting their capacity.
150
+
151
+ Other generative models for discrete data Other generative models, such as Varational Autoencoders (VAE) (Kingma & Welling, 2013), Generateive Adversarial Networks (GAN) (Goodfellow et al., 2014; Yu et al., 2017; Che et al., 2017; Hjelm et al., 2017; Fedus et al., 2018) have also been applied to generate discrete data. These methods have not yet achieved the level of performance as autoregressive models on tasks such as discrete image generation or text generation, in terms of sample quality or data likelihood. Potentially, the proposed analog bits can also be applied to these continuous generative models, by having the networks directly model and generate analog bits, but it is not explored in this work.
152
+
153
+ Other related work The proposed Self-Conditioning technique shares some similarities with selfmodulation in GANs (Chen et al., 2018a) (where the earlier latent state can directly modulate the later latent states) and SUNDAE (Savinov et al., 2021) (where an inference step is incorporated for denoising).
154
+
155
+ # 5 CONCLUSION
156
+
157
+ We introduce a simple and generic technique that enables continuous state diffusion models to generate discrete data. The main idea is to encode discrete or categorical data into bits and then model these bits as real numbers that we call analog bits. We also propose two simple techniques, namely Self-Conditioning (i.e., condition the diffusion models directly on their previously generated samples) and Asymmetric Time Intervals, that lead to improved sample quality. We demonstrate that our approach leads to state-of-the-art results in discrete / categorical image generation, beating the best autoregressive model. In an image-conditional text generation task on MS-COCO dataset, we also achieve competitive results compared to autoregressive models. One limitation of our approach, similar to other existing diffusion models, is that they still require a significant number of inference steps for generating good (image) samples. However, we expect that future improvements from diffusion models for continuous data can also transfer to discrete data using analog bits.
158
+
159
+ # ACKNOWLEDGEMENTS
160
+
161
+ We would like to thank Priyank Jaini, Kevin Swersky for providing helpful feedback to our draft. Our implementation is partially based on the Pix2Seq codebase, and we thank Lala Li, Saurabh Saxena, for their contributions to the Pix2Seq codebase.
162
+
163
+ # REFERENCES
164
+
165
+ Jacob Austin, Daniel D Johnson, Jonathan Ho, Daniel Tarlow, and Rianne van den Berg. Structured denoising diffusion models in discrete state-spaces. Advances in Neural Information Processing Systems, 34:17981– 17993, 2021. (Cited on 1, 2, 5, 9)
166
+
167
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. arXiv preprint arXiv:1809.11096, 2018. (Cited on 4)
168
+
169
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. (Cited on 1, 8)
170
+
171
+ Andrew Campbell, Joe Benton, Valentin De Bortoli, Tom Rainforth, George Deligiannidis, and Arnaud Doucet. A continuous time framework for discrete denoising models. arXiv preprint arXiv:2205.14987, 2022. (Cited on 5, 9)
172
+
173
+ Tong Che, Yanran Li, Ruixiang Zhang, R Devon Hjelm, Wenjie Li, Yangqiu Song, and Yoshua Bengio. Maximum-likelihood augmented discrete generative adversarial networks. arXiv preprint arXiv:1702.07983, 2017. (Cited on 9)
174
+
175
+ Mark Chen, Alec Radford, Rewon Child, Jeffrey Wu, Heewoo Jun, David Luan, and Ilya Sutskever. Generative pretraining from pixels. In International conference on machine learning, pp. 1691–1703. PMLR, 2020a. (Cited on 8)
176
+
177
+ Ting Chen, Mario Lucic, Neil Houlsby, and Sylvain Gelly. On self modulation for generative adversarial networks. arXiv preprint arXiv:1810.01365, 2018a. (Cited on 9)
178
+
179
+ Ting Chen, Martin Renqiang Min, and Yizhou Sun. Learning k-way d-dimensional discrete codes for compact embedding representations. In International Conference on Machine Learning, pp. 854–863. PMLR, 2018b. (Cited on 14)
180
+
181
+ Ting Chen, Lala Li, and Yizhou Sun. Differentiable product quantization for end-to-end embedding compression. In International Conference on Machine Learning, pp. 1617–1626. PMLR, 2020b. (Cited on 14)
182
+
183
+ 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. (Cited on 5, 8)
184
+
185
+ 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. (Cited on 4, 5, 8)
186
+
187
+ Rewon Child, Scott Gray, Alec Radford, and Ilya Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019. (Cited on 1, 8)
188
+
189
+ 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. (Cited on 1, 8)
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. (Cited on 4)
192
+
193
+ Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021. (Cited on 1, 9)
194
+
195
+ Laurent Dinh, Jascha Sohl-Dickstein, and Samy Bengio. Density estimation using real NVP. In International Conference on Learning Representations, 2017. (Cited on 9)
196
+
197
+ William Fedus, Ian Goodfellow, and Andrew M Dai. Maskgan: better text generation via filling in the_. arXiv preprint arXiv:1801.07736, 2018. (Cited on 9)
198
+
199
+ 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. (Cited on 9)
200
+
201
+ 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. (Cited on 5)
202
+
203
+ Martin Heusel, Hubert Ramsauer, Thomas Unterthiner, Bernhard Nessler, and Sepp Hochreiter. Gans trained by a two time-scale update rule converge to a local nash equilibrium. Advances in neural information processing systems, 30, 2017. (Cited on 4)
204
+
205
+ R Devon Hjelm, Athul Paul Jacob, Tong Che, Adam Trischler, Kyunghyun Cho, and Yoshua Bengio. Boundaryseeking generative adversarial networks. arXiv preprint arXiv:1702.08431, 2017. (Cited on 9)
206
+
207
+ Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021. (Cited on 19)
208
+
209
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020. (Cited on 1, 2, 4, 5)
210
+
211
+ Jonathan Ho, Chitwan Saharia, William Chan, David J Fleet, Mohammad Norouzi, and Tim Salimans. Cascaded diffusion models for high fidelity image generation. J. Mach. Learn. Res., 23:47–1, 2022. (Cited on 1, 3, 9)
212
+
213
+ Emiel Hoogeboom, Jorn Peters, Rianne Van Den Berg, and Max Welling. Integer discrete flows and lossless compression. Advances in Neural Information Processing Systems, 32, 2019. (Cited on 9)
214
+
215
+ Emiel Hoogeboom, Didrik Nielsen, Priyank Jaini, Patrick Forré, and Max Welling. Argmax flows and multinomial diffusion: Learning categorical distributions. Advances in Neural Information Processing Systems, 34: 12454–12465, 2021. (Cited on 1, 2, 9)
216
+
217
+ Heewoo Jun, Rewon Child, Mark Chen, John Schulman, Aditya Ramesh, Alec Radford, and Ilya Sutskever. Distribution augmentation for generative modeling. In International Conference on Machine Learning, pp. 5006–5019. PMLR, 2020. (Cited on 1, 2, 5, 8)
218
+
219
+ Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. (Cited on 5)
220
+
221
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. (Cited on 9)
222
+
223
+ Durk P Kingma and Prafulla Dhariwal. Glow: Generative flow with invertible 1x1 convolutions. Advances in neural information processing systems, 31, 2018. (Cited on 9)
224
+
225
+ Durk P Kingma, Tim Salimans, Rafal Jozefowicz, Xi Chen, Ilya Sutskever, and Max Welling. Improved variational inference with inverse autoregressive flow. Advances in neural information processing systems, 29, 2016. (Cited on 9)
226
+
227
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. (Cited on 4)
228
+
229
+ Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. arXiv preprint arXiv:1808.06226, 2018. (Cited on 4)
230
+
231
+ Xiang Lisa Li, John Thickstun, Ishaan Gulrajani, Percy Liang, and Tatsunori B Hashimoto. Diffusion-lm improves controllable text generation. arXiv preprint arXiv:2205.14217, 2022. (Cited on 9)
232
+
233
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European Conference on Computer Vision, pp. 740–755. Springer, 2014. (Cited on 4)
234
+
235
+ Alexandra Lindt and Emiel Hoogeboom. Discrete denoising flows. arXiv preprint arXiv:2107.11625, 2021. (Cited on 9)
236
+
237
+ Phillip Lippe and Efstratios Gavves. Categorical normalizing flows via continuous transformations. In International Conference on Learning Representations, 2021. (Cited on 9)
238
+
239
+ 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. (Cited on 16)
240
+
241
+ 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. (Cited on 1, 9)
242
+
243
+ Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162–8171. PMLR, 2021. (Cited on 3, 4, 5, 6)
244
+
245
+ Niki Parmar, Ashish Vaswani, Jakob Uszkoreit, Lukasz Kaiser, Noam Shazeer, Alexander Ku, and Dustin Tran. Image transformer. In International conference on machine learning, pp. 4055–4064. PMLR, 2018. (Cited on 1, 8)
246
+
247
+ 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. (Cited on 1, 9)
248
+
249
+ Danilo Rezende and Shakir Mohamed. Variational inference with normalizing flows. In International conference on machine learning, pp. 1530–1538. PMLR, 2015. (Cited on 9)
250
+
251
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computer-assisted intervention, pp. 234–241. Springer, 2015. (Cited on 5)
252
+
253
+ Aurko Roy, Mohammad Saffar, Ashish Vaswani, and David Grangier. Efficient content-based sparse attention with routing transformers. Transactions of the Association for Computational Linguistics, 9:53–68, 2021. (Cited on 1, 8)
254
+
255
+ Chitwan Saharia, Jonathan Ho, William Chan, Tim Salimans, David J Fleet, and Mohammad Norouzi. Image super-resolution via iterative refinement. arXiv preprint arXiv:2104.07636, 2021. (Cited on 3)
256
+
257
+ Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, et al. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022. (Cited on 1, 9)
258
+
259
+ Tim Salimans, Andrej Karpathy, Xi Chen, and Diederik P Kingma. Pixelcnn $^ { + + }$ : Improving the pixelcnn with discretized logistic mixture likelihood and other modifications. arXiv preprint arXiv:1701.05517, 2017. (Cited on 1, 8)
260
+
261
+ Nikolay Savinov, Junyoung Chung, Mikolaj Binkowski, Erich Elsen, and Aaron van den Oord. Step-unrolled denoising autoencoders for text generation. arXiv preprint arXiv:2112.06749, 2021. (Cited on 9)
262
+
263
+ Rico Sennrich, Barry Haddow, and Alexandra Birch. Neural machine translation of rare words with subword units. arXiv preprint arXiv:1508.07909, 2015. (Cited on 14)
264
+
265
+ Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. PMLR, 2015. (Cited on 1, 2, 4, 9)
266
+
267
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020. (Cited on 1, 2)
268
+
269
+ Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 32, 2019. (Cited on 1)
270
+
271
+ Yang Song and Stefano Ermon. Improved techniques for training score-based generative models. Advances in neural information processing systems, 33:12438–12448, 2020. (Cited on 1)
272
+
273
+ Yang Song, Jascha Sohl-Dickstein, Diederik P Kingma, Abhishek Kumar, Stefano Ermon, and Ben Poole. Score-based generative modeling through stochastic differential equations. In International Conference on Learning Representations, 2021. (Cited on 1, 2)
274
+
275
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: a simple way to prevent neural networks from overfitting. The journal of machine learning research, 15(1): 1929–1958, 2014. (Cited on 5)
276
+
277
+ Ilya Sutskever, Oriol Vinyals, and Quoc V Le. Sequence to sequence learning with neural networks. Advances in neural information processing systems, 27, 2014. (Cited on 1, 8)
278
+
279
+ Shawn Tan, Chin-Wei Huang, Alessandro Sordoni, and Aaron Courville. Learning to dequantise with truncated flows. In International Conference on Learning Representations, 2021. (Cited on 9)
280
+
281
+ Lucas Theis, Aäron van den Oord, and Matthias Bethge. A note on the evaluation of generative models. arXiv preprint arXiv:1511.01844, 2015. (Cited on 9)
282
+
283
+ Dustin Tran, Keyon Vafa, Kumar Agrawal, Laurent Dinh, and Ben Poole. Discrete flows: Invertible generative models of discrete data. Advances in Neural Information Processing Systems, 32, 2019. (Cited on 9)
284
+
285
+ Aaron Van den Oord, Nal Kalchbrenner, Lasse Espeholt, Oriol Vinyals, Alex Graves, et al. Conditional image generation with pixelcnn decoders. Advances in neural information processing systems, 29, 2016. (Cited on 1, 8)
286
+
287
+ 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. (Cited on 1, 5, 8)
288
+
289
+ Lantao Yu, Weinan Zhang, Jun Wang, and Yong Yu. Seqgan: Sequence generative adversarial nets with policy gradient. In Proceedings of the AAAI conference on artificial intelligence, volume 31, 2017. (Cited on 9)
290
+
291
+ Zijun Zhang, Ruixiang Zhang, Zongpeng Li, Yoshua Bengio, and Liam Paull. Perceptual generative autoencoders. In International Conference on Machine Learning, pp. 11298–11306. PMLR, 2020. (Cited on 9)
292
+
293
+ Zachary Ziegler and Alexander Rush. Latent normalizing flows for discrete sequences. In International Conference on Machine Learning, pp. 7673–7682. PMLR, 2019. (Cited on 9)
294
+
295
+ # A MORE DETAILS OF ALGORITHM 1 AND 2
296
+
297
+ Algorithm 3 and 4 provide more detailed implementations of functions in Algorithm 1 and 2.
298
+
299
+ Algorithm 3 Binary encoding and decoding algorithms (in Tensorflow).
300
+
301
+ import tensorflow as tf
302
+
303
+ def int2bit(x, $\mathrm { n } { = } 8$ ): # Convert integers into the corresponding binary bits. $\textrm { \textbf { x } } =$ tf.bitwise.right_shift(tf.expand_dims(x, -1), tf.range(n)) $\textrm { \textbf { x } } =$ tf.math.mod(x, 2) return x
304
+
305
+ def bit2int(x): # Convert binary bits into the corresponding integers. $\textrm { \textbf { x } } =$ tf.cast(x, tf.int32) n $=$ x.shape[-1] $\textrm { \textbf { x } } =$ tf.math.reduce_sum(x \* (2 \*\* tf.range(n)), -1) return x
306
+
307
+ # Algorithm 4 $x _ { t }$ estimation with DDIM / DDPM updating rules.
308
+
309
+ def gamma(t, $\scriptstyle \mathrm { n s = 0 } . 0 0 0 2$ , ds=0.00025): # A scheduling function based on cosine function. return numpy.cos(((t + ns) / (1 + ds)) $\star$ numpy.pi / 2)\*\*2 def ddim_step(x_t, x_pred, t_now, t_next): # Estimate x at t_next with DDIM updating rule. γnow $=$ gamma(t_now) γnext $=$ gamma(t_next) x_pred $=$ clip(x_pred, -scale, scale) eps = √ 11−γnow (x_t - γnow \* x_pred) x_next $\mathbf { \Sigma } = \mathbf { \Sigma } \sqrt { \gamma _ { \mathrm { n e x t } } }$ \* x_pred $^ +$ $\sqrt { 1 - \gamma _ { \mathrm { n e x t } } }$ \* eps return x_next
310
+
311
+ def ddpm_step(x_t, x_pred, t_now, t_next): # Estimate x at t_next with DDPM updating rule. γnow $=$ gamma(t_now) $\alpha _ { \Omega \circ w } =$ gamma(t_now) / gamma(t_next) $\sigma _ { \mathrm { n o w } } =$ sqrt $\mathrm { ~ ( ~ 1 ~ ~ - ~ } ~ \alpha _ { \mathrm { n o w } }$ ) $z =$ normal(mean ${ } = 0$ , std $^ { = 1 }$ ) x_pred $=$ clip(x_pred, -scale, scale) eps $= { \frac { 1 } { \sqrt { 1 - \gamma _ { \mathrm { n o w } } } } }$ \* (x_t - γnow \* x_pred) x_next = √ 1αnow \* (x_t - 1−γnow √1−αnow \* eps) + σnow \* z return x_next
312
+
313
+ # B ALTERNATIVE BINARY ENCODING AND LOSS FUNCTIONS
314
+
315
+ B.1 ANALOG BITS BASED ON ONE-HOT ENCODING
316
+
317
+ An alternative binary encoding to the base-2 encoding of the discrete data used in the main paper, is the one-hot encoding, where a discrete variable is represented as a vector whose length is the same as the vocabulary size $K$ , with a single slot being 1 and the rest being 0. The resulting one-hot vector can be similarly treated as analog bits and modeled by continuous state diffusion models. To obtain discrete variables corresponding to the generated analog bits, we use an arg max operation over all candidate categories, instead of the thresholding operation in base-2 analog bits. Note that the one-hot encoding requires $K$ bits, which is less efficient compared to base-2 encoding that only requires $\lceil \log _ { 2 } K \rceil$ bits, especially for large $K$ . 5
318
+
319
+ # B.2 SIGMOID CROSS ENTROPY LOSS
320
+
321
+ As we use $\ell _ { 2 }$ loss by default for its simplicity and compatibility with continuous diffusion models. The proposed Bit Diffusion models can work with other loss functions too. Since the analog bits are bimodal, we can use the following sigmoid cross entropy loss:
322
+
323
+ $$
324
+ \begin{array} { r } { \mathcal { L } _ { \pmb { x } _ { 0 } , \pmb { x } _ { t } , t } = \log \sigma ( \pmb { x } _ { 0 } f ( \pmb { x } _ { t } , t ) ) , } \end{array}
325
+ $$
326
+
327
+ where we assume $\pmb { x } _ { 0 } \in \{ - 1 , 1 \} ^ { n }$ , and $\sigma$ is a sigmoid function. During the sampling process, we use $2 \sigma ( f ( \pmb { x } _ { t } , t ) ) - 1$ as the output of denoising network.
328
+
329
+ # B.3 SOFTMAX CROSS ENTROPY LOSS
330
+
331
+ For one-hot analog bits, one could also add a softmax activation function for the output of denosing network $f$ , and use the following softmax cross entropy loss:
332
+
333
+ $$
334
+ \begin{array} { r } { \mathcal { L } _ { \pmb { x } _ { 0 } , \pmb { x } _ { t } , t } = \pmb { x } _ { 0 } \log \mathrm { s o f t m a x } ( f ( \pmb { x } _ { t } , t ) ) , } \end{array}
335
+ $$
336
+
337
+ where we assume $\pmb { x } _ { 0 } \in \{ 0 , 1 \} ^ { n }$ which is the one-hot representation.
338
+
339
+ # B.4 PRELIMINARY EXPERIMENTS
340
+
341
+ Table 6 presents FIDs of Bit Diffusion models with different types of analog bits and loss functions on unconditional CIFAR-10. Note that it is possible some of these results can be improved by more tuning of hyper-parameters or tweaks of the network, but we do not focus on them in this work.
342
+
343
+ Table 6: FIDs of Bit Diffusion models with different types of analog bits and loss functions on unconditional CIFAR-10.
344
+
345
+ <table><tr><td></td><td>l2 loss</td><td>Logistic loss</td><td>Softmax loss</td></tr><tr><td>ONE HOT</td><td>46.32</td><td>26.82</td><td>29.49</td></tr><tr><td>UINT8</td><td>3.48</td><td>3.53</td><td>1</td></tr><tr><td>GRAY CODE</td><td>3.86</td><td>3.71</td><td>=</td></tr><tr><td>UINT8 (RAND)</td><td>6.93</td><td>49.29</td><td>-</td></tr></table>
346
+
347
+ C ON BINARY ENCODING OF PIXELS: UINT8, GRAY CODE, UINT8 (RAND)
348
+
349
+ In the main paper, we describe three different types of binary encodings of pixels. Here we provide additional detail on how we generate UINT8 (RAND): we first apply a random permutation to 256 sub-pixel values, and then assign the binary binary bits of permuted integers to the non-permuted integers. For example, assume 0 is mapped to 228 after the permutation, the analog bits of 0 would be the binary bits of 228. The random permutation is generated by numpy.random.seed(42); numpy.random.shuffle(numpy.arange(256)).
350
+
351
+ ![](images/5c5048a370cbdae3ad4f4add0ee59c4dc8d0e03265bf05ba9e1544806945fd40.jpg)
352
+ Figure 8: Correlation between (absolute) difference in subpixel intensity and the Hamming distance of the corresponding binary bits.
353
+
354
+ Figure 8 show the correlation between Hamming distance of three different binary encodings we use and the (absolute) difference of sub-pixel intensity. This is done by taking every pair of subpixel integers (in [0, 256)), compute their absolute difference, as well as the Hamming distance between the corresponding binary bits. We find that both UINT8 and GRAY CODE exhibit partial correlation between the two quantities (with different correlation patterns), meaning that these codes partially contain the order information about the original sub-pixel intensity. However, UINT8 (RAND) exhibits no correlation between hamming distance and sub-pixel intensity, indicating the order information is fully removed, thus can be considered as categorical data.
355
+
356
+ # D A TOY EXAMPLE ON CONTINUOUS MODELING OF DISCRETE VARIABLES
357
+
358
+ An intuitive toy example of how a continuous generative model can generate binary data is given in Figure 9, where a mapping from prior distribution at $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } T }$ to data distribution at $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ is shown. With a deterministic sampler (such as DDIM), it is straight-forward how they can represent any Bernoulli distribution by dividing the prior into two regions of probability densities corresponding to the Bernoulli distribution. For stochastic samplers, they can achieve a similar effect but the mapping from noise to data is stochastic. For an arbitrary discrete variable, represented as m-dimensional Bernoulli distribution, the mapping from continuous noise distribution to the target Bernoulli distribution also exists but it is more complicated (and difficult to visualize).
359
+
360
+ ![](images/5f6d559af6c6f590dc65c06be016cdac1595cb78b27323a2db579ba392e43fe2.jpg)
361
+ Figure 9: A toy example on continuous modeling of discrete variables.
362
+
363
+ # E ON OTHER SAMPLERS FOR CONTINUOUS DIFFUSION MODELS
364
+
365
+ As our models are based on continuous diffusion models, in theory our models are able to incorporate faster samplers. To this end, we conduct preliminary exploration of using DPM-Solver (Lu et al., 2022) for sampling some of our models.
366
+
367
+ We find that DPM-Solver provides a boost to diffusion models based on analog bits, similar to what it is able to do for continuous data. This shows a potential of our model enjoying faster continuous sampler while other baselines (e.g., D3PM) may not be able to do due to their use of discrete states. Table 7 below shows the FID scores of bit diffusion models on ImageNet-64x64 under different binary encoding schemes. We find that the DPM-Solver is able to provide a significant reduction in function evaluations for bit diffusion on discrete/categorical data (with 30 NFEs it gets comparable FIDs as 100 NFEs of DDIM), similar to that in continuous diffusion models.
368
+
369
+ Furthermore, we also find that self-conditioning continues to provide a boost with DPM-solver. For example, the table 8 shows FID scores of diffusion models on ImageNet 64x64 (continuous rgb values). And we find that the self-conditioning consistently improves the performance of DPM-Solver with fixed number of function evaluations.
370
+
371
+ # F EXTRA RANDOM SAMPLES ON CIFAR-10 AND IMAGENET $6 4 \times 6 4$
372
+
373
+ Figure 10 shows random samples (non cherry-picked) from unconditional diffusion models on CIFAR-10 with continuous pixels and analog bits.
374
+
375
+ Figure 11 shows random samples (non cherry-picked) from class-conditional diffusion models on IMAGENET $6 4 \times 6 4$ with continuous pixels and analog bits.
376
+
377
+ Table 7: Comparison of Continuous Diffusion Samplers. FIDs on ImageNet $6 4 \times 6 4$ shown below.
378
+
379
+ <table><tr><td>Samplers</td><td>UINT8</td><td>Gray Code</td><td>UINT8 (RAND)</td></tr><tr><td>DDIM @ 1000 NFE</td><td>5.51</td><td>5.14</td><td>58.45</td></tr><tr><td>DDPM @ 1000 NFE</td><td>7.71</td><td>6.91</td><td>64.08</td></tr><tr><td>DDIM @ 400 NFE</td><td>5.00</td><td>5.52</td><td>38.44</td></tr><tr><td>DDPM @ 400 NFE</td><td>4.84</td><td>5.37</td><td>40.91</td></tr><tr><td>DDIM @ 100 NFE</td><td>8.80</td><td>11.31</td><td>8.76</td></tr><tr><td>DDPM @ 100 NFE</td><td>13.04</td><td>12.77</td><td>9.25</td></tr><tr><td>DPM-Solver @ 30 NFE</td><td>7.85</td><td>9.64</td><td>10.39</td></tr><tr><td>DPM-Solver @ 50 NFE</td><td>6.46</td><td>7.61</td><td>10.96</td></tr></table>
380
+
381
+ Table 8: The effect of Self-Conditioning for sampling with DPM-Solver. FIDs on ImageNet $6 4 \times 6 4$ shown below.
382
+
383
+ <table><tr><td>Model</td><td>DPM-Solver @ 20 NFE|DPM-Solver @ 30 NFE</td><td></td></tr><tr><td>E prediction, w/o self-conditioning e prediction, w/ self-conditioning</td><td>6.10 4.24</td><td>5.58 4.15</td></tr><tr><td>xo prediction, w/o self-conditioning xo prediction, w/ self-conditioning</td><td>12.13 6.94</td><td>11.05 6.43</td></tr></table>
384
+
385
+ ![](images/39950aa93042e67fdc28e63a17ee0ba480d0808b29d949a36ad47b1fd1319276.jpg)
386
+ Figure 10: Random samples from unconditional models trained on CIFAR-10. (a) is for continuous image generation, (b), (c), and (d) are for discrete/categorial image generation.
387
+
388
+ ![](images/0087973f3f7fbbac5ed2501a0fe621a7bbfa949861342d891ce84a7ba0cba029.jpg)
389
+ Figure 11: Random samples from class-conditional models trained on IMAGENET $6 4 \times 6 4$ . (a) is for continuous image generation, (b), (c), and (d) are for discrete/categorial image generation.
390
+
391
+ # G ON SAMPLING STRATEGIES WITH SELF-CONDITIONING
392
+
393
+ # G.1 METHOD
394
+
395
+ In this section, we present extensions to the default sampling strategy with Self-Conditioning in Algorithm 2. The default sampling strategy utilizes data estimate from the previous step as the conditional input to the denoising network for producing data estimate at the current step. While this is both simple and effective, we observe that, for UINT8 (RAND) encoding of pixels, as the number of sampling steps increases (with both DDIM or DDPM samplers), the generated samples tend to be over-smoothed. We propose the following two extensions of the default sampling strategy to mitigate the issues and provide improvements when using larger sampling steps.
396
+
397
+ Self-Conditioning based on Momentum Estimate The first extension to the default sampling strategy is to adopt an exponential moving average over the previous data estimate to provide a more reliable conditioning input, similar to a momentum optimizer. The detailed procedure is shown in algorithm 5, where the differences from the default sampling strategy are highlighted in blue. Note that the default sampling strategy can also be considered as a special case of this generalized form in that the momentum is set to zero.
398
+
399
+ Self-Conditioning based on Self-Guidance One potential issue with the default sampling strategy is the slight discrepancy of the Self-Conditioning signal during training and inference/sampling. Specifically, during training, the Self-Conditioning signal is the data estimate from the same time step, while, during sampling, it is from the past time step(s). Therefore, here we propose an approach that also use the same step data estimate for self-conditioning, which comes at the cost of extra forward pass over the denoising network at sampling time. Specifically, we conduct two forward passes of denoising network per sampling step, one with zero data estimate and the other with current data step estimate, and then we use a weighted combination, similar to (Ho & Salimans, 2021), of both prediction to form the final prediction at the current step. The detailed procedure is given in algorithm 6 with differences to the default sampling strategy highlighted.
400
+
401
+ # Algorithm 5 Sampling with Self-Conditioning based on Momentum Estimate.
402
+
403
+ # Algorithm 6 Sampling with Self-Conditioning based on Self-Guidance.
404
+
405
+ ![](images/0056fbc804ba1f5cfe054d28ced48060002aa3630bff0e17c22d7352b912d3ce.jpg)
406
+
407
+ # G.2 EXPERIMENTS
408
+
409
+ Table 9 reports the best FID scores across various sampling strategies discussed here (as well as samplers, sampling steps, time difference in asymmetric time intervals).
410
+
411
+ Table 9: Best FIDs of Bit Diffusion models with different Self-Conditioning sampling strategies on conditional IMAGENET $6 4 \times 6 4$ .
412
+
413
+ <table><tr><td></td><td>UINT8</td><td>GRAY CODE</td><td>UINT8 (RAND)</td></tr><tr><td>Default sampling (momentum= 0)</td><td>4.84</td><td>5.14</td><td>8.76</td></tr><tr><td>Momentum Estimate</td><td>4.85</td><td>5.14</td><td>8.51</td></tr><tr><td>Self-Guidance</td><td>5.15</td><td>5.65</td><td>7.87</td></tr></table>
414
+
415
+ Figure 12 shows FIDs on conditional IMAGENET $6 4 \times 6 4$ with UINT8 encoding, using Momentum Estimate with different sampling steps. We find that the momentum on the data estimate is only helpful when sampling steps are larger.
416
+
417
+ Figure 13 shows FIDs on conditional IMAGENET $6 4 \times 6 4$ with UINT8 encoding, using Self-Guidance with different sampling steps. We find that a guidance weight between 3.0 and 5.0 is generally preferable and robust to other hyper-parameters (such as sampler choice, sampling steps, and time difference).
418
+
419
+ # G.3 SAMPLES
420
+
421
+ Figure 14 and 15 provide generated samples from different sampling strategies with 100 and 1000 DDIM sampling steps, respectively.
422
+
423
+ ![](images/e0cc712c3974b0d7aa91d39f7f4ca1200feea15ccb966b114d05e815e0f4bdfa.jpg)
424
+
425
+ ![](images/8d8810ce1d18fb7fcccc7187ed9ecd89bfb6e4e3edc67cf6004e1873fe0127b4.jpg)
426
+ Figure 12: FID on conditional IMAGENET $6 4 \times 6 4$ with UINT8 (RAND) encoding using selfcondition sampling based on momentum estimate. The statistics of FID scores in each group are aggregated over the number of sampling steps in $\{ 1 0 0 , 2 0 0 , 4 0 0 , 6 0 0 , 8 0 0 , 1 0 0 0 \}$ , time difference in $\{ 0 . 0 , 0 . 2 , 0 . 4 , 0 . 6 , 0 . 8 \}$ .
427
+ Figure 13: FID on conditional IMAGENET $6 4 \times 6 4$ with UINT8 (RAND) encoding using self-condition sampling based on self-guidance. The statistics of FID scores in each group are aggregated over the number of sampling steps in $\{ 1 0 0 , 2 0 0 , 4 0 0 , 6 0 0 , 8 0 0 , 1 0 0 0 \}$ , time difference in $\{ 0 . 0 , 0 . 1 \}$ .
428
+
429
+ ![](images/98c330bd3cfa80d1b5cfa628e7d92a67251242f56ef91dce4e362169079ed40f.jpg)
430
+ Figure 14: Random samples of Bit Diffusion with UINT8 (RAND) on categorical IMAGENET $6 4 \times 6 4$ using various Self-Conditioning sampling strategies. Different plots share the same set of $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } \mathcal { T } }$ . Sampling with 100 steps of DDIM without asymmetric time intervals.
431
+
432
+ ![](images/b0406388784e46f6aaa31871b6b6b44bf9fb3267ea5db5e28d46a84a39b8b3f1.jpg)
433
+ Figure 15: Random samples of Bit Diffusion with UINT8 (RAND) on categorical IMAGENET $6 4 \times 6 4$ using various Self-Conditioning sampling strategies. Different plots share the same set of $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } \mathcal { T } }$ . Sampling with 1000 steps of DDIM without asymmetric time intervals.
md/dev/6NT1a56mNim/6NT1a56mNim.md ADDED
@@ -0,0 +1,286 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LANGUAGE MODELS AS ZERO-SHOT PLANNERS: EXTRACTING ACTIONABLE KNOWLEDGE FOR EMBODIED AGENTS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Can world knowledge learned by large language models (LLMs) be used to act in interactive environments? In this paper, we investigate the possibility of grounding high-level tasks, expressed in natural language (i.e. “make breakfast”), to a chosen set of actionable steps (i.e. “open fridge”). While prior work focused on learning from explicit step-by-step examples of how to act, we surprisingly find that if pre-trained LMs are large enough and prompted appropriately, they can effectively decompose high-level tasks into low-level plans without any further training. However, the plans produced naively by LLMs often cannot map precisely to admissible actions. We propose a procedure that conditions on existing demonstrations and semantically translates the plans to admissible actions. Our evaluation in the recent VirtualHome environment shows that the resulting method substantially improves executability over the LLM baseline. The conducted human evaluation reveals a trade-off between executability and correctness but shows a promising sign towards extracting actionable knowledge from language models1.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Large language models (LLMs) have made impressive advances in language generation and understanding in recent years (Devlin et al., 2018; Radford et al., 2019; Raffel et al., 2019; Brown et al., 2020). See Bommasani et al. (2021) for a recent summary of their capabilities and impacts. Being trained on large corpora of human-produced language, these models are thought to contain a lot of information about the world (Roberts et al., 2020; Li et al., 2021; BIG-bench collaboration, 2021) - albeit in linguistic form.
12
+
13
+ We ask whether we can use such knowledge contained in LLMs not just for linguistic tasks, but to make goal-driven decisions to that can be enacted in interactive, embodied environments. But we are not simply interested in whether we can train models on a dataset of demonstrations collected for some specific environment – we are instead interested in whether LLMs already contain information necessary to accomplish goals without any additional training.
14
+
15
+ More specifically, we ask whether world knowledge about how to perform high-level tasks (such as “make breakfast”) can be expanded to a series of groundable actions (such as “open fridge”, “grab milk”, “close fridge”, etc) that can be executed in the environment. For our investigation, we use recently proposed VirtualHome environment (Puig et al., 2018). It can simulate a large variety of realistic human activities in a household environment and supports ability to perform them via embodied actions defined with a verb-object syntax. However, due to open-ended nature of the tasks, it is difficult to autonomously evaluate their success. We rely on human evaluation (conducted on Mechanical Turk) to decide whether sequences of actions meaningfully accomplish posed tasks.
16
+
17
+ We find that large GPT-3 (Brown et al., 2020) and Codex (Chen et al., 2021) models, when prompted with a single fixed example of a task description and its associated sequence of actions, can produce very plausible action plans for the task we’re interested in. Such completions reflect the information already stored in the model – no model fine-tuning is involved. Additionally, we only observe this effect in the larger models. Unfortunately, despite their semantic correctness, the produced action plans are often not executable in the environment. Produced actions may not map precisely to admissible actions, or may contain various linguistic ambiguities.
18
+
19
+ ![](images/a24d1ce4158585dea15fe7aba14314c25e020e09e7ef5ac52d4f0a0daf0d9eca.jpg)
20
+ Figure 1: Executability v.s. semantic correctness of generated action plans (left) and sample action plans generated by different models (right). Large models can produce action plans indistinguishable from plans created by humans, but frequently are not executable in the environment. Using our techniques, we can significantly improve executability, albeit at the cost of correctness.
21
+
22
+ We propose several tools to improve executability of the model’s outputs. First, we enumerate all admissible action phrases and map the model’s output action to the most semantically-similar admissible action (we use similarity measure between sentence embeddings produced by a RoBERTa model Liu et al. (2019) in this work, but other choices are possible). Second, we use the model to autoregressively generate actions in a plan by conditioning past actions that have been made admissible via the technique above. Such on the fly correction can keep generation anchored to admissible actions. Third, we provide weak supervision to the model by prompting the model with a known task example similar to the query task. This is somewhat reminiscent of prompt tuning approaches, but does not require access to gradients or internals of the model.
23
+
24
+ Using above tools to bias model generation, we find that we improve executability of instructions from $18 \%$ to $79 \%$ (see Figure 1) without any invasive modifications to model parameters or any extra gradient or internal information beyond what is returned from the model’s forward pass. This is advantageous because it does not require any modifications to model training procedure and can fit within existing model serving pipelines. However, we do find there to be a significant drop in correctness of the instruction sequences generated with above tools (as judged by humans), indicating a promising step, but requiring more research on the topic.
25
+
26
+ To summarize, our paper’s contributions are as follows:
27
+
28
+ • We show that without any training, large language models can be prompted to generate plausible goal-driven action plans, but such plans are frequently not executable in interactive environments.
29
+ • We propose several tools to improve executability of the model generation without invasive probing or modifications to the model.
30
+ • We conduct a human evaluation of multiple techniques and models and report on the tradeoffs between executabiltiy and semantic correctness.
31
+
32
+ # 2 EVALUATION FRAMEWORK
33
+
34
+ Simulating open-ended tasks that resemble naturalistic human activities requires an environment to support a rich set of diverse interactions, rendering most existing embodied environments unsuitable for our investigation. One exception is VirtualHome (Puig et al., 2018), which models human activities in a typical household. Therefore, we only provide evaluation in this environment. To further measure correctness given open-ended tasks, we conduct a human evaluation. We note that since no further training is involved throughout our investigations, the observations and findings presented in this paper should also translate to similar embodied environments.
35
+
36
+ # 2.1 EVALUATED ENVIRONMENT: VIRTUALHOME
37
+
38
+ Preliminaries In VirtualHome, activities are expressed as programs. Each program consists of a sequence of steps, where each step is written as: [action] $\langle a r g _ { 1 } \rangle ( i d _ { 1 } )$ ... $\langle a r g _ { n } \rangle ( i d _ { n } )$ . Each action refers to atomic actions such as “walk”, “open”, and “put”. A total of 45 atomic actions are supported by VirtualHome. Different actions take in different numbers of arg necessary for specifying an interaction. Associated with each arg is a unique $i d$ specifying the corresponding node in the environment graph, in case of multiple instances of the same object class are present in the graph. For the sake of simplicity, we omit the $i d$ in the remaining discussions of this paper and allow automatic assignment by the environment. An example program is shown in Appendix 4.
39
+
40
+ Evaluated Tasks We use the knowledge base collected by VirtualHome for evaluation. The knowledge base contains household activities crowd-sourced from Amazon Mechanical Turk (MTurk). The MTurk workers were asked to provide natural language descriptions of daily household activities and all actionable steps necessary for completing the activities. The descriptions are both given as high-level task descriptions and step-by-step instructions. We omit the use of stepby-step instructions in this work as we desire direct extraction of executable programs from only task descriptions. For evaluations, we randomly sample a subset of 88 high-level tasks, each having one or more annotated ground-truth programs. The remaining 204 tasks are used as demonstration set, from which we are allowed to select as example(s) for prompting language models. Note that no training or fine-tuning is performed using these tasks and their annotations. More details of the evaluated tasks can be found in Appendix 8.6.
41
+
42
+ # 2.2 METRICS
43
+
44
+ A program that commands the agent to wander around in a household environment is highly executable but may not complete the desired task. On the other hand, a program composed of step instructions from knowledge bases can likely complete the task but cannot be executed. The reason is that free-form instructions can be ambiguous and may lack necessary common-sense actions. To this end, we consider two axes for evaluation: executability and correctness.
45
+
46
+ Executability Executability measures whether an action plan can be correctly parsed and satisfies the common-sense constraints of the environment. To be correctly parsed, an action plan must be syntatically correct and contain only allowed actions and recognizable objects. To satisfy the common-sense constraints, each action step must not violate the set of its pre-conditions (e.g. the agent cannot grab milk from the fridge before opening it) and post-conditions (e.g. the state of the fridge changes from “closed” to “open” after the agent opens it). We report the average executability across all 88 tasks and across all 7 VirtualHome scenes.
47
+
48
+ Correctness Unlike most embodied environments where the completion of a task can be easily judged, the ambiguous and multimodal nature of natural language task specification makes it impractical to obtain a gold-standard measurement of correctness. One approach could be measuring similarity of the final environment state produced by executing predicted and ground-truth programs, but VirtualHome initializes an environment differently based on the to-be-executed program, making comparisons difficult if measured in such way. Therefore, we conduct human evaluation for the highlighted methods. More details of the human evaluations can be found in Appendix 8.5. For the remaining methods and ablation studies, we rely on a match-based metric that measures how similar a generated program is to human annotations. Specifically, we follow Puig et al. (2018) and calculate the longest common subsequence (LCS) between two programs, normalized by the maximum length of the two. In the presence of multiple ground-truth programs for a single task, we take the maximum LCS across the ground-truth programs. However, we note that the majority of the tasks only have one ground-truth annotation, but there are often many plausible ways to complete a certain task, making this metric imperfect at evaluation program correctness2. Although correlation between the two is shown by Puig et al. (2018), we consider it only as a proxy metric in replacement of unscalable human evaluation.
49
+
50
+ ![](images/3fc27a6d1f4ab6c9de1366e50d5832a5f1d55a9a48f4da6dea52f4f5857ed62d.jpg)
51
+ Zero-Shot Planning via Causal LLM
52
+
53
+ ![](images/c42e3b664e14a2fdb2efd720431d14e61a741bc129346c810bb24bdb37bdaa56.jpg)
54
+ Translation to Admissible Action
55
+
56
+ ![](images/e09c408546dd11c5b347cced2e90ba8fc498ebc4998ea5901b86071d56b1750a.jpg)
57
+ Figure 2: We investigate the possibility of extracting actionable knowledge from pre-trained language models without any additional training. We first show surprising finding that large language models (LLMs) can decompose high-level tasks into sensible low-level action plans (left). To make the action plans executable, we propose to translate each step into admissible action via another LLM (middle). The translated action is appended to the original prompt used for generating the remaining steps (right).
58
+
59
+ # 3 METHOD
60
+
61
+ In this section, we investigate the possibility of extracting actionable knowledge from pre-trained language models without further training. We first give an overview of the common approach to query large language models (LLMs) and how it may be used for embodied agents. Then we describe an inference-time procedure that addresses several deficiencies of the LLM baseline and offers better executability in embodied environments. We break down the proposed procedure into three individual components, each discussed in Sec 3.2, 3.3, and 3.4.
62
+
63
+ Since LMs excel at dealing with natural language text instead of the specific format required by VirtualHome as described in Section 2.1, we only expose natural language text to LMs. To do this, we define a mapping for each atomic action that parses a natural language phrase to the required format. For instance, “Walk to living room” is converted to “[Walk] hliving roomi(1)”. When an LM output cannot be parsed to any of the allowed action, the entire program is considered syntactically incorrect and thus not executable.
64
+
65
+ # 3.1 PROMPTING
66
+
67
+ Previous works have shown that large language models pre-trained on a colossal amount of data contain useful world knowledge that can be probed to perform various down-stream tasks (Radford et al., 2019; Brown et al., 2020). Notably, autoregressive LLMs can even perform in-context learning, an approach to solve tasks using only contextual information without gradient updates (Brown et al., 2020). Contextual information is given as part of the input prompt and LMs are asked to complete the remaining text. It often consists of natural language instructions and/or a number of examples containing the desired input/output pairs.
68
+
69
+ We adopt the same approach to query LLMs to generate action plans for high-level tasks. Specifically, we prepend one example task description sentence and its annotated action plan from the demonstration set to the query task description, as shown in Fig 2. To obtain text completion results, we sample from autoregressive LLM using temperature sampling and nucleus sampling (Holtzman et al., 2019). We refer to this LM as Planning LM and the approach using this LM for plan generation as Vanilla $I L M ]$ , where $I L M J$ is replaced by specific language model such as GPT-3 or Codex.
70
+
71
+ To further improve the quality of the generated output, we follow Chen et al. (2021) that uses LMs for program synthesis to sample multiple output for each task. However, unlike prior works in program synthesis that choose the sample with highest unit test pass rate, we only consider the setting where one sample is allowed to be evaluated for each task. This is because repetitive trialand-errors can be dangerous in the real world, and executing many action plans is equivalent to probing the environment for privileged information, which is often considered not viable.
72
+
73
+ # 3.2 ROBUST PARSING BY SEMANTIC TRANSLATION
74
+
75
+ One issue arises when naively following the above approach to generate action plans for high-level tasks: the action plan is often not executable because LMs are allowed to generate free-form text.
76
+
77
+ Therefore, most of the time the output cannot be mapped to one unambiguous actionable step. And many reasons can cause such failures: 1) the output does not follow pre-defined mappings of any atomic action (i.e. “I first walk to the bedroom” does not follow “Walk to $\langle \mathrm { P L A C E } \rangle ^ { \prime \prime } )$ , 2) the output may refer to atomic action and objects using words unrecognizable by the environment (i.e. “Clean the dirty dishes in the sink” where “clean” and “dirty dishes in the sink” cannot be mapped to precise action and object), 3) the output contains lexical ambiguous words (i.e. “Open TV” should instead be “Switch on TV”), or 4) the output may use disallowed action (i.e. “Microwave the cup”).
78
+
79
+ Instead of developing a set of rules to transform the free-form text into admissible action steps, we propose to again leverage world knowledge learned by large language models to semantically translate the action. For each step in the action plan $\hat { a }$ , we aim to find the most similar admissible environment action $a _ { e }$ as measured by cosine similarity:
80
+
81
+ $\operatorname { a r g m a x } \frac { f ( \hat { a } ) \cdot f ( a _ { e } ) } { \| f ( \hat { a } ) \| \| f ( a _ { e } ) \| }$ where $f$ is an embedding function.
82
+
83
+ To embed the output text and environment actions, we use a BERT-style LM (Devlin et al., 2018; Liu et al., 2019) trained with Sentence-BERT (Reimers & Gurevych, 2019) objective because of its suitability for sentence modeling. The sentence embedding is obtained by mean-pooling the last layer hidden states across all tokens. We refer to this LM as Translation LM. Note that this is a different LM than the GPT-style Planning LM discussed in the text so far. Using a single LM for both purposes could as well be possible and likely more efficient, but we leave such investigation to future works. While the set of actions in our environment is discrete and possible to exhaustively enumerate, sampling or projection can be employed in larger discrete or continuous action spaces.
84
+
85
+ Since Translation LM can guarantee the parsed action is allowed by the environment, we can tradeoff semantic soundness of an LM step by how likely it can be mapped to an admissible action in the environment. This can be achieved by a simple modification to the scheme that we use to choose the best sample from the LM output. Instead of only using mean token log probability as a ranking metric, we choose the sample with the highest score calculated as $s = C + \beta \cdot l o g p r o b$ , where $C$ is the cosine similarity to the closest allowed action and $\beta$ is a weighting parameter.
86
+
87
+ # 3.3 AUTOREGRESSIVE TRAJECTORY CORRECTION
88
+
89
+ Translating each step of the program after the entire program has been synthesized is analogous to open-loop planning and is subject to compounding errors. In practice, LLMs might output compounded instructions for a single step, even though it cannot be completed using one admissible action in the environment. To this end, we can instead interleave plan generation and action translation to allow for automatic trajectory correction. At each step, we first query Planning LM to generate $k$ samples for a single action. Then we calculate score $s$ for each sample using Translation LM and append the translated action to the unfinished text completion. This way all subsequent steps will be conditioned on admissible actions instead of free-form text output generated by Planning LM. Furthermore, we can use Translation LM to detect out-of-distribution actions, those outside the capabilities of a robot, and terminate a program early instead of mapping to a faulty action. This can be easily implemented by setting a threshold $\epsilon$ such that if $C _ { \mathrm { m a x } } ^ { t } < \epsilon$ at step $t$ , the program is terminated early. We empirically show this leads to better executability while maintaining similar correctness of the generated action plans.
90
+
91
+ # 3.4 DYNAMIC EXAMPLE SELECTION FOR IMPROVED KNOWLEDGE EXTRACTION
92
+
93
+ So far in the text, we always give the same example in the prompt for all evaluated high-level tasks. However, consider the task of “ordering pizza”. Prompting LLMs with this task may give the assumption that the agent is initialized in front of a computer, and the LLMs may guide the agent to search for a pizza store and click “checkout my cart”. Although these are reasonable and feasible in the real world, such assumption cannot always be made as these interactions may not be supported in simulated environments like VirtualHome. In fact, the closest series of actions that human experts give may be “walking to a computer”, “switching on the computer”, and “typing the keyboard”. Without being finetuned on these data, LLMs would often fail at these tasks. To provide weak supervision at inference time, we propose to use Translation LM to select the most similar task from the demonstration set to be used as the example in the prompt. Specifically, we choose the task whose high-level description matches closely the query task as measured by cosine similarity. This allows Planning LM to reason how to perform a similar task given a human-annotated example. In our evaluations, we make sure the demonstration set is not overlapping with our test queries.
94
+
95
+ ![](images/8bcdc34cf82e9ec412ef334ee9cfec2fa6c4106d1a23c2e2af1e86633dc3553c.jpg)
96
+ Figure 3: Visualization of VirtualHome programs generated by our approach. The top row shows the execution of the task “Complete Amazon Turk Surveys”, and the bottom row shows the task “Get Glass of Milk”. We show LLMs not only can generate sensible action plans given only high-level tasks but also contains the actionable knowledge that can be extracted for grounding in embodied environments.
97
+
98
+ Combining the various improvement discussed above, we refer to the final approach as Translated $I L M ]$ , where $I L M ]$ is replaced by specific language model used such as GPT-3 and Codex.
99
+
100
+ # 4 RESULTS
101
+
102
+ In this section, we first show that language models can generate sensible action plans for many highlevel tasks, even without any additional training. Then we highlight its inadequacy when naively applied to embodied environments and demonstrate how this can be improved by again leveraging world knowledge learned by LLMs. Visualization of generated programs are shown in Fig 3.
103
+
104
+ Sampling from LMs Pre-trained LMs are sensitive to sampling parameters and the specific example given in the prompt. For all evaluated methods, we perform hyper-parameter search over various sampling parameters, and for methods using fixed prompt example, we report metrics averaged across three randomly chosen examples. To select the best run for each method, we rank the runs by LCS + executability, each normalized by human-expert scores3. Further details can be found in Appendix 8.3.
105
+
106
+ Model Choices We find empirically the combination of Codex-12B and Sentence-RoBERTa355M work well in our setting. Codex and GPT-3 are accessed using OpenAI API. The remaining models are accessed through open-source packages, Hugging Face Transformers (Wolf et al., 2019) and SentenceTransformers (Reimers & Gurevych, 2019), without additional modifications.
107
+
108
+ # 4.1 DO LLMS CONTAIN ACTIONABLE KNOWLEDGE FOR HIGH-LEVEL TASKS?
109
+
110
+ We first investigate whether LLMs can generate sensible action plans expressed in free-form language. We use the approach described in Section 3.1 to query pre-trained LLMs. To evaluate the correctness of generated action plans, we conduct human evaluations. For each model, we ask 10 human annotators to determine – by answering “Yes” or “No” – whether each task can be completed using provided action steps. To provide a reference of how humans might rate the action plans provided by other humans, we also ask annotators to rate the ground-truth action plans provided in the VirtualHome dataset for the same set of tasks. In contrast to the free-form text output by LLMs, the ground-truth action plans from VirtualHome are generated via a graphical programming interface that enforces strict syntax, although annotators were allowed to compose necessary actions.
111
+
112
+ We show the human evaluation results in Fig 1, where y-axis shows correctness averaged across all tasks and all annotators. Surprisingly, when LLMs are large enough and without imposed syntactic constraints, they can generate highly realistic action plans whose correctness – as deemed by human annotators – even surpasses human-labeled ground-truth. Yet another interesting finding is that Codex outperforms GPT-3 significantly under the same number of model parameters. One hypothesis could be that by fine-tuning on structured data (docstrings and code), Codex specializes at decomposing a high-level objective into a number of basic operations, even with those operations described in natural language. We also observe some level of correctness for smaller models such as GPT-2. However, inspection of its produced output indicates that it often generates significantly shorter plans by ignoring common-sense actions or by simply rephrasing the given task (e.g. the task “Go to sleep” produces only a single step “Go to bed”). These failure modes sometimes mislead human annotators to mark them correct as the annotators may ignore common-sense actions in their judgment as well, resulting in a higher correctness rate than the quality of the output shows.
113
+
114
+ Table 1: Human-evaluated correctness and evaluation results in VirtualHome. Although action plans generated by GPT-3 and Codex can even surpass the annotated GT in correctness measure, they are rarely executable. By translating the naive action plans, we show an important step towards grounding LLMs in embodied environments, but we observe room to achieve this without trading executability for correctness. We also observe a failure mode among smaller models that lead to high executability.
115
+
116
+ <table><tr><td>Language Model</td><td>Executability</td><td>LCS</td><td>Correctness</td></tr><tr><td>Vanilla GPT-2117M</td><td>18.66%</td><td>3.19%</td><td>14.27%</td></tr><tr><td>Vanilla GPT-21.5B</td><td>39.40%</td><td>7.78%</td><td>19.51%</td></tr><tr><td>Vanilla Codex 2.5B</td><td>17.62%</td><td>15.57%</td><td>53.44%</td></tr><tr><td>Vanilla GPT-Neo 2.7B</td><td>29.92%</td><td>11.52%</td><td>50.74%</td></tr><tr><td>Vanilla Codex 12B</td><td>18.07%</td><td>16.97%</td><td>56.06%</td></tr><tr><td>Vanilla GPT-312B Vanilla GPT-3175B</td><td>25.87% 7.79%</td><td>13.40%</td><td>30.98%</td></tr><tr><td>Annotated GT</td><td>100.00%</td><td>17.82% N/A</td><td>65.19% 54.80%</td></tr><tr><td>Fine-tuned GPT-3 12B</td><td>66.07%</td><td>34.08%</td><td>50.56%</td></tr><tr><td>OurFinal Methods</td><td></td><td></td><td></td></tr><tr><td>Translated Codex 12B</td><td>78.57%</td><td>24.72%</td><td>34.97%</td></tr><tr><td>Translated GPT-3175B</td><td>73.05%</td><td>24.09%</td><td>51.73%</td></tr></table>
117
+
118
+ # 4.2 HOW EXECUTABLE ARE THE LLM ACTION PLANS?
119
+
120
+ We analyze the executability of LLM plans by evaluating them in all 7 household scenes in VirtualHome. As shown in Table 1, we find action plans generated naively by LLMs are generally not very executable. Although smaller models seem to have higher executability, we find that the majority of these executable plans are produced by ignoring the queried task and repeating the given GT example of a different task. This is validated by the fact that smaller models have lower LCS than larger models despite having higher executability, showing that this failure mode is prevalent among smaller models. In contrast, larger models do not suffer severely from this failure mode. Yet as a result of being more expressive, their generated programs are substantially less executable.
121
+
122
+ # 4.3 CAN LLM ACTION PLANS BE MADE EXECUTABLE BY ACTION TRANSLATION?
123
+
124
+ In this section, we evaluate the effectiveness of our proposed procedure of action translation. We first create a bank of all allowed 47522 action steps in the environment, including all possible combinations of atomic actions and allowed arguments/objects. Then we use an off-the-shelf SentenceRoBERTa (Liu et al., 2019; Reimers & Gurevych, 2019) as Translation LM to create embeddings for actions and output text. For better computational efficiency, we pre-compute the embeddings for all allowed actions, leaving minor computation overhead for our procedure over the baseline methods at inference time. As shown in Table 1, executability of generated programs is significantly improved. Furthermore, we also observe improved LCS because the translated action steps precisely follow the program syntax and thus are more similar to ground-truth annotations. One sample output is shown in Fig 1 and a larger random subset of generated samples can be found in Appendix 8.7.
125
+
126
+ To validate their correctness, we again perform human studies using the same procedure in Sec 4.1. Results are shown in Table 1. We find that despite being more similar to GT, the programs are deemed less correct by humans. By examining the generated output, we observe two main sources of errors. First, we find Translation LM is poor at mapping compounded instructions to a succinct admissible action. This is partly due to that Translation LM is trained on a much smaller dataset and contains much a smaller number of parameters, so we expect further improvement by using a larger pre-trained model for translation. The second source of error comes from imperfect expressivity of the environment; we find that for many tasks we evaluate, certain necessary actions or objects are not implemented. This is also reflected by out human evaluation results of the GT programs, as only half of the programs are considered complete by the human annotators.
127
+
128
+ # 5 ANALYSIS AND DISCUSSIONS
129
+
130
+ # 5.1 ABLATION OF DESIGN DECISIONS
131
+
132
+ We perform ablation studies to show the effectiveness and necessity of three components of our proposed procedure, each described Sec 3.2, 3.3, and 3.4. As shown in Table 2, leaving out any of the three components would all
133
+
134
+ lead to decreased performance in both executability and LCS. Notably, not doing action translation leads to the most significant executability drop, showing the importance of action translation in extracting executable action plans from LLMs.
135
+
136
+ Table 2: Ablation of three proposed techniques.
137
+
138
+ <table><tr><td>Methods</td><td>Executability</td><td>LCS</td></tr><tr><td>Translated Codex 12B</td><td>78.57%</td><td>24.72%</td></tr><tr><td>- w/o Action Translation</td><td>31.49%</td><td>22.53%</td></tr><tr><td>- w/o Dynamic Example</td><td>50.86%</td><td>22.84%</td></tr><tr><td>- w/o Iterative</td><td>55.19%</td><td>24.43%</td></tr></table>
139
+
140
+ # 5.2 CAN LLMS GENERATE ACTIONABLE PROGRAMS BY FOLLOWING DETAILED INSTRUCTIONS?
141
+
142
+ Prior works often focus on translating step-by-step instructions into executable programs. We evaluate LLMs under this setting using a prompt format shown in Appendix 8.2. Although this setting is easier as it does not require rich actionable knowledge, detailed instructions can help resolve much ambiguity of exactly how to perform a high-level task when multiple solutions are possible. Therefore, Translated Codex 12B achieves executability of $7 8 . 5 7 \%$ and LCS of $3 2 . 8 7 \%$ , where LCS sees a considerable bump from the setting without detailed instructions. Surprisingly, the LCS result is very close to that of a supervised LSTM (Hochreiter & Schmidhuber, 1997) baseline from VirtualHome trained on human-annotated data, which is at $3 4 . 0 0 \%$ . Note that since code to train the baseline and the specific train/test split is not publicly released, we only show results reported in Puig et al. (2018) as a reference. We also cannot compare executability as it is not reported.
143
+
144
+ The investigations of this paper are two-fold: 1) Is actionable knowledge present in LLMs? 2) Can we ground this actionable knowledge in interactive environment? In this section, we focus our attention on the second question by conditioning on the assumption that first question is true. To do this, since successful execution of correct action plans directly measures grounding, we select only the correct plans generated by LLMs and measure how executable they are. We deem an action plan to be correct if $70 \%$ or more human annotators decide it is correct.
145
+
146
+ 5.3 IS ACTION TRANSLATION NECESSARY FOR ACTIONABLE KNOWLEDGE GROUNDING?
147
+ Table 3: Count of correct/executable programs and percentage of executable among correct. C indicates correct and E indicates executable.
148
+
149
+ <table><tr><td>Methods</td><td># ofC</td><td>#of C and E</td><td>E/C</td></tr><tr><td>GPT-21.5B</td><td>8</td><td>0</td><td>0.00%</td></tr><tr><td>GPT-312B</td><td>24</td><td>2</td><td>8.33%</td></tr><tr><td>GPT-3175B</td><td>68</td><td>5</td><td>7.35%</td></tr><tr><td>Codex 12B</td><td>45</td><td>8</td><td>17.78%</td></tr><tr><td>Translated Codex 12B</td><td>18</td><td>15</td><td>83.33%</td></tr></table>
150
+
151
+ As shown by Table 3, when an LM is not large enough (e.g. GPT-2), not only it contains little actionable knowledge, but this knowledge cannot be grounded at all. GPT-3 and Codex, on the other hand, can generate highly correct action plans in free-form language. However, they do not have the capability to ground their actionable knowledge in interactive environments. What’s more interesting, by comparing GPT-3 of both 12B parameters and 175B parameters, ratio of executable plans does not improve with the parameter count. This shows that simply training larger models does not necessarily lead to better knowledge grounding. In the meantime, action translation offers a promising way towards grounding actionable knowledge by producing highly executable plans. However, we again note that it comes at a trade-off of producing less correct plans as compared to its vanilla counterpart, and we hope to see future endeavors for bridging the gap.
152
+
153
+ # 6 RELATED WORKS
154
+
155
+ Large-scale natural language modeling has witnessed rapid advances since the inception of the Transformer architecture (Vaswani et al., 2017). It has been shown by recent works that large language models (LLMs) pre-trained on large unstructured text corpus not only can perform strongly on various down-stream NLP tasks (Devlin et al., 2018; Radford et al., 2019; Raffel et al., 2019; Brown et al., 2020) but also can internalize an implicit knowledge base containing rich information about the world (Petroni et al., 2019; Jiang et al., 2020; Davison et al., 2019; Talmor et al., 2020; Roberts et al., 2020). Furthermore, the learned representations can be used to model relations of entities (Li et al., 2021), retrieve matching visual features (Ilharco et al., 2020), and even as valuable priors when applied to diverse tasks from different modalities (Lu et al., 2021; Tsimpoukelli et al., 2021). Compared to prior works in knowledge extraction that extract single-step factual answers memorized by the models (e.g. “Dante was born in [PLACE]”), we aim to extract sequential action plans to complete an open-ended human activity (e.g. “make breakfast”). We further require these plans to only contain allowed actions and satisfy the pre/post-conditions of actions in order to be executed by an embodied agent.
156
+
157
+ At the same time, there has also been growing interest and development in grounding language in embodied environment. A series of prior works have investigated the possibility of parsing language instructions into formal logic to resolve various linguistic ambiguities for embodied agents (Artzi & Zettlemoyer, 2013; Misra et al., 2015; Tenorth et al., 2010). However, they often scale poorly to complex tasks and environments. Recently, more research efforts have been put into creating better and more realistic environments with the goal to further advances in this area (Puig et al., 2018; Shridhar et al., 2020a;b; Kolve et al., 2017; Savva et al., 2019). At the same time, by leveraging the better representation power of neural architectures, a number of works have looked into creating instruction-following agents that can perform manipulation (Lynch & Sermanet, 2020), navigation (Majumdar et al., 2020), or both (Suglia et al., 2021; Hill et al., 2020).
158
+
159
+ Notably, most of these prior works do not leverage full-blown pre-trained LLMs (Suglia et al., 2021) or do not scale to complex human activities (Hill et al., 2020; Lynch & Sermanet, 2020). Perhaps more importantly, few works have evaluated LLMs in an embodiment setting that realizes the full potential of the world knowledge these models contain: the tasks evaluated are often “pick”, “grab”, “open”, and etc, which do not resemble the highly diverse activities that humans perform in daily lives. The development of VirtualHome environment Puig et al. (2018) enables such possibility. However, relevant works (Puig et al., 2020; Liao et al., 2019) rely on human-annotated data and perform supervised training from scratch. Due to the lack of rich world knowledge, these models can only generate action plans given step-by-step instructions of how to act or video demonstrations. In this work, we take a step further by conditioning only on the high-level descriptions and by extracting executable action plans from LLMs without any additional training.
160
+
161
+ # 7 LIMITATIONS AND CONCLUSION
162
+
163
+ There are several notable limitations of this work. First, although our approach presents a viable way to ground world knowledge in embodied environments, it is still a trade-off rather than one best solution since we observe considerable drop in correctness. Second, we focus on high-level to midlevel grounding, assuming there is a controller that can execute mid-level tasks (such as “grab cup”). Our work does not investigate usefulness of LLMs for low-level sensorimotor behavior grounding. The third limitation is that we do not incorporate observation context or feedback into our models. To some extent, we approach LLMs in the same way as how VirtualHome asks human annotators to give action plans for a given huamn activity by imagination, in which case the human-generated action plans also do not incorporate observation context. However, we do see incorporating observation context for complex activities as an exciting future direction.
164
+
165
+ # REFERENCES
166
+
167
+ Yoav Artzi and Luke Zettlemoyer. Weakly supervised learning of semantic parsers for mapping instructions to actions. Transactions of the Association for Computational Linguistics, 1:49–62, 2013.
168
+
169
+ BIG-bench collaboration. Beyond the imitation game: Measuring and extrapolating the capabilities of language models. In preparation, 2021. URL https://github.com/google/ BIG-bench/.
170
+
171
+ Rishi Bommasani, Drew A. Hudson, Ehsan Adeli, Russ Altman, Simran Arora, Sydney von Arx, Michael S. Bernstein, Jeannette Bohg, Antoine Bosselut, Emma Brunskill, Erik Brynjolfsson, Shyamal Buch, Dallas Card, Rodrigo Castellon, Niladri Chatterji, Annie Chen, Kathleen Creel, Jared Quincy Davis, Dora Demszky, Chris Donahue, Moussa Doumbouya, Esin Durmus, Stefano Ermon, John Etchemendy, Kawin Ethayarajh, Li Fei-Fei, Chelsea Finn, Trevor Gale, Lauren Gillespie, Karan Goel, Noah Goodman, Shelby Grossman, Neel Guha, Tatsunori Hashimoto, Peter Henderson, John Hewitt, Daniel E. Ho, Jenny Hong, Kyle Hsu, Jing Huang, Thomas Icard, Saahil Jain, Dan Jurafsky, Pratyusha Kalluri, Siddharth Karamcheti, Geoff Keeling, Fereshte Khani, Omar Khattab, Pang Wei Kohd, Mark Krass, Ranjay Krishna, Rohith Kuditipudi, Ananya Kumar, Faisal Ladhak, Mina Lee, Tony Lee, Jure Leskovec, Isabelle Levent, Xiang Lisa Li, Xuechen Li, Tengyu Ma, Ali Malik, Christopher D. Manning, Suvir Mirchandani, Eric Mitchell, Zanele Munyikwa, Suraj Nair, Avanika Narayan, Deepak Narayanan, Ben Newman, Allen Nie, Juan Carlos Niebles, Hamed Nilforoshan, Julian Nyarko, Giray Ogut, Laurel Orr, Isabel Papadimitriou, Joon Sung Park, Chris Piech, Eva Portelance, Christopher Potts, Aditi Raghunathan, Rob Reich, Hongyu Ren, Frieda Rong, Yusuf Roohani, Camilo Ruiz, Jack Ryan, Christopher Re,´ Dorsa Sadigh, Shiori Sagawa, Keshav Santhanam, Andy Shih, Krishnan Srinivasan, Alex Tamkin, Rohan Taori, Armin W. Thomas, Florian Tramer, Rose E. Wang, William Wang, Bohan Wu, Jiajun \` Wu, Yuhuai Wu, Sang Michael Xie, Michihiro Yasunaga, Jiaxuan You, Matei Zaharia, Michael Zhang, Tianyi Zhang, Xikun Zhang, Yuhui Zhang, Lucia Zheng, Kaitlyn Zhou, and Percy Liang. On the opportunities and risks of foundation models, 2021.
172
+
173
+ 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.
174
+
175
+ Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde, Jared Kaplan, Harri Edwards, Yura Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
176
+
177
+ Joe Davison, Joshua Feldman, and Alexander M Rush. Commonsense knowledge mining from pretrained models. In Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP), pp. 1173–1178, 2019.
178
+
179
+ 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.
180
+
181
+ Felix Hill, Sona Mokra, Nathaniel Wong, and Tim Harley. Human instruction-following with deep reinforcement learning via transfer-learning from text. arXiv preprint arXiv:2005.09382, 2020.
182
+
183
+ Sepp Hochreiter and Jurgen Schmidhuber. Long short-term memory. ¨ Neural computation, 9(8): 1735–1780, 1997.
184
+
185
+ Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. arXiv preprint arXiv:1904.09751, 2019.
186
+
187
+ Gabriel Ilharco, Rowan Zellers, Ali Farhadi, and Hannaneh Hajishirzi. Probing text models for common ground with visual representations. arXiv e-prints, pp. arXiv–2005, 2020.
188
+
189
+ Zhengbao Jiang, Frank F Xu, Jun Araki, and Graham Neubig. How can we know what language models know? Transactions of the Association for Computational Linguistics, 8:423–438, 2020.
190
+
191
+ Eric Kolve, Roozbeh Mottaghi, Winson Han, Eli VanderBilt, Luca Weihs, Alvaro Herrasti, Daniel Gordon, Yuke Zhu, Abhinav Gupta, and Ali Farhadi. Ai2-thor: An interactive 3d environment for visual ai. arXiv preprint arXiv:1712.05474, 2017.
192
+
193
+ Belinda Z Li, Maxwell Nye, and Jacob Andreas. Implicit representations of meaning in neural language models. arXiv preprint arXiv:2106.00737, 2021.
194
+
195
+ Yuan-Hong Liao, Xavier Puig, Marko Boben, Antonio Torralba, and Sanja Fidler. Synthesizing environment-aware activities via activity sketches. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6291–6299, 2019.
196
+
197
+ 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.
198
+
199
+ Kevin Lu, Aditya Grover, Pieter Abbeel, and Igor Mordatch. Pretrained transformers as universal computation engines. arXiv preprint arXiv:2103.05247, 2021.
200
+
201
+ Corey Lynch and Pierre Sermanet. Grounding language in play. arXiv preprint arXiv:2005.07648, 2020.
202
+
203
+ Arjun Majumdar, Ayush Shrivastava, Stefan Lee, Peter Anderson, Devi Parikh, and Dhruv Batra. Improving vision-and-language navigation with image-text pairs from the web. In European Conference on Computer Vision, pp. 259–274. Springer, 2020.
204
+
205
+ Dipendra Misra, Kejia Tao, Percy Liang, and Ashutosh Saxena. Environment-driven lexicon induction for high-level instructions. In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics and the 7th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 992–1002, 2015.
206
+
207
+ Fabio Petroni, Tim Rocktaschel, Patrick Lewis, Anton Bakhtin, Yuxiang Wu, Alexander H Miller, ¨ and Sebastian Riedel. Language models as knowledge bases? arXiv preprint arXiv:1909.01066, 2019.
208
+
209
+ Xavier Puig, Kevin Ra, Marko Boben, Jiaman Li, Tingwu Wang, Sanja Fidler, and Antonio Torralba. Virtualhome: Simulating household activities via programs. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 8494–8502, 2018.
210
+
211
+ Xavier Puig, Tianmin Shu, Shuang Li, Zilin Wang, Joshua B Tenenbaum, Sanja Fidler, and Antonio Torralba. Watch-and-help: A challenge for social perception and human-ai collaboration. arXiv preprint arXiv:2010.09890, 2020.
212
+
213
+ 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.
214
+
215
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683, 2019.
216
+
217
+ Nils Reimers and Iryna Gurevych. Sentence-bert: Sentence embeddings using siamese bertnetworks. arXiv preprint arXiv:1908.10084, 2019.
218
+
219
+ Adam Roberts, Colin Raffel, and Noam Shazeer. How much knowledge can you pack into the parameters of a language model? arXiv preprint arXiv:2002.08910, 2020.
220
+
221
+ Manolis Savva, Abhishek Kadian, Oleksandr Maksymets, Yili Zhao, Erik Wijmans, Bhavana Jain, Julian Straub, Jia Liu, Vladlen Koltun, Jitendra Malik, et al. Habitat: A platform for embodied ai research. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9339–9347, 2019.
222
+
223
+ Mohit Shridhar, Jesse Thomason, Daniel Gordon, Yonatan Bisk, Winson Han, Roozbeh Mottaghi, Luke Zettlemoyer, and Dieter Fox. Alfred: A benchmark for interpreting grounded instructions for everyday tasks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 10740–10749, 2020a.
224
+
225
+ Mohit Shridhar, Xingdi Yuan, Marc-Alexandre Cotˆ e, Yonatan Bisk, Adam Trischler, and Matthew ´ Hausknecht. Alfworld: Aligning text and embodied environments for interactive learning. arXiv preprint arXiv:2010.03768, 2020b.
226
+
227
+ Alessandro Suglia, Qiaozi Gao, Jesse Thomason, Govind Thattai, and Gaurav Sukhatme. Embodied bert: A transformer model for embodied, language-guided visual task completion. arXiv preprint arXiv:2108.04927, 2021.
228
+
229
+ Alon Talmor, Yanai Elazar, Yoav Goldberg, and Jonathan Berant. olmpics-on what language model pre-training captures. Transactions of the Association for Computational Linguistics, 8:743–758, 2020.
230
+
231
+ Moritz Tenorth, Daniel Nyga, and Michael Beetz. Understanding and executing instructions for everyday manipulation tasks from the world wide web. In 2010 ieee international conference on robotics and automation, pp. 1486–1491. IEEE, 2010.
232
+
233
+ Maria Tsimpoukelli, Jacob Menick, Serkan Cabi, SM Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models. arXiv preprint arXiv:2106.13884, 2021.
234
+
235
+ 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.
236
+
237
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, et al. Huggingface’s transformers: ´ State-of-the-art natural language processing. arXiv preprint arXiv:1910.03771, 2019.
238
+
239
+ # 8 APPENDIX
240
+
241
+ # 8.1 EXAMPLE PROGRAM IN VIRTUALHOME
242
+
243
+ [Walk] h living room i (1) [Walk] h television i (1) [Find] h television i (1) [SwitchOn] h television i (1) [Find] h sofa i (1) [Sit] h sofa i (1) [TurnTo] h television i (1) [Watch] h television i (1)
244
+
245
+ ![](images/cdd10b5b1764575509d058912492130d6873463de86c074dab324e7ca787b63c.jpg)
246
+ Figure 4: An example prompt containing step-by-step instructions.
247
+
248
+ # 8.3 HYPERPARAMETER SEARCH
249
+
250
+ For each evaluated method, we perform grid search over the following hyperparameters:
251
+
252
+ <table><tr><td>Name</td><td>Description</td><td>Search Values</td></tr><tr><td>epsilon (e)</td><td>OOD cutoff threshold used in iterative action{0,O.4,0.8} translation</td><td></td></tr><tr><td> temperature</td><td>sampling parameter adjusting relative probabili-{0.1, O.3, 0.6} ties across tokens</td><td></td></tr><tr><td>k</td><td>number of samples generated when querying LMs{1, 10} each time</td><td></td></tr><tr><td>frequence_penalty</td><td>OpenAI API specific; penalize new tokens based on their existing frequency in the text so far</td><td>{0.1, 0.3, 0.6, 0.9}</td></tr><tr><td>presence_penalty</td><td>OpenAI API specific; penalize new tokens based on whether they appear in the text so far</td><td>{0.3,0.5, 0.8}</td></tr><tr><td>repetition_penalty</td><td>Hugging Face Transformers specific; penalize new tokens based on whether they are repeating existing text</td><td>{1.0, 1.2, 1.5, 1.8}</td></tr></table>
253
+
254
+ For methods that use fixed example across evaluated tasks, we search over the following three randomly chosen examples:
255
+
256
+ <table><tr><td rowspan=1 colspan=1>Example 1</td><td rowspan=1 colspan=2>Example 2</td><td rowspan=1 colspan=1>Example 3</td></tr><tr><td rowspan=2 colspan=1>Task: Use computerStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find computerStep 6: Switch on computerStep 7: Turn to computerStep 8: Look at computerStep 9: Find keyboardStep 10: Type on keyboard</td><td rowspan=2 colspan=2>Task: Relax on sofaStep 1: Walk to home officeStep 2: Walk to couchStep 3: Find couchStep 4: Sit on couchStep 5: Find pillowStep 6: Lie on couch</td><td rowspan=2 colspan=1>Task:Read bookStep 1: Walk to home officeStep 2: Walk to novelStep 3: Find novelStep 4: Grab novelStep 5: Find chairStep 6: Sit on chairStep 7: Read novel</td></tr><tr><td rowspan=1 colspan=1></td></tr></table>
257
+
258
+ # 8.4 ANALYSIS OF PROGRAM LENGTH
259
+
260
+ Shorter programs have a natural advantage of being more executable. Consider a task “wash hands” and a corresponding program that only commands an agent to “go to bathroom” without additional steps. The program is obviously incorrect yet trivially executable. To validate our approach does not simply generate very short program, we calculate the average program length across the 88 evaluated tasks. Results are shown in Table 6. In addition to the failure mode discussed in Section 4.2 that leads to incorrect yet executable programs, smaller LMs such as GPT-2 also generate programs significantly shorter than larger models, making them more executable. In contrast, larger models like Codex-12B generate more expressive program of high correctness, but they often suffer from executability. We show action translation can lead to benefits of both worlds, generating programs that are highly executable while maintaining similar expressiveness in terms of program length.
261
+
262
+ <table><tr><td>Methods</td><td>Executability</td><td> Average Length</td></tr><tr><td>Vanilla GPT-2 1.5B</td><td>39.40%</td><td>4.24</td></tr><tr><td>Vanilla Codex 12B</td><td>18.07%</td><td>7.22</td></tr><tr><td>Translated Codex 12B</td><td>78.57%</td><td>7.13</td></tr><tr><td>Ground-Truth</td><td>100.00%</td><td>9.66</td></tr></table>
263
+
264
+ Table 6: Average executability & program length of different methods and human annotations.
265
+
266
+ # 8.5 DETAILS OF HUMAN EVALUATIONS
267
+
268
+ Human evaluations are conducted on Amazon Mechanical Turk. For each method, we generate action plans for all 88 high-level tasks. To account for expressivity of the VirtualHome environment (Puig et al., 2018), we further include ground-truth action plans from the VirtualHome dataset in our human evaluations. The human evaluations are conducted in the form of questionnaires containing all action plans with unknown corresponding methods. The questionnaire contains the following instructions at the top:
269
+
270
+ For every question below, determine whether the task can be completed in any reasonable scenario using the provided steps. In other words, can the task be decomposed into these steps? Note that simply re-stating the task does not mean completing it.
271
+
272
+ Human annotators are required to answer all the questions in the questionnaire, where each question is an action plan generated by a method unknown to the annotator. The order of the questions is randomly permuted before presented to each annotator. For each question, the annotators need to answer either “Yes” or “No” indicating if they believe the action plan completes the task. For each method, we report correctness percentage averaged across 10 participated human annotators.
273
+
274
+ # 8.6 DETAILS OF VIRTUALHOME TASKS
275
+
276
+ VirtualHome ActivityPrograms is a knowledge base collected on Mechanical Turk by Puig et al. (2018). The knowledge base features real household activities of humans and correspondingly sequences of basic actions for robots to perform these activities. Each entry contains a high-level task name (i.e. “Watch TV”), a mid-level detailed description (i.e. “Sit on my couch directly opposite my TV, switch on my TV with the remote control and watch”), and a sequence of allowed actions (a.k.a. a program) to perform the task in VirtualHome. There are 292 distinct high-level tasks and a total of 2821 different entries in the knowledge base, where each high-level task may correspond one or several programs. The knowledge base covers a diverse set of real human activities and a wide range of different actions and objects. Puig et al. (2018) also conduct additional human evaluation on 100 randomly sampled programs and show that $6 4 \%$ of them are complete (i.e. contain all necessary steps). Readers are encouraged to refer to Puig et al. (2018) for more comprehensive analysis of the dataset.
277
+
278
+ Train/Test Split From all 292 distinct high-level tasks from the ActivityPrograms knowledge base, we randomly sample 88 high-level tasks for evaluation. The remaining 204 tasks are used as demonstration set from which we are allowed to select as example(s) for prompting language models, or in the case of supervised fine-tuning, they are used to fine-tune pre-trained language models.
279
+
280
+ 8.7 RANDOM SAMPLES OF GT, VANILLA CODEX, AND TRANSLATED CODEX
281
+
282
+ <table><tr><td>Annotated Ground-Truth</td><td>Codex</td><td>Translated Codex (Ours)</td></tr><tr><td>Task: Go to sleep Step 1: Walk to bedroom Step 2: Walk to bed Step 3: Find bed Step 4: Turn to bed</td><td>Task: Go to sleep Step 1: Walk to bedroom Step 2: Walk to bed Step 3: Find bed Step 4: Sit on bed</td><td>Task: Go to sleep Step 1: Walk to bedroom Step 2: Walk to bed Step 3: Lie on bed Step 4: Sleep</td></tr><tr><td>Task:Browse internet Step 1: Walk to home office Step 2: Walk to chair Step 3: Find chair Step 4: Sit on chair Step 5: Find computer Step 6: Switch on computer Step 7: Turn to computer Step 8: Look at computer Step 9: Find keyboard Step 10: Type on keyboard Task:Listen to music</td><td>Task:Browse internet Step 1: Walk to home office Step 2: Walk to chair Step 3: Find chair Step 4: Sit on chair Step 5: Find computer Step 6: Switch on computer Step 7: Turn to computer Step 8: Look at computer Step 9: Find keyboard</td><td>Task:Browse internet Step 1: Walk to home office Step 2: Walk to desk Step 3: Find chair Step 4: Sit on chair Step 5: Find computer Step 6: Switch on computer Step 7: Find mouse Step 8: Grab mouse Step 9: Turn to computer Step 10: Point at computer</td></tr><tr><td>Step 1: Walk to bedroom Step 2: Walk to computer Step 3: Find computer Step 4: Turn to computer Step 5: Look at computer Step 6: Walk to computer Step 7: Find chair Step 8: Pull chair Step 9: Sit on chair Step 10: Find headset Step 11: Grab headset Step 12: Put on headset Step 13: Switch on computer Step 14: Find keyboard Step 15: Type on keyboard Task:Brush teeth Step 1: Walk to bathroom Step 2: Walk to tooth paste Step 3: Find tooth paste Step 4: Grab tooth paste Step 5: Find toothbrush Step 6: Grab toothbrush Step 6:Move brush around mouth for two minutes Step 7: Spit out toothpaste and brush into sink</td><td>Step 10: Type on keyboard Task:Listen to music Step 1: Walk to home office Step 2: Walk to chair Step 3: Find chair Step 4: Sit on chair Step 5: Find computer Step 6: Switch on computer Step 7: Turn to computer Step 8: Look at computer Step 9: Find keyboard Step 10: Type on keyboard Task:Brush teeth Step 1: Walk to bathroom Step 2: Walk to sink Step 3: Find toothbrush Step 4: Pick up toothbrush Step 5: Put toothbrush in mouth</td><td>Task:Listen to music Step 1: Walk to home office Step 2: Walk to computer Step 3: Sit on chair Step 4: Switch on computer Step 5: Find music stand Task:Brush teeth Step 1: Walk to bathroom Step 2: Open door Step 3: Walk to sink Step 4: Put pot on sink Step 5: Put brush on toothbrush</td></tr><tr><td>Task: Dry soap bottles Step 1: Find towel Step 2: Find soap Step 3: Grab soap Step 4: Wipe soap Step 5: Put back soap Step 6: Find shampoo Step 7: Grab shampoo Step 8: Wipe shampoo Step 9: Put back shampoo Step 10: Find shampoo Step 11: Grab shampoo Step 12: Wipe shampoo Step 13: Put back shampoo</td><td>Step 8: Turn on water in sink and rinse brush for one minute Step 9: Turn off water in sink and return brush to cupboard Task:Dry soap bottles Step 1: Walk to kitchen Step 2: Walk to sink Step 3: Find sink Step 4: Turn on water tap Step 5: Wait for water to be hot enough Step 6: Fill container with hot water Step 7: Find soap bottles Step 8: Pour soap into container with hot water Step 9: Wait for soap to dissolve in water</td><td>Task: Dry soap bottles Step 1: Walk to bathroom Step 2: Walk to shower Step 3: Find soap</td></tr></table>
283
+
284
+ <table><tr><td colspan="4" rowspan="2">Task: Vacuum Task: Vacuum Task:VacuumStep 1: Walk to home office Step 1: Walk to hallway Step 1: Walk to home officeStep 2: Walk to computer Step 2: Walk to closet Step 2: Walk to dresserStep 3: Find vacuum cleaner Step 3:Find closet Step 3: Open dresserStep 4:Switch on vacuum Step 4: Open closet Step 4: Find vacuum cleanercleaner Step 5:Find vacuum cleaner Step 5: Grab vacuum cleaner Step 5:Switch off vacuum Step 6: Turn on vacuum cleaner Step 6: Pull vacuum cleanercleaner Step 7: Walk to living room Step 7: Plug in vacuum cleanerStep 8: Vacuum floor in living Step 8: Switch on vacuumroom cleanerStep 9: Pull vacuum cleanerStep 10: Push vacuum cleaner</td></tr><tr><td colspan="1" rowspan="1">Task: Vacuum Step 1: Walk to hallwayStep 2: Walk to closetStep 3:Find closetStep 4: Open closetStep 5:Find vacuum cleanerStep 6: Turn on vacuum cleaner Step 7: Walk to living roomStep 8: Vacuum floor in livingroom</td></tr><tr><td colspan="2" rowspan="2">Task: Find dictionaryStep 1: Walk to home officeStep 2: Walk to bookshelf</td><td colspan="1" rowspan="3">Task: Find dictionaryStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find dictionary Step 6: Open dictionaryStep 7: Look at dictionary</td><td colspan="1" rowspan="3">Task: Find dictionaryStep 1: Walk to home officeStep 2: Walk to bookStep 3: Find textbook</td></tr><tr><td colspan="1" rowspan="1">f</td></tr><tr><td colspan="2" rowspan="1">Step 3: Turn to bookshelfStep 4: Look at bookshelfStep 5: Turn to bookshelfStep 6: Look at bookshelfStep 7: Turn to bookshelfStep 8: Look at bookshelfStep 9: Turn to bookshelfStep 10: Look at bookshelfStep 11: Turn to bookshelfStep 12: Look at bookshelfStep 13: Turn to bookshelfStep 14: Look at bookshelfStep 15: Find novelStep 16: Grab novel</td></tr><tr><td colspan="2" rowspan="1">Task:Wash monitorStep 1: Walk to home officeStep 2: Walk to computerStep 3: Find computerStep 4: Turn to computerStep 5: Look at computerStep 6: Switch off computerStep 7: Find brushStep 8: Turn to brushStep 9: Look at brushStep 10: Grab brush Step 11: Wipe computerStep 12: Drop brushStep 13:Find napkinStep 14: Grab napkinStep 15: Wash napkinStep 16: Wipe computer</td><td colspan="1" rowspan="1">Task:Wash monitorStep 1: Walk to home officeStep 2: Walk to chairStep 3:Find chairStep 4: Sit on chairStep 5: Find computerStep 6: Switch on computerStep 7: Turn to computerStep 8: Look at computerStep 9: Find keyboardStep 10: Type on keyboard</td><td colspan="1" rowspan="1">Task:Wash monitorStep 1:Walk to checkStep 2: Walk to desk</td></tr><tr><td colspan="2" rowspan="1">Task: Read newspaperStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find newspaperStep 6: Grab newspaperStep 7: Open newspaperStep 8: Read newspaper</td><td colspan="1" rowspan="1">Task: Read newspaperStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find newspaperStep 6: Open newspaperStep 7: Read newspaper</td><td colspan="1" rowspan="1">Task: Read newspaperStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find newspaperStep 6: Grab newspaperStep 7: Read newspaper</td></tr><tr><td colspan="1" rowspan="1">Task:ApplylotionStep 1: Find bedStep 2: Turn to bedStep 3: Point at bedStep 4: Wash bedStep 5: Turn to bedStep 6: Look at bedStep 7: Push bedStep 8: Sit on bed</td><td colspan="1" rowspan="1">Task:ApplylotionStep 1: Walk to bathroomStep 2: Walk to cabinetStep 3:Open cabinetStep 4: Find lotionStep 5: Apply lotion on handsStep 6: Rub hands together for10 secondsStep 7: Apply lotion on face</td><td colspan="1" rowspan="1">Task:ApplylotionStep 1: Walk to bathroomStep 2: Turn to lotionbottleStep 3:Grab lotionbottle</td></tr><tr><td colspan="1" rowspan="1">Task: Draw pictureStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find deskStep 6: Open deskStep 7: Find checkStep 8: Grab checkStep 9: Put check on deskStep 10: Find pencilStep 11: Grab pencilStep 12: Close desk</td><td colspan="1" rowspan="1">Task: Draw pictureStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find computerStep 6: Switch on computerStep 7: Turn to computerStep 8: Look at computerStep 9: Find keyboardStep 10: Type on keyboard</td><td colspan="1" rowspan="1">Task: Draw pictureStep 1: Walk to home officeStep 2: Walk to wallStep 3: Walk to drawingStep 4: Find drawingStep 5: Turn to drawingStep 6: Look at drawingStep 7: Touch drawingStep 8: Pull drawingStep 9: Push drawing</td></tr><tr><td colspan="1" rowspan="1">Task: Prepare pot of boiling wa-terStep 1: Walk to dining roomStep 2: Walk to potStep 3: Find potStep 4: Grab potStep 5: Walk to sinkStep 6: Find faucetStep 7: Switch on faucetStep 8: Put pot on sinkStep 9: Grab potStep 10: Switch off faucetStep 11: Grab potStep 12: Walk to oven Step 13: Put pot on ovenStep 14: Switch on oven</td><td colspan="1" rowspan="1">Task: Prepare pot of boiling wa-terStep1: Walk to kitchenStep 2: Walk to sinkStep 3:Find sink Step 4: Turn on tapStep 5: Fill kettle with waterStep 6: Put kettle on stoveStep 7: Turn on stoveStep 8: Wait for water to boil</td><td colspan="1" rowspan="1">Task: Prepare pot of boiling wa-terStep 1: Walk to kitchenStep 2: Walk to cabinetStep 3: Find pot Step 4: Grab pot Step 5: Walk to stoveStep 6: Find stoveStep 7: Switch on stove</td></tr><tr><td colspan="1" rowspan="1">Task: Look at mirrorStep 1: Walk to bathroomStep 2: Walk to mirrorStep 3:Find mirrorStep 4: Turn to mirrorStep 5: Look at mirror</td><td colspan="1" rowspan="1">Task: Look at mirrorStep 1: Walk to bathroomStep 2: Walk to mirrorStep 3: Look at mirror</td><td colspan="1" rowspan="1">Task:Look at mirrorStep 1: Walk to bedroomStep 2: Walk to mirrorStep 3:Find mirrorStep 4: Turn to mirrorStep 5: Look at mirror</td></tr><tr><td colspan="1" rowspan="1">Task:Wipe down sinkStep 1: Walk to dining roomStep 2: Walk to ragStep 3: Find ragStep 4: Grab ragStep 5: Walk to sinkStep 6: Wipe sinkStep 7: Put back rag</td><td colspan="1" rowspan="1">Task:Wipe down sinkStep1: Walk to kitchenStep 2: Walk to sinkStep 3: Find sinkStep 4: Wipe down sinkStep 5: Return to kitchen</td><td colspan="1" rowspan="1">Task:Wipe down sinkStep1: Walk to bathroomStep 2: Walk to cleaning solutionStep 3: Find cleaning solutionStep 4: Grab cleaning solutionStep 5: Find sinkStep 6: Pour cleaning solutioninto glassesStep 7: Find faucetStep 8: Switch on faucetStep 9: Scrub sinkStep 10:Wash sink</td></tr></table>
285
+
286
+ <table><tr><td colspan="4" rowspan="5">Task: Complete surveys on ama- Task: Complete surveys on ama- Task: Complete surveys on ama-zon turk zon turk zon turkStep 1: Walk to chair Step 1: Walk to home office Step 1: Walk to home officeStep 2: Sit on chair Step 2: Walk to chair Step 2: Walk to desk Step 3: Find computer Step 3: Find chair Step 3: Find chairStep 4: Switch on computer Step 4: Sit on chair Step 4: Sit on chairStep 5: Turn to computer Step 5: Find computer Step 5: Find computerStep 6: Look at computer Step 6: Switch on computer Step 6: Switch on computerStep 7: Find mouse Step 7: Turn to computerStep 8: Grab mouse Step 8: Look at computerStep 9: Turn to computer Step 9:Find keyboard Step 10: Point at computer Step 10: Type on keyboardStep 11: Find checkStep 12: Grab checkStep 13: Read checkStep 14: Put back mouseStep 15: Find keyboardStep 16: Type on keyboard</td></tr><tr><td colspan="2" rowspan="1">Task: Complete surveys on ama-zon turkStep 1: Walk to chair</td><td colspan="1" rowspan="4">Task: Complete surveys on ama- zon turkStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find computerStep 6: Switch on computerStep 7: Turn to computerStep 8: Look at computerStep 9:Find keyboardStep 10: Type on keyboard</td></tr><tr><td colspan="2" rowspan="2">Step 2: Sit on chair Step 3: Find computerStep 4: Switch on computerStep 5: Turn to computer</td><td colspan="1" rowspan="1"></td></tr><tr><td colspan="1" rowspan="1"></td></tr><tr><td colspan="2" rowspan="1">Step 6: Look at computerStep 7: Find mouseStep 8: Grab mouseStep 9: Turn to computer Step 10: Point at computerStep 11: Find checkStep 12: Grab checkStep 13: Read checkStep 14: Put back mouseStep 15: Find keyboardStep 16: Type on keyboard</td></tr><tr><td colspan="2" rowspan="1">Task:Write book Step 1: Walk to home office Step 2: Walk to laptopStep 3: Find laptopStep 4: Grab laptopStep 5: Find electrical outletStep 6: Plug in laptopStep 7: Walk to love seatStep 8: Sit on love seat</td><td colspan="1" rowspan="2">Task: Write bookStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find computerStep 6: Switch on computerStep 7: Turn to computerStep 8: Look at computerStep 9: Find keyboardStep 10: Type on keyboard</td><td colspan="1" rowspan="2">Task:Write bookStep 1: Walk to home officeStep 2: Walk to lightStep 3: Find lightStep 4: Switch on lightStep 5: Find penStep 6: Grab penStep 7: Find chairStep 8: Sit on chairStep 9: Turn to novel</td></tr><tr><td colspan="2" rowspan="1">Step 7: Walk to love seatStep 8: Sit on love seatStep 9: Switch on laptopStep 10: Find keyboardStep 11: Type on keyboard</td></tr><tr><td colspan="2" rowspan="1">Task: Paint ceiling Step 1: Find drawing Step 2: Turn to drawingStep 3: Point at drawing Step 4: Watch drawingStep 5: Touch drawingStep 6: Walk to bedroom</td><td colspan="1" rowspan="1">Task: Paint ceilingStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find paint canStep 6: Open paint can Step 7: Pour paint into paint canStep 8: Close paint canStep 9: Find roller Step 10: Roll paint onto ceiling</td><td colspan="1" rowspan="1">Task: Paint ceilingStep 1: Walk to home office Step 2: Walk to ceilingStep 3: Walk to paintingStep 4: Find paintingStep 5: Turn to paintingStep 6: Look at paintingStep 7: Touch paintingStep 8: Pull paintingStep 9: Push painting</td></tr><tr><td colspan="2" rowspan="2">Task: Change clothesStep 1: Walk to bedroomStep 2: Walk to dresserStep 3: Open dresserStep 4: Find dressStep 5: Grab dressStep 6: Put on dressStep 7: Close dresser</td><td colspan="1" rowspan="1">Task: Change clothesStep 1: Walk to closetStep 2: Open closetStep 3: Find clothesStep 4: Put on clothesStep 5: Close closet</td><td colspan="1" rowspan="2">Task: Change clothesStep 1: Walk to bedroomStep 2: Walk to dresserStep 3: Find dresserStep 4: Open dresserStep 5: Find pantsStep 6: Grab pantsStep 7: Put on pantsStep 8: Find shirtStep 9: Grab shirtStep 10: Put on shirtStep 11: Close dresser</td></tr><tr><td colspan="1" rowspan="1"></td></tr><tr><td colspan="3" rowspan="2">Task: Make bed Task: Make bed Task:Make bedStep 1: Walk to bedroom Step 1: Walk to bedroom Step 1: Stand upStep 2: Walk to bed Step 2: Walk to bed Step 2: Walk to bedroomStep 3: Find sheets Step 3: Find bed Step 3: Walk to bedStep 4: Grab sheets Step 4: Sit on bed Step 4: Turn to bedStep 5: Pull sheets Step 5: Find sheet Step 5: Put sheets on bedStep 6: Pick up sheetStep 7: Find pillowStep 8: Pick up pillowStep 9: Find blanketStep 10: Pick up blanket</td></tr><tr><td colspan="1" rowspan="1">Step 2: Walk to bedStep 3: Find sheetsStep 4: Grab sheetsStep 5: Pull sheets</td></tr><tr><td colspan="1" rowspan="1">Task: Read yourself to sleepStep 1: Walk to bedroomStep 2: Walk to novelStep 3: Find novelStep 4: Grab novelStep 5: Find bedStep 6: Sit on bedStep 7: Find bookmarkStep 8: Grab bookmarkStep 9: Read novelStep 10: Put bookmark on novelStep 11: Sleep</td><td colspan="1" rowspan="1">Task: Read yourself to sleep Step 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find computerStep 6: Switch on computerStep 7: Turn to computerStep 8: Look at computerStep 9: Find keyboardStep 10: Type on keyboard</td><td colspan="1" rowspan="1">Task: Read yourself to sleepStep 1: Walk to bedroomStep 2: Walk to bookStep 3: Sit on chairStep 4: Read checkStep 5: Sleep</td></tr><tr><td colspan="1" rowspan="1">Task: Hang keysStep 1: Walk to bedroomStep 2: Walk to dresserStep 3: Find purseStep 4: Grab purseStep 5: Open purseStep 6: Find keysStep 7: Grab keysStep 8: Find bowlStep 9: Put keys on bowlStep 10: Close purseStep 11: Put back purse</td><td colspan="1" rowspan="1">Task: Hang keysStep 1: Walk to home officeStep 2: Walk to chairStep 3: Find chairStep 4: Sit on chairStep 5: Find computerStep 6: Switch on computerStep 7: Turn to computerStep 8: Look at computerStep 9: Find keyboardStep 10: Type on keyboard</td><td colspan="1" rowspan="1">Task: Hang keysStep 1: Walk to home officeStep 2: Walk to tableStep 3: Find keysStep 4: Grab keysStep 5: Walk to wallStep 6: Find hangerStep 7: Put keys on hanger</td></tr><tr><td colspan="1" rowspan="1">Task:Eat cheeseStep 1: Walk to dining roomStep 2: Walk to freezerStep 3: Open freezerStep 4: Find cheeseStep 5: Grab cheeseStep 6: Eat cheese</td><td colspan="1" rowspan="1">Task:Eat cheeseStep 1: Walk to fridge Step 2: Open fridgeStep 3: Find cheeseStep 4: Pick up cheeseStep 5: Walk to tableStep 6: Place cheese on tableStep 7: Close fridgeStep 8: Walk to chairStep 9: Sit on chairStep 10: Eat cheese</td><td colspan="1" rowspan="1">Task: Eat cheeseStep 1: Walk to dining roomStep 2: Walk to tableStep 3: Find tableStep 4: Turn to tableStep 5: Find chairStep 6: Sit on chairStep 7: Find foodStep 8: Grab foodStep 9: Find plateStep 10: Put food on plate</td></tr></table>
md/dev/716PvHoDct/716PvHoDct.md ADDED
@@ -0,0 +1,367 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VPGTrans: Transfer Visual Prompt Generator across LLMs
2
+
3
+ Ao Zhang 1 Hao Fei 1∗ Yuan $\mathbf { Y a o } ^ { 2 * }$ Wei Ji 1 Li Li 1 Zhiyuan Liu 2 Tat-Seng Chua 1 1 $\mathbf { N E x T + + }$ Lab, School of Computing, National University of Singapore 2Department of Computer Science and Technology, Tsinghua University zhanga6@outlook.com haofei37@nus.edu.sg yaoyuanthu@163.com
4
+
5
+ Project: https://vpgtrans.github.io
6
+
7
+ # Abstract
8
+
9
+ Since developing a new multimodal LLM (MLLM) by pre-training on a tremendous amount of image-text pairs from scratch is exceedingly resource-consuming, connecting an existing LLM with a comparatively lightweight visual prompt generator (VPG) becomes a feasible paradigm. However, further tuning the VPG component of the MLLM still incurs significant computational costs, such as thousands of GPU hours and millions of training data points. An alternative solution is to transfer an existing VPG from one MLLM to the target MLLM. In this work, we investigate VPG transferability across LLMs for the first time, aiming to reduce the cost of VPG transfer. Specifically, we explore VPG transfer across different LLM sizes (e.g., small-to-large) and types. We identify key factors to maximize the transfer efficiency, based on which we develop a simple yet highly effective two-stage transfer framework, called VPGTrans. Notably, it enables VPG transfer from BLIP-2 $\mathrm { O P T } _ { 2 . 7 \mathrm { B } }$ to BLIP-2 $\mathrm { O P T } _ { 6 . 7 \mathrm { B } }$ with less than $10 \%$ of GPU hours using only $1 0 . 7 \%$ of the training data compared to training a VPG for $\mathrm { O P T } _ { 6 . 7 \mathrm { B } }$ from scratch. Furthermore, we provide a series of intriguing findings and discuss potential explanations behind them. Finally, we showcase the practical value of our VPGTrans approach, by customizing two novel MLLMs, including VL-LLaMA and VL-Vicuna, with the recently released LLaMA and Vicuna LLMs.
10
+
11
+ ![](images/47f10b1dd10c7582861b3a81730cf2754b8fef72df8b0732479b81981c6d570f.jpg)
12
+ Figure 1: (a) The general architecture of MLLMs, e.g., BLIP-2 [30] and PaLM-E [16], including a visual prompt generator (VPG), a linear projector and a backbone LLM. Typically, to tune the MLLM, only the VPG and the projector are updated, while the LLM is kept frozen. (b) This work investigates the VPG transferability across LLMs, including different LLM sizes and LLM types.
13
+
14
+ # 1 Introduction
15
+
16
+ Background. Recent years have witnessed a great rise in large-scale language models (LLMs) in ushering the human-like artificial intelligence. Text-based LLMs [42, 7, 44] are further enhanced by associating with other modalities such as vision, leading to the multimodal LLMs (MLLMs), such as BLIP-2 [30], Flamingo [2], GPT-4 [8] for multimodal dialog system, and PaLM-E [16] for embodied AI system. To construct a MLLM, a visual prompt generator (VPG) module (cf. Fig. 1(a)) that produces soft prompts for the input images/videos is added2 for bridging the gap between vision and language modalities. Currently, such architecture has been frequently adopted by many popular MLLMs [30, 27]. For example, BLIP-2 pre-trains a CLIP-ViT [43] combined with a Q-Former as VPG. To obtain the final MLLM, the VPG needs to be tuned. Ideally, the vast LLM backbone can remain untouched, leaving only the relatively lightweight VPG module to be fully or partially updated.3
17
+
18
+ Motivation. However, building a MLLM is inevitably computation-expensive, due to the huge overhead brought by the LLM. For example, training a BLIP-2 Flan ${ \mathrm { 7 } } 5 _ { \mathrm { X X L } }$ needs over 600 A100-GPU hours on over 100 million image-text pairs. Hopefully, transferring a pre-trained VPG (which is the main body of trainable parts) from an existing MLLM to a novel LLM instead of training from scratch,4 offers a promising solution. Intuitively, all the MLLMs literally can share the same VPG infrastructure and utility,5 which makes the VPG transfer theoretically feasible. In this work, we thus investigate the potential of transferring VPG across LLMs.
19
+
20
+ Proposal. Specifically, this paper examines the transferability of VPG across LLMs: 1) with different sizes (the same type), i.e. , transfer across LLM sizes, and 2) across different LLM types, i.e. , transfer across LLM type, as illustrated in Fig. 1(b).
21
+
22
+ • [Transfer across LLM Sizes (TaS)]. It has been a typical practice for LLM-related research [8] to validate the training strategy and the hyperparameter on smaller models (e.g., $\mathrm { O P T } _ { 2 . 7 \mathrm { B } }$ ) and then scale up to larger ones (e.g., $\mathrm { O P T } _ { 6 . 7 \mathrm { B } }$ ). It is thus worth exploring whether a VPG trained on a smaller LLM can be transferred to a larger LLM, resulting in reduced computational costs & data, and maintaining comparable performance. • [Transfer across LLM Types (TaT)]. With a well-tuned VPG for a type of LLM, it is interesting to see if VPG can be transferred to other types of LLMs even with different architectures (e.g., decoder v.s. encoder-decoder). If the transfer can be achieved, how to make it more efficient?
23
+
24
+ We conduct a series of exploratory analyses (cf. $\ S 3 . 1 \ r ,$ ) to identify the key factors for transfer efficiency. Based on our empirical study, we design a two-stage transfer learning framework $( c f . \ \ S 3 . 2 )$ , namely VPGTrans, that includes a projector warm-up (stage-1) and vanilla fine-tuning (stage-2). For stage-1, we find that warming up the projector before VPG tuning can effectively reduce the training step for adapting a pre-trained VPG to a new LLM, and avoid the potential performance drop in the adaptation. To achieve an efficient warm-up, the projector will be well-initialized and then trained with an extremely large learning rate $( 5 \times l r )$ . For stage-2, there is a vanilla fine-tuning of both the VPG and projector. Despite its simplicity, VPGTrans is able to significantly speed up the VPG-transfer process without harming the performance.
25
+
26
+ Results and Findings. Via extensive experiments on the transfer across LLM sizes and types (cf. $\ S 4$ & §5), we gain the following key observations:
27
+
28
+ • VPGTrans helps to avoid the performance drop caused by directly inheriting the VPG and achieves at most 10 times acceleration for the small-to-large transfer across LLMs in the same type. • VPGTrans can also achieve comparable or better performance than training from scratch and achieve at most 5 times acceleration for the transfers between different model types. • Notably, our VPGTrans helps to achieve a BLIP-2 ViT-G $\mathbf { O P T _ { 2 . 7 B 6 . 7 B } }$ transfer with less than $10 \%$ of GPU hours and $1 0 . 7 \%$ of training data required for the original model training. • Furthermore, our framework can even outperform the original BLIP-2 $\mathrm { O P T } _ { 6 . 7 \mathrm { B } }$ on most of the evaluated datasets, with a $\mathbf { + 2 . 9 }$ improvement on VQAv2 and a $\mathbf { + 3 . 4 }$ improvement on OKVQA.
29
+
30
+ Our investigation further reveals some intriguing findings, for which we provide possible explanations:
31
+
32
+ ![](images/fe9874330a5d4f954361378d30db421b9ee5eb4c7b892fe951e704e0517ee88f.jpg)
33
+ Figure 2: Comparing the cost between training VPG from scratch vs. transferring VPG via our VPGTrans strategy. Note the LLM via VPGTrans is FlanT5 $\bf { \Phi } _ { \mathrm { X L \to X X L } }$ and $\mathrm { O P T } _ { 2 . 7 \mathrm { B } 6 . 7 \mathrm { B } }$ , respectively.
34
+
35
+ • When conducting TaS from $\mathbf { L L M } _ { \mathrm { s r c } }$ to $\mathrm { L L M _ { \mathrm { t g t } } }$ , the size of $\mathbf { L L M } _ { \mathrm { s r c } }$ is not the larger the better. The transfer sometimes even follows a counterintuitive principle of “the smaller the $L L M _ { s r c }$ size, the more speed-up and better performance” $( c f . \ \ S 4 . 2 )$ . • When conducting TaT, efficient VPG transfer can not be achieved between two small LLMs with our VPGTrans, due to the large gap between small LLMs’ embedding space (cf. $\ S 5 . 2 )$ .
36
+
37
+ Contributions. In this study, we show for the first time that effective VPG transfer across LLMs can be achieved under most conditions, suggesting that it is possible to build a new MLLM with considerably lower computational cost, as seen in Fig. 2. To summarize, we make the following key contributions:
38
+
39
+ • Effective approach. We investigate the key factors for VPG-transfer efficiency and propose a two-stage transfer framework VPGTrans. The approach helps to achieve a highly-efficient VPG transfer across LLMs with less training data and even task improvements. • Intriguing findings. By exploring the VPG transfer across LLMs, we reveal several intriguing findings and provide potential explanations that will shed light on further research. • Open source. We showcase how to customize a novel GPT-4-like MLLM with our VPGTrans (cf. $\ S 6$ , and release two multimodal-version MLLMs: VL-LLaMA and VL-Vicuna. All codes and models is released at https://github.com/VPGTrans/VPGTrans.
40
+
41
+ # 2 Preliminary
42
+
43
+ This section will outlines the existing prevailing MLLMs, and elaborates on the settings of the exploratory analyses of these MLLMs.
44
+
45
+ # 2.1 MLLM
46
+
47
+ Architecture. As illustrated in Fig. 1(a), current MLLMs mostly adopt a common architecture, including a visual prompt generator (VPG), a projector, and a backbone LLM. Typically, VPG takes images/videos as inputs, and encodes the visual input into a fixed length of soft prompts. Then, a linear projector is employed to align the soft prompt’s dimension to LLM’s word embedding dimension. Finally, the LLM will generate sentences based on the information from the soft prompt. We list some of the recent representative MLLMs in Table 1.
48
+
49
+ Table 1: MLLMs architectures and pre-training paradigm. †: it is a GPT-2-like LLM with relative position embeddings.
50
+
51
+ <table><tr><td>MLLMs</td><td>VPG</td><td>VPG Trainable</td><td>LLM</td><td>LLMTrainable</td></tr><tr><td>KOSMOS-1[19]</td><td>CLIP [43]</td><td>All</td><td>Rand.Init.LM</td><td>All</td></tr><tr><td>Frozen [54]</td><td>NF-ResNet-50 [6]</td><td>NF-ResNet-50</td><td>GPT-2-like��� [42]</td><td>No</td></tr><tr><td>Flamingo [2]</td><td>NFNet-F6 [6]+Resampler [21]</td><td>Resampler</td><td>Chinchilla [18]</td><td>Xattn-Dense</td></tr><tr><td>PaLM-E[16]</td><td>ViT[15]/OSRT[49]</td><td>All</td><td>PaLM[11]</td><td>No</td></tr><tr><td>BLIP-2 [30]</td><td>EVA-CLIP [52] + Q-Former [30]</td><td>Q-Former</td><td>OPT[60]/Flan-T5[12]</td><td>No</td></tr></table>
52
+
53
+ Training Paradigm. Given a MLLM, typically the VPG and linear projector will be trained, fully or partially. For example, PaLM-E updates all of the parameters of VPG in the pre-training stage, while BLIP-2 and Flamingo freeze the ViTs and tune their Q-Former and Resampler, respectively. As the main part of the whole architecture, the LLM is usually frozen during the training or tuned only a small portion (e.g., 10B for Flamingo-80B). KOSMOS-1 is an exception, which does not use a pre-trained LLM but trains the LLM from scratch. Such a training paradigm typically results in much longer training time and data (both multimodal and pure text corpus). Recent works [30, 16] show that adopting an existing LLM and freezing all of its parameters can also achieve excellent performance with significantly reduced computational cost, which leads to the trend of adapting frozen pre-trained LLM. For example, BLIP-2 FlanT $\mathfrak { j } _ { \mathrm { X X L } }$ (12.1B) can achieve better zero-shot VQAv2 performance $( 6 5 . 0 \%$ in Acc.) compared with KOSMOS-1 $5 1 . 0 \%$ in Acc.) and Flamingo-80B $5 6 . 3 \%$ in Acc.). Thus, in this paper, we mainly focus on VPG transfer across frozen LLMs.
54
+
55
+ # 2.2 Experiment Settings
56
+
57
+ Architecture. We adopt BLIP-2’s architecture and training paradigm. In our exploration experiments, we consider using the VPG that consists of a CLIP ViT-L/14 [43], and a Q-Former that has already undergone a BLIP-like pre-training (the 1st stage pre-training in BLIP-2’s paper [30]).
58
+
59
+ Training Data. For all of the exploration experiments, we adopt human-annotated COCO caption dataset [34] and web image-text pairs SBU dataset [40], which results in 1.4 million image-text pairs.
60
+
61
+ Transfer Direction. For the small-to-large model transfer among the same type of LLMs, we investigate: 1) OPT [60] (decoder-only) series including 125M, 350M, 1.3B, and 2.7B, and 2) FlanT5 [12] (encoder-decoder) ranging base, large, and XL. For the transfer across different types of LLMs, we consider the ones of OPT and FlanT5 with similar sizes.
62
+
63
+ Evaluation. To evaluate the performance of MLLMs, we choose two caption datasets: (1) COCO caption [34] (2) NoCaps [1], and three VQA datasets: (3) VQAv2 [4] (4) GQA [20] (5) OKVQA [37]. We make evaluations after the pre-training without task-specific fine-tuning and report the CIDEr [55] for all caption tasks and accuracy for all VQA tasks.
64
+
65
+ Implementation Details. We follow the same implementation details of BLIP-2, via the open code.6 Concretely, we use FP16 and BFloat16 for OPT and FlanT5 respectively in the model training. For the learning rate, we first conduct a linear warm-up from 1e-6 to 1e-4, and then use a cosine learning rate schedule with the minimal $l r { = } 1 \mathrm { e } { - } 5$ for 10 epochs. Due to the limited data amount, we slightly decrease the batch size, which we find beneficial for the final performance. Specifically, we set the batch size of 1,728 and 1,152 for OPT and FlanT5-based models, respectively.
66
+
67
+ # 3 Maximizing the Transfer Efficiency with a Two-stage Transfer Strategy
68
+
69
+ In this section, we first identify the key factors for maximizing transfer efficiency, based on which we then motivate our solution for better transfer.
70
+
71
+ # 3.1 Exploratory Analysis: Identifying Key Factors for VPG Transfer
72
+
73
+ Via selected experiments of small-to-large transfer among OPT models, we can obtain the following key observations. More systematical comparisons are conducted in the later section (cf. §4).
74
+
75
+ • Inheriting the trained VPG can accelerate training. To demonstrate this, we compare the convergence rates of VPG training on $\mathrm { O P T } _ { 3 5 0 \mathrm { M } }$ from scratch, and inheriting VPG trained on $\mathrm { O P T } _ { 1 2 5 \mathrm { M } }$ The patterns are shown in Fig. 3. Overall, we find that inheriting VPG trained on $\mathrm { O P T } _ { 1 2 5 \mathrm { M } }$ accelerates convergence, particularly for two caption tasks. However, for datasets that require fine-grained visual perception such as VQAv2 and GQA, directly conduct continue training with an inherited VPG will harm the performance. We hypothesize that tuning VPG with a randomly initialized projector will compromise the existing fine-grained visual perception ability of VPG. The possible reason can be that, the VPG is typically a pre-trained model with powerful visual perception ability, and thus updating based on the gradient passed through a random projector will mislead the VPG at the initial steps [2, 33, 23].
76
+
77
+ • Warming up the linear projector can prevent performance drop and expedite VPG training. To verify this, we first conduct a warm-up training of the linear projector for 3 epochs, during which both VPG and LLM are frozen. Subsequently, we jointly train VPG and the projector and plot the performance curve in Fig. 4 (the warm-up process is not included in this figure). The results show that the performance drop observed in Fig.3 can be avoided in Fig. 4. Additionally, we observe that the warm-up training leads to fewer training steps required for VPG and projector joint training. However, we must emphasize that warming up is a costly step. In the case of a large LLM, such as 6.7B, the trainable parameters of BLIP-2’s VPG will account for less than $10 \%$ of the total parameters, where freezing VPG can only lead to a reduction of $5 . 4 \%$ of A100 hours (36.9 out of 684.0 A100 hours). We will elaborate on how to accelerate the linear projector warm-up in our later discussion (cf. 3.1).
78
+
79
+ ![](images/77bfd9db8e4a48b0aed1c3c4bbc1af6ae6f361ece62d3323ca16cbef7ebc2455.jpg)
80
+ Figure 3: Comparisons between i) inheriting VPG from $\mathrm { O P T } _ { 1 2 5 \mathrm { M } }$ and training it with randomly initialized projector for $\mathrm { O P T } _ { 3 5 0 \mathrm { M } }$ and ii) training VPG and randomly initialized projector for OPT350M from scratch.
81
+
82
+ • Initializing $\mathbf { L L M _ { \mathrm { t g t } } } ^ { \prime }$ s projector with the help of the word converter can accelerate the linear projector warm-up. In fact, the VPG and projector trained on $\mathbf { L L M } _ { \mathrm { s r c } }$ have already learned how to map the visual content to $\mathbf { L L M } _ { \mathrm { s r c } }$ ’s understandable soft prompt [39]. If we can convert the $\mathbf { L L M } _ { \mathrm { s r c } }$ ’s soft prompt to $\mathrm { L L M _ { \mathrm { t g t } } }$ ’s soft prompt, we can directly get a VPG suitable for $\mathrm { L L M } _ { t g t }$ . One natural idea is to leverage the word embeddings of both models as a proxy for the soft prompt [25]. The intuition behind the scene is that, the soft prompt works in the same format as normal words.
83
+
84
+ ![](images/7cd279fb90695a457a34a0af9cf6c126e10153fd3c1f56570ca729680105284c.jpg)
85
+ Figure 4: First warming-up then transferring can avoid performance drop on VQAv2 and accelerate convergence for COCO caption.
86
+
87
+ To validate our hypothesis, we conduct an experiment on the transfer from $\mathrm { O P T } _ { 1 2 5 \mathrm { M } }$ to $\mathrm { O P T } _ { 1 . 3 \mathrm { B } }$ . After training a linear word embedding converter (cf. $\ S 3 . 2 ( \mathsf { b } ) )$ , we initialize the projector for $\mathrm { O P T } _ { 1 . 3 \mathrm { B } }$ with the merged linear operation of the projector for $\mathrm { O P T } _ { 1 2 5 \mathrm { M } }$ and converter. As shown in Table 2, we observe that the initialization can reduce the 3 epochs’ warm-up to 2 epochs.
88
+
89
+ • Linear projector warm-up enables faster convergence with an extremely large learning rate. To determine the most efficient transfer practice, we experiment with training the projector using different learning rates. Surprisingly, we find that the linear projector enables fast and stable convergence with an extremely large learning rate. Specifically, by setting the learning rate to 5 times of the original value, the COCO caption’s CIDEr score can reach 133.1 with 1 epoch training, which is higher than the 3 epochs results of w/o init. as shown in Table 2.
90
+
91
+ Table 2: Comparison between linear projector warm-up with/without word embedding initialization. The metric is COCO caption’s CIDEr.
92
+
93
+ <table><tr><td>Epoch</td><td>w/ init.</td><td>w/o init.</td></tr><tr><td>1</td><td>130.2</td><td>126.1</td></tr><tr><td>2</td><td>132.7</td><td>131.6</td></tr><tr><td>3</td><td>133.4</td><td>132.8</td></tr></table>
94
+
95
+ # 3.2 A Two-stage VPG Transfer Framework
96
+
97
+ By connecting all the dots as discussed above in $\ S 3 . 1$ , we now design our two-stage VPGTrans framework for more efficient VPG transfer. As shown in Fig. 5, the stage-1 of VPGTrans performs projector warm-up and the stage-2 carries out a vanilla fine-tuning. Our results demonstrate that the VPGTrans is simple yet effective that can significantly speed up the transfer without compromising performance. Detailed results are given in the later sections (cf. §4 & 5).
98
+
99
+ # ▶ Stage-1: Projector Warm-up.
100
+
101
+ (a) Inherit VPG. We first initialize the VPG for $\mathrm { L L M _ { \mathrm { t g t } } }$ with the VPG trained on $\mathbf { L L M } _ { \mathrm { s r c } }$
102
+
103
+ $( b )$ Projector Initialization. Then, we initialize the projector for $\mathrm { L L M _ { \mathrm { t g t } } }$ merged from the projector of $\mathbf { L L M } _ { \mathrm { s r c } }$ and a linear word converter. Formally, we define the linear projector of $\mathbf { L L M } _ { \mathrm { s r c } }$ as ${ \bar { f } } _ { s } ( x ) = W _ { s } x + b _ { s }$ , the linear projector for $\mathrm { L L M _ { \mathrm { t g t } } }$ as ${ \dot { \boldsymbol { f } } } _ { t } ( { \boldsymbol { x } } ) = W _ { t } { \boldsymbol { x } } + b _ { t }$ , and the word converter as $g _ { c } ( x ) = W _ { c } x + b _ { c }$ .
104
+
105
+ The word converter is a linear layer trained with text-only caption data to convert the $\mathbf { L L M } _ { \mathrm { s r c } }$ ’s word embeddings to $\mathrm { L L M _ { \mathrm { t g t } } }$ ’s word embeddings. We experiment with optimizing losses based on cosine similarity or Euclidean distance, and observe no significant difference between the two losses. Thus we simply use cosine similarity in our experiments. In cases where $\mathbf { L L M } _ { \mathrm { s r c } }$ and $\mathrm { L L M _ { \mathrm { t g t } } }$ use different tokenization methods, we optimize based on the overlapped tokens. Formally, for every given token $k$ , we denote its word embeddings of $\mathbf { L L M } _ { \mathrm { s r c } }$ and $\mathrm { L L M _ { \mathrm { t g t } } }$ as $x _ { s }$ and $x _ { t }$ . Then, we minimize the loss:
106
+
107
+ ![](images/9f6e9e59a458377f952659afdc462b5701c4d509e76a8037345325d7cb356240.jpg)
108
+ Figure 5: Our two-stage VPGTrans framework. Stage-1 is to first (a) inherit the VPG of $\mathbf { L L M } _ { \mathrm { s r c } }$ and (b) initialize the projector by merging the projector of $\mathbf { L L M } _ { \mathrm { s r c } }$ and word converter. (c) Then the projector will be warmed up for 1 epoch with a large learning rate. Stage-2 is to (d) conduct a vanilla fine-tuning for the VPG and projector for $n$ epochs.
109
+
110
+ $$
111
+ \mathcal { L } = 1 - s i m ( g _ { c } ( x _ { s } ) , x _ { t } ) .
112
+ $$
113
+
114
+ Once we obtain the word converter $g _ { c } ( \cdot )$ , we can easily merge it with the projector of $\mathbf { L L M } _ { \mathrm { s r c } }$ as:
115
+
116
+ $$
117
+ f _ { t } ( x ) = f _ { s } ( g _ { c } ( x ) ) = W _ { s } ( W _ { c } x + b _ { c } ) + b _ { s } ,
118
+ $$
119
+
120
+ resulting in $f _ { t }$ ’s weight and bias as $W _ { t } = W _ { s } W _ { c }$ and $b _ { t } = W _ { s } b _ { c } + b _ { s }$ .
121
+
122
+ (c) Warm-up Training. Then, we only train the projector in this stage with a frozen VPG and LLM. Specifically, we train the projector for 1 epoch with 5 times of the normal learning rate.
123
+
124
+ $\blacktriangleright$ Stage-2: Vanilla Fine-tuning. $( d )$ Vanilla Fine-tuning. In the final step, we conduct a joint training of VPG and projector for $n$
125
+ epochs with a normal learning rate.
126
+
127
+ # 4 Exp-I: Transfer across Different Model Sizes
128
+
129
+ In this section, we conduct experiments to systematically illustrate the effectiveness of our VPGTrans and analyze the relationship between transfer efficiency and model size. For simplicity, we use TaS to represent the transfer across different model sizes.
130
+
131
+ # 4.1 Experimental Settings
132
+
133
+ In this part, we introduce baselines and transfer variants. For details about training data and implementation details, please refer to the experiment settings in the Preliminary (cf. 2.2).
134
+
135
+ Baselines. We mainly compare our VPGTrans with training from scratch (TFS) and VPG inheritance (VPG Inherit), where we report their performance on the aforementioned 5 tasks without further task-specific fine-tuning. For our VPGTrans, the word converter training only requires updating a linear layer on tokenized text data and typically takes less than 10 minutes on 1 A100 GPU with less than 15G GPU memory. Meanwhile, freezing the VPG can lead to at least 14 A100 minutes speed-up per epoch. Therefore, we consider the whole stage-1 training as the 1st epoch for simplicity.
136
+
137
+ Transfer Variants. We conducted experiments on transfer learning using 1) the OPT model across four different sizes: 125M, 350M, 1.3B, and 2.7B, and 2) the FlanT5 model across three sizes: base, large, and XL. However, we encountered significant instability during training with FlanT5large. As a result, we mainly present the transfer results between FlanT $\bar { \mathsf { \Sigma } } _ { \mathrm { b a s e } }$ and FlanT ${ \mathrm { 5 } } _ { \mathrm { X L } }$ .
138
+
139
+ # 4.2 VPGTrans Enabling Faster Convergence without Performance Drop under TaS
140
+
141
+ First of all, as shown in Fig. 6, our VPGTrans can consistently accelerate the model convergence. For COCO caption and NoCaps that require more training steps to converge, our VPGTrans (green line) can be higher than the other two lines (blue and orange lines). To give a quantitative evaluation of the speed-up rate, we show the speed-up rate in Table 3. The speed-up rate is calculated by considering the number of epochs reduced to achieve the best TFS performance on a particular dataset. Formally, given a dataset $D$ , TFS obtains the best performance $p$ on $D$ at epoch $e _ { \mathrm { { t f s } } }$ , whereas VPGTrans first achieves a better performance than $p$ at epoch $e _ { \mathrm { v t } }$ . The speed-up rate on $D$ is given by $\frac { e _ { \mathrm { t f s } } } { e _ { \mathrm { v t } } }$ . According to Table 3, our VPGTrans can achieve at least 4 times speed-up on $40 \%$ of Transfer-Task variants. Furthermore, for the two caption datasets, which take a long time to converge, our VPGTrans $\mathrm { O P T } _ { 1 2 5 \mathrm { M } 2 . 7 \mathrm { B } }$ delivers a 10 times speed-up.
142
+
143
+ ![](images/fa99f2b6f62c2ce0b26adb7222ba147e3060579929d0401acfa7be373dfb66d8.jpg)
144
+ Figure 6: Comparison between different methods across 3 TaS variants on 5 tasks. Note that the model is directly evaluated after pre-training without further fine-tuning. Please refer to Appendix§C for other transfer variants.
145
+
146
+ Table 3: The speed-up rate of our VPGTrans compared with training from scratch (TFS). The symbol "-" means VPGTrans can not achieve better performance than TFS.
147
+
148
+ <table><tr><td>Transfer</td><td>COCO Caption</td><td>NoCaps</td><td>VQAv2</td><td>GQA</td><td>OKVQA</td></tr><tr><td>OPT125M→350M</td><td>1.7</td><td>3.0</td><td>1.0</td><td>5.0</td><td>5.0</td></tr><tr><td>OPT125M→1.3B</td><td>9.0</td><td>10.0</td><td>9.0</td><td>=</td><td>2.0</td></tr><tr><td>OPT350M→1.3B</td><td>4.5</td><td>5.0</td><td>9.0</td><td>2.0</td><td>2.0</td></tr><tr><td>OPT125M→2.7B</td><td>10.0</td><td>10.0</td><td>2.0</td><td>2.0</td><td>3.0</td></tr><tr><td>OPT350M→2.7B</td><td>10.0</td><td>10.0</td><td>2.0</td><td>1</td><td>3.0</td></tr><tr><td>OPT1.3B-→2.7B</td><td>3.3</td><td>3.3</td><td>2.0</td><td>-</td><td>1.5</td></tr><tr><td>FlanT5base→XL</td><td>1.0</td><td>1.1</td><td>3.0</td><td>4.0</td><td>2.0</td></tr><tr><td>FlanT5xL →OPT2.7B</td><td>5.0</td><td>5.0</td><td>2.0</td><td>2.0</td><td>3.0</td></tr><tr><td>OPT2.7B→FlanT5xL</td><td>1.7</td><td>2.0</td><td>1</td><td>2.0</td><td>1</td></tr></table>
149
+
150
+ Moreover, when compared with the VPG inherit in Fig. 6, our VPGTrans can achieve a higher speed-up rate on all of the variants on caption tasks, and achieve better performance on most variants except for $\mathrm { O P T } _ { 1 . 3 \mathrm { B } 2 . 7 \mathrm { B } }$ . We refer the readers to Appendix $\mathrm { \ : \ : \xi { 8 C . 3 } }$ for more comparisons.
151
+
152
+ We provide interesting findings with respect to the efficiency transfer by VPGTrans in the following.
153
+
154
+ • The smaller size of $\mathbf { L L M _ { s r c } } ,$ the easier the transfer. In our OPT based experiments, we notice an interesting phenomenon: when transferring to a given $\mathrm { L L M _ { \mathrm { t g t } } }$ , both the convergence rate and optimal performance are roughly inversely proportional to the size of $\mathbf { L L M } _ { \mathrm { s r c } }$ . For example, as shown in Table 3, the $\mathrm { O P T } _ { 1 2 5 \mathrm { M } 2 . 7 \mathrm { B } }$ and $\mathrm { O P T } _ { 3 5 0 \mathbf { M } 2 . 7 \mathbf { B } }$ have much higher speed-up rate than $\mathrm { O P T } _ { 1 . 3 \mathrm { B } 2 . 7 \mathrm { B } }$ on all of the datasets. Meanwhile, as demonstrated in Fig. 6, the optimal performance of $\mathrm { O P T } _ { 1 2 5 \mathrm { M } 2 . 7 \mathrm { B } }$ is better than $\mathrm { O P T } _ { 1 . 3 \mathrm { B } 2 . 7 \mathrm { B } }$ on 3 VQA tasks.
155
+
156
+ Table 4: Comparison between models built with our VPGTrans and the original BLIP-2 ViT-G $\mathrm { O P T } _ { 6 . 7 \mathrm { B } }$ and BLIP-2 ViT-G FlanT $5 _ { \mathrm { X X L } }$ .
157
+
158
+ <table><tr><td>Models</td><td>VQAv2 val</td><td>GQA test-dev</td><td>OKVQA test</td><td>GPU hours</td><td>training data</td></tr><tr><td>BLIP-2 ViT-G OPT6.7B</td><td>54.3</td><td>36.4</td><td>36.4</td><td>631.5</td><td>129M</td></tr><tr><td>BLIP-2 ViT-G OPT2.7B-→6.7B (0urs)</td><td>57.2</td><td>36.2</td><td>39.8</td><td>59.0</td><td>13.8M</td></tr><tr><td>VL-LLaMA7B (ours)</td><td>58.1</td><td>37.5</td><td>37.4</td><td>67.1</td><td>13.8M</td></tr><tr><td>BLIP-2 ViT-G FlanT5xXL</td><td>65.2</td><td>44.7</td><td>45.9</td><td>684.0</td><td>121.6M</td></tr><tr><td>BLIP-2 ViT-G FlanT5xL-→XXL (ours)</td><td>65.2</td><td>45.0</td><td>45.0</td><td>32.4</td><td>5.3M</td></tr></table>
159
+
160
+ ![](images/f11488c7c1f59614c4c51593b02dafbaba22e12307d37ed4aa376c6986e89da4.jpg)
161
+ Figure 8: Comparison between different methods across $2 \ \mathrm { T a T }$ variants on 5 tasks. Note that the model is directly evaluated after pre-training without further fine-tuning. Please refer to Appendix§D for other transfer variants.
162
+
163
+ We hypothesize that training VPG on larger OPT will have a worse influence on VPG’s existing fine-grained perception ability, which might be caused by the enlarging embedding dimensions. To validate our hypothesis, we fix the VPG weight and only tune linear projectors to test VPGs trained on different $\mathbf { L L M } _ { s r c }$ through cross-size transfer. The SPICE [3] metric on COCO caption is used to evaluate the VPG’s visual perception ability, where SPICE is specifically designed for visual concept perception in captions. As shown in Fig. 7, for each row, given the $\mathbf { L L M } _ { t a r }$ , the performance of VPG trained on smaller $\mathbf { L L M } _ { s r c }$ can outperform the larger ones in most conditions, which indicates a better visual perception ability of VPG trained on smaller $\mathbf { L L M } _ { s r c }$ . Therefore, adapting a VPG from a smaller OPT model which is less affected, is helpful to take fewer steps to reach the TFS’s best performance and achieve even better performance.
164
+
165
+ # 4.3 Scale-up Experiments
166
+
167
+ To validate the effectiveness of our VPGTrans on the real-world application level, we experiment on transferring from BLIP-2 ViT-G $\mathrm { O P T } _ { 2 . 7 \mathrm { B } }$ to $\mathrm { O P T } _ { 6 . 7 \mathrm { B } }$ and from BLIP-2 ViT-G FlanT $5 _ { \mathrm { X L } }$ to FlanT5XXL. Please refer to Appendix $\mathrm { \ : \ S C . 4 }$ for implementation details.
168
+
169
+ Speed-up with non-degenerated performances. As shown in Table 4, we can see that (1) $\mathbf { O P T } _ { 2 . 7 \mathbf { B } 6 . 7 \mathbf { B } } ;$ : our VPGTrans achieves a 10.7 times speed-up with only $1 0 . 7 \%$ training data, while the performance on VQAv2 and OKVQA have over 2 points improvement. (2) FlanT $\bf \Pi ^ { \prime } 5 _ { X L X X L }$ : VPGTrans can achieve 21.1 times speed-up with less than $5 \%$ training data while achieving the same performance on VQAv2, higher performance on GQA and slightly lower performance on OKVQA. Note that continuing training the FlanT $\mathsf { \Pi } _ { \mathrm { X L X X L } }$ only shows improvement on VQAv2 and GQA. Thus, we do not show a checkpoint with more training steps.
170
+
171
+ ![](images/0c22991255013c317bd03c3ea2c511cd0e2a0a970e3a3141779a5f18e0221710.jpg)
172
+ Figure 7: The confusion matrix. Only linear layers are trained for VPG evaluation. Models are tested on COCO caption with SPICE metric to compare the VPGs trained on different $\mathrm { L L M } _ { s r c }$ .
173
+
174
+ Table 5: Comparison between our VL-Vicuna and SOTA MLLMs for multimodal conversation. The evaluation is done by Multimodality Chatbot Arena platform via user voting.
175
+
176
+ <table><tr><td>Rank</td><td>Model Elo Rating</td></tr><tr><td>1</td><td>LLaMA-Adapter v2 [17] 1023.0</td></tr><tr><td>2 LLaVA [35]</td><td>1019.9</td></tr><tr><td>3</td><td>VL-Vicuna (ours) 1012.1</td></tr><tr><td>4</td><td>MiniGPT-4 [62] 1011.9</td></tr><tr><td>5</td><td>InstructBLIP[13] 999.5</td></tr><tr><td>6</td><td>mPLUG-Owl[59] 996.3</td></tr><tr><td>7 Otter [26]</td><td>981.5</td></tr><tr><td>8 BLIP-2 [30]</td><td>955.8</td></tr></table>
177
+
178
+ # 5 Exp-II: Transfer across Different Model Types
179
+
180
+ In this section, we further investigate the transfer across different model types. For simplicity, we mark this type of transfer as TaT.
181
+
182
+ # 5.1 Experimental Settings
183
+
184
+ In this part, we introduce baselines and transfer variants. For details about training data and implementation details, please refer to the experiment settings in the Preliminary (cf. 2.2).
185
+
186
+ Baselines. We mainly compare our VPGTrans with training from scratch (TFS), and report the performance on the aforementioned 5 tasks. Other details (cf. 4.1) are totally the same with TaS experiments.
187
+
188
+ Transfer Variants. We conducted experiments on transfer learning between 1) $\mathrm { O P T } _ { 3 5 0 \mathrm { M } }$ and FlanT $\mathrm { \Delta } 5 _ { \mathrm { b a s e } }$ , and 2) $\mathrm { O P T } _ { 2 . 7 \mathrm { B } }$ and FlanT $5 _ { \mathrm { X L } }$ .
189
+
190
+ # 5.2 VPGTrans Enabling Faster Convergence only on Large LLMs under TaT
191
+
192
+ • There is no speed-up of TaT between two small LLMs. A finding is that on TaT our VPGTrans does not show speed-up for small models, and even shows a degeneration of training speed in the initial several epochs. As shown in Fig. 8, when transferring from $\mathrm { O P T } _ { 3 5 0 \mathrm { M } }$ to FlanT $5 _ { \mathrm { b a s e } }$ , the convergence speed of VPGTrans is even slower than TFS in the initial several epochs.
193
+
194
+ • Speed-up of VPGTrans happens in large LLMs. However, when moving to the large LLMs like $\mathrm { O P T } _ { 2 . 7 \mathrm { B } }$ and FlanT ${ \mathrm { 5 } } _ { \mathrm { X L } }$ , there is an obvious speed-up. As shown in Table 3, we can see at least 2 times speed-up when transferring from $\mathrm { F l a n T 5 } _ { \mathrm { X L } }$ to $\mathrm { O P T } _ { 2 . 7 \mathrm { B } }$ . We empirically find that the soft prompts for larger LLM are more linear transferrable among different LLM types. As shown in Fig. 8, when transferring between ${ \mathrm { F l a n T } } 5 _ { \mathrm { b a s e } }$ and $\mathrm { O P T } _ { 3 5 0 \mathrm { M } }$ , the VGPTrans’ 1st epoch results on two caption datasets are limited, where only a linear operation can be trained. The result of $\mathrm { O P T } _ { 3 5 0 \mathrm { M } } { } \mathrm { F l a n T } 5 _ { \mathrm { b a s e } }$ on the COCO caption is even near to zero. By contrast, the result of $\mathrm { F l a n T } 5 _ { \mathrm { X L } } { } \mathrm { O P T } _ { 2 . 7 \mathrm { B } }$ with our VPGTrans are obviously higher than TFS. We hypothesize that larger LLM typically learned more generalizable text embeddings and share more similarity among relative word distances, which enables an easier VPG transfer.
195
+
196
+ # 6 Customizing New MLLMs with Any LLMs
197
+
198
+ Above, we thoroughly certify the efficacy of our proposed VPGTrans approach for higher efficient transfer of VPG. In this section, we illustrate how to apply the VPGTrans framework for VPG transfer to customize new MLLMs with any LLMs.
199
+
200
+ VL-LLaMA. By applying our VPGTrans, we can equip the recently released LLaMA [53] model with a VPG trained on BLIP-2 $\mathrm { O P T } _ { 6 . 7 \mathrm { B } }$ to perceive the visual information. As shown in Table 4, we can see that our VL-LLaMA can outperform the original BLIP-2 $\mathrm { O P T } _ { 6 . 7 B }$ on all datasets.
201
+
202
+ VL-Vicuna. An exciting application of our VPGTrans is to build a GPT-4 [8] style multimodal conversation chatbot. To achieve our goal, we employ Vicuna [10] as our base LLM. Similarly, we transfer the VPG from BLIP-2 $\mathrm { O P T } _ { 6 . 7 \mathrm { B } }$ , and add an extra instruction tuning using MiniGPT-4’s selfinstruct data [62]. We compare our model with MiniGPT-4 in Fig. 9. When compared to MiniGPT-4, our VL-Vicuna shows better visual perception ability. Please refer to Appendix $\mathrm { \Omega ^ { \ S E } }$ for more cases. In addition, we also report the ranking and ELO ratings for our VL-Vicuna compared with the other 7 SOTA multimodal chatbots in Table 5 (The evaluation is done by Multimodality Chatbot Arena platform7). The results show the effectiveness of our VL-Vicuna compared with existing SOTA models.
203
+
204
+ ![](images/26ccc1e5deaa7a37d5a1df096d13105e4a9097978362507df2699ccb5e3303ae.jpg)
205
+ Figure 9: Comparison between MiniGPT-4 and our VL-Vicuna.
206
+
207
+ # 7 Conclusion
208
+
209
+ In this work, we conduct a comprehensive investigation to the problem of VPG transferability across LLMs. We first explore the key factors for maximizing the transfer efficiency under the VPG transfer across different LLM sizes and types. Based on the key findings, we propose a novel two-stage transfer framework, namely VPGTrans, which can help to achieve comparable or better performance while significantly reducing the training costs. Moreover, a list of important findings and possible reasons behind them are shown and discussed. Finally, we demonstrate the practical value of our VPGTrans, by customizing new MLLMs via VPG transfer from existing MLLMs.
210
+
211
+ # Acknowledgments
212
+
213
+ This research is supported by ${ \mathrm { N E x T } } + +$ Lab, Singapore Ministry of Education Academic Research Fund Tier 2 under MOE’s official grant number T2EP20221-0023, and CCF-Baidu Open Fund.
214
+
215
+ # References
216
+
217
+ IEEE/CVF international conference on computer vision, pages 8948–8957, 2019.
218
+ [2] Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716–23736, 2022.
219
+ [3] Peter Anderson, Basura Fernando, Mark Johnson, and Stephen Gould. Spice: Semantic propositional image caption evaluation. In Computer Vision–ECCV 2016: 14th European Conference, Amsterdam, The Netherlands, October 11-14, 2016, Proceedings, Part V 14, pages 382–398. Springer, 2016.
220
+ [4] 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, pages 2425–2433, 2015.
221
+ [5] Yuntao Bai, Andy Jones, Kamal Ndousse, Amanda Askell, Anna Chen, Nova DasSarma, Dawn Drain, Stanislav Fort, Deep Ganguli, Tom Henighan, et al. Training a helpful and harmless assistant with reinforcement learning from human feedback. arXiv preprint arXiv:2204.05862, 2022.
222
+ [6] Andy Brock, Soham De, Samuel L Smith, and Karen Simonyan. High-performance large-scale image recognition without normalization. In International Conference on Machine Learning, pages 1059–1071. PMLR, 2021.
223
+ [7] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
224
+ [8] Sébastien Bubeck, Varun Chandrasekaran, Ronen Eldan, Johannes Gehrke, Eric Horvitz, Ece Kamar, Peter Lee, Yin Tat Lee, Yuanzhi Li, Scott Lundberg, et al. Sparks of artificial general intelligence: Early experiments with gpt-4. arXiv preprint arXiv:2303.12712, 2023.
225
+ [9] 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, pages 104–120. Springer, 2020.
226
+ [10] Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% *$ chatgpt quality, March 2023. URL https://vicuna.lmsys.org.
227
+ [11] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. PaLM: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
228
+ [12] 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.
229
+ [13] 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, 2023.
230
+ [14] Mingkai Deng, Jianyu Wang, Cheng-Ping Hsieh, Yihan Wang, Han Guo, Tianmin Shu, Meng Song, Eric P Xing, and Zhiting Hu. Rlprompt: Optimizing discrete text prompts with reinforcement learning. arXiv preprint arXiv:2205.12548, 2022.
231
+ [15] 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.
232
+ [16] Danny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, et al. PaLM-E: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023.
233
+ [17] 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. arXiv preprint arXiv:2304.15010, 2023.
234
+ [18] 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.
235
+ [19] Shaohan Huang, Li Dong, Wenhui Wang, Yaru Hao, Saksham Singhal, Shuming Ma, Tengchao Lv, Lei Cui, Owais Khan Mohammed, Qiang Liu, et al. Language is not all you need: Aligning perception with language models. arXiv preprint arXiv:2302.14045, 2023.
236
+ [20] Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 6700–6709, 2019.
237
+ [21] Andrew Jaegle, Felix Gimeno, Andy Brock, Oriol Vinyals, Andrew Zisserman, and Joao Carreira. Perceiver: General perception with iterative attention. In International conference on machine learning, pages 4651– 4664. PMLR, 2021.
238
+ [22] Menglin Jia, Luming Tang, Bor-Chun Chen, Claire Cardie, Serge Belongie, Bharath Hariharan, and Ser-Nam Lim. Visual prompt tuning. In Computer Vision–ECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23–27, 2022, Proceedings, Part XXXIII, pages 709–727. Springer, 2022.
239
+ [23] Ananya Kumar, Aditi Raghunathan, Robbie Jones, Tengyu Ma, and Percy Liang. Fine-tuning can distort pretrained features and underperform out-of-distribution. arXiv preprint arXiv:2202.10054, 2022.
240
+ [24] Brian Lester, Rami Al-Rfou, and Noah Constant. The power of scale for parameter-efficient prompt tuning. arXiv preprint arXiv:2104.08691, 2021.
241
+ [25] Brian Lester, Joshua Yurtsever, Siamak Shakeri, and Noah Constant. Reducing retraining by recycling parameter-efficient prompts. arXiv preprint arXiv:2208.05577, 2022.
242
+ [26] Bo Li, Yuanhan Zhang, Liangyu Chen, Jinghao Wang, Jingkang Yang, and Ziwei Liu. Otter: A multi-modal model with in-context instruction tuning. arXiv preprint arXiv:2305.03726, 2023.
243
+ [27] Juncheng Li, Kaihang Pan, Zhiqi Ge, Minghe Gao, Hanwang Zhang, Wei Ji, Wenqiao Zhang, Tat-Seng Chua, Siliang Tang, and Yueting Zhuang. Fine-tuning multimodal llms to follow zero-shot demonstrative instructions. arXiv preprint arXiv:2308.04152, 2023.
244
+ [28] Junnan Li, Ramprasaath Selvaraju, Akhilesh Gotmare, Shafiq Joty, Caiming Xiong, and Steven Chu Hong Hoi. Align before fuse: Vision and language representation learning with momentum distillation. Advances in neural information processing systems, 34:9694–9705, 2021.
245
+ [29] Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation. In International Conference on Machine Learning, pages 12888–12900. PMLR, 2022.
246
+ [30] Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. BLIP-2: Bootstrapping language-image pretraining with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023.
247
+ [31] Pandeng Li, Chen-Wei Xie, Hongtao Xie, Liming Zhao, Lei Zhang, Yun Zheng, Deli Zhao, and Yongdong Zhang. Momentdiff: Generative video moment retrieval from random to real. In Advances in neural information processing systems, 2023.
248
+ [32] Pandeng Li, Chen-Wei Xie, Liming Zhao, Hongtao Xie, Jiannan Ge, Yun Zheng, Deli Zhao, and Yongdong Zhang. Progressive spatio-temporal prototype matching for text-video retrieval. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 4100–4110, 2023.
249
+ [33] Dongze Lian, Daquan Zhou, Jiashi Feng, and Xinchao Wang. Scaling & shifting your features: A new baseline for efficient model tuning. arXiv preprint arXiv:2210.08823, 2022.
250
+ [34] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In Computer Vision–ECCV 2014: 13th European Conference, Zurich, Switzerland, September 6-12, 2014, Proceedings, Part V 13, pages 740–755. Springer, 2014.
251
+ [35] Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning, 2023.
252
+ [36] Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. Advances in neural information processing systems, 32, 2019.
253
+ [37] Kenneth Marino, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. OK-VQA: A visual question answering benchmark requiring external knowledge. In Proceedings of the IEEE/cvf conference on computer vision and pattern recognition, pages 3195–3204, 2019.
254
+ [38] Jacob Menick, Maja Trebacz, Vladimir Mikulik, John Aslanides, Francis Song, Martin Chadwick, Mia Glaese, Susannah Young, Lucy Campbell-Gillingham, Geoffrey Irving, et al. Teaching language models to support answers with verified quotes. arXiv preprint arXiv:2203.11147, 2022.
255
+ [39] Ron Mokady, Amir Hertz, and Amit H Bermano. Clipcap: Clip prefix for image captioning. arXiv preprint arXiv:2111.09734, 2021.
256
+ [40] Vicente Ordonez, Girish Kulkarni, and Tamara Berg. Im2text: Describing images using 1 million captioned photographs. Advances in neural information processing systems, 24, 2011.
257
+ [41] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730–27744, 2022.
258
+ [42] 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.
259
+ [43] 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.
260
+ [44] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. The Journal of Machine Learning Research, 21(1):5485–5551, 2020.
261
+ [45] Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pages 8821–8831. PMLR, 2021.
262
+ [46] Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical text-conditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
263
+ [47] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28, 2015.
264
+ [48] Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily L Denton, Kamyar Ghasemipour, Raphael Gontijo Lopes, Burcu Karagol Ayan, Tim Salimans, et al. Photorealistic text-toimage diffusion models with deep language understanding. Advances in Neural Information Processing Systems, 35:36479–36494, 2022.
265
+ [49] Mehdi SM Sajjadi, Daniel Duckworth, Aravindh Mahendran, Sjoerd van Steenkiste, Filip Pavetic, Mario Lucic, Leonidas J Guibas, Klaus Greff, and Thomas Kipf. Object scene representation transformer. Advances in Neural Information Processing Systems, 35:9512–9524, 2022.
266
+ [50] Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019.
267
+ [51] Yusheng Su, Xiaozhi Wang, Yujia Qin, Chi-Min Chan, Yankai Lin, Huadong Wang, Kaiyue Wen, Zhiyuan Liu, Peng Li, Juanzi Li, et al. On transferability of prompt tuning for natural language processing. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 3949–3969, 2022.
268
+ [52] Quan Sun, Yuxin Fang, Ledell Wu, Xinlong Wang, and Yue Cao. Eva-clip: Improved training techniques for clip at scale. arXiv preprint arXiv:2303.15389, 2023.
269
+ [53] 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.
270
+ [54] Maria Tsimpoukelli, Jacob L Menick, Serkan Cabi, SM Eslami, Oriol Vinyals, and Felix Hill. Multimodal few-shot learning with frozen language models. Advances in Neural Information Processing Systems, 34: 200–212, 2021.
271
+ [55] 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.
272
+ [56] 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.
273
+ [57] Jason Wei, Yi Tay, Rishi Bommasani, Colin Raffel, Barret Zoph, Sebastian Borgeaud, Dani Yogatama, Maarten Bosma, Denny Zhou, Donald Metzler, et al. Emergent abilities of large language models. arXiv preprint arXiv:2206.07682, 2022.
274
+ [58] 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.
275
+ [59] Qinghao Ye, Haiyang Xu, Guohai Xu, Jiabo Ye, Ming Yan, Yiyang Zhou, Junyang Wang, Anwen Hu, Pengcheng Shi, Yaya Shi, Chaoya Jiang, Chenliang Li, Yuanhong Xu, Hehong Chen, Junfeng Tian, Qian Qi, Ji Zhang, and Fei Huang. mplug-owl: Modularization empowers large language models with multimodality, 2023.
276
+ [60] 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.
277
+ [61] Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Learning to prompt for vision-language models. International Journal of Computer Vision, 130(9):2337–2348, 2022.
278
+ [62] 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.
279
+
280
+ # A Related Work
281
+
282
+ # A.1 Vision and Language Models
283
+
284
+ Vision and language models (VLMs) [50, 29, 32, 31] aim at understanding visual and textual information with a single model. Previously, the VLM mainly employs a pre-trained object detector as its feature extractor and conducts unsupervised training on a huge amount of image-text pairs. For example, VL-Bert [50], ViL-Bert [36] and Uniter [9] adopt Faster-RCNN [47] to extract image information into object features and take advantage of the masked language model as their pre-training task. Later, due to the prevalence of vision transformer (ViT), the VLM paradigm is turned into end-to-end training with a ViT as the visual encoder. The representative works include ALBEF [28], BLIP [29], and BEIT-v3 [56], which show the state-of-the-arts supervised training performance on a wide range of downstream tasks.
285
+
286
+ Recently, LLMs have shown their remarkable capability as zero/few-shot learners [7] and a series of emergent abilities [57] like in-context learning [7], and chain-of-thoughts reasoning [58]. A new paradigm, i.e., MLLMs is created by associating the VLM or pure vision encoders with LLMs. As we illustrated before, the VLM or visual encoders are typically able to convert the input vision signals into LLM-understandable soft prompts, and thus we call them VPG. The MLLMs advance in inheriting the great potentials of the backbone LLMs, and thus are capable of achieving excellent zero/few-shot performances [2, 30] on downstream tasks or be equipped with visual planning ability [16]. However, connecting the VPG to the existing LLMs with further tuning is costly. Even the BLIP-2 [30], targeted at efficient training, will take over 600 A100 GPU hours on over 100M image-text pairs for its largest model. With this regard, our proposed VPGTrans can effectively reduce the cost of building new MLLMs with the help of existing ones.
287
+
288
+ # A.2 Prompt Transfer
289
+
290
+ In this paper, we investigate the VPG transfer, where the soft prompt is to represent the content of specific inputs like images and videos. In addition to the content prompt, the more explored soft prompt is the task prompt [24, 61, 22], where a sequence of soft prompts are tuned to assist the pre-trained models to achieve better performance on specific tasks. There have already been some works exploring the transferability of task prompts. For example, Su et al. [51] conducts a series of experiments to illustrate the transferability across tasks and models. Specifically, Su et al. [51] find that the transfer between similar tasks is beneficial for training speed-up and better performance. Lester et al. [25] proposes to recycle soft prompts across models with vocab-to-vocab transformations, or linear-combination transformations. Note that our word converter initialization is similar to the idea of vocab-to-vocab transformations. However, we do not observe a zero-shot transfer in our experiments like them, which indicates a potential difference between the content prompts and task prompts. Another way of soft prompt transfer [14] is to conduct prompt tuning on discrete prompts, and thus the discrete prompts can be directly shared across models. Different from these task prompts transfer works, our VPG transfer scenario actually suffers from fewer limitations. For example, the task soft prompts transfer suffers from the dimension change problem, where the main body of the trainable parameters should be processed. However, our VPG (the main trainable parameters) can naturally be shared among LLMs with different embedding dimensions and leave the dimension change problem to a simple projector with ignorable parameters.
291
+
292
+ # B Extended Findings in Exploratory Analysis
293
+
294
+ In this section, we show extended findings of exploratory analysis (cf. §3.1).
295
+
296
+ • 1. Merely tuning the projector can not achieve the best performance. We want to clarify that merely tuning the projector is insufficient for achieving the best performance. Notably, as shown in Fig. 10, significant performance gaps are observed between the “only linear” (green curve) and “train from scratch” (orange curve) approaches for COCO caption and NoCaps. Therefore, if the goal is to build a multimodal conversation robot using carefully collected dialog data, training only the linear projector is insufficient to align with the provided data.
297
+
298
+ ![](images/33540963e9f2bd811dc970d5f78f00224ddc6d489b9621249332294a34459900.jpg)
299
+ Figure 10: Comparisons between i) inheriting VPG from $\mathrm { O P T } _ { 1 2 5 \mathrm { M } }$ and training it with randomly initialized projector for $\mathrm { O P T } _ { 3 5 0 \mathrm { M } }$ and ii) training VPG and randomly initialized projector for $\mathrm { O P T } _ { 3 5 0 \mathrm { M } }$ from scratch. iii) training only the projector.
300
+
301
+ ![](images/32f1e17321f3f1584e1644e783c867e1bde2b301cc63f5fd1793a651ad638427.jpg)
302
+ Figure 11: Interpreting generated soft prompts for $\mathrm { O P T } _ { 1 2 5 \mathrm { M } }$ with nearest words.
303
+
304
+ • 2. Word embedding converter can not replace a trained linear projector. As demonstrated in Fig. 11, we observe a common pattern: the last token of soft prompts is closest to EOS, while the middle tokens represent the image content. Such a phenomenon indicates a similarity between soft prompts and word embeddings. However, they are not identical. For instance, the norm of soft prompts is typically around 10 times the average norm of word embeddings. It is important to note that the linear projector initialization cannot replace the warm-up training. Using only the linear projector initialization even yields a random performance. We believe that a better understanding of how prompt works will further benefit the VPG’s transfer learning.
305
+
306
+ • 3. The projector warm-up is robust to a larger learning rate, while VPG can not. The first thing we want to clarify is that the 5 times normal learning rate will result in a training crash for VPG. Additionally, we find that although increasing the learning rate to 10 times in the projector warm-up does not yield any additional acceleration, the projector can converge without crashing during training.
307
+
308
+ # C Extended TaS Experiments
309
+
310
+ In this section, we first illustrate extending findings of TaS experiments (cf. $\ S 4 )$ . Then, we introduce the implementation details of scale-up experiments. We also plot a more complete version of Fig. 6 in Fig. 13.
311
+
312
+ # C.1 VPGTrans Enabling Stable Training under TaS
313
+
314
+ As we illustrated before, $\mathrm { F l a n T } 5 _ { \mathrm { l a r g e } }$ training is extremely unstable. Even when the learning rate is adjusted to one-tenth of its original value, the model does not converge or shows a very slow convergence rate after 4 epochs. However, we find that by lowering the learning rate for stage-2 training, our VPGTrans can achieve stable training on $\mathrm { F l a n T } 5 _ { \mathrm { l a r g e } }$ . We plot the performance curve of the COCO caption in Fig. 12.
315
+
316
+ # C.2 VPGTrans Enabling Training with Less Data under TaS
317
+
318
+ We empirically find that TaS can reduce the requirement for the amount of training data. By reducing the training data to only COCO, we find no obvious performance drop. However, we want to stress that the retained data should be of high quality, which means that if the same number of SBU data
319
+
320
+ ![](images/3e4dd23620bef89b02685655c6d2638d085099edb3dda84cf3da77d5e5a29fd1.jpg)
321
+ Figure 12: Comparison of training FlanT5 $\mathrm { l a r g e }$ using different methods.
322
+
323
+ Table 6: The speed-up rate of our VPGTrans compared with VPG inherit. The symbol "-" means VPGTrans can not achieve better performance than VPG inherit.
324
+
325
+ <table><tr><td>Transfer</td><td>COCO Caption</td><td>NoCaps</td><td>VQAv2</td><td>GQA</td><td>OKVQA</td></tr><tr><td>OPT125M→350M</td><td>1.1</td><td>2.7</td><td>10.0</td><td>6.0</td><td>6.0</td></tr><tr><td>OPT125M→1.3B</td><td>-</td><td>2.7</td><td>1</td><td>-</td><td>1</td></tr><tr><td>OPT350M→1.3B</td><td>1</td><td>1.7</td><td>1.0</td><td>2.0</td><td>1.0</td></tr><tr><td>OPT125M→2.7B</td><td>3.0</td><td>3.0</td><td>3.0</td><td>1.0</td><td>3.0</td></tr><tr><td>OPT350M→2.7B</td><td>3.3</td><td>4.5</td><td>1.0</td><td>1.0</td><td>1.0</td></tr><tr><td>OPT1.3B→2.7B</td><td>2.3</td><td>3.0</td><td>1</td><td>1</td><td>1</td></tr><tr><td>FlanT5base-→XL</td><td>1</td><td>1.0</td><td>1.8</td><td>9.0</td><td>0.4</td></tr></table>
326
+
327
+ is retained, the performance especially for captioning will drop. The conclusion can also be found in Table 4. We refer the readers to the next subsection for more details.
328
+
329
+ # C.3 Comparison between VPGTrans and VPG Inherit
330
+
331
+ As shown in Fig. 13, the green line (our VPGTrans) can be higher than the orange line (VPG inherit) for the majority of various conditions. Especially when considering the best performance of different tasks, our VPGTrans can achieve better performance than VPG inherit (non “-” in Table 6) for over $74 \%$ Transfer-Task variants. Moreover, among the variants that our VPGTrans can achieve better performance, our VPGTrans can also achieve a speed-up on $6 9 . 2 \%$ conditions.
332
+
333
+ # C.4 Scale-up Experiment Implementation Details
334
+
335
+ The scale-up experiment refers to the results in Table 4. We try to imitate BLIP-2’s pre-training data composition. First of all, two human-annotated datasets COCO and VG are used. SBU is also used. Then, BLIP-2 uses BLIP to generate captions for the 115M web images and rank them with CLIP ViT-L/14. We also adopt similar synthetic data from Laion-COCO.8 We report the concrete number of data we use in Table 4. For the stage-1 training, we keep the same as the previous validation experiments where COCO and SBU are used for warm-up with a 5 times the learning rate. Then, we use COCO, VG, and Laion-COCO for the stage-2 training. Note that we have tried to include Laion-COCO and VG for the stage-1 training, but found no obvious difference and thus use COCO and SBU for simplicity. For VL-Vicuna, to align with the conversation scenario, we further fine-tune our VL-Vicuna with MiniGPT-4’s self-instruct data, which is 3,439 image-text pairs.
336
+
337
+ ![](images/4392bb6f62287ea11fe623c93cb50e6fb2a414be6c70d57c54cdd18ec14375cf.jpg)
338
+ Figure 13: Comparison between different methods across 7 TaS variants on 5 tasks. Note that the model is directly evaluated after pre-training without further fine-tuning.
339
+
340
+ Table 7: Comparison between tuning only the projector (i.e. linear transfer) and the best results the VPGTrans achieve.
341
+
342
+ <table><tr><td rowspan="2">Transfer</td><td colspan="2">COCO Caption</td><td colspan="2">VQAv2</td></tr><tr><td>linear</td><td>best</td><td>linear</td><td>best</td></tr><tr><td>FlanT5base → OPT350M</td><td>110.8</td><td>136.5</td><td>40.4</td><td>44.2</td></tr><tr><td>FlanT5xL →OPT2.7B</td><td>132.1</td><td>139.3</td><td>50.4</td><td>50.3</td></tr><tr><td>OPT350M→FlanT5base</td><td>1.1</td><td>122.1</td><td>34.0</td><td>49.9</td></tr><tr><td>OPT2.7B→FlanT5xL</td><td>106.5</td><td>133.2</td><td>51.3</td><td>53.5</td></tr></table>
343
+
344
+ # D Extended TaT Experiments
345
+
346
+ In this section, we mainly illustrate extending findings of TaT experiments $( c f . \ \ S 5 )$ . We plot a more complete version of Fig. 8 in Fig. 14.
347
+
348
+ # D.1 Linear Transfer Gap between Different LLM’s Visual Prompts
349
+
350
+ As illustrated in Section 5.2, it is more difficult to transfer between two small LLMs with our VPGTrans due to the weaker linear transferability between two small LLMs’ visual prompts. To better support our results, we compare the results of tuning only the projector (i.e. linear transfer) and the best results the VPGTrans can achieve. As shown in Table 7, we can see that when conducting transfers between two large models $( \mathrm { O P T } _ { 3 5 0 \mathrm { M } }$ and ${ \mathrm { F l a n T } } 5 _ { \mathrm { b a s e } }$ ), the performance is typically far from the optimal results. However, when we transfer between $\mathrm { O P T } _ { 2 . 7 \mathrm { B } }$ and $\mathrm { F l a n T 5 } _ { \mathrm { X L } }$ , the linear performance is near to the optimal performance. There is a 25.7 points gap between $\mathrm { F l a n T 5 _ { b a s e } }$ $\mathrm { O P T } _ { 3 5 0 \mathrm { M } }$ ’s linear and best on COCO caption datasets but only 7.2 points gap between FlanT $5 _ { \mathrm { X L } }$ $ \mathrm { O P T } _ { 2 . 7 \mathrm { B } }$ ’s linear and best. If considering the transfer between the small to large LLMs under TaT, both the VPG’s visual perception ability and transfer gap should be considered. We leave the systematical exploration for future works.
351
+
352
+ # E Extended Results for MLLM Customization
353
+
354
+ We show more comparisons between VL-Vicuna and MiniGPT-4 in Fig. 15. We can see that our VL-Vicuna has better visual perception ability. For example, when MiniGPT-4 falsely recognizes the three people in the image as two in the first example, our VL-Vicuna can not only recognize the number of people but also tell their roles. Moreover, our VL-Vicuna can successfully link the vision content with external knowledge. In the third example, our VL-Vicuna can recognize Leonardo and link the content with his films like Titanic.
355
+
356
+ # F Potential Impact and Limitations
357
+
358
+ Our VPGTrans is designed for building new MLLMs with lower computational cost, i.e., shorter training time and less training data. With an already pre-trained MLLM, VPGTrans enables fast VPG transfer to build either a larger MLLM or a MLLM with a different type of LLM. We hope VPGTrans can facilitate teams in LLM communicty to customize their MLLMs with reduced cost. There are also possible limitations of the current version of VPGTrans. The first one is that our VPGTrans should rely on some already-aligned VPGs. The second potential limitation is that the VPGTrans-built MLLMs still suffer from the common problems of content generation AI systems [45, 46, 48, 7]. For example, the VL-Vicuna may make up some sentences with falsely recognized visual facts, like what is shown in Fig. 16. It is worth exploring associating our VPGTrans with training safer models [5, 41, 38].
359
+
360
+ ![](images/6b71e6150cb974ca3f4ff4a2b8513068f693caa29c5ead48ea547b61a244d464.jpg)
361
+ Figure 14: Comparison between different methods across 4 TaS variants on 5 tasks. Note that the model is directly evaluated after pre-training without further fine-tuning.
362
+
363
+ ![](images/782e3db48f255a657cbf6437cf9fcc5416f9d47fc7e9c50b97780d26130971cd.jpg)
364
+ Figure 15: Comparison between MiniGPT-4 and our VL-Vicuna.
365
+
366
+ ![](images/ca663ea28691202a79fd05df32d71dd60e6ff115c315efa2a9179c903804c7cf.jpg)
367
+ Figure 16: Failure cases of our VL-Vicuna.
md/dev/7UmjRGzp-A/7UmjRGzp-A.md ADDED
The diff for this file is too large to render. See raw diff
 
md/dev/8FhxBtXSl0/8FhxBtXSl0.md ADDED
The diff for this file is too large to render. See raw diff
 
md/dev/9U4gLR_lRP/9U4gLR_lRP.md ADDED
@@ -0,0 +1,439 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Logit Margin Matters: Improving Transferable Targeted Adversarial Attack by Logit Calibration
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Previous works have extensively studied the transferability of adversarial samples
11
+ 2 in untargeted black-box scenarios. However, it still remains challenging to craft
12
+ 3 the targeted adversarial examples with higher transferability than non-targeted
13
+ 4 ones. Recent studies reveal that the traditional Cross-Entropy (CE) loss function is
14
+ 5 insufficient to learn transferable targeted perturbations due to the issue of vanishing
15
+ 6 gradient. In this work, we provide a comprehensive investigation of the CE function
16
+ 7 and find that the logit margin between the targeted and non-targeted classes will
17
+ 8 quickly obtain saturated in CE, which largely limits the transferability. Therefore,
18
+ 9 in this paper, we devote to the goal of enlarging logit margins and propose two
19
+ 10 simple and effective logit calibration methods, which are achieved by downscale
20
+ 11 the logits with a temperature factor and an adaptive margin, respectively. Both of
21
+ 12 them can effectively encourage the optimization to produce larger logit margins and
22
+ 13 lead to higher transferability. Besides, we show that minimizing the cosine distance
23
+ 14 between the adversarial examples and the targeted classifier can further improve
24
+ 15 the transferability, which is benefited from downscale logits via L2-normalization.
25
+ 16 Experiments conducted on the ImageNet dataset validate the effectiveness of the
26
+ 17 proposed methods, which outperforms the state-of-the-art methods in black-box
27
+ 18 targeted attacks. The source code of our method is available at Link.
28
+
29
+ # 19 1 Introduction
30
+
31
+ 20 In the past decade, deep neural networks (DNNs) have achieved remarkable success in various
32
+ 21 fields, e.g., image classification [24], image segmentation [19], and object detection [23]. However,
33
+ 22 Goodfellow et al. [5] reveal that the DNNs are vulnerable to adversarial attacks, in which adding
34
+ 23 imperceptible disturbances to the input can lead the DNNs to make an incorrect prediction. Many
35
+ 24 following approaches [3, 4, 1, 27, 29] have been proposed to construct more destructive adversarial
36
+ 25 samples for investigating the vulnerability of the DNNs. [5, 18] also show that the adversarial samples
37
+ 26 are transferable across different networks, raising a more critical robustness threat under the black-box
38
+ 27 scenarios. Therefore, it is vital to explore the vulnerability of the DNNs, which is very useful for
39
+ 28 designing robust DNNs.
40
+ 29 Currently, most of the works [3, 29, 16, 10, 28, 6] have been devoted to the untargeted black-box
41
+ 30 attack, in which adversarial examples are crafted to fool unknown CNN models to predict unspecified
42
+ 31 incorrect labels. For example, [3, 29] leveraged input-level transformation or augmentation to
43
+ 32 improve the non-targeted transferability. [10] proposed a powerful intermediate feature-level attack.
44
+ 33 [28, 6] demonstrated that backpropagating more gradients through the skip-connections can increase
45
+ 34 the transferability. Despite the success in non-targeted cases, the targeted transferability remains
46
+ 35 challenging, which requires eliciting the black-box models into a pre-defined target category label.
47
+ 36 For learning the transferable adversarial samples in untargeted cases, most methods have leveraged
48
+ 37 the Cross-Entropy (CE) as the loss function. However, [15, 30] recently showed that the CE loss is
49
+ 38 insufficient for learning the adversarial perturbation in the targeted case due to the issue of vanishing
50
+ 39 gradient. To deal with this issue, [15] adopt the Poincaré distance to increase the gradient magnitude
51
+ 40 during the optimization adaptively. [30] demonstrated that an effortless logit loss equal to the negative
52
+ 41 value of the targeted logits could alleviate the gradient issue and achieve surprisingly strong targeted
53
+ 42 transferability. Besides, [30] also showed that optimizing with more iterations can significantly
54
+ 43 increase the targeted transferability. Although [30] demonstrated that continually enlarging the logits
55
+ 44 of the targeted class can improve the transferability of adversarial samples, it still does not thoroughly
56
+ 45 analyze the insufficient issue in the CE loss function.
57
+ 46 In this study, we take a closer look at the vanishing gradient issue in the CE and find that the
58
+ 47 logit margin between the targeted and non-targeted classes will quickly get saturated during the
59
+ 48 optimization (as shown in Fig. 1(a)). Moreover, this issue will influence the performance of the
60
+ 49 perturbations and thus essentially limit the transferability. Specifically, along with the training
61
+ 50 iterations in CE, we observe that the logits of the targeted and non-targeted classes increase rapidly in
62
+ 51 the first few iterations. However, after reaching the peak, the logit margin between the targeted and
63
+ 52 non-targeted classes will get saturated, and further training will decrease the logits simultaneously
64
+ 53 to maintain this margin. This phenomenon is mainly due to the fact that the softmax function in
65
+ 54 CE will approximately output the probability of the target class to 1 when reaching the saturated
66
+ 55 margin (e.g., 10). Thus, it raises the problem that the transferability will not be further increased even
67
+ 56 optimized with more iterations. While in practice, we are encouraged to increase the transferability
68
+ 57 by maximizing both the logit for the targeted class and its margin against other non-targeted classes
69
+ 58 to cross the decision boundaries of other black-box models.
70
+ 59 In this paper, we devote to enlarging logit margins to alleviate the above saturation issue in CE.
71
+ 60 Inspired by the temperature-scaling used in the knowledge distillation [8], a higher temperature $T$
72
+ 61 will produce a softer probability distribution over different classes. We firstly leverage this scaling
73
+ 62 technique into the targeted adversarial attack to calibrate the logits. Then the logits margin between
74
+ 63 the targeted and non-targeted classes will not be saturated after only a few iterations and will keep
75
+ 64 improving the transferability. On the other aspect, instead of using a constant $T$ , we further explored
76
+ 65 an adaptive margin-based calibration by scaling the logits based on the logit margin of the target
77
+ 66 class and the highest non-target class. In addition, we also investigate the effectiveness of calibrating
78
+ 67 the targeted logit into the unit length feature space by L2-normalization, which is equivalent to
79
+ 68 minimizing the angle between the adversarial examples and the targeted classifier.
80
+ 69 Finally, we conduct experiments on the ImageNet dataset to validate the effectiveness of the logits
81
+ 70 calibration for crafting transferable targeted adversarial examples. Experimental results demonstrated
82
+ 71 that the calibration of the logits helps achieve a higher attack success rate than other state-of-the-art
83
+ 72 methods. Additionally, we tested the logit calibration in Generative Adversarial Networks (GANs)-
84
+ 73 based TTP method [21] to train the target-class-specific generators, which is also beneficial for
85
+ 74 increasing the transferability in the resource-intensive method.
86
+
87
+ ![](images/e96218cb02dc106c275a988e1054a3bbc908b1934d9a6686f7a527c5558fafe6.jpg)
88
+ Figure 1: The average Top-3 logits and logit margin of 50 adversarial samples trained by the CrossEntropy, ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ and Logit loss functions for crafting the ResNet-50. ( $^ *$ Training and computation details of this figure are in Section 3.1)
89
+
90
+ # 75 2 Related Works
91
+
92
+ 76 In this section, we give a brief introduction of the related works from the following two aspects:
93
+ 77 untargeted black-box attacks and targeted attacks.
94
+
95
+ # 78 2.1 Untargetd Black-box Attacks
96
+
97
+ After [25] exposed the vulnerability of deep neural networks, many attack methods [29, 4] have been proposed to craft highly transferable adversaries in the non-targeted scenario. We first review several gradient-based attack methods that focus on enhancing the transferability against black-box models.
98
+
99
+ 2 Iterative-Fast Gradient Sign Method (I-FGSM) [14] is an iterative version of FGSM [5], which
100
+ 3 adds a small perturbation with a small step size $\alpha$ in the gradient direction iteratively:
101
+
102
+ $$
103
+ \begin{array} { r } { \hat { x } _ { 0 } = x , \quad \hat { x } _ { i + 1 } = \hat { x } _ { i } ^ { \prime } + \alpha \cdot \mathrm { s i g n } ( \nabla _ { \hat { x } } J ( \hat { x } _ { i } ^ { \prime } , y ) ) , } \end{array}
104
+ $$
105
+
106
+ where $\hat { x } _ { i } ^ { \prime }$ denotes the adversarial image in the $i _ { t h }$ iteration, $\alpha = \epsilon / T$ ensures the adversaries be constrained within an upper-bound perturbation $\epsilon$ through the $l _ { p }$ -norm when optimized by $T$ iterations.
107
+
108
+ Following the seminal I-FGSM [14], a series of methods have been proposed to improve the transferability of attacking black-box models from different aspects, e.g., gradient-based, input augmentationbased. For example, the Momentum Iterative-FGSM (MI-FGSM) [3] introduces a momentum term to compute the gradient of the I-FGSM, encouraging the perturbation is updated in a stable direction. The Translation Invariant-FGSM (TI-FGSM) [4] adopts a predefined kernel $W$ to convolve the gradient $\nabla _ { \boldsymbol { \hat { x } } } J ( \hat { x } _ { i } ^ { \prime } , y )$ at each iteration $t$ , which can approximated the average gradient over multiple randomly translated images of the input $\hat { x } _ { t }$ . On the other aspects, the Diverse Input-FGSM (DI-FGSM) leveraged the random resizing and padding to augmentation the input $\hat { x } _ { t }$ at each iteration. Currently, most targeted attack methods [15, 30, 21] simultaneously use the MI, TI and DI to form a strong baseline with better transferability.
109
+
110
+ # 2.2 Targeted Attacks
111
+
112
+ Targeted attacks are different from non-targeted attacks, which need to change the decision to a specific target class. [13] integrates the above non-targeted attack methods into targeted attacks to craft targeted adversarial examples. However, the performance is limited because it is insufficient to fool the black-box model only by maximizing the probability of the target class with the CE loss.
113
+
114
+ $\mathbf { P 0 + T r i p }$ [15] found the insufficiency is mainly due to vanishing gradient issue in CE. Then, [15] leverage dthe Poincaré space as the metric space and further utilized Triplet loss to improve targeted transferability by forcing adversarial example toward the target label and away from the ground-truth label. To further address this gradient issue, Logits [30] adopts a simple and straightforward idea by directly maximizing the target logit to pull the adversarial examples close to the target class, which can be expressed as:
115
+
116
+ $$
117
+ L _ { L o g i t } = - z _ { t } ( { \bf r } ^ { \prime } ) ,
118
+ $$
119
+
120
+ # where $z _ { t } ( \cdot )$ is the output logits of the target class.
121
+
122
+ 108 On the other hand, many studies employ resource-intensive approaches to achieve targeted attack,
123
+ 109 which train target class-specific models (auxiliary classifiers or generative models) on additional
124
+ 110 large-scale data. For example, the FDA methods [12, 11] used the intermediate feature distributions of
125
+ 111 CNNs to boost the targeted transferability by training class-specific auxiliary classifiers to model layer
126
+ 112 wise feature distributions. The GAP [22] trained a generative model for crafting targeted adversarial
127
+ 113 examples. Subsequently, [20] adopted a relativistic training objective to train the generative model
128
+ 114 for improving attack performance and cross-domain transferability. Recently, the TTP [21] utilized
129
+ 115 the global and local distribution matching for training target class-specific generators for obtaining
130
+ 116 high targeted transferability. However, the TTP requires actual data samples from the target class
131
+ 117 and brings expensive training costs. Different from the above methods, we introduce three simple
132
+ 118 and effective logit calibration methods into the CE loss function, which can achieve competitive
133
+ 119 performance without additional data and training.
134
+
135
+ # 20 3 Method
136
+
137
+ Problem Definition Given a white-box surrogate model $\mathbb { F } _ { s }$ and an input $x$ not from the targeted class $t$ , our primary goal is to learn an imperceptible perturbation $\delta$ that can fool the $\mathbb { F } _ { s }$ to output the target $t$ for ${ \hat { x } } = x + \delta$ . Besides, the prediction of $\hat { x }$ will also be $t$ when feeding to other unknown black-box surrogate models. The $l _ { \infty }$ -norm is usually used to constrained the $\delta$ within an upper-bound $\epsilon$ , denoted as $| | \bar { \delta } | | _ { \infty } \leq \epsilon$ .
138
+
139
+ 126 For the surrogate model $\mathbb { F } _ { s }$ , we denoted the feature for the final classification layer of the input $x$ as
140
+ 127 $\phi ( x )$ . The logit $z _ { i }$ of a category $i$ is computed by $z _ { i } = W _ { i } ^ { T } \phi ( x ) + b _ { i }$ , the $W _ { i }$ and $b _ { i }$ are the classifier
141
+ 128 weights and bias. The corresponding probability $p _ { i }$ after the softmax is $\begin{array} { r } { p _ { i } = \frac { e ^ { z _ { i } } } { \sum e ^ { z _ { j } } } } \end{array}$ .
142
+
143
+ # 129 3.1 Logit Margin
144
+
145
+ 130 When successfully attacked the $\mathbb { F } _ { s }$ , the logit $z _ { t }$ of the target class will be higher than the logits $z _ { n t }$ of
146
+ 131 any other non-target class in the classification task. Their logit margins can be computed by,
147
+
148
+ $$
149
+ G ( \phi ( \hat { x } ) ) = z _ { t } - z _ { n t } = W _ { t } ^ { T } \phi ( \hat { x } ) + b _ { t } - W _ { n t } ^ { T } \phi ( \hat { x } ) + b _ { n t } .
150
+ $$
151
+
152
+ 132 [15, 30] showed that it is insufficient to obtain transferable targeted adversarial samples that are only
153
+ 133 close to the target class while not away from true class and other non-targeted classes. Based on this
154
+ 134 property, it encourages us to continually enlarge this logit margin to increase the separation between
155
+ 135 the targeted and other non-targeted classes.
156
+ 136 To have a better understanding of the relationship between the logit margins and the targeted
157
+ 137 transferability, we visualize the average Top-3 logits (1 targeted class and other two non-targeted
158
+ 138 classes) of 50 random adversarial samples trained for crafted ResNet50 by the CE, ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ , and the
159
+ 139 Logit loss functions with MI, DI and TI following [30]. We also compute the average logit margin
160
+ 140 of the targeted class against the Top-20 non-targeted classes. The logit and margin are shown in
161
+ 141 Figure 1, and the transferability from ResNet50 to VGG16 is plot in Figure 2.
162
+ 142 From Figure 1, we can observe that the logits of the tar
163
+ 143 geted class and the Top-2 non-targeted classes increase
164
+ 144 rapidly in the first few iterations for the CE and ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$
165
+ 145 loss, as well as their logit margins. When reaching the
166
+ 146 peak, the margin is saturated, and the logits start to de
167
+ 147 crease simultaneously to maintain the saturated margin.
168
+ 148 By comparing the CE and ${ \mathrm { P o + T r i p } }$ , the $\mathrm { P o + }$ Trip needs
169
+ 149 fewer more iterations to reach the saturated status and
170
+ 150 thus shows a marginal better transferability than CE, as
171
+ 151 shown in Figure 2. In comparison, the Logit loss function
172
+ 152 will keep increasing the logits of the targeted category
173
+ 153 and the logit margin. Thus, the Logit loss function shows
174
+ 154 a much better targeted-attack success rate than CE and
175
+ 155 ${ \mathrm { P o } } { + } { \mathrm { T r i p } }$ . On the other hand, the Logit loss also signifi
176
+ 156 cantly increases the logits for other non-targeted classes.
177
+ 157 To further analyze why the CE loss function saturated
178
+ 158 to this logit margin and explore the effectiveness of in
179
+ 159 creasing the margin during training, in the following sections, we will revisit the cross-entropy loss
180
+ 160 function and introduce the logit calibration to achieve this goal.
181
+
182
+ ![](images/a47221b47a39cfd96ad4a99fa0446139363f57600042241e750142a1c7b73050.jpg)
183
+ Figure 2: The targeted attack success rate $( \% )$ on VGG-16 by using the ResNet-50 as the surrogate model.
184
+
185
+ # 161 3.2 Revisiting the Cross-Entropy Loss
186
+
187
+ 162 Firstly, our objective is to maximize the logit margin in Eq. 3. After computing the gradient w.r.t. to
188
+ 163 $\phi ( { \hat { x } } )$ , we can get
189
+
190
+ $$
191
+ \frac { \partial G } { \partial \phi ( x ) } = W _ { t } - W _ { n t } .
192
+ $$
193
+
194
+ 164 This gradient indicates that the adversarial feature $\phi ( { \hat { x } } )$ needs to move towards the target class while
195
+ 165 apart from those non-target classes. Next, we compute the gradient w.r.t. to $\phi ( { \hat { x } } )$ in the Cross-Entropy
196
+ 166 loss function
197
+
198
+ $$
199
+ L _ { C E } = - \log ( p _ { t } ) = - z _ { t } + \log ( \sum e ^ { z _ { k } } ) ,
200
+ $$
201
+
202
+ and get the gradient 167 $\frac { \partial L _ { c e } } { \partial \phi ( \hat { x } ) }$ as
203
+
204
+ $$
205
+ \begin{array} { r l } & { \displaystyle \frac { \partial L _ { c e } } { \partial \phi ( \hat { x } ) } = - \frac { \partial z _ { t } } { \partial \phi ( \hat { x } ) } + \frac { 1 } { \sum e ^ { z _ { k } } } \cdot \frac { \partial \sum e ^ { z _ { k } } } { \partial \phi ( \hat { x } ) } } \\ & { \quad \quad \quad = - \displaystyle \sum _ { \sum { e ^ { z _ { k } } } } e ^ { z _ { i } } \cdot \frac { \partial z _ { t } } { \partial \phi ( \hat { x } ) } + \frac { 1 } { \sum e ^ { z _ { k } } } \sum e ^ { z _ { i } } \frac { \partial z _ { i } } { \partial \phi ( \hat { x } ) } } \\ & { \quad \quad \quad = \displaystyle \sum \frac { e ^ { z _ { i } } } { \sum e ^ { z _ { k } } } \cdot ( \frac { \partial z _ { i } } { \partial \phi ( \hat { x } ) } - \frac { \partial z _ { t } } { \partial \phi ( \hat { x } ) } ) = \sum - p _ { i } ( W _ { t } - W _ { i } ) . } \end{array}
206
+ $$
207
+
208
+ 168 From Eq. 6, we actually can find the CE loss function is designed to adaptively optimize the $\phi ( { \hat { x } } )$
209
+ 169 towards $W _ { t }$ and away from other $W _ { i }$ . However, after being optimized for several iterations, the $p _ { i }$ of
210
+ 170 the non-targeted class will quickly approximate to 0 and then significantly vanish the $W _ { t } - W _ { i }$ .
211
+
212
+ 171 Let’s consider the case only with 2 classes ( $t$ and $n t$ ), we have the probabilities $p _ { t }$ and $p _ { n t }$ as:
213
+
214
+ $$
215
+ p _ { t } = \frac { e ^ { z _ { t } } } { e ^ { z _ { t } } + e ^ { z _ { n t } } } = \frac { 1 } { 1 + e ^ { - ( z _ { t } - z _ { n t } ) } } ,
216
+ $$
217
+
218
+ 172
219
+
220
+ $$
221
+ p _ { n t } = \frac { e ^ { z _ { n t } } } { e ^ { z _ { t } } + e ^ { z _ { n t } } } = \frac { 1 } { 1 + e ^ { ( z _ { t } - z _ { n t } ) } } .
222
+ $$
223
+
224
+ 173 As shown in Figure 3, the $p _ { t }$ will get close to 1 when $z _ { t } \mathrm { ~ - ~ } z _ { n t } \mathrm { ~ > ~ } 6$ (e.g., $p _ { n t } \approx 2 e ^ { - 9 }$ when
225
+ 174 $z _ { t } - z _ { n t } = 2 0 ,$ ). In such a context, the gradient will significantly vanish. Recall that, in the CE
226
+ 175 loss function (Figure 1 (a)), the logit margin between Top-1 and Top-2 logits first increases rapidly
227
+ 176 but will reach saturated status when approaching a certain value. This further indicates that the
228
+ 177 optimization of the CE loss function is largely restrained when the logit margin reaches a certain value.
229
+ 79 To this end, we raise the question $i f$ we explicitly enforce the
230
+ 80 optimization to enlarge the logit margin $( z _ { t } - z _ { n t } )$ , could we get
231
+ 81 better transferable targeted adversarial samples?
232
+
233
+ To answer this, we propose to downscale the $z _ { t } - z _ { n t }$ by a factor 3 $s$ in the CE and extent the informative optimization for more iterations. Since in such circumstance, $z _ { t } - z _ { n t }$ will be enlarger 5 by the factor $s$ . Specifically, suppose that the optimization will be 6 saturated when $z _ { t } - z _ { n t }$ reaches a certain value $v$ . Using $z _ { t } - z _ { n t }$ and $\frac { z _ { t } - z _ { n } { } _ { t } } { s }$ in the CE will both approach the saturated value of $v$ 8 Then, it is easy to infer that, for the latter case, $z _ { t } - z _ { n t }$ will be 9 $v \times s$ .
234
+
235
+ ![](images/ce2cfc4bd227088257b08b6c374d216162bfde1ee0f489f54a1d327a9d84406b.jpg)
236
+ Figure 3: The probability of $p _ { t }$ under different $z _ { t } - z _ { n t }$ .
237
+
238
+ # 3.3 Calibrating the Logits
239
+
240
+ To downscale the $z _ { t } ~ - ~ z _ { n t }$ during the optimization, we investigate three different types of logit calibrations in this study, i.e., Temperature-based, Margin-based, and Angle-based.
241
+
242
+ # 3.3.1 Temperature-based
243
+
244
+ Inspired by the Temperature-scaling used in the Knowledge distillation [8], our first logit calibration directly downscale the logits by a constant temperature factor $T$ ,
245
+
246
+ $$
247
+ \tilde { z } _ { i } = \frac { z _ { i } } { T } .
248
+ $$
249
+
250
+ 196 After introducing the $T$ , the probability distribution $\pmb { p }$ will be more softer over different classes. The
251
+ 197 corresponding gradient can be compute by:
252
+
253
+ $$
254
+ \frac { \partial L _ { c e } ^ { T } } { \partial \phi ( \hat { x } ) } = \frac { e ^ { z _ { j } / T } } { \sum e ^ { z _ { j } / T } } \cdot \frac { 1 } { T } ( \frac { \partial z _ { j } } { \partial x } - \frac { \partial z _ { t } } { \partial \hat { x } } ) = \sum - \hat { p _ { i } } \frac { ( W _ { t } - W _ { i } ) } { T } .
255
+ $$
256
+
257
+ 198 The $\hat { p _ { i } }$ will not quickly approach to 0 after only a few iterations.
258
+
259
+ 199 In Figure 4 (a)(b), we visualized the logits of using $T = 5$ and $T = 2 0$ . We can find that targeted
260
+ 200 logits and the logit margin will keep increasing as the same as the Logit in Figure 1. Meanwhile, the
261
+ 201 trend of $T = 2 0$ is very similar with the Logit [30] and we show that the Logit loss function can be
262
+ 202 considered as a special case of calibrating the logits with a large $T$ in the supplementary.
263
+
264
+ ![](images/81df7a69bc036ca48fc5edea2f337e97eee7ddc05fe4a28044bdfabedbed112c.jpg)
265
+ Figure 4: The average Top-3 logits and logit margin of 50 adversarial samples after the logit calibration for crafting the ResNet-50.
266
+
267
+ # 203 3.3.2 Margin-based
268
+
269
+ The previous Temperature-based logit calibration contains a hype-parameter $T$ , which could be different for different surrogate model $\mathbb { F } _ { s }$ . To migrate this issue, we further introduce an adaptive margin-based logit calibration. Specifically, we calibrate the logits by using the margin between the Top-2 logits in each iteration, denoted as:
270
+
271
+ $$
272
+ \tilde { z } _ { i } = \frac { z _ { i } } { \hat { z } _ { 1 } - \hat { z } _ { 2 } } ,
273
+ $$
274
+
275
+ 208 where $\hat { z } _ { 1 }$ and $\hat { z } _ { 2 }$ are the Top-1 and the Top-2 logit, respectively.
276
+
277
+ In this Margin-based logit calibration, we will enforce the209 $p _ { t }$ and $p _ { \hat { 1 } }$ of the Top-1 non-target class at 210 each iteration meet the following constraints:
278
+
279
+ 211
280
+
281
+ $$
282
+ p _ { t } = \frac { 1 } { 1 + \sum _ { i \neq t } e ^ { - ( \tilde { z } _ { t } - \tilde { z } _ { i } ) } } < \frac { 1 } { 1 + e ^ { - 1 } } ,
283
+ $$
284
+
285
+ $$
286
+ p _ { \hat { 1 } } = \frac { 1 } { e ^ { \tilde { z } _ { \hat { 1 } } - \tilde { z } _ { t } } + \sum _ { i \neq t } e ^ { \tilde { z } _ { i } - \tilde { z } _ { \hat { 1 } } } } > \frac { 1 } { N - 1 } ( 1 - \frac { 1 } { 1 + e ^ { - 1 } } ) .
287
+ $$
288
+
289
+ Then, it can adaptively deal with the vanishing gradient issue in the original CE loss function. The logits and the margin is shown in Figure 4 (c).
290
+
291
+ # 3.3.3 Angle-based
292
+
293
+ On the other aspect, different $W _ { t }$ usually has a different norm. To further alleviate the influence of various norms, we calibrate the logit into the feature space with unit length by L2-normalization, $\frac { W _ { i } ^ { T } \phi ( \hat { x } ) + b _ { i } } { | | W _ { i } | | | | \phi ( x ) | | }$ . If omit the $b _ { i }$ , this calibration is compute the $c o s ( \theta )$ between $\phi ( { \hat { x } } )$ and $W _ { i }$ , and we term it as angle-based calibration. Since, this angle-based calibration will bound each logit smaller than one. Instead of using the CE loss function, we directly minimize the angle between the $\phi ( { \hat { x } } )$ and the targeted $W _ { t }$ . The optimization loss function is:
294
+
295
+ $$
296
+ L _ { c o s i n e } = - \frac { W _ { t } ^ { T } \phi ( \hat { x } ) } { | | W _ { t } | | | \phi ( \hat { x } ) | | } .
297
+ $$
298
+
299
+ 21 The angle-based classifiers have been widely using in Face-Recognition task [17, 2]. In the experi
300
+ 22 ments, we evaluate the performance of using different logit calibrations and their mutual benefits.
301
+
302
+ # 4 Experiments
303
+
304
+ Experimental Setup In this section, we evaluate the effectiveness of logit calibration for improving transferable targeted adversarial attack. Following the recent study [30], we conduct the experiments on the difficult ImageNet-Compatible Dataset1. This dataset contains 1,000 images with 1,000 unique class labels corresponded to the ImageNet dataset. We implement our methods based on the source
305
+
306
+ Table 1: The targeted transfer success rates $( \% )$ in the single-model transfer scenario. (Results with 20/100/300 iterations are reported, and the highest one at 300 iterations is showed bold.)
307
+
308
+ <table><tr><td rowspan="2">Attack</td><td colspan="3">SurrogateModel:ResNet50</td><td colspan="3">Surrogate Model:Dense121</td></tr><tr><td>→Dense121</td><td>→VGG16</td><td>→Inc-v3</td><td>→Res50</td><td>→VGG16</td><td>→Inc-v3</td></tr><tr><td>CE</td><td>27.0/40.2/42.7</td><td>17.4/27.6/29.1</td><td>2.3/4.1/4.6</td><td>12.3/17.2/18.4</td><td>8.6/10.5/10.9</td><td>1.6/2.3/2.8</td></tr><tr><td>Po+Trip</td><td>27.9/51.2/54.8</td><td>17.9/35.5/34.7</td><td>3.2/6.8/7.8</td><td>11.0/14.8/15.0</td><td>7.3/9.2/8.6</td><td>1.6/2.8/2.8</td></tr><tr><td>Logit</td><td>31.4/64.0/71.8</td><td>23.8/55.0/62.4</td><td>3.1/8.6/10.9</td><td>17.4/38.6/43.5</td><td>13.7/33.8/37.8</td><td>2.3/6.6/7.5</td></tr><tr><td>T=5</td><td>33.3/69.9/77.8</td><td>24.8/59.9/66.1</td><td>3.1/9.4/12.2</td><td>19.3/43.4/47.5</td><td>14.6/36.6/39.4</td><td>2.3/7.3/8.8</td></tr><tr><td>T=10</td><td>31.6/68.5/77.0</td><td>23.6/58.5/66.4</td><td>2.8/9.4/11.6</td><td>17.9/43.2/49.3</td><td>13.4/36.8/41.5</td><td>2.2/7.7/8.8</td></tr><tr><td>Margin</td><td>33.3/65.8/76.5</td><td>23.1/58.6/65.7</td><td>3.0/9.5/12.2</td><td>18.8/42.8/47.2</td><td>14.5/36.5/41.4</td><td>2.5/7.7/9.4</td></tr><tr><td>Angle</td><td>38.9/72.5/77.2</td><td>29.2/60.7/65.2</td><td>4.4/10.7/11.1</td><td>20.6/43.2/47.8</td><td>16.5/35.7/39.3</td><td>3.0/7.7/8.9</td></tr><tr><td rowspan="2">Attack</td><td colspan="3">Surrogate Model: VGG16</td><td colspan="3">Surrogate Model: Inc-v3</td></tr><tr><td>→Res50</td><td>→Dense121</td><td>→Inc-v3</td><td>→Res50</td><td>→Dense121</td><td>→VGG16</td></tr><tr><td>CE</td><td>0.5/0.3/0.6</td><td>0.6/0.3/0.3</td><td>0/0/0.1</td><td>0.7/1.2/1.8</td><td>0.6/1.3/1.9</td><td>0.4/0.8/1.3</td></tr><tr><td>Po+Trip</td><td>0.7/0.6/0.7</td><td>0.7/0.6/0.5</td><td>0.1/0.1/0.1</td><td>1.0/1.6/1.7</td><td>0.6/1.7/2.5</td><td>0.7/1.2/1.8</td></tr><tr><td>Logit</td><td>3.4/9.9/11.6</td><td>3.5/12.0/13.9</td><td>0.3/1.0/1.3</td><td>0.6/1.1/2.0</td><td>0.6/1.9/3.0</td><td>0.6/1.5/2.8</td></tr><tr><td>T=5</td><td>3.1/7.0/6.9</td><td>3.3/7.6/7.8</td><td>0.2/0.9/0.8</td><td>0.7/1.7/2.1</td><td>0.5/1.9/3.3</td><td>0.4/1.6/2.6</td></tr><tr><td>T=10</td><td>3.6/9.0/9.7</td><td>3.4/10.5/11.7</td><td>3.2/1.1/1.3</td><td>0.5/1.3/1.9</td><td>0.6/2.0/2.7</td><td>0.4/1.5/2.8</td></tr><tr><td>Margin</td><td>3.3/10.3/12.0</td><td>3.5/12.5/14.5</td><td>0.3/1.1/1.3</td><td>0.5/1.4/1.7</td><td>0.7/2.1/3.1</td><td>0.5/1.7/2.7</td></tr><tr><td>Angle</td><td>0.4/0.7/0.5</td><td>0.6/0.4/0.5</td><td>0/0/0.1</td><td>0.8/1.8/2.6</td><td>0.8/2.2/3.0</td><td>0.9/1.7/2.4</td></tr></table>
309
+
310
+ 228 code2 provided by the Logit [30]. The same four diverse CNN models are used for evaluation, i.e.,
311
+ 229 ResNet-50 [7], DenseNet-121 [9], VGG-16 with Batch Normalization [24] and Inception-v3 [26].
312
+ 230 The perturbation is bounded by $L _ { \infty } \leq 1 6$ . The TI [4], MI [3] and DI [29] were used for all attacks,
313
+ 231 and $| | W | | _ { 1 } = 5$ is set for TI. The I-FSGM is adopted for optimization with the $\alpha = 2$ . The attacks
314
+ 232 are trained for 300 iterations on a NVIDIA-2080 Ti GPU. We run all the experiments for 5 times, and
315
+ 233 report the average targeted transfer success rates $( \% )$ . More experimental results can be found in the
316
+ 234 supplementary.
317
+
318
+ # 4.1 Comparison with Other Methods in Single-Model Transfer
319
+
320
+ We first compare the proposed (temperature-based, margin-based and angle-based) logit calibrations with the original CE, ${ \mathrm { P o + T r i p } }$ [15], and Logit [30] in the single-model transfer task. In this task, we take one surrogate model for training, and test the targeted transferability in attacking other 3 models.
321
+
322
+ As shown in Table 1, the original CE loss function produces a worst performance than the ${ \mathrm { P o + T r i p } }$ and Logit. But after performing the logit calibration in the CE loss function, we can find a significant performance boost compared with the original CE. All the calibration methods can outperform the Logit, especially when using the ResNet50 and Dense121 as the surrogate. These results indicate that the logit margin can significantly influence the performance of the targeted transferability. On the other aspect, we find that $T = 1 0$ has better performance than $T = 5$ on the VGG-16, suggesting that different models may need different $T$ . Instead of finding the best $T$ for a different model, the Margin-based calibration can solve the issue and reach the overall best transferability in all four models. However, we find that the Angle-based calibration is not working on the VGG16, which needs further investigation.
323
+
324
+ # 49 4.2 The Influence of Different $T$ in CE
325
+
326
+ In this section, we evaluate the influence of using different T in the CE loss function. The results are reported in Table 2. From the Table, we can have the following observations. 1) The scaling factor $T$ has a significant influence on the targeted transferability. Specifically, there is a large decrease in performance when using a small $T = 0 . 5$ . After increasing the $T$ , we can observe the number of successfully attacked samples will increase. 2) The optimal $T$ for different model is different. For example, $T = 5$ can produce the overall best performance for ResNet50, Dense121, and Inception v3, while the VGG16 with fewer convolutional layers requires a large $T$ to obtain better transferability. 3) The performance are comparable when using $T = 5$ and $T = 1 0$ for ResNet50, Dense121, and Inception v3. This is because that we use I-FSGM for optimization, which only considers the sign of the gradients. 4) Using a larger $T$ , the performance will be similar to the Logit loss function (see Table 1). We provide a deep analysis of this phenomenon in the supplementary material.
327
+
328
+ Table 2: The targeted transfer success rates $( \% )$ by using different $T$ in CE loss function. (Results with 20/100/300 iterations are reported.)
329
+
330
+ <table><tr><td rowspan="2">Attack</td><td colspan="3">Surrogate Model: ResNet50</td><td colspan="3">Surrogate Model: Dense121</td></tr><tr><td>→Dense121</td><td>→VGG16</td><td>→Inc-v3</td><td>→Res50</td><td>→VGG16</td><td>→Inc-v3</td></tr><tr><td>T=0.5</td><td>13.2/16.0/19.5</td><td>7.1/9.5/11.0</td><td>1.2/1.8/2.4</td><td>4.2/5.0/6.2</td><td>2.5/3.5/3.2</td><td>0.6/0.9/1.1</td></tr><tr><td>T=1</td><td>27.0/40.2/42.7</td><td>17.4/27.6/29.1</td><td>2.3/4.1/4.6</td><td>12.3/17.2/18.4</td><td>8.6/10.5/10.9</td><td>1.6/2.3/2.8</td></tr><tr><td>T=2</td><td>34.2/62.8/67.7</td><td>24.4/52.3/53.9</td><td>3.3/7.2/8.5</td><td>18.7/35.0/36.1</td><td>13.2/27.3/27.0</td><td>2.2/5.5/6.1</td></tr><tr><td>T=5</td><td>33.3/69.9/77.8</td><td>24.8/59.9/66.1</td><td>3.1/9.4/12.2</td><td>19.3/43.4/47.5</td><td>14.6/36.6/39.4</td><td>2.3/7.3/8.8</td></tr><tr><td>T=10</td><td>31.6/68.5/77.0</td><td>23.6/58.5/66.4</td><td>2.8/9.4/11.6</td><td>17.9/43.2/49.3</td><td>13.4/36.8/41.5</td><td>2.2/7.7/8.8</td></tr><tr><td>T=20</td><td>30.4/65.6/74.3</td><td>22.9/55.4/63.6</td><td>3.2/9.0/11.6</td><td>17.6/40.3/46.2</td><td>13.4/35.4/40.1</td><td>2.3/6.7/8.7</td></tr><tr><td rowspan="2">Attack</td><td colspan="3">Surrogate Model: VGG16</td><td colspan="3">Surrogate Model: Inc-v3</td></tr><tr><td>→Res50</td><td>→Dense121</td><td>→Inc-v3</td><td>→Res50</td><td>→Dense121</td><td>→VGG16</td></tr><tr><td>T=0.5</td><td>0.2/0.1/0.2</td><td>0.1/0.1/0.1</td><td>0/0/0</td><td>0.3/0.9/0.9</td><td>0.3/0.8/1.4</td><td>0.3/0.6/1.3</td></tr><tr><td>T=1</td><td>0.5/0.3/0.6</td><td>0.6/0.3/0.3</td><td>0/0/0.1</td><td>0.7/1.2/1.8</td><td>0.6/1.3/1.9</td><td>0.4/0.8/1.3</td></tr><tr><td>T=2</td><td>1.6/1.8/1.8</td><td>1.8/1.9/1.6</td><td>0.2/0.2/0.2</td><td>0.6/1.5/2.0</td><td>0.4/1.7/2.2</td><td>0.5/1.2/2.0</td></tr><tr><td>T=5</td><td>3.1/7.0/6.9</td><td>3.3/7.6/7.8</td><td>0.2/0.9/0.8</td><td>0.7/1.7/2.1</td><td>0.5/1.9/3.3</td><td>0.4/1.6/2.6</td></tr><tr><td>T=10</td><td>3.6/9.0/9.7</td><td>3.4/10.5/11.7</td><td>0.3/1.1/1.3</td><td>0.5/1.3/1.9</td><td>0.6/2.0/2.7</td><td>0.4/1.5/2.8</td></tr><tr><td>T=20</td><td>3.4/9.7/11.1</td><td>3.6/12.7/13.8</td><td>0.3/1.2/1.3</td><td>0.5/1.4/2.3</td><td>0.6/1.8/3.1</td><td>0.5/1.6/2.4</td></tr></table>
331
+
332
+ # 261 4.3 The Targeted Success rates for Transfer with Varied Targets
333
+
334
+ In Table 3, we report the result of a worse-case transfer scenario by gradually varying the target class from the highest-ranked to the lowest one, and have the following findings: 1) The three types of logit calibration methods can improve the targeted transfer success rate over the original CE. The angle-based calibration has the best performance. But, we notice that the margin-based calibration doesn’t work well in this setting. 2) The Temperature-based $\scriptstyle \mathrm { T } = 5 / 1 0$ ) and the Angle-based calibrations can outperform the Logit loss by a large margin, especially the Angle-based calibration.
335
+
336
+ # 4.4 The Mutual Benefits of Different Calibration Methods
337
+
338
+ In this part, we evaluate the mutual benefits of combining different calibrations and can have the following findings. 1) Combining the $\mathrm { T } { = } 5 / 1 0 / 2 0$ and Margin, there is no increase in performance compared with using one of them. This is because that the gradient directions of these two methods are very similar. 2) Combining the $\mathrm { T } { = } 5$ and Angle, we can observe a further improvement when using ResNet50 and Dense121 as the surrogate model, e.g., the transferable rate of “ResNet $5 0 $ Dense121” is increased to $8 2 . 4 \%$ with 300 iterations. Since the Angle obtains poor performance on
339
+
340
+ Table 3: Targeted transfer success rate $( \% )$ when varying the target from the high-ranked class to low.
341
+
342
+ <table><tr><td></td><td>2nd 10th 200th</td><td>500th</td><td>800th</td><td>1000th</td></tr><tr><td>Logit</td><td>83.7 83.2</td><td>74.5 71.5</td><td>64.9</td><td>52.4</td></tr><tr><td>CE</td><td>77.4 58.6</td><td>26.9 23.7</td><td>16.7</td><td>7.0</td></tr><tr><td>CE/5</td><td>91.3 88.7</td><td>77.1 75.8</td><td>70.1</td><td>58.8</td></tr><tr><td>CE/10</td><td>89.0 87.8</td><td>81.0 79.2</td><td>73.5</td><td>62.5</td></tr><tr><td>Margin</td><td>87.4 81.7</td><td>61.3 51.6</td><td>43.1</td><td>23.0</td></tr><tr><td>Angle</td><td>92.4 89.1</td><td>80.3 79.2</td><td>76.1</td><td>66.3</td></tr></table>
343
+
344
+ VGG16, the transferable rates of corresponding combinations are also low in $_ { \mathrm { T = 5 / 1 0 + . } }$ Angle, but ${ \mathrm { T } } { = } 2 0 { + } .$ Angle can deal with this issue. 3) Combining the Margin and Angle, there are only slight improvements on ResNet50 and Dense121, while it can alleviate the negative effects caused by the angle-based calibration. Finally, by jointly considering the results in Table 1, 2 and 4, we suggest using $\mathrm { T } { = } 5 +$ Angle for CNNs with more layers and the single Margin-based calibration for CNNs with fewer layers to achieve better targeted transfer attack.
345
+
346
+ # 4.5 Comparison with The TTP Method
347
+
348
+ In this section, we further evaluate the proposed temperature-based logit calibration in the GAN-based targeted attacks. Following the setting in TTP [21], we sampled 50K images from the ImageNet training set and 50K images from the Painting dataset3, which are used to train the targeted generators from different source domains. Instead of using the distribution matching and neighborhood similarity matching loss [21], we only use the cross-entropy function for training the targeted generators while keeping other settings identical. More training and evaluation details used by TTP can be referred to [21]. We used the ResNet50 as the surrogate model and reported the results in Table 5.
349
+
350
+ Table 4: The comparison of combining logit calibrations. (The targeted transfer success rates $( \% )$ with 20/100/300 iterations are reported.)
351
+
352
+ <table><tr><td rowspan="2">Attack</td><td colspan="3">Surrogate Model:ResNet50</td><td colspan="3">Surrogate Model: Dense121</td></tr><tr><td>→Dense121</td><td>→VGG16</td><td>→Inc-v3</td><td>→Res50</td><td>→VGG16</td><td>→Inc-v3</td></tr><tr><td>T=5+Margin</td><td>33.8/69.8/77.2</td><td>24.0/59.0/65.5</td><td>3.3/9.6/11.1</td><td>19.3/44.3/47.8</td><td>14.1/37.7/40.8</td><td>2.5/7.5/9.4</td></tr><tr><td>T=5 + Angle</td><td>34.5/74.3/82.4</td><td>25.6/66.5/72.2</td><td>3.6/10.5/13.1</td><td>20.3/52.7/61.9</td><td>15.8/45.0/53.6</td><td>2.3/9.2/12.7</td></tr><tr><td>T=10+Margin</td><td>32.7/69.5/77.3</td><td>22.8/59.4/66.3</td><td>12.9/9.7/11.5</td><td>18.3/44.1/49.1</td><td>13.7/36.9/41.6</td><td>2.4/8.3/9.2</td></tr><tr><td>T=10+ Angle</td><td>33.0/69.8/79.1</td><td>24.4/59.0/68.9</td><td>3.4/10.0/12.9</td><td>19.4/47.2/56.1</td><td>14.8/40.1/47.0</td><td>2.5/8.3/11.0</td></tr><tr><td>T=20+Margin</td><td>33.0/69.2/76.2</td><td>23.1/58.4/65.8</td><td>3.2/9.5/11.8</td><td>19.1/43.4/48.5</td><td>13.9/36.7/41.4</td><td>2.4/7.8/9.5</td></tr><tr><td>T=20 +Angle</td><td>34.2/68.6/76.5</td><td>24.7/58.7/66.6</td><td>3.4/9.7/12.7</td><td>20.0/44.4/50.9</td><td>15.5/38.4/43.7</td><td>2.5/8.2/9.5</td></tr><tr><td>Margin+Angle</td><td>34.4/70.8/78.1</td><td>24.3/60.2/67.4</td><td>3.5/10.4/12.6</td><td>19.9/46.6/52.7</td><td>15.2/39.3/44.5</td><td>2.7/8.2/9.9</td></tr><tr><td rowspan="2">Attack</td><td colspan="3">Surrogate Model: VGG16</td><td colspan="3">Surrogate Model: Inc-v3</td></tr><tr><td>→Res50</td><td>→Dense121</td><td>→Inc-v3</td><td>→Res50</td><td>→Dense121</td><td>→VGG16</td></tr><tr><td>T=5+Margin</td><td>3.5/10.2/11.4</td><td>3.7/12.4/14.6</td><td>0.3/1.1/1.3</td><td>0.5/1.4/1.6</td><td>0.6/2.1/2.9</td><td>0.5/1.7/2.8</td></tr><tr><td>T=5 +Angle</td><td>2.2/2.5/2.3</td><td>2.4/2.6/2.3</td><td>0.2/0.1/0.2</td><td>0.5/1.6/2.4</td><td>0.6/2.0/3.1</td><td>0.5/1.7/2.5</td></tr><tr><td>T=10+Margin</td><td>3.2/10.7/11.7</td><td>3.4/12.9/15.0</td><td>0.2/1.0/1.4</td><td>0.5/1.4/1.9</td><td>0.5/1.9/3.0</td><td>0.3/1.5/2.3</td></tr><tr><td>T=10 + Angle</td><td>3.4/6.2/5.1</td><td>3.5/7.5/7.0</td><td>0.2/0.6/0.6</td><td>0.6/1.3/1.9</td><td>0.6/2.0/3.2</td><td>0.5/1.6/2.6</td></tr><tr><td>T=20+Margin</td><td>3.5/10.1/11.8</td><td>3.4/12.0/14.9</td><td>0.3/1.2/1.4</td><td>0.6/1.2/1.9</td><td>0.5/1.9/2.9</td><td>0.5/1.6/2.7</td></tr><tr><td>T=20 + Angle</td><td>3.2/9.7/10.1</td><td>3.9/11.9/13.3</td><td>0.3/1.0/1.2</td><td>0.6/1.6/2.0</td><td>0.6/2.0/3.5</td><td>0.5/1.7/2.9</td></tr><tr><td>Margin+Angle</td><td>3.3/9.8/11.1</td><td>3.5/12.6/14.6</td><td>0.3/1.2/1.4</td><td>0.6/1.4/2.0</td><td>0.6/1.7/3.1</td><td>0.5/1.5/2.6</td></tr></table>
353
+
354
+ Table 5: Comparison with TTP [21] on Target Transferablity. The averaged Top-1 targeted accuracy $( \% )$ across 10 targets are computed with 49.95K ImageNet validation samples. Perturbation budget: $l _ { \infty } \leq 1 6$ . \* indicates the training surrogate model.
355
+
356
+ <table><tr><td>Dataset</td><td>Loss</td><td>ResNet50*</td><td>VGG19 BN</td><td>Dense121</td><td>ResNet152</td><td>WRN-50-2</td><td>Average</td></tr><tr><td rowspan="3">ImageNet</td><td>TTP</td><td>97.02*</td><td>78.15</td><td>81.64</td><td>80.56</td><td>78.25</td><td>83.12</td></tr><tr><td>CE</td><td>97.15*</td><td>70.44</td><td>78.96</td><td>76.22</td><td>78.24</td><td>80.20</td></tr><tr><td>CE(T=5)</td><td>99.18*</td><td>86.65</td><td>90.55</td><td>90.30</td><td>93.22</td><td>91.98</td></tr><tr><td rowspan="2">Painting</td><td>TTP</td><td>96.63*</td><td>73.09</td><td>84.76</td><td>76.27</td><td>75.92</td><td>81.33</td></tr><tr><td>CE (T=5)</td><td>98.95*</td><td>82.97</td><td>87.07</td><td>87.81</td><td>91.70</td><td>89.70</td></tr></table>
357
+
358
+ 295 From Table 5, we make the following findings. 1) By using ImageNet as the training dataset, the TTP
359
+ 296 shows better transferability than the CE in attacking other black-box models. The average targeted
360
+ 297 accuracy of TTP is around $3 \%$ higher than that of CE. 2) After downscale the logit by 5 in the CE loss
361
+ 298 function (CE $\left( \mathrm { T } { = } 5 \right)$ ), we can observe a significant boost of the Top-1 targeted accuracy for all models,
362
+ 299 reaching the average targeted accuracy of $9 1 . 9 8 \%$ (ImageNet). 3) For both ImageNet and Painting
363
+ 300 as the training source, the CE $( \mathrm { T } { = } 5 )$ can surpass the TTP by a large margin $( 9 1 . 9 8 \%$ vs. $8 3 . 1 2 \%$ &
364
+ 301 $8 9 . 7 0 \%$ vs. $8 1 . 3 3 \%$ ). These experimental results demonstrate that the proposed temperate-based logit
365
+ 302 calibration is also effective in training generator-based targeted attackers. Note that, compared to
366
+ 303 TPP, our logit calibration has the benefit of without using any data from the target class.
367
+
368
+ # 304 5 Conclusion
369
+
370
+ In this study, we analyzed the logit margin in different loss functions for the transferable targeted attack, and find that the margin will quickly get saturated in the CE loss and thus limited the transferablity. To deal with this issue, we introduce to use logit calibrations in the CE loss function, including Temperature-based, Margin-based, and Angle-based. Experimental results verified the effectiveness of using the logit calibration in the CE loss function for crafting transferable targeted adversarial samples. The proposed logit calibration methods are simple and easy to implement, which can achieve state-of-the-art performance in transferable targeted attack.
371
+
372
+ Potential Social Impact. Our findings in targeted transfer attacks can potentially motivate the AI community to design more robust defenses against transferable attacks. In the long run, it may also be directly used for suitable social applications, such as protecting privacy. Contrariwise, some applications may use targeted transferable attacks in a harmful manner to damage the outcome of AI systems, especially in scenarios of speech recognition and facial verification systems. Finally, we firmly believe that our investigation in this study can provide valuable insight for future researchers by using the logit calibration for both adversarial attack and defense.
373
+
374
+ References
375
+ [1] Jeremy Cohen, Elan Rosenfeld, and Zico Kolter. Certified adversarial robustness via randomized smoothing. In ICML, 2019.
376
+ [2] Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. Arcface: Additive angular margin loss for deep face recognition. In CVPR, 2019.
377
+ [3] Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In CVPR, 2018.
378
+ [4] Yinpeng Dong, Tianyu Pang, Hang Su, and Jun Zhu. Evading defenses to transferable adversarial examples by translation-invariant attacks. In CVPR, 2019.
379
+ [5] Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In ICLR, 2015.
380
+ [6] Yiwen Guo, Qizhang Li, and Hao Chen. Backpropagating linearly improves transferability of adversarial examples. In NeurIPS, 2020.
381
+ [7] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
382
+ [8] Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network (2015). arXiv preprint arXiv:1503.02531, 2015.
383
+ [9] Gao Huang, Zhuang Liu, Laurens Van Der Maaten, and Kilian Q Weinberger. Densely connected convolutional networks. In CVPR, 2017.
384
+ [10] Qian Huang, Isay Katsman, Horace He, Zeqi Gu, Serge Belongie, and Ser-Nam Lim. Enhancing adversarial example transferability with an intermediate level attack. In CVPR, 2019.
385
+ [11] Nathan Inkawhich, Kevin Liang, Binghui Wang, Matthew Inkawhich, Lawrence Carin, and Yiran Chen. Perturbing across the feature hierarchy to improve standard and strict blackbox attack transferability. NeruIPS, 2020.
386
+ [12] Nathan Inkawhich, Kevin J Liang, Lawrence Carin, and Yiran Chen. Transferable perturbations of deep feature distributions. arXiv preprint arXiv:2004.12519, 2020.
387
+ [13] Alexey Kurakin, Ian Goodfellow, and Samy Bengio. Adversarial machine learning at scale. arXiv preprint arXiv:1611.01236, 2016.
388
+ [14] Alexey Kurakin, Ian J Goodfellow, and Samy Bengio. Adversarial examples in the physical world. In Artificial intelligence safety and security, pages 99–112. Chapman and Hall/CRC, 2018.
389
+ [15] Maosen Li, Cheng Deng, Tengjiao Li, Junchi Yan, Xinbo Gao, and Heng Huang. Towards transferable targeted attack. In CVPR, 2020.
390
+ [16] Jiadong Lin, Chuanbiao Song, Kun He, Liwei Wang, and John E Hopcroft. Nesterov accelerated gradient and scale invariance for adversarial attacks. 2020.
391
+ [17] Weiyang Liu, Yandong Wen, Zhiding Yu, Ming Li, Bhiksha Raj, and Le Song. Sphereface: Deep hypersphere embedding for face recognition. In CVPR, 2017.
392
+ [18] Yanpei Liu, Xinyun Chen, Chang Liu, and Dawn Song. Delving into transferable adversarial examples and black-box attacks. In ICLR, 2016.
393
+ [19] Jonathan Long, Evan Shelhamer, and Trevor Darrell. Fully convolutional networks for semantic segmentation. In CVPR, 2015.
394
+ [20] Muhammad Muzammal Naseer, Salman H Khan, Muhammad Haris Khan, Fahad Shahbaz Khan, and Fatih Porikli. Cross-domain transferability of adversarial perturbations. NeurIPS, 2019.
395
+ [21] Muzammal Naseer, Salman Khan, Munawar Hayat, Fahad Shahbaz Khan, and Fatih Porikli. On generating transferable targeted perturbations. In ICCV, 2021.
396
+ [22] Omid Poursaeed, Isay Katsman, Bicheng Gao, and Serge Belongie. Generative adversarial perturbations. In CVPR, 2018.
397
+ [23] Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. NeurIPS, 2015.
398
+ [24] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
399
+ [25] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, 2015.
400
+ [26] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016.
401
+ [27] Florian Tramèr, Alexey Kurakin, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick McDaniel. Ensemble adversarial training: Attacks and defenses. In ICLR, 2018.
402
+ [28] Dongxian Wu, Yisen Wang, Shu-Tao Xia, James Bailey, and Xingjun Ma. Skip connections matter: On the transferability of adversarial examples generated with resnets. In ICLR, 2020.
403
+ [29] Cihang Xie, Zhishuai Zhang, Yuyin Zhou, Song Bai, Jianyu Wang, Zhou Ren, and Alan L Yuille. Improving transferability of adversarial examples with input diversity. In CVPR, 2019.
404
+ [30] Zhengyu Zhao, Zhuoran Liu, and Martha Larson. On success and simplicity: A second look at transferable targeted attacks. NeurIPS, 34, 2021.
405
+
406
+ # Checklist
407
+
408
+ 1. For all authors...
409
+
410
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
411
+ (b) Did you describe the limitations of your work? [No]
412
+ (c) Did you discuss any potential negative societal impacts of your work? [No] No negative effects
413
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
414
+
415
+ 2. If you are including theoretical results...
416
+
417
+ (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]
418
+
419
+ 3. If you ran experiments...
420
+
421
+ (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 abstract.
422
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 4.
423
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We report the average of running experiments 5 times.
424
+ (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 URL in abstract
425
+
426
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
427
+
428
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
429
+ (b) Did you mention the license of the assets? [Yes]
430
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
431
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] The code and data are public
432
+
433
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] No use of personally identifiable information or objectionable content.
434
+
435
+ 5. If you used crowdsourcing or conducted research with human subjects...
436
+
437
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
438
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
439
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/Fn17vlng9pD/Fn17vlng9pD.md ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # NIERT: Accurate Numerical Interpolation through Unifying Scattered Data Representations using Transformer Encoder
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Numerical interpolation for scattered data aims to estimate values for target points
11
+ 2 based on those of some observed points. Traditional approaches produce estima
12
+ 3 tions through constructing an interpolation function that combines multiple basis
13
+ 4 functions. These approaches require the basis functions to be pre-defined explicitly,
14
+ 5 thus greatly limiting their applications in practical scenarios. Recent advances
15
+ 6 exhibit an alternative strategy that learns interpolation functions directly from
16
+ 7 observed points using machine learning techniques, say deep neural networks. This
17
+ 8 strategy, although promising, cannot effectively exploit the correlations between
18
+ 9 observed points and target points as it treats these types of points separately. Here,
19
+ 10 we present a learning-based approach to numerical interpolation using encoder
20
+ 11 representations of Transformers (thus called NIERT). NIERT treats the value of
21
+ 12 each target point as a masked token, which enables processing target points and
22
+ 13 observed points in a unified fashion. By calculating the partial self-attention be
23
+ 14 tween target points and observed points at each layer, NIERT gains advantages
24
+ 15 of exploiting the correlations among these points and, more importantly, avoiding
25
+ 16 the unexpected interference of target points on observed points. NIERT also uses
26
+ 17 the pre-training technique to further improve its accuracy. On three representative
27
+ 18 datasets, including two synthetic datasets and a real-world dataset, NIERT outper
28
+ 19 forms the existing approaches, e.g., on the TFRD-ADlet dataset for temperature
29
+ 20 field reconstruction, NIERT achieves an MAE of $1 . 8 9 7 \times 1 0 ^ { - 3 }$ , substantially better
30
+ 21 than the transformer-based approach (MAE: $2 7 . 0 7 4 \times 1 0 ^ { - 3 }$ ). These results clearly
31
+ 22 demonstrate the accuracy of NIERT and its potential to apply in multiple practical
32
+ 23 fields.
33
+
34
+ # 24 1 Introduction
35
+
36
+ 25 Numerical interpolation for scattered data plays important and fundamental roles in a wide range
37
+ 26 of practical scenarios, including solving partial differential equations (PDEs) [1], temperature field
38
+ 27 reconstruction [2], time series interpolation [3, 4]. In meshfree PDE solvers, the interpolation
39
+ 28 error often leads to deviations in subsequent calculations, which seriously affects the solution’s
40
+ 29 accuracy [5]. In the task of temperature field reconstruction for micro-scale electronics, interpolation
41
+ 30 methods are used to obtain the real-time working environment of electronic components from
42
+ 31 limited measurements, and imprecise interpolation will significantly increase the cost of predictive
43
+ 32 maintenance [2]. Thus, accurate approaches to numerical interpolation are highly desirable.
44
+ 33 A large number of approaches have been proposed for interpolation of scattered data, which can
45
+ 34 be divided into two categories, namely, traditional non-learning based methods and recent learning
46
+ 35 based methods. The typical traditional interpolation schemes construct the target function by a linear
47
+ 36 combination of basis functions [6]. These schemes require explicitly-defined basis functions to
48
+ 37 model the target function space, and various types of basis functions have been devised by algorithm
49
+ 38 designers to adapt to different scenarios. Nevertheless, such methods still suffer the from limitations
50
+ 39 of high requirement of sufficient observed points, and the limited complexity of the target function.
51
+ 40 Recent progress has exhibited an alternative strategy that uses neural networks to learn interpolation
52
+ 41 functions directly from the given observed points. For example, conditional neural processes (CNPs)
53
+ 42 [7] and their extensions [8–10] model the conditional distribution of regression functions given
54
+ 43 the observed points. In addition, Chen et al. [2] proposed to use vanilla Transformer [11] to solve
55
+ 44 interpolation task in temperature field reconstruction. All of these approaches use an “encoder
56
+ 45 decoder” architecture, in which the encoder learns the representations of observed points while the
57
+ 46 decoder estimates values for target points. Intuitively, observed points and target points should be
58
+ 47 processed in a unified fashion because they are from the same domain. However, this architecture
59
+ 48 treats them separately and cannot effectively exploit the correlation between them.
60
+ 49 Inspired by the recent advances of language/image models, especially BERT [12] and BEIT [13], we
61
+ 50 designed an approach to numerical interpolation that can effectively exploit the correlations between
62
+ 51 observed points and target points. Our approach is a learning-based approach using the encoder
63
+ 52 representations of Transformers (thus called NIERT). The key elements of NIERT include: $i$ ) the
64
+ 53 use of the mask mechanism, which enables processing target points and observed points in a unified
65
+ 54 fashion, ii) a novel partial self-attention model, which calculates attentions between target points and
66
+ 55 observed points at each layer, thus gaining the advantages of exploiting the correlations between these
67
+ 56 two types of points and, more importantly, avoiding the unexpected interference of target points on
68
+ 57 observed points simultaneously, and iii) the use of the pre-training technique, which further improves
69
+ 58 the interpolation accuracy of NIERT.
70
+
71
+ 59 The main contributions of this study are summarized as follows.
72
+
73
+ 1. We propose an accurate approach to numerical interpolation for scattered data. On representative datasets, including both synthetic and real-world datasets, our approach outperforms existing approaches. The experimental results demonstrate the potential of our approach in a wide range of application fields. The source code of NIERT will be released for open source use.
74
+ 2. We propose a novel partial self-attention mechanism to make Transformer incorporated with strong inductive bias for interpolation tasks; i.e., it can effectively exploit the correlation among two types of points but simultaneously avoid the interference of one type of points onto the others.
75
+ 3. We propose to use the pre-training technique to enhance interpolation approaches. When facing an interpolation task in a newly-appearing application field, we can benefit from the experience learned from low-cost synthesized interpolation tasks.
76
+
77
+ # 72 2 Related works
78
+
79
+ # 2.1 Traditional interpolation approaches for scattered data
80
+
81
+ 74 Traditional interpolation approaches for scattered data use explicit basis functions to construct
82
+ 75 interpolation function, e.g., Lagrange interpolation, Newton interpolation [6], B-spline interpolation
83
+ 76 [14], Shepard’s method [15], Kriging [16], and radial basis function interpolation (RBF) [17, 18].
84
+ 77 Among these approaches, the classical Lagrange interpolation, Newton interpolation and B-splines
85
+ 78 interpolation are usually used for univariate interpolation. Wang et al. [19] proposed a high order
86
+ 79 multivariate approximation scheme for scattered data sets, in which approximation error is represented
87
+ 80 with Taylor expansions at data points, and basis functions are determined through minimizing the
88
+ 81 squares of approximation error.
89
+
90
+ # 82 2.2 Neural network-based interpolation approaches
91
+
92
+ 83 Equipped with deep neural networks, data-driven interpolation and reconstruction methods show great
93
+ 84 advantages and potential. For instance, convolutional neural networks (CNNs) have been applied
94
+ 85 in the interpolation tasks of single image super-resolution [20, 21], and recurrent neural networks
95
+ 86 (RNNs) and Transformers have been used for interpolation of sequences like time series data [4, 22].
96
+ 87 Recently, Garnelo et al. [7] proposed to model the conditional distribution of regression functions
97
+ 88 given observed points. The proposed approach, conditional neural processes (CNPs), has shown
98
+ 89 increased estimation accuracy and generalizing ability. Kim et al. [8] designed an enhanced model,
99
+ 90 attentive neural processes (ANPs), with improved accuracy. Lee et al. [10] leveraged Bayesian
100
+ 91 last layer (BLL) [23] for faster training and better prediction. In addition, the bootstrap technique
101
+ 92 was also employed for further improvement [9]. To solve the interpolation task in 2D temperature
102
+ 93 field reconstruction, Chen et al. [2] proposed an Transformer-based approach, referred to as TFR
103
+ 94 tranformer, which can also be applied to solve interpolation tasks for scattered data with higher
104
+ 95 dimensions. Note that although TFR-transformer and our NIERT are both based on transformer,
105
+ 96 they are fundamentally different: $i$ ) TFR-transformer adopts an encoder-decoder structure and treats
106
+ 97 observed points and target points respectively, while NIERT adopts only a Transformer encoder
107
+ 98 (equiped with partial self-attention) to encode and learn corelatetion of the scattered data in a unified
108
+ 99 fashion; ii) TFR-transformer is trained by minimizing the prediction error of target points, while
109
+ 100 NIERT’s training objective considers the prediction error of both observation points and target points.
110
+
111
+ ![](images/0dbdbb710117149033e2b31168830e381e417130b55b15955994594cf91a1921.jpg)
112
+ Figure 1: Overview of NIERT training process. Here, $x _ { i }$ represents the position of a point, and $y _ { i }$ represents its value. The predicted values of the point is denoted as $\hat { y } _ { i }$ . We prepare the training interpolation tasks by first sampling functions from a function distribution $\mathcal { F }$ and then sampling observed points $O$ and target points $T$ on each function. NIERT trains an interpolator over this data. The partial self-attention mechanism facilitates exploiting the correlations between observed points and target points and avoiding the unexpected interference of target points on observed points
113
+
114
+ # 2.3 Masked language/image models and the pre-training technique
115
+
116
+ 102 The design of NIERT is also inspired by the recent advances in masked language/image models
117
+ 103 [12, 13, 24, 25] and pre-trained models for symbolic regression [26, 27]. The masked pre-trained
118
+ 104 models have been shown to be successful in learning representations of languages and images
119
+ 105 from large-scale data and improving the performance of downstream tasks. In addition, the mask
120
+ 106 mechanism makes the model able to reconstruct missing data from their context. Utilizing large-scale
121
+ 107 synthetic symbolic functions and sampled scattered data, Biggio et al. [26] and Valipour et al. [27]
122
+ 108 pre-trained Transformers to learn the map from scattered data to corresponding symbolic formulas.
123
+ 109 Different from these approaches, NIERT uses synthetic data to learn interpolating functions from
124
+ 110 scattered data numerically.
125
+
126
+ # 3 Method
127
+
128
+ # 3.1 Overview of NIERT
129
+
130
+ In the study, we focus on the interpolation task that can be formally described as follows: We are given $n$ observed points with known values $O = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ , and $m$ target points with values to be determined, denoted as T = {xi}n+mi=n+1 . Here, $x _ { i } \in X$ denotes position of a point, $y _ { i } = f ( x _ { i } ) \in Y$ denotes the value of a point, and $f : X \to Y$ denotes a function mapping positions to values. The function $f$ is from a function distribution $\mathcal { F }$ , which can be explicitly defined using a mathematical formula or implicitly represented using a set of scattered data in the form $( x _ { i } , y _ { i } )$ . The goal of
131
+
132
+ Require: NIERT model $M _ { \theta }$ with parameters $\theta$ , epoch number $N$ , batch size $B$ , domain $X$ ,
133
+ function distribution $\mathcal { F }$ and error metric function $\mathrm { E r r o r } ( \cdot , \cdot )$
134
+ for $k$ in $\{ 1 . . N \}$ do $J \gets 0$ for $b$ in $\{ 1 . . B \}$ do $f$ $\dot { , } \{ x _ { i } \} _ { i } \gets$ sample a function and scatter points from ${ \mathcal { F } } , X$ $\{ y _ { i } \} _ { i } \gets$ calculate $f$ on $\{ x _ { i } \} _ { i }$ $O , T \gets$ split and mask scatter points with values $\{ ( x _ { i } , y _ { i } ) \} _ { i }$ $\{ \hat { y } _ { i } \} _ { i } \gets M _ { \theta } ( O , T )$ $J \gets J + \sum _ { i }$ Error( ˆyi, yi) end for Compute the gradient $\nabla _ { \boldsymbol { \theta } } J$ and update $\theta$
135
+ end for
136
+
137
+ 119 interpolation task is to accurately estimate the values $f ( x )$ for each target point $x \in T$ according to
138
+ 120 the observed points in $O$ .
139
+ 121 Figure 1 depicts the schematic diagram of our NIERT approach. Briefly speaking, our approach
140
+ 122 employs a data-driven approach to numerical interpolation using encoder representations of Trans
141
+ 123 formers. The main element of our approach is a neural interpolator that learns to estimate values for
142
+ 124 target points. The interpolator is featured by the characteristic that it treats the value of each target
143
+ 125 point as a masked token, thus enabling the unifying fashion to process both target points and observed
144
+ 126 points in the subsequent encoding and estimation procedures.
145
+ 127 To suit the interpolation task, we design a partial self-attention mechanism: on one side, we calculate
146
+ 128 the attention between target points and observed points at each layer, which gains NIERT the
147
+ 129 advantage to effectively exploit the correlations between these two types of points. On the other side,
148
+ 130 the attention is a partial one as we do not consider the effects of a target point on all other points.
149
+ 131 This way, the unexpected interference of target points onto the observed points, and the interference
150
+ 132 among target points, are completely avoided.
151
+ 133 The training process is depicted in Algorithm 1. Specifically, we prepare the training interpolation
152
+ 134 tasks by first sampling functions from a distribution $\mathcal { F }$ and then sampling observed points $O$ and
153
+ 135 target points $T$ on each function. When training NIERT, we set the loss function as the error between
154
+ 136 the estimated values and the corresponding ground-truth. It should be pointed out that errors acquired
155
+ 137 on both observed points and target points are accounted into loss function.
156
+
157
+ # 138 3.2 Architecture of the NIERT interpolator
158
+
159
+ The neural interpolator in NIERT adopts the Transformer encoder framework; however, to suit the interpolation task, significant modifications and extensions were made in embedding, Transformer and output layers, which are described in details below.
160
+
161
+ Embedding with masked tokens: NIERT embeds both observed points and target points into the unified high-dimensional embedding space. As the position $x$ of a data point and its value $y$ are from different domains, we use two linear modules $:$ $\operatorname { L i n e a r } _ { x }$ embeds the positions while ${ \mathrm { L i n e a r } } _ { y }$ embeds 5 the values.
162
+
163
+ 146 It should be noted that for target points, their values are absent when embedding as they are to be
164
+ 147 determined. In this case, we use a masked token as substitutes, which is embedded as a trainable
165
+ 148 parameter $\mathrm { M A S K } _ { y }$ as performed in BERT [12]. This way, the interpolator processes both target
166
+ 149 points and observed points in a unifying fashion.
167
+
168
+ 150 We concatenate the embeddings of position and value of a data point as the point’s embedding, denoted as 151 $h _ { i } ^ { 0 }$ , i.e.,
169
+
170
+ $$
171
+ h _ { i } ^ { 0 } = \left\{ \begin{array} { l l } { [ \mathrm { L i n e a r } _ { x } ( x _ { i } ) , \mathrm { L i n e a r } _ { y } ( y _ { i } ) ] , } & { \mathrm { i f } \ ( x _ { i } , y _ { i } ) \in O } \\ { [ \mathrm { L i n e a r } _ { x } ( x _ { i } ) , \mathrm { M A S K } _ { y } ] , } & { \mathrm { i f } \ x _ { i } \in T } \end{array} \right.
172
+ $$
173
+
174
+ 152 Transformer layer with partial self-attention mechanism: NIERT feeds the embeddings of the
175
+ 153 points into a stack of $L$ Transformer layers, producing encodings of these points as results. Each
176
+ 154 Transformer layer contains two subsequent sub-layers, namely, a multi-head self-attention module,
177
+ 155 and a point-wise fully-connected network. These sub-layers are interlaced with residual connections
178
+ 156 and layer normalization between them.
179
+ 157 To avoid the unexpected interference of target points on observed points and target points themselves,
180
+ 158 NIERT replaces the original self-attention in Transformer layer with a partial self-attention, which
181
+ 159 calculates the feature of point $i$ at the $l + 1$ -st layer as follows:
182
+
183
+ 160
184
+
185
+ $$
186
+ \begin{array} { r } { h ^ { l + 1 } = \mathrm { L a y e r N o r m } ( \widetilde { v } ^ { l } + \mathrm { M L P } ( \widetilde { v } ^ { l } ) ) , } \\ { \widetilde { v } _ { i } ^ { l } = \mathrm { L a y e r N o r m } \Big ( v _ { i } ^ { l } + \displaystyle \sum _ { j } w _ { i j } \alpha _ { i j } ^ { l } v _ { j } ^ { l } \Big ) } \end{array}
187
+ $$
188
+
189
+ where 161 $v _ { i } ^ { l }$ and $\alpha _ { i j } ^ { l }$ represent the value embedding and ordinary attention weights at the $l$ -th layer as 162 calculated in Transformer [11]. In this formula, we introduce a new term $w _ { i j }$ that represents the 163 partial self-attention pattern, i.e.,
190
+
191
+ $$
192
+ w _ { i j } = \left\{ { \begin{array} { l l } { 1 , } & { { \mathrm { i f ~ } } ( x _ { j } , y _ { j } ) \in O } \\ { 0 , } & { { \mathrm { i f ~ } } x _ { j } \in T } \end{array} } \right. .
193
+ $$
194
+
195
+ 164 By forcing the weight $w _ { i j }$ to be 0 for a target point $i$ and any point $j$ , we completely avoid the
196
+ 165 unexpected interference of target points on the other points.
197
+
198
+ Estimating values for target points: For each target point 166 $i$ , we estimate its value $\hat { y } _ { i }$ through feeding 167 its features at the final Transformer layer into a fully connected feed-forward network, i.e.,
199
+
200
+ $$
201
+ \begin{array} { r } { \hat { y _ { i } } = \mathrm { M L P _ { o u t } } ( h _ { i } ^ { L } ) . } \end{array}
202
+ $$
203
+
204
+ We calculate the error between the estimation and the corresponding ground-truth value, and compose the errors for all points into a loss function to be minimized.
205
+
206
+ # 170 3.3 Enhancing NIERT using pre-training technique
207
+
208
+ 171 The interpolation functions from different applications usually differ greatly in their forms; however,
209
+ 172 the interpolation tasks might still share some common characteristics, say the correlation between
210
+ 173 observed points and target points. These common characteristics enable enhancing NIERT using
211
+ 174 the pre-training technique. Here, we pre-train NIERT using a synthetic dataset (see 4.1 for further
212
+ 175 details) and fine-tune it on other datasets in application fields.
213
+
214
+ # 176 4 Experiments and results
215
+
216
+ 177 We evaluated NIERT and compared it with ten representative scattered data interpolation approaches
217
+ 178 on both synthetic and real-world datasets. We also examined the effects of the key elements of NIERT,
218
+ 179 including the partial self-attention, and the pre-training technique.
219
+
220
+ # 4.1 Experiment setting
221
+
222
+ The datasets, metrics and approaches for comparison are briefly described below. Further details of experiment settings are provided in Supplementary text.
223
+
224
+ Datasets: Three representative datasets in various application fields, including two synthetic datasets NeSymReS and TFRD-ADlet, and real-world dataset PhysioNet, are used for evaluation.
225
+
226
+ NeSymReS is a synthetic dataset for mathematical function interpolation, which is built using data generator proposed by Biggio et al. [26] and Lample and Charton [28]. We construct a function set with various dimensionality of data points, including 1D, 2D, 3D, and 4D. Scattered points in each instance are randomly sampled and divided into observed points and target points.
227
+
228
+ 189 TFRD-ADlet [2] is a synthetic dataset for 2D temperature field reconstruction where each instance
229
+ 190 represents a simulated 2D temperature field containing several heat source components and a specific
230
+ 191 Dirichlet conditioned boundary. The goal of each task instance is to reconstruct the whole temperature
231
+ 192 field according to a limited number of observed points with measured temperature.
232
+ 193 PhysioNet Challenge 2012 dataset [29] is a real world dataset collected from intensive care unit
233
+ 194 (ICU) records for time-series data interpolation. Each point in an instance represents a measurement
234
+ 195 at a specific time, where each measurement contains up to 37 physiological indices. Following the
235
+ 196 study [22], we randomly divided the points into observed points and target points by setting the ratio
236
+ 197 of observed points at five levels, i.e., $50 \%$ , $60 \%$ , $70 \%$ , $80 \%$ , and $90 \%$ . Note that this dataset is a
237
+ 198 representative of hard interpolation tasks due to the sparsity and irregularity of the records.
238
+
239
+ Pre-training dataset: In this study, NeSymReS dataset was used for pre-training NIERT to further improve its interpolation accuracy on TFRD-ADlet and PhysioNet dataset. For TFRD-ADlet dataset we directly use 2D TFRD-ADlet dataset for pre-training. As the PhysioNet dataset has a dimensionality of 37, we construct the pre-training instances by stacking random 37 functions from 1D TFRD-ADlet dataset and then sampling interpolation task instances.
240
+
241
+ Metrics: When evaluating NIERT and other interpolation approaches, the prediction error of target points are calculated as interpolation accuracy. For the NeSymReS and PhysioNet dataset, we adopted mean squared error (MSE) as the error metric. For TFRD-ADlet dataset, we use three error metrics: mean absolute error (MAE), MAE in component area (CMAE) and MAE at boundary (BMAE) following Chen et al. [2]. Accordingly, we use $L _ { 2 }$ -form loss function for NeSymReS and PhysioNet dataset and $L _ { 1 }$ -form loss function for TFRD-ADlet dataset for training.
242
+
243
+ Approaches for comparison: For NeSymReS dataset, we compared NIERT with six representative interpolation approaches, including RBF[30], MIR [19], CNP[7], ANP[8], BANP[9] and TFRtransformer [2]. For TFRD-ADlet we compared NIERT with CNP, ANP, BANP and TFR-transformer. For PhysioNet we compared NIERT with four approaches designed for time-series data interpolation, including RNN-VAE [31], L-ODE-RNN [32], L-ODE-ODE[33], and mTAND-Full[22].
244
+
245
+ # 15 4.2 Interpolation accuracy on synthetic and real-world datasets
246
+
247
+ 218
248
+
249
+ 216 For each instance of the test datasets, we applied the trained NIERT to estimate values for the target 17 points. We calculate the errors between the estimation and the ground-truth as interpolation accuracy.
250
+
251
+ <table><tr><td rowspan="2">Interpolation approach</td><td colspan="4">MSE(×10- -5)on NeSymReS test set</td></tr><tr><td>1D</td><td>2D</td><td>3D</td><td>4D</td></tr><tr><td>RBF</td><td>215.439</td><td>347.060</td><td>443.094</td><td>327.775</td></tr><tr><td>MIR</td><td>67.281</td><td>274.601</td><td>448.933</td><td>342.997</td></tr><tr><td>CNP</td><td>67.176</td><td>248.668</td><td>392.348</td><td>314.311</td></tr><tr><td>ANP</td><td>34.558</td><td>140.005</td><td>206.699</td><td>164.751</td></tr><tr><td>BANP</td><td>14.913</td><td>84.187</td><td>143.518</td><td>140.288</td></tr><tr><td>TFR-transformer</td><td>15.556</td><td>58.569</td><td>99.986</td><td>90.579</td></tr><tr><td>NIERT</td><td>8.964</td><td>45.319</td><td>77.664</td><td>72.025</td></tr></table>
252
+
253
+ Table 2: Interpolation accuracy of NIERT and the existing approaches over the TFRD-ADlet dataset
254
+
255
+ <table><tr><td rowspan="2">Interpolation approach</td><td colspan="3">Evaluation criteria (×10-3)</td></tr><tr><td>MAE</td><td>CMAE</td><td>BMAE</td></tr><tr><td>CNP</td><td>96.674</td><td>109.419</td><td>56.939</td></tr><tr><td>ANP</td><td>54.684</td><td>62.511</td><td>26.524</td></tr><tr><td>BANP</td><td>28.671</td><td>29.450</td><td>19.984</td></tr><tr><td>TFR-transformer</td><td>27.074</td><td>29.772</td><td>18.835</td></tr><tr><td>NIERT</td><td>3.473</td><td>3.947</td><td>2.467</td></tr><tr><td>NIERT w/ pretraining</td><td>1.897</td><td>1.971</td><td>1.246</td></tr></table>
256
+
257
+ Table 1: Interpolation accuracy of NIERT and the existing approaches on NeSymReS test dataset
258
+ Table 3: The relationship between interpolation accuracy (measured using MSE, $\times 1 0 ^ { - 3 }$ ) and the ratio of observed points. Here, we use the PhysioNet dataset as representatives
259
+
260
+ <table><tr><td rowspan="2">Interpolation approach</td><td colspan="5">Ratio of observed points</td></tr><tr><td>50%</td><td>60%</td><td>70%</td><td>80%</td><td>90%</td></tr><tr><td>RNN-VAE</td><td>13.418±0.008</td><td>12.594±0.004</td><td>11.887±0.005</td><td>11.133±0.007</td><td>11.470±0.006</td></tr><tr><td>L-ODE-RNN</td><td>8.132±0.020</td><td>8.140±0.018</td><td>8.171±0.030</td><td>8.143±0.025</td><td>8.402±0.022</td></tr><tr><td>L-ODE-ODE</td><td>6.721±0.109</td><td>6.816±0.045</td><td>6.798±0.143</td><td>6.850±0.066</td><td>7.142±0.066</td></tr><tr><td>mTAND-Full</td><td>4.139±0.029</td><td>4.018±0.048</td><td>4.157±0.053</td><td>4.410±0.149</td><td>4.798±0.036</td></tr><tr><td>NIERT</td><td>2.868±0.021</td><td>2.811±0.032</td><td>2.656±0.041</td><td>2.598±0.078</td><td>2.709±0.157</td></tr><tr><td>NIERT w/ pretraining</td><td>2.831±0.021</td><td>2.771±0.019</td><td>2.641±0.052</td><td>2.539±0.085</td><td>2.596±0.159</td></tr></table>
261
+
262
+ 219 Accuracy on the NeSymReS dataset: As shown in Table 1, on the 1D NeSymReS testset, RBF
263
+ 220 shows the largest interpolation error (MSE: 215.439). MIR, another approach using explicit basis
264
+ 221 functions, also shows a high interpolation error of 67.281. In contrast, BANP and TFR-transformer,
265
+ 222 which use neural networks to learn interpolation, show relatively lower errors (MSE: 14.913, 15.556).
266
+ 223 Compared with these approaches, our NIERT approach achieves the best interpolation accuracy
267
+ 24 (MSE: 8.964). Table 1 also demonstrates the advantage of NIERT over the existing approach on the
268
+ 25 2D, 3D, and 4D instances.
269
+
270
+ Note that the number of observed points varies greatly in test instances, making the average interpolation error calculated over all test instances insufficient to measure interpolation performance. Therefore, we further divide test instances into subsets according to the number of observed points. As shown in Figure 2, as the number of observed points increases, the interpolation error decreases as expected. In addition, the relative advantages of these approaches vary with the number of observed points, e.g., CNP is better than RBF and MIR initially but finally becomes worse as the number of observed points increases. Among all approaches, NIERT stably shows the best performance over all test subsets, regardless of the number of observed points.
271
+
272
+ ![](images/738aab1a6723bfcee613ea10cde395c539e338ba4c0a1966abebb4ba6d3f48c9.jpg)
273
+ Figure 2: The relationship between the interpolation accuracy and the number of observed points. Here we use the 2D instances in the NeSymReS test dataset as representatives
274
+
275
+ Accuracy on the TFRD-ADlet dataset: As shown in Table 2, CNP, although employing the neural network technique, still performs poorly with MAE as high as of 96.674. In contrast, NIERT achieves the lowest interpolation error (MAE: 3.473), which is over one order of magnitude lower than CNP, ANP, BANP and TFR-transformer. Moreover, when enhanced with the pre-training technique, NIERT can further decrease its interpolation MAE to be 1.897. Besides MAE, other metrics, say CMAE and BMAE, also show the superior of NIERT over the existing approaches (Table 2 ).
276
+
277
+ Accuracy on the PhysioNet dataset: Table 3 suggests that on the PhysioNet dataset, NIERT also outperforms the existing approaches, e.g., when controlling the ratio of observed points to be $50 \%$ NIERT achieves an average MSE $( \times 1 0 ^ { - 3 } )$ ) of 2.868, significantly lower than RNN-VAE (13.418), L-ODE-RNN (8.132), L-ODE-ODE (6.721) and mTAND-Full (4.139). Again, NIERT with the pre-training technique shows better performance. The advantages of NIERT hold across various settings of the ratio of the observed points.
278
+
279
+ Taken together, these results clearly demonstrate the power of NIERT for numerical interpolation in multiple application fields, including interpolating the scattered data generated using mathematical functions, reconstructing temperature fields, and interpolating time-series data.
280
+
281
+ # 57 4.3 Case studies of interpolation results
282
+
283
+ To further understand the advantages of NIERT, we carried out case studies through visualizing the observed points, the reconstructed interpolation functions and the interpolation errors in this subsection. More visualized cases are put in the Supplementary material.
284
+
285
+ ![](images/44df2ccaa4325479e2b9c766ef28593dc505e4f3075ac485cc9e89803cde2330.jpg)
286
+ Figure 3: An example of 2D interpolation task extracted from NeSymReS test set. The up-left figure shows the ground-truth function while the bottom-left figure shows the 22 observed points. The interpolation functions reported by NIERT and the existing approaches are listed on the top panel with their differences with the ground-truth are list below
287
+
288
+ 261 Figure 3 show a 2D instance in the NeSymReS test set, respectively. As illustrated by these two
289
+ 262 figures, RBF performs poorly in the application scenario with sparse observed data. In addition, RBF
290
+ 263 and MIR, especially ANP, cannot accurately predict values for the target points that fall out of the
291
+ 264 range restricted by observed points. The CNP approach can only learn the rough trend stated by the
292
+
293
+ 65 observed points, thus leading to significant errors. In contrast, BANP, TFR-transformer and NIERT 6 can accurately estimate values for target points within considerably large range, and compared with BANP and TFR-transformer, NIERT can produce more accurate results.
294
+
295
+ 68 Figure4 shows an instance of temperature field reconstruction extracted from TFRD-ADlet. From
296
+ 69 this figure, we can observe that when using pre-training technique, NIERT further improves its
297
+ 70 interpolation accuracy in the whole area.
298
+
299
+ ![](images/4c0c82844ae5d444e7a4c0f214125446844926fdc98477265e819cfc169fc845.jpg)
300
+ Figure 4: An example of temperature field reconstruction task extracted from TFRD-ADlet test set. The up-left figure shows the ground-truth temperature field while the bottom-left figure shows the 32 observed points. The reconstructed results reported by NIERT and the existing approaches are listed on the top panel with their differences with the ground-truth temperature field are list below
301
+
302
+ # 271 4.4 Contribution analysis of observed points for interpolation
303
+
304
+ 272 An idealized interpolation approach is expected to effectively exploit all observed points with
305
+ 273 appropriate consideration of relative positions among observed points and target points as well. To
306
+ 274 examine this issue, we visualized the attention weight of each observed point to all target points.
307
+ 275 These attention weights provide an intuitive description of the contribution by observed points.
308
+
309
+ As shown in Figure 5, when using TFR-transformer, the contributions by observed points are considerably imbalanced: on one side, some observed points might affect their neighboring target points in a large region; on the other side, the other observed points have little contributions to interpolation. In contrast, when using NIERT, contributions by an observed point are much more local and thus targeted. More importantly, all observed points have contributions to interpolation.
310
+
311
+ 281 These results demonstrate that NIERT can exploit the correlation between observed points and target
312
+ 282 points more effectively.
313
+
314
+ ![](images/4ea3d314189944952576d6ceef0526deba0ddd65895e2eec7d773c1907c8a11a.jpg)
315
+ Figure 5: Contributions by observed points for interpolation. The 2D instance is same to that used in Figure 3. We randomly select 4 observed points and extract their attention weights from the final attention layer of NIERT and TFR-transformer. These attention weights provide an intuitive description of the contribution by observed points. The contributions by other 18 observed points are shown in Supplementary material
316
+
317
+ # 4.5 Ablation study
318
+
319
+ The effects of partial self-attention: For a specific interpolation task, the interpolation function is determined by the observed points only. Thus, an idealized encoding of observed points should not be affected by target points. To investigate the affects of target points, we evaluated NIERT on the test sets with various number of target points. Here, we compared two variants of NIERT, one with partial self-attention, and the other with vanilla self-attention. Both of these two variants were trained using the same training sets (the number of target points varies within [206, 246]).
320
+
321
+ 290 As illustrated by Figure 6, the variant with vanilla self-attention shows poor performance for the tasks
322
+ 291 with few target points, say less than 64 target points. In contrast, the variant with partial self-attention
323
+ 292 always performs stably without significant changes of accuracy.
324
+ 293 The results clearly demonstrate that the partial self-attention mechanism allows NIERT to be free
325
+ 294 from the unexpected affects by the target points.
326
+
327
+ The effects of pre-training technique: To investigate the effects of the pre-training technique, we show in Figure 7 the training process of two versions of NIERT, one without pre-training technique, and the other enhanced with pre-training. As depicted by the figure, even at the first epoch, the pre-trained NIERT shows a sufficiently high interpolation accuracy, which is comparable with the fully-trained BANP and TFR-transformer. Moreover, the performance of the pre-trained NIERT improves in roughly the same convergence speed to the original NIERT. At the final epoch, the pre-trained NIERT decreases the interpolation error to be nearly half of that of the original NIERT.
328
+
329
+ 02 These results clearly suggest that the experience learned by NIERT from the interpolation task in one
330
+ 03 application field has potential to be transferred to the interpolation tasks in other application fields.
331
+
332
+ ![](images/7fc3f03ce9a335f045e606aaf8a4138d0c6ac2f339b85514b41091c014eeb024.jpg)
333
+ Figure 6: The robustness of NIERT to the number of target points. Here, two variants of NIERT are trained on 1D NeSymReS dataset
334
+
335
+ ![](images/3092cd96640fc10c9b630a6d5d6c796db775c298581e89b1a6c4cc885e20b4ea.jpg)
336
+ Figure 7: The convergence of NIERT, NIERT with pre-training, and the existing approaches. Here, models are trained on TFRD-ADlet dataset
337
+
338
+ # 5 Discussion and conclusion
339
+
340
+ We present in the study an accurate approach to numerical interpolation for scattered data. The specific features of our NIERT approach are highlighted by the full exploitation of the correlation between observed points and target points through unifying scattered data representation. At the same time, the use of partial self-attention mechanism can effectively avoid the interference of target points onto the observed points. The enhancement with pre-training technique is another special feature of NIERT. The advantages of NIERT in interpolation accuracy have been clearly demonstrated by experimental results on both synthetic and real-world datasets.
341
+
342
+ The current version of NIERT has a computational complexity of $O ( n ( m + n ) )$ , thus cannot handle the interpolation tasks with extremely large amounts of observed points due to the limitations of GPU memory size. Compared with the lightweight traditional methods, our NIERT approach has a much larger model with expensive computation to learn complex function distribution, which limits its application in cost sensitive scenarios. How to reduce the memory requirement and computational cost is one of the future works. Additionally, it is interesting to combine NIERT and the traditional approaches based on basis functions to yield an approach with both high accuracy and interpretability.
343
+
344
+ We expect NIERT, with extensions and modifications, to greatly facilitate numerical interpolations in a wide range of engineering and science fields.
345
+
346
+ # References
347
+
348
+ [1] Richard Franke and Gregory M Nielson. Scattered data interpolation and applications: A tutorial and survey. Geometric Modeling, pages 131–160, 1991.
349
+ [2] Xiaoqian Chen, Zhiqiang Gong, Xiaoyu Zhao, Weien Zhou, and Wen Yao. A Machine Learning Modelling Benchmark for Temperature Field Reconstruction of Heat-Source Systems. arXiv
350
+ [3] Mathieu Lepot, Jean-Baptiste Aubin, and François HLR Clemens. Interpolation in time series: An introductive overview of existing methods, their performance criteria and uncertainty assessment. Water, 9(10):796, 2017.
351
+ [4] Satya Narayan Shukla and Benjamin M Marlin. Interpolation-prediction networks for irregularly sampled time series. arXiv preprint arXiv:1909.07782, 2019.
352
+ [5] GR3543275 Liu. An overview on meshfree methods: for computational solid mechanics. International Journal of Computational Methods, 13(05):1630001, 2016.
353
+ [6] Michael T Heath. Scientific Computing: An Introductory Survey, Revised Second Edition. Society for Industrial and Applied Mathematics, revised 2nd edition edition, 2018.
354
+ [7] Marta Garnelo, Dan Rosenbaum, Christopher Maddison, Tiago Ramalho, David Saxton, Murray Shanahan, Yee Whye Teh, Danilo Rezende, and S. M. Ali Eslami. Conditional Neural Processes. In Jennifer Dy and Andreas Krause, editors, Proceedings of the 35th International Conference on Machine Learning, volume 80 of Proceedings of Machine Learning Research, pages 1704–1713. PMLR, 10–15 Jul 2018.
355
+ [8] Hyunjik Kim, Andriy Mnih, Jonathan Schwarz, Marta Garnelo, Ali Eslami, Dan Rosenbaum, Oriol Vinyals, and Yee Whye Teh. Attentive Neural Processes. In International Conference on Learning Representations, 2019.
356
+ [9] Juho Lee, Yoonho Lee, Jungtaek Kim, Eunho Yang, Sung Ju Hwang, and Yee Whye Teh. Bootstrapping neural processes. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 6606–6615. Curran Associates, Inc., 2020.
357
+ [10] Byung-Jun Lee, Seunghoon Hong, and Kee-Eung Kim. Residual neural processes. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 4545–4552, 2020.
358
+ [11] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pages 5998–6008, 2017.
359
+ [12] 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.
360
+ [13] Hangbo Bao, Li Dong, and Furu Wei. BEiT: BERT Pre-Training of Image Transformers. arXiv preprint arXiv:2106.08254, 2021.
361
+ [14] Charles A Hall and W Weston Meyer. Optimal error bounds for cubic spline interpolation. Journal of Approximation Theory, 16(2):105–122, 1976.
362
+ [15] William J Gordon and James A Wixom. Shepard’s method of “metric interpolation” to bivariate and multivariate interpolation. Mathematics of computation, 32(141):253–264, 1978.
363
+ [16] Hans Wackernagel. Multivariate geostatistics: an introduction with applications. Springer Science & Business Media, 2003.
364
+ [17] Michael JD Powell. Radial basis functions for multivariable interpolation: a review. Algorithms for approximation, 1987.
365
+ [18] Bengt Fornberg and Julia Zuev. The Runge phenomenon and spatially variable shape parameters in RBF interpolation. Computers & Mathematics with Applications, 54(3):379–398, 2007.
366
+ [19] Qiqi Wang, Parviz Moin, and Gianluca Iaccarino. A high order multivariate approximation scheme for scattered data sets. Journal of Computational Physics, 229(18):6343–6361, 2010.
367
+
368
+ 373 [20] Ying Tai, Jian Yang, and Xiaoming Liu. Image super-resolution via deep recursive residual
369
+ 374 network. In Proceedings of the IEEE conference on computer vision and pattern recognition,
370
+ 375 pages 3147–3155, 2017.
371
+ 376 [21] Juncheng Li, Zehua Pei, and Tieyong Zeng. From Beginner to Master: A Survey for Deep
372
+ 377 Learning-based Single-Image Super-Resolution. arXiv preprint arXiv:2109.14335, 2021.
373
+ 378 [22] Satya Narayan Shukla and Benjamin Marlin. Multi-Time Attention Networks for Irregularly
374
+ 379 Sampled Time Series. In International Conference on Learning Representations, 2021.
375
+ 380 [23] Noah Weber, Janez Starc, Arpit Mittal, Roi Blanco, and Lluís Màrquez. Optimizing over a
376
+ 381 bayesian last layer. In NeurIPS workshop on Bayesian Deep Learning, 2018.
377
+ 382 [24] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal,
378
+ 383 Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel
379
+ 384 Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler,
380
+ 385 Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott
381
+ 386 Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya
382
+ 387 Sutskever, and Dario Amodei. Language Models are Few-Shot Learners. In H. Larochelle,
383
+ 388 M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin, editors, Advances in Neural Information
384
+ 389 Processing Systems, volume 33, pages 1877–1901. Curran Associates, Inc., 2020.
385
+ 390 [25] Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked
386
+ 391 autoencoders are scalable vision learners. arXiv preprint arXiv:2111.06377, 2021.
387
+ 392 [26] Luca Biggio, Tommaso Bendinelli, Alexander Neitz, Aurelien Lucchi, and Giambattista Paras
388
+ 393 candolo. Neural Symbolic Regression that Scales. In International Conference on Machine
389
+ 394 Learning, pages 936–945. PMLR, 2021.
390
+ 395 [27] Mojtaba Valipour, Bowen You, Maysum Panju, and Ali Ghodsi. SymbolicGPT: A Generative
391
+ 396 Transformer Model for Symbolic Regression. arXiv preprint arXiv:2106.14131, 2021.
392
+ 397 [28] Guillaume Lample and François Charton. Deep learning for symbolic mathematics. arXiv
393
+ 398 preprint arXiv:1912.01412, 2019.
394
+ 399 [29] Ikaro Silva, George Moody, Daniel J Scott, Leo A Celi, and Roger G Mark. Predicting in
395
+ 400 hospital mortality of icu patients: The physionet/computing in cardiology challenge 2012. In
396
+ 401 2012 Computing in Cardiology, pages 245–248. IEEE, 2012.
397
+ 402 [30] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David
398
+ 403 Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J.
399
+ 404 van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew
400
+ 405 R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, C J Carey, ˙ Ilhan Polat, Yu Feng, Eric W.
401
+ 406 Moore, Jake VanderPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E. A.
402
+ 407 Quintero, Charles R. Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul
403
+ 408 van Mulbregt, and SciPy 1.0 Contributors. SciPy 1.0: Fundamental Algorithms for Scientific
404
+ 409 Computing in Python. Nature Methods, 17:261–272, 2020. doi: 10.1038/s41592-019-0686-2.
405
+ 410 [31] Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation
406
+ 411 of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555,
407
+ 412 2014.
408
+ 413 [32] Ricky T. Q. Chen, Yulia Rubanova, Jesse Bettencourt, and David Duvenaud. Neural Ordinary
409
+ 14 Differential Equations. Advances in Neural Information Processing Systems, 2018.
410
+ 415 [33] Yulia Rubanova, Ricky T. Q. Chen, and David K Duvenaud. Latent Ordinary Differential
411
+ 416 Equations for Irregularly-Sampled Time Series. In H. Wallach, H. Larochelle, A. Beygelzimer,
412
+ 417 F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing
413
+ 418 Systems, volume 32. Curran Associates, Inc., 2019.
414
+
415
+ 1. For all authors...
416
+
417
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
418
+ (b) Did you describe the limitations of your work? [Yes] Limitations of our work are briefly described in Section 5.
419
+ (c) Did you discuss any potential negative societal impacts of your work? [No]
420
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
421
+
422
+ 2. If you are including theoretical results...
423
+
424
+ (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]
425
+
426
+ 3. If you ran experiments...
427
+
428
+ (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 the Supplementary.
429
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] All the training details are in the Supplementary.
430
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We reported error bars in experiments on PhysioNet dataset. See Table 3.
431
+ (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] Described in the Supplementary.
432
+
433
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
434
+
435
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
436
+ (b) Did you mention the license of the assets? [Yes] Mentioned in the Supplementary.
437
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
438
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] The datasets used in our work are all open-sourced by their creators.
439
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] The data we are using doesn’t contain any personally identifiable information or offensive content.
440
+
441
+ 5. If you used crowdsourcing or conducted research with human subjects...
442
+
443
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
444
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
445
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/GoOuIrDHG_Y/GoOuIrDHG_Y.md ADDED
@@ -0,0 +1,262 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # End-to-end Symbolic Regression with Transformers
2
+
3
+ Pierre-Alexandre Kamienny∗1,2, Stéphane d’Ascoli\*1,3 Guillaume Lample1, François Charton1 1Meta AI 2ISIR MLIA, Sorbonne Université 3Department of Physics, Ecole Normale Supérieure pakamienny@meta.com
4
+
5
+ # Abstract
6
+
7
+ Symbolic regression, the task of predicting the mathematical expression of a function from the observation of its values, is a difficult task which usually involves a two-step procedure: predicting the "skeleton" of the expression up to the choice of numerical constants, then fitting the constants by optimizing a non-convex loss function. The dominant approach is genetic programming, which evolves candidates by iterating this subroutine a large number of times. Neural networks have recently been tasked to predict the correct skeleton in a single try, but remain much less powerful.
8
+
9
+ In this paper, we challenge this two-step procedure, and task a Transformer to directly predict the full mathematical expression, constants included. One can subsequently refine the predicted constants by feeding them to the non-convex optimizer as an informed initialization. We present ablations to show that this end-to-end approach yields better results, sometimes even without the refinement step. We evaluate our model on problems from the SRBench benchmark and show that our model approaches the performance of state-of-the-art genetic programming with several orders of magnitude faster inference.
10
+
11
+ # Introduction
12
+
13
+ Inferring mathematical laws from experimental data is a central problem in natural science; having observed a variable $y$ at $n$ points $\{ x _ { i } \} _ { i \in \mathbb { N } _ { n } }$ , it implies finding a function $f$ such that $y _ { i } \approx f ( x _ { i } )$ for all $i \in \mathbb { N } _ { n }$ . Two types of approaches exist to solve this problem. In parametric statistics (PS), the function $f$ is defined by a small number of parameters that can directly be estimated from the data. On the other hand, machine learning (ML) techniques such as decision trees and neural networks select $f$ from large families of non-linear functions by minimizing a loss over the data. The latter relax the assumptions about the underlying law, but their solutions are more difficult to interpret, and tend to overfit small experimental data sets, yielding poor extrapolation performance.
14
+
15
+ Symbolic regression (SR) stands as a middle ground between PS and ML approaches: $f$ is selected from a large family of functions, but is required to be defined by an interpretable analytical expression. It has already proved extremely useful in a variety of tasks such as inferring physical laws [1, 2].
16
+
17
+ SR is usually performed in two steps. First, predicting a “skeleton”, a parametric function using a pre-defined list of operators – typically, the basic operations $( + , \times , \div )$ and functions (sqrt, exp, sin, etc.). It determines the general shape of the law up to a choice of constants, e.g. $f ( x ) = \cos ( a x + b )$ . Then, the constants in the skeleton $( a , b )$ are estimated using optimization techniques, typically the Broyden–Fletcher–Goldfarb–Shanno algorithm (BFGS).
18
+
19
+ ![](images/fa3d51c7533362b23cc3ef2aca51bbcab62b9f44a7183e0cfd1e5d9ad6232ce9.jpg)
20
+ Figure 1: Our model outperforms previous DL-based methods and offers at least an order of magnitude inference speedup compared to SOTA GP-based methods. Pareto plot comparing the average test performance and inference time of our models with baselines provided by the SRbench benchmark [7], both on Feynman SR problems [1] and black-box regression problems. We use colors to distinguish three families of models: deep-learning based SR, genetic programming-based SR and classic machine learning methods (which do not provide symbolic solutions). A similar Pareto plot against formula complexity is provided in Fig. 11.
21
+
22
+ The leading algorithms for SR rely on genetic programming (GP). At each generation, a population of candidates is predicted, and the fittest ones are selected based on the data, and mutated to build the next generation. The algorithm iterates this procedure until a satisfactory accuracy level is achieved.
23
+
24
+ While GP algorithms achieve good prediction accuracy, they are notably slow (see the Pareto plot of Fig. 1). Indeed, the manually predefined function space to search is generally vast, and each generation involves a costly call to the BFGS routine. Also, GP does not leverage past experience: every new problem is learned from scratch. Inference time, i.e. time required to output a satisfactory expression, for most GP algorithms is both long and unbounded (the longer, the better the results), therefore this property has been neglected by the SR community, however fast inference can be useful to improve search-based SR algorithms, e.g. by reducing search space or providing initial guesses, as well as to tackle practical applications with time constraints, e.g. control or reinforcement learning [3, 4].
25
+
26
+ Supervised training neural networks built for language modelling on large datasets of synthetic examples has recently been proposed for SR [5, 6]. These references follow the two-step procedure (predicting the skeleton then fitting the constants) inherited from GP. Once the model is trained, at inference, the skeleton is predicted via a simple forward pass, and a single call to BFGS is needed, thus resulting in a significant speed-up compared to GP. However, these methods are not as accurate as state-of-the-art GP, and have so far been limited to low-dimensional functions $D \le 3 ,$ ). We argue that two reasons underlie their shortcomings.
27
+
28
+ First, skeleton prediction is an ill-posed problem that does not provide sufficient supervision: different instances of the same skeleton can have very different shapes, and instances of very different skeletons can be very close. Second, the loss function minimized by BFGS can be highly non-nonconvex: even when the skeleton is perfectly predicted, the correct constants are not guaranteed to be found. For these reasons, we believe, and will show, that doing away with skeleton estimation as a intermediary step can greatly facilitate the task of SR for language models.
29
+
30
+ Contributions In this paper, we train Transformers over synthetic datasets to perform end-to-end (E2E) symbolic regression: solutions are predicted directly, without resorting to skeletons. To this effect, we leverage a hybrid symbolic-numeric vocabulary, that uses both symbolic tokens for the operators and variables and numeric tokens for the constants. One can then perform a refinement of the predicted constants by feeding them as informed guess to BFGS, mitigating nonlinear optimization issues. Finally, we introduce generation and inference techniques that allow our models to scale to larger problems: up to 10 input features against 3 in concurrent works.
31
+
32
+ Evaluated over the SRBench benchmark [7], our model significantly narrows the accuracy gap with state-of-the-art GP techniques, while providing several orders of magnitude of inference time speedup (see Fig. 1). We also demonstrate strong robustness to noise and extrapolation capabilities.
33
+
34
+ Related work SR is a challenging task that traces back from a few decades ago, with a large number of open-source and commercial softwares, and has already been used to accelerate scientific discoveries [8, 9, 10]. Most popular frameworks for symbolic regression use GP [11, 12, 13, 14, 15, 16, 17, 18, 19] (see [7] for a recent review), but SR has also seen growing interest from the Deep Learning (DL) community, motivated by the fact that neural networks are good at identifying qualitative patterns.
35
+
36
+ Neural networks have been combined with GP algorithms, e.g. to simplify the original dataset [1], or to propose a good starting distribution over mathematical expressions[20]. [21, 22] propose modifications to feed-forward networks to include interpretable components, i.e. replacing usual activation functions by operators such as cos, sin, however these are hard to optimize and prone to numerical issues.
37
+
38
+ Language models, and especially Transformers [23], have been trained over synthetic datasets to solve various mathematical problems: integration [24], dynamical systems [25], linear algebra [26], formal logic [27] and theorem proving [28]. A few papers apply these techniques to symbolic regression: the aforementioned references [6, 5] train Transformers to predict function skeletons, while [29] infers one-dimensional recurrence relations in sequences of numbers. [30] trains fully-connected networks to predict simple formulas from tabular data.
39
+
40
+ The recently introduced SRBench [7] provides a benchmark for rigorous evaluation of SR methods, in addition to 14 SR methods and $7 \mathrm { M L }$ baselines which we will compare to in this work.
41
+
42
+ # 1 Data generation
43
+
44
+ Our approach consists in training language models on vast synthetic datasets. Each training example is a pair: a set of $N$ points $( x , y ) \in \bar { \mathbb { R } ^ { D } } \overset { - } { \times } \mathbb { R }$ as the input, and a function $f$ such that $y = f ( x )$ as the target2 Examples are generated by first sampling a random function $f$ , then a set of $N$ input values $( x _ { i } ) _ { i \in \mathbb { N } _ { N } }$ in $\mathring { \mathbb { R } } ^ { D }$ , and computing $y _ { i } = f ( x _ { i } )$ .
45
+
46
+ # 1.1 Generating functions
47
+
48
+ To sample functions $f$ , we follow the seminal approach of Lample and Charton [24], and generate random trees with mathematical operators as internal nodes and variables or constants as leaves. The procedure is detailed below (see Table 3 in the Appendix for the values of parameters):
49
+
50
+ 1. Sample the desired input dimension $D$ of the function $f$ from $\mathcal { U } \{ 1 , D _ { \mathrm { m a x } } \}$ .
51
+ 2. Sample the number of binary operators $b$ from $\mathcal { U } \{ D - 1 , D + b _ { \mathrm { m a x } } \}$ then sample $b$ operators from $\mathcal { U } \{ + , - , \times \} ^ { 3 }$ .
52
+ 3. Build a binary tree with those $b$ nodes, using the sampling procedure of [24].
53
+ 4. For each leaf in the tree, sample one of the variables $x _ { d }$ , $d \in \mathbb { N } _ { D }$ .
54
+ 5. Sample the number of unary operators $u$ from $\mathcal { U } \{ 0 , u _ { \mathrm { m a x } } \}$ then sample $u$ operators from the list $O _ { u }$ in Table 3, and insert them at random positions in the tree.
55
+ 6. For each variable $x _ { d }$ and unary operator $u$ , apply a random affine transformation, i.e. replace $x _ { d }$ by $a x _ { d } + b$ , and $u$ by $a u + b$ , with $( a , b )$ sampled from $\mathcal { D } _ { \mathrm { a f f } }$ .
56
+
57
+ Note that since we require independent control on the number of unary operators (which is independent of $D$ ) and binary operators (which depends on $D$ ), we cannot directly sample a unary-binary tree as in [24]. Note also that the first $D$ variables are sampled in ascending order to obtain the desired input dimension, which means functions with missing variables such as $x _ { 1 } + x _ { 3 }$ are never encountered; this is not an issue as our model can always set the prefactor of $x _ { 2 }$ to zero. As discussed quantitatively in App. C, the number of possible skeletons as well as the random sampling of numerical constants guarantees that our model almost never sees the same function twice, and cannot simply perform memorization. See App. B for examples of the skeleton of generated expressions.
58
+
59
+ ![](images/3e48139554525a020662b9a675c7eb49c7bd34e4f9191884863084676779ee11.jpg)
60
+ Figure 2: Sketch of our model. During training, the inputs are all whitened. At inference, we whiten them as a pre-processing step; the predicted function must then be unscaled to account for the whitening.
61
+
62
+ # 1.2 Generating inputs
63
+
64
+ For each function $f : \mathbb { R } ^ { D } \mathbb { R }$ , we sample $N \in \mathcal { U } \{ 1 0 D , N _ { \mathrm { m a x } } \}$ input values $x _ { i } \in \mathbb { R } ^ { D }$ from the distribution $\mathcal { D } _ { x }$ described below, and compute the corresponding output values $y _ { i } = f ( x _ { i } )$ . If any $x _ { i }$ is outside the domain of definition of $f$ or if any $y _ { i }$ is larger $1 \bar { 0 } ^ { 1 0 0 }$ , the process is aborted, and we start again by generating a new function. Note that rejecting and resampling out-of-domain values of $x _ { i }$ , the obvious and cheaper alternative, would provide the model with additional information about $f$ , by allowing it to learn its domain of definition.
65
+
66
+ To maximize the diversity of input distributions seen during training, we sample our inputs from a mixture of distributions (uniform or gaussian), centered around $k$ random centroids4, see App. A for some illustrations at $D = 2$ . Input samples are generated as follows:
67
+
68
+ 1. Sample a number of clusters $k \sim \mathcal { U } \{ 1 , k _ { m a x } \}$ and $k$ weights $w _ { i } \sim \mathcal { U } ( 0 , 1 )$ , which are then normalized so that $\textstyle \sum _ { i } w _ { i } = 1$ .
69
+ 2. For each cluster $i \in \mathbb { N } _ { k }$ , sample a centroid $\mu _ { i } \sim \mathcal { N } ( 0 , 1 ) ^ { D }$ , a vector of variances $\sigma _ { i } \sim$ $\mathcal { U } ( 0 , 1 ) ^ { D }$ and a distribution shape (gaussian or uniform) $\dot { \mathcal { D } _ { i } } \in \{ \mathcal { N } , \mathcal { U } \}$ .
70
+ 3. For each cluster $i \in \mathbb { N } _ { k }$ , sample $\lfloor w _ { i } N \rfloor$ input points from $\mathcal { D } _ { i } ( \mu _ { i } , \sigma _ { i } )$ then apply a random rotation sampled from the Haar distribution.
71
+ 4. Finally, concatenate all the points obtained and whiten them by substracting the mean and dividing by the standard deviation along each dimension.
72
+
73
+ # 1.3 Tokenization
74
+
75
+ Following [26], we represent numbers in base 10 floating-point notation, round them to four significant digits, and encode them as sequences of 3 tokens: their sign, mantissa (between 0 and 9999), and exponent (from E-100 to E100).
76
+
77
+ To represent mathematical functions as sequences, we enumerate the trees in prefix order, i.e. direct Polish notation, as in [24]: operators and variables and integers are represented as single autonomous tokens, and constants are encoded as explained above.
78
+
79
+ For example, the expression $f ( x ) = \cos ( 2 . 4 2 4 2 x )$ is encoded as [c $\mathtt { \mathtt { P S } } , \mathtt { m u l } , + , 2 4 2 4 , \mathtt { E } - 3 , \mathtt { x } ]$ . Note that the vocabulary of the decoder contains a mix of symbolic tokens (operators and variables) and numeric tokens, whereas that of the encoder contains only numeric tokens5.
80
+
81
+ ![](images/2841e91f2a3dbd4efcd9843518678a73997e842ec2c5c64c40095eaf0f581ccf.jpg)
82
+ Figure 3: Attention heads reveal intricate mathematical analysis. We considered the expression $f ( { \bar { x } } ) = \sin ( x ) / x$ , with $N = 1 0 0$ input points sampled between $- 2 0$ and 20 (red dots; the y-axis is arbitrary). We plotted the attention maps of a few heads of the encoder, which are $N \times N$ matrices where the element $( i , j )$ represents the attention between point $i$ and point $j$ . Notice that heads 2, 3 and 4 of the second layer analyze the periodicity of the function in a Fourier-like manner.
83
+
84
+ # 2 Methods
85
+
86
+ Below we describe our approach for end-to-end symbolic regression; please refer to Fig. 2 for an illustration.
87
+
88
+ # 2.1 Model
89
+
90
+ Embedder Our model is provided $N$ input points $( x , y ) \in \mathbb { R } ^ { D + 1 }$ , each of which is represented as $3 ( D + 1 )$ tokens of dimension $d _ { \mathrm { e m b } }$ . As $D$ and $N$ become large, this results in long input sequences (e.g. 6600 tokens for $D = 1 0$ and $N = 2 0 0$ ), which challenge the quadratic complexity of Transformers. To mitigate this, we introduce an embedder to map each input point to a single embedding.
91
+
92
+ The embedder pads the empty input dimensions to $D _ { \mathrm { m a x } }$ , then feeds the $3 ( D _ { \mathrm { m a x } } + 1 ) d _ { \mathrm { e m b } }$ -dimensional vector into a 2-layer fully-connected feedforward network (FFN) with ReLU activations, which projects down to dimension $d _ { \mathrm { e m b } } \mathrm { ^ 6 }$ The resulting $N$ embeddings of dimension $d _ { \mathrm { e m b } }$ are then fed to the Transformer.
93
+
94
+ Transformer We use a sequence to sequence Transformer architecture [23] with 16 attention heads and an embedding dimension of 512, containing a total of 86M parameters. Like [26], we observe that the best architecture for this problem is asymmetric, with a deeper decoder: we use 4 layers in the encoder and 16 in the decoder. A notable property of this task is the permutation invariance of the $N$ input points. To account for this invariance, we remove positional embeddings from the encoder.
95
+
96
+ As shown in Fig. 3 and detailed in App. D, the encoder captures the most distinctive features of the functions considered, such as critical points and periodicity, and blends a mix of short-ranged heads focusing on local details with long-ranged heads which capture the global shape of the function.
97
+
98
+ Training We optimize a cross-entropy loss with the Adam optimizer, warming up the learning rate from $1 0 ^ { - 7 }$ to $2 . 1 0 ^ { - 4 }$ over the first 10,000 steps, then decaying it as the inverse square root of the number of steps, following [23]. We hold out a validation set of $1 0 ^ { 4 }$ examples from the same generator, and train our models until the accuracy on the validation set saturates (around 50 epochs of 3M examples).
99
+
100
+ Input sequence lengths vary significantly with the number of points $N$ ; to avoid wasteful padding, we batch together examples of similar lengths, ensuring that a full batch contains a minimum of 10,000 tokens. On 32 GPU with 32GB memory each, one epoch is processed in about half an hour.
101
+
102
+ # 2.2 Inference tricks
103
+
104
+ In this section, we describe three tricks to improve the performance of our model at inference.
105
+
106
+ Table 1: The importance of an end-to-end model with refinement.
107
+
108
+ <table><tr><td>Model</td><td>Function f(x,y)</td></tr><tr><td>Target</td><td>sin(10x) exp(0.1y)</td></tr><tr><td>Skeleton +BFGS</td><td>- sin(1.7x)(0.059y + 0.19)</td></tr><tr><td>E2E no BFGS</td><td>sin(9.9x) exp(0.1y)</td></tr><tr><td>E2E+BFGS random init</td><td>- sin(0.095x) exp(0.27y)</td></tr><tr><td>E2E+BFGS model init</td><td>sin(10x) exp(0.1y)</td></tr></table>
109
+
110
+ The skeleton approach recovers an incorrect skeleton. The E2E approach predicts the right skeleton. Refinement worsens original prediction when randomly initialized, and yields the correct result when initialized with predicted constants.
111
+
112
+ Refinement Previous language models for SR, such as [6], follow a skeleton approach: they first predict equation skeletons, then fit the constants with a non-linear optimisation solver such as BFGS. In this paper, we follow an end-to-end (E2E) approach: predicting simultaneously the function and the values of the constants. However, we improve our results by adding a refinement step: fine-tuning the constants a posteriori with BFGS, initialized with our model predictions7.
113
+
114
+ This results in a large improvement over the skeleton approach, as we show by training a Transformer to predict skeletons in the same experimental setting. The improvement comes from two reasons: first, prediction of the full formula provides better supervision, and helps the model predict the skeleton; second, the BFGS routine strongly benefits from the informed initial guess, which helps the model predict the constants. This is illustrated qualitatively in Table 1, and quantitatively in Table 2.
115
+
116
+ Scaling As described in Section 1.2, all input points presented to the model during training are whitened: their distribution is centered around the origin and has unit variance. To allow accurate prediction for input points with a different mean and variance, we introduce a scaling procedure during inference. Let $f$ the function to be inferred, $x$ be the input points, and $\mu = \mathrm { m e a n } ( x ) , \sigma = \mathrm { s t d } ( x )$ . As illustrated in Fig. 2 we pre-process the input data by replacing $x$ by $\begin{array} { r } { \tilde { x } = \frac { x - \mu } { \sigma } } \end{array}$ . The model then predicts ${ \hat { f } } ( { \tilde { x } } ) = { \hat { f } } ( \sigma x + \mu )$ , and we can recover an approximation of $f$ by unscaling the variables in $\hat { f }$ .
117
+
118
+ This gives our model the desirable property to be insensitive to the scale of the input points: DL-based approaches to SR are known to fail when the inputs are outside the range of values seen during training [29, 26]. Note that here, the scale of the inputs translates to the scale of the constants in the function $f$ ; although these coefficients are sampled in ${ \mathcal { D } } _ { \mathrm { a f f } }$ during training, coefficients outside $\mathcal { D } _ { \mathrm { a f f } }$ can be expressed by multiplication of constants in $\mathcal { D } _ { \mathrm { a f f } }$ .
119
+
120
+ Bagging and decoding Since our model was trained on $N \leq 2 0 0$ input points, it does not perform satisfactorily at inference when presented with more than 200 input points. To take advantage of large datasets while accommodating memory constraints, we perform bagging: whenever $N$ is larger than 200 at inference, we randomly split the dataset into $B$ bags of 200 input points8.
121
+
122
+ For each bag, we apply a forward pass and generate $C$ function candidates via random sampling or beam search using the next token distribution. As shown in App. F (Fig. 16), the more commonly used beam search [34] strategy leads to much less good results than sampling due to the lack of diversity induced by constant prediction (typical beams will look like $\sin ( x ) , \sin ( 1 . 1 x ) , \sin ( 0 . 9 x ) , \ldots )$ . This provides us with a set of $B C$ candidate solutions.
123
+
124
+ Inference time Our model inference speed has two sources: the forward passes described above on one hand (which can be parallelized up to memory limits of the GPU), and the refinements of candidate functions on the other (which are CPU-based and could also be parallelized, although we did not consider this option here).
125
+
126
+ Table 2: Our approach outperforms the skeleton approach.
127
+
128
+ <table><tr><td>Model</td><td>R²</td><td>Acco.1</td><td>Acco.01</td><td>Acco.001</td></tr><tr><td>Skeleton + BFGS</td><td>0.43</td><td>0.40</td><td>0.27</td><td>0.17</td></tr><tr><td>E2E no BFGS</td><td>0.62</td><td>0.51</td><td>0.27</td><td>0.09</td></tr><tr><td>E2E +BFGS random init</td><td>0.44</td><td>0.44</td><td>0.30</td><td>0.19</td></tr><tr><td>E2E+BFGS model init</td><td>0.68</td><td>0.61</td><td>0.44</td><td>0.29</td></tr></table>
129
+
130
+ Metrics are computed over the 10, 000 examples of the evaluation set.
131
+
132
+ Since $B C$ can become large, we rank candidate functions (according to their error on all input points), get rid of redundant skeleton functions and keep the best $K$ candidates for the refinement step9. To speed up the refinement, we use a subset of at most 1024 input points for the optimization. The parameters $B$ , $C$ and $K$ can be used as cursors in the speed-accuracy tradeoff: in the experiments presented in Fig. 1, we selected $B = 1 0 0$ , $C = 1 0$ , $K = 1 0$ .
133
+
134
+ # 3 Results
135
+
136
+ In this section, we present the results of our model. We begin by studying in-domain accuracy, then present results on out-of-domain datasets.
137
+
138
+ # 3.1 In-domain performance
139
+
140
+ We report the in-domain performance of our models by evaluating them on a fixed validation set of 100,000 examples, generated as per Section 1. Validation functions are uniformly spread out over three difficulty factors: number of unary operators, binary operators, and input dimension. For each function, we evaluate the performance of the model when presented $N = [ 5 0 , 1 0 0 , 1 5 0 , 2 0 0 ]$ input points $( x , y )$ , and prediction accuracy is evaluated on $N _ { \mathrm { t e s t } } = 2 0 0$ points sampled from a fresh instance of the multimodal distribution described in Section 1.2.
141
+
142
+ We assess the performance of our model using two popular metrics: $R ^ { 2 }$ -score [7] and accuracy to tolerance $\tau$ [6, 29]:
143
+
144
+ $$
145
+ R ^ { 2 } = 1 - \frac { \sum _ { i } ^ { N _ { \mathrm { t s t } } } \left( y _ { i } - \hat { y } _ { i } \right) ^ { 2 } } { \sum _ { i } ^ { N _ { \mathrm { t s t } } } \left( y _ { i } - \bar { y } \right) ^ { 2 } } , \qquad \operatorname { A c c } _ { \tau } = 1 \left( \operatorname* { m a x } _ { 1 \leq i \leq N _ { \mathrm { t s t } } } \left| \frac { \hat { y } _ { i } - y _ { i } } { y _ { i } } \right| \leq \tau \right) ,
146
+ $$
147
+
148
+ where $\mathbb { 1 }$ is the indicator function.
149
+
150
+ $R ^ { 2 }$ is classically used in statistics, but it is unbounded, hence a single bad prediction can cause the average $R ^ { 2 }$ over a set of examples to be extremely bad. To circumvent this, we set $R ^ { 2 } = 0$ upon pathological examples as in [7](such examples occur in less that $1 \%$ of cases)10. The accuracy metric provides a better idea of the precision of the predicted expression as it depends on a desired tolerance threshold. However, due to the presence of the max operator, it is sensitive to outliers, and hence to the number of points considered at test time (more points entails a higher risk of outlier). To circumvent this, we discard the $5 \%$ worst predictions, following [6].
151
+
152
+ End-to-end outperforms skeleton In Table 2, we report the average in-domain results of our models. Without refinement, our E2E model outperforms the skeleton model trained under the same protocol in terms of low precision prediction $R ^ { 2 }$ and $\mathbf { A c c } _ { 0 . 1 }$ metrics), but small errors in the prediction of the constants lead to lower performance at high precision $\mathbf { \widetilde { A c c } _ { 0 . 0 0 1 } }$ metric). The refinement procedure alleviates this issue significantly, inducing a three-fold increase in $\operatorname { A c c } _ { 0 . 0 0 1 }$ while also boosting other metrics. Initializing BFGS with the constants estimated in the E2E phase plays a crucial role: with random initialization, the BFGS step actually degrades E2E performance. However, refinement with random initialization still achieves better results than the skeleton model: this suggests that the E2E model predicts skeletons better that the skeleton model.
153
+
154
+ ![](images/76c303fcb62bae6cd5933b6368f08c69013d5a7bbd22ba7579cf51c5da8b7be1.jpg)
155
+ Figure 4: Ablation over the function difficulty (top row) and input difficulty (bottom row). We plot the accuracy at $\tau = 0 . 1$ (Eq. 1), see App. E for the $R ^ { 2 }$ score. We distinguish four models: skeleton, E2E without refinement, E2E with refinement from random guess and E2E with refinement. A: number of unary operators. B: number of binary operators. C: input dimension. D: Low-resource performance, evaluated by varying the number of input points. E: Extrapolation performance, evaluated by varying the variance of the inputs. F: Robustness to noise, evaluated by varying the multiplicative noise added to the labels.
156
+
157
+ Ablation Fig. 4A,B,C presents an ablation over three indicators of formula difficulty (from left to right): number of unary operators, number of binary operators and input dimension. In all cases, increasing the factor of difficulty degrades performance, as one could expect. This may give the impression that our model does not scale well with the input dimension, but we show that our model scales in fact very well on out-of-domain datasets compared to concurrent methods (see Fig. 15 of the Appendix). We include a qualitative ablation on the improvement caused by the use of mixture of distributions in App. E.
158
+
159
+ Fig. 4D shows how performance depends on the number of input points fed to the model, $N$ . In all cases, performance increases, but much more signicantly for the E2E models than for the skeleton model, demonstrating the importance of having a lot of data to accurately predict the constants in the expression.
160
+
161
+ Extrapolation and robustness In Fig. 4E, we examine the ability of our models to interpolate/extrapolate by varying the scale of the test points: instead of normalizing the test points to unit variance, we normalize them to a scale $\sigma$ . As expected, performance degrades as we increase $\sigma$ , however the extrapolation performance remains decent even very far away from the inputs $\sigma = 3 2$ ).
162
+
163
+ Finally, in Fig. 4F, we examine the effect of corrupting the targets $y$ with a multiplicative noise of variance $\sigma$ : $y \to y ( 1 + \xi ) , \xi \sim \mathcal { N } ( 0 , \varepsilon )$ . The results reveal something interesting: without refinement, the E2E model is not robust to noise, and actually performs worse than the skeleton model at high noise. This shows how sensitive the Transformer is to the inputs when predicting constants. Refinement improves robustness significantly, but the initialization of constants to estimated values has less impact, since the prediction of constants is corrupted by the noise.
164
+
165
+ # 3.2 Out-of-domain generalization
166
+
167
+ We evaluate our method on the recently released benchmark SRBench[7]. Its repository contains a set of 252 regression datasets from the Penn Machine Learning Benchmark (PMLB)[35] in addition to 14 open-source SR and ML baselines. The datasets consist in "ground-truth" problems where the true underlying function is known, as well as "black-box" problems which are more general regression datasets without an underlying ground truth. We filter out problems from SRBench to only keep regression problems with $D \leq 1 0$ with continuous features; this results in 190 regression datasets, splitted into 57 black-box problems (combination of real-world and noisy, synthetic datasets), 119 SR datasets from the Feynman [1] and 14 SR datasets from the ODE-Strogatz [36] databases. Each dataset is split into $7 5 \%$ training data and $2 5 \%$ test data, on which performance is evaluated.
168
+
169
+ The overall performance of our models is illustrated in the Pareto plot of Fig. 1, where we see that on both types of problems, our model achieves performance close to state-of-the-art GP models such as Operon with a fraction of the inference time11. Impressively, our model outperforms all classic ML methods (e.g. XGBoost and Random Forests) on real-world problems with a lower inference time, and while outputting an interpretable formula.
170
+
171
+ We provide more detailed results on Feynman problems in Fig. 5, where we additionally plot the formula complexity, i.e. the number of nodes in the mathematical tree (see App. F for similar results on black-box and Strogatz problems). Varying the noise applied to the targets noise, we see that our model displays similar robustness to state-of-the-art GP models. We additionally include ablation on the use of scaling during inference in App. E.
172
+
173
+ While the average accuracy or our model is only ranked fourth, it outputs formulas with lower complexity than the top 2 models (Operon and SBP-GP), which is an important criteria for SR problems: see App. 11 for complexity-accuracy Pareto plots. To the best of our knowledge, our model is the first non-GP approach to achieve such competitive results for SR.
174
+
175
+ ![](images/fceb11b119081140d389755cf596b6bdf20ae4bbd4f59aea3eeeb207c85b02f3.jpg)
176
+ Figure 5: Our model presents strong accuracy-speed-complexity tradeoffs, even in presence of noise. Results are averaged over all 119 Feynman problems, for 10 random seeds and three target noises each as shown in the legend. The accuracy is computed as the fraction of problems for which the $R ^ { 2 }$ score on test examples is above 0.99. Models are ranked according to the accuracy averaged over all target noise.
177
+
178
+ # Conclusion
179
+
180
+ In this work, we introduced a competitive deep learning model for SR by using a novel numericsymbolic approach. Through rigorous ablations, we showed that predicting the constants in an expression not only improves performance compared to predicting a skeleton, but can also serve as an informed initial condition for a solver to refine the value of the constants.
181
+
182
+ Our model outperforms previous deep learning approaches by a margin on SR benchmarks, and scales to larger dimensions. Yet, the dimensions considered here remain moderate $D < 1 0 \AA$ ): adapting to the truly high-dimensional setup is an interesting future direction, and will likely require qualitative changes in the data generation protocol. While our model narrows the gap between GP and DL based SR, closing the gap also remains a challenge for future work.
183
+
184
+ This work opens up a whole new range of applications for SR in fields which require real-time inference. We hope that the methods presented here may also serve as a toolbox for many future applications of Transformers for symbolic tasks.
185
+
186
+ References
187
+ [1] Silviu-Marian Udrescu and Max Tegmark. Ai feynman: a physics-inspired method for symbolic regression, 2020.
188
+ [2] M. Cranmer, Alvaro Sanchez-Gonzalez, Peter W. Battaglia, Rui Xu, Kyle Cranmer, David N. Spergel, and Shirley Ho. Discovering symbolic models from deep learning with inductive biases. ArXiv, abs/2006.11287, 2020.
189
+ [3] Jiˇrí Kubalík, Erik Derner, Jan Žegklitz, and Robert Babuška. Symbolic regression methods for reinforcement learning. IEEE Access, 9:139697–139711, 2021.
190
+ [4] Erik Derner, Jirí Kubalík, Nicola Ancona, and Robert Babuška. Symbolic regression for constructing analytic models in reinforcement learning. ArXiv, abs/1903.11483, 2019.
191
+ [5] Mojtaba Valipour, Bowen You, Maysum Panju, and Ali Ghodsi. Symbolicgpt: A generative transformer model for symbolic regression. arXiv preprint arXiv:2106.14131, 2021.
192
+ [6] Luca Biggio, Tommaso Bendinelli, Alexander Neitz, Aurelien Lucchi, and Giambattista Parascandolo. Neural symbolic regression that scales, 2021.
193
+ [7] William La Cava, Patryk Orzechowski, Bogdan Burlacu, Fabricio Olivetti de Franca, Marco Virgolin, Ying Jin, Michael Kommenda, and Jason H Moore. Contemporary symbolic regression methods and their relative performance. arXiv preprint arXiv:2107.14351, 2021.
194
+ [8] Nikos Aréchiga, Francine Chen, Yan-Ying Chen, Yanxia Zhang, Rumen Iliev, Heishiro Toyoda, and Kent Lyons. Accelerating understanding of scientific experiments with end to end symbolic regression. ArXiv, abs/2112.04023, 2021.
195
+ [9] Silviu-Marian Udrescu and Max Tegmark. Symbolic pregression: Discovering physical laws from raw distorted video. Physical review. E, 103 4-1:043307, 2021.
196
+ [10] Anja Butter, Tilman Plehn, Nathalie Soybelman, and Johann Brehmer. Back to the formula – lhc edition. 2021.
197
+ [11] Michael Schmidt and Hod Lipson. Age-fitness pareto optimization. In Genetic programming theory and practice VIII, pages 129–146. Springer, 2011.
198
+ [12] Michael Schmidt and Hod Lipson. Distilling free-form natural laws from experimental data. science, 324(5923):81–85, 2009.
199
+ [13] William La Cava, Tilak Raj Singh, James Taggart, Srinivas Suri, and Jason H Moore. Learning concise representations for regression by evolving networks of trees. arXiv preprint arXiv:1807.00981, 2018.
200
+ [14] Trent McConaghy. Ffx: Fast, scalable, deterministic symbolic regression technology. In Genetic Programming Theory and Practice IX, pages 235–260. Springer, 2011.
201
+ [15] Marco Virgolin, Tanja Alderliesten, Cees Witteveen, and Peter AN Bosman. Improving model-based genetic programming for symbolic regression of small expressions. Evolutionary computation, 29(2):211–237, 2021.
202
+ [16] Fabricio Olivetti de França and Guilherme Seidyo Imai Aldeia. Interaction–transformation evolutionary algorithm for symbolic regression. Evolutionary computation, 29(3):367–390, 2021.
203
+ [17] Ignacio Arnaldo, Krzysztof Krawiec, and Una-May O’Reilly. Multiple regression genetic programming. In Proceedings of the 2014 Annual Conference on Genetic and Evolutionary Computation, pages 879–886, 2014.
204
+ [18] Marco Virgolin, Tanja Alderliesten, and Peter A. N. Bosman. Linear scaling with and within semantic backpropagation-based genetic programming for symbolic regression. In Proceedings of the Genetic and Evolutionary Computation Conference, GECCO ’19, page 1084–1092, New York, NY, USA, 2019. Association for Computing Machinery.
205
+ [19] Michael Kommenda, Bogdan Burlacu, Gabriel Kronberger, and Michael Affenzeller. Parameter identification for symbolic regression using nonlinear least squares. Genetic Programming and Evolvable Machines, 21(3):471–501, 2020.
206
+ [20] Brenden K Petersen, Mikel Landajuela Larma, T Nathan Mundhenk, Claudio P Santiago, Soo K Kim, and Joanne T Kim. Deep symbolic regression: Recovering mathematical expressions from data via risk-seeking policy gradients. arXiv preprint arXiv:1912.04871, 2019.
207
+ [21] Georg Martius and Christoph H Lampert. Extrapolation and learning equations. arXiv preprint arXiv:1610.02995, 2016.
208
+ [22] Subham Sahoo, Christoph Lampert, and Georg Martius. Learning equations for extrapolation and control. In International Conference on Machine Learning, pages 4442–4450. PMLR, 2018.
209
+ [23] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pages 5998–6008, 2017.
210
+ [24] Guillaume Lample and François Charton. Deep learning for symbolic mathematics. arXiv preprint arXiv:1912.01412, 2019.
211
+ [25] François Charton, Amaury Hayat, and Guillaume Lample. Learning advanced mathematical computations from examples. arXiv preprint arXiv:2006.06462, 2020.
212
+ [26] François Charton. Linear algebra with transformers. arXiv preprint arXiv:2112.01898, 2021.
213
+ [27] Christopher Hahn, Frederik Schmitt, Jens U Kreber, Markus N Rabe, and Bernd Finkbeiner. Teaching temporal logics to neural networks. arXiv preprint arXiv:2003.04218, 2020.
214
+ [28] Stanislas Polu and Ilya Sutskever. Generative language modeling for automated theorem proving. arXiv preprint arXiv:2009.03393, 2020.
215
+ [29] Stéphane d’Ascoli, Pierre-Alexandre Kamienny, Guillaume Lample, and François Charton. Deep symbolic regression for recurrent sequences. arXiv preprint arXiv:2201.04600, 2022.
216
+ [30] Nikos Arechiga, Francine Chen, Yan-Ying Chen, Yanxia Zhang, Rumen Iliev, Heishiro Toyoda, and Kent Lyons. Accelerating understanding of scientific experiments with end to end symbolic regression, 2021.
217
+ [31] Roger Guimerà, Ignasi Reichardt, Antoni Aguilar-Mogas, Francesco A Massucci, Manuel Miranda, Jordi Pallarès, and Marta Sales-Pardo. A bayesian machine scientist to aid in the solution of challenging scientific problems. Science advances, 6(5):eaav6971, 2020.
218
+ [32] Patrick Kidger. Sympytorch. https://github.com/patrick-kidger/sympytorch, 2021.
219
+ [33] Richard Zou Horace He. functorch: Jax-like composable function transforms for pytorch. https://github.com/pytorch/functorch, 2021.
220
+ [34] Sam Wiseman and Alexander M. Rush. Sequence-to-sequence learning as beam-search optimization, 2016.
221
+ [35] Jerome H Friedman. Greedy function approximation: a gradient boosting machine. Annals of statistics, pages 1189–1232, 2001.
222
+ [36] Steven H. Strogatz. Nonlinear Dynamics and Chaos: With Applications to Physics, Biology, Chemistry and Engineering. Westview Press, 2000.
223
+ [37] Ying Jin, Weilin Fu, Jian Kang, Jiadong Guo, and Jian Guo. Bayesian symbolic regression, 2020.
224
+ [38] T. Nathan Mundhenk, Mikel Landajuela, Ruben Glatt, Claudio P. Santiago, Daniel M. Faissol, and Brenden K. Petersen. Symbolic regression via neural-guided genetic programming population seeding, 2021.
225
+
226
+ [39] Sean Welleck, Peter West, Jize Cao, and Yejin Choi. Symbolic brittleness in sequence models: on systematic generalization in symbolic mathematics. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pages 8629–8637, 2022.
227
+
228
+ [40] Martin Vastl, Jonáš Kulhánek, Jirí Kubalík, Erik Derner, and Robert Babuška. Symformer: End-to-end symbolic regression using transformer-based architecture. arXiv preprint arXiv:2205.15764, 2022.
229
+
230
+ # Checklist
231
+
232
+ 1. For all authors...
233
+
234
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
235
+ (b) Did you describe the limitations of your work? [Yes]
236
+ (c) Did you discuss any potential negative societal impacts of your work? [N/A]
237
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
238
+
239
+ 2. If you are including theoretical results...
240
+
241
+ (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]
242
+
243
+ 3. If you ran experiments...
244
+
245
+ (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]
246
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
247
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We noticed the random seed that dictates model initialization had no influence on performance after a few training epochs, therefore we trained our models on a single random seed to avoid unnecessary computations, especially as learning is costly.
248
+ (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]
249
+
250
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
251
+
252
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
253
+ (b) Did you mention the license of the assets? [Yes]
254
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
255
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
256
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
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/I59qJ0sJ2nh/I59qJ0sJ2nh.md ADDED
@@ -0,0 +1,390 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # A Ranking Game for Imitation Learning
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 We propose a new framework for imitation learning—treating imitation as a two
11
+ 2 player ranking-based game between a policy and a reward. In this game,the reward
12
+ 3 agent learns to satisfy pairwise performance rankings between behaviors,while the
13
+ 4 policy agent learns to maximize this reward. In imitation learning, near-optimal
14
+ 5 expert data can be difficult to obtain,and even in the limit of infinite data cannot
15
+ 6 imply a total ordering over trajectories as preferences can. On the other hand,
16
+ 7 learning from preferences alone is challenging as a large number of preferences
17
+ 8 are required to infer a high-dimensional reward function, though preference data is
18
+ 9 typically much easier to collect than expert demonstrations.The classical inverse
19
+ 10 reinforcement learning (IRL) formulation learns from expert demonstrations but
20
+ 11 provides no mechanism to incorporate learning from offline preferences and vice
21
+ 12 versa. We instantiate the proposed ranking-game framework with a novel ranking
22
+ 13 loss giving an algorithm that can simultaneously learn from expert demonstrations
23
+ 14 and preferences,gaining the advantages of both modalities. Our experiments show
24
+ 15 that the proposed method achieves state-of-the-art sample efciency and can solve
25
+ 16 previously unsolvable tasks in the Learning from Observation (LfO) setting.
26
+
27
+ # 171 Introduction
28
+
29
+ 18 Reinforcement learning relies on environmental reward feedback to learn meaningful behaviors.
30
+ 19 Reward specification is a hard problem [39], thus motivating imitation learning (IL) as a technique
31
+ 20 to bypass reward specification and learn from expert data, often via Inverse Reinforcement Learning
32
+ 21 (IRL) techniques. Learning from expert observations (imitation learning) alone can require efficient
33
+ 22 exploration when the expert actions are unavailable as in LfO [36]. Incorporating preferences over
34
+ 23 potentially suboptimal trajectories for reward learning can help reduce the exploration burden by
35
+ 24 regularizing the reward function and providing effective guidance for policy optimization. Previous
36
+ 25 literature in learning from preferences either assumes no environment interaction [10,9] or assumes
37
+ 26 an active query framework with a restricted reward class [47]. The classical IRL formulation suffers
38
+ 27 from two issues: (1) Learning from expert demonstrations and learning from preferences/rankings
39
+ 28 provide complementary advantages for increasing learning efficiency [30, 47]; however, existing
40
+ 29 IRL methods that learn from expert demonstrations provide no mechanisms to incorporate ofline
41
+ 30 preferences and vice versa. (2) Optimization is diffcult, making learning sample inefficient [5, 28]
42
+ 31 due to the adversarial min-max game.
43
+ 32 Our primary contribution is an algorithmic framework casting imitation learning as a rank
44
+ 33 ing game which addresses both of the above issues in IRL.This framework treats imi
45
+ 34 tation as a ranking game between two agents: a reward agent and a policy agent—the
46
+ 35reward agent learns to satisfy pairwise performance rankings between different behaviors
47
+ 36represented as state-action or state visitations,while the policy agent maximizes its per
48
+ 37formance under the learned reward function.The ranking game is detailed in Figure 1
49
+ 38 and is specified by three components:(1) The
50
+ 39 dataset of pairwise behavior rankings,(2)A
51
+ 40 ranking loss function,and (3) An optimization
52
+ 41 strategy. This game encompasses a large subset
53
+ 42 of both inverse reinforcement learning (IRL)
54
+ 43 methods and methods which learn from subop
55
+ 44 timal ofline preferences.Popular IRL methods
56
+ 45 such as GAIL,AIRL, $f$ -MAX [28,22,34] are
57
+ 46 instantiations of this ranking game in which
58
+ 47 rankings are given only between the learning
59
+ 48 agent and the expert,and a gradient descent
60
+ 49 ascent (GDA) optimization strategy is used with
61
+ 50 a ranking loss that maximizes the performance
62
+ 51 gap between the behavior rankings.
63
+
64
+ ![](images/287f29d02f9dc57c3ed3ab5e78f84a206a17fa42f0d26d01bc7c8c541839c021.jpg)
65
+ Figure 1: rank-game:The Policy agent maximizes the reward function by interacting with the environment. The Reward agent satisfies a set of behavior rankings obtained from various sources: generated by the policy agent (vanilla),automatically generated (auto),or offline annotated rankings obtained from a human or offline dataset (pref). Treating this game in the Stackelberg framework leads to either Policy being a leader and Reward being a follower, or vice-versa.
66
+
67
+ The ranking loss used by the prior IRL approaches is specific to the comparison of optimal (expert) vs. suboptimal (agent) data, and precludes incorporation of comparisons among suboptimal behaviors.In this work, we instantiate the ranking game by proposing a new ranking loss $( L _ { k } )$ that facilitates incorporation of rankings over suboptimal trajectories for
68
+
69
+ 0 reward learning. Our theoretical analysis reveals that the proposed ranking loss results in a bounded
70
+ performance gap with the expert that depends on a controllable hyperparameter. Our ranking loss
71
+ 2 can also ease policy optimization by supporting data augmentation to make the reward landscape
72
+ 3 smooth and allowing control over the learned reward scale.Finally, viewing our ranking game in the
73
+ 4 Stackelberg game framework (see Section 3)—an eficient setup for solving general-sum games-we
74
+ 5 obtain two algorithms with complementary benefits in non-stationary environments depending on
75
+ 6 which agent is set to be the leader.
76
+ 67 In summary,this paper formulates a new framework rank-game for imitation learning that allows
77
+ 68 us to view learning from preferences and demonstrations under a unified perspective. We instantiate
78
+ 69 the framework with a principled ranking loss that can naturally incorporate rankings provided by di
79
+ 70 verse sources.Finally, by incorporating additional rankings—auto-generated or ofline—our method:
80
+ 71 (a) outperforms state-of-the-art methods for imitation learning in several MuJoCo simulated domains
81
+ 72 by a significant margin and (b) solves complex tasks like imitating to reorient a pen with dextrous ma
82
+ 73 nipulation using only a few observation trajectories that none of the previous LfO baselines can solve.
83
+
84
+ # 742 Related Work
85
+
86
+ 75 Imitation learning methods are broadly divided into two categories: Behavioral cloning [48,54] and
87
+ 76 Inverse Reinforcement Learning (IRL) [44,1,72,18,20,28,22]. Our work focuses on developing a
88
+ 77 new framework in the seting of IRL through the lens of ranking. Table 1 shows a comparison of the
89
+ 78 proposed rank-game method to prior works.
90
+
91
+ Classical Imitation Game for IRL: The classical imitation game for IRL aims to solve the adversarial min-max problem of finding a policy that minimizes the worst-case performance gap between the agent and the expert. A number of previous works [22, 60,34] have focused on analyzing the properties of this min-max game and its relation to divergence minimization. Under some additional regularization, this min-max objective can be understood as minimizing a certain $f$ -divergence [28,22,34] between the agent and expert state-action visitation. More recently, [60] showed that allforms of imitation learning (BC and IRL) can be understood as performing moment matching under differing assumptions. In this work, we present a new perspective on imitation
92
+
93
+ <table><tr><td>IL Method</td><td>Offline Preferences</td><td>Expert Data</td><td>Ranking Loss</td><td>Reward Function</td><td>Active Human Query</td></tr><tr><td>MaxEntIRL,AdRIL,GAN-GCL, GAIL,f-MAX,AIRL</td><td>X</td><td>LfD</td><td>supremum</td><td>non-linear</td><td>X</td></tr><tr><td>BCO,GAIfO,DACfO, OPOLO,f-IRL</td><td>X</td><td>LfO</td><td>supremum</td><td>non-linear</td><td>X</td></tr><tr><td>TREX,DREX</td><td>√</td><td>X</td><td>Bradley-Terry</td><td>non-linear</td><td>×</td></tr><tr><td>BREX</td><td>√</td><td>X</td><td>Bradley-Terry</td><td>linear</td><td>X</td></tr><tr><td>DemPref</td><td>√</td><td>LfO/LfD</td><td>Bradley-Terry</td><td>linear</td><td>√</td></tr><tr><td>Ibarz et al[30]</td><td>√</td><td>LfD</td><td>Bradley-Terry</td><td>non-linear</td><td>√</td></tr><tr><td>rank-game</td><td>√</td><td>LfO/LfD</td><td>Lk</td><td>non-linear</td><td>X</td></tr></table>
94
+
95
+ Table 1: A summary of IL methods demonstrating the data modalities they can handle (expert data and/or preferences),the ranking-loss functions they use,the assumptions they make on reward function,and whether they require availability of an external agent to provide preferences during training. We highlight whether a method enables LfD,LfO,or both when it is able to incorporate expert data.
96
+
97
+ in which the reward function is learned using a dataset of behavior comparisons,generalizing previous IRL methods that learn from expert demonstrations and additionally giving the flexibility to incorporate rankings over suboptimal behaviors.
98
+
99
+ Learning from Preferences and Suboptimal Data: Learning from preferences and suboptimal data is important when expert data is limited or hard to obtain. Preferences [3, 65,55,14,47] have the advantage of providing guidance in situations expert might not get into,and in the limit provides full ordering over trajectories which expert data cannot. A previous line of work [10,11,9,13] has studied this seting and demonstrated that ofline rankings over suboptimal behaviors can be effectively leveraged to learn a reward function. [14, 47,30] studied the question of learning from preferences in the seting when a human is available to provide online preferences1 (active queries), while [47] additionally assumed the reward to be linear in known features. Our work makes no such assumptions and allows for integrating ofline preferences and expert demonstrations under a common framework.
100
+
101
+ 99 Learning from Observation (LfO): LfO is the problem seting of learning from expert observations.
102
+ 100 This is typically more challenging than the traditional learning from demonstration setting (LfD),
103
+ 101 because actions taken by the expert are unavailable.LfO is broadly formulated using two objectives:
104
+ 102 state-next state marginal matching [63,71,58] and direct state marginal matching [45,43]. Some
105
+ 103 prior works [61, 67,16] approach LfO by inferring expert actions through a learned inverse dynamics
106
+ 104 model. These methods assume injective dynamics and suffer from compounding errors when the
107
+ 105 policy is deployed. A recently proposed method OPOLO [71] derives an upper bound for the LfO
108
+ 106 objective which enables it to utilize off-policy data and increase sample efciency. Our method
109
+ 107 outperforms baselines including OPOLO, by a significant margin.
110
+
111
+ # ;3Background
112
+
113
+ We consider a learning agent in a Markov Decision Process (MDP)[49, 59] which can be defined as a tuple: $\mathcal { M } = ( S , \mathcal { A } , P , R , \gamma , \rho _ { 0 } )$ ,where $s$ and $\mathcal { A }$ are the state and action spaces; $P$ is the state transition probability function,with $P ( s ^ { \prime } | s , a )$ indicating the probability of transitioning from $s$ to $s ^ { \prime }$ when taking action $a$ $R : S \times \mathcal { A } \mathbb { R }$ is the reward function bounded in $[ 0 , R _ { m a x } ]$ ; We consider MDPs with infinite horizon, with the discount factor $\gamma \in [ 0 , 1 ]$ , though our results extend to finite horizons as well; $p _ { 0 }$ is the initial state distribution. We use $\Pi$ and $\mathcal { R }$ to denote the space of policies and reward functions respectively. A reinforcement learning agent aims to find a policy $\pi : { \mathcal { S } } A$ that maximizes its expected return, $\begin{array} { r } { J ( R ; \pi ) = \frac { 1 } { 1 - \gamma } \mathbb { E } _ { ( s , a ) \sim \rho ^ { \pi } ( s , a ) } [ R ( s , a ) ] } \end{array}$ where $\rho ^ { \pi } ( s , a )$ is the stationary state-action distribution induced by $\pi$ . In imitation learning, we are provided with samples from the state-action visitation of the expert $\rho ^ { \pi _ { E } } ( s , a )$ but the reward function of the expert is unknown. We will use $\rho ^ { E } ( s , a )$ as a shorthand for $\rho ^ { \pi _ { E } } ( s , a )$ :
114
+
115
+ Classical Imitation Learning: The goal of imitation learning is to close the imitation gap $J ( R ; \pi ^ { E } ) -$ $J ( R ; \pi )$ defined with respect to the unknown expert reward function $R$ .Several prior works [28,60, 38,45]tackle this problem by minimizing the imitation gap on allpossible reward hypotheses. This
116
+
117
+ 123leads to a zero-sum (min-max) game formulation of imitation learning in which a policy is optimized
118
+ 124with respect to the reward function that induces the largest imitation gap:
119
+
120
+ $$
121
+ \mathrm { i m i t - g a m e } ( \pi ) = \arg \operatorname* { m i n } _ { \pi \in \Pi } \operatorname* { s u p } _ { f \in { \mathcal R } } \mathbb { E } _ { \rho ^ { E } ( s , a ) } [ f ( s , a ) ] - \mathbb { E } _ { \rho ^ { \pi } ( s , a ) } [ f ( s , a ) ] .
122
+ $$
123
+
124
+ 125Here, the imitation gap is upper bounded as follows $\left( \forall \pi \right)$ :
125
+
126
+ $$
127
+ J ( R ; \pi ^ { E } ) - J ( R ; \pi ) \leq \operatorname* { s u p } _ { f \in { \mathcal R } } \mathbb { E } _ { \rho ^ { E } ( s , a ) } [ f ( s , a ) ] - \mathbb { E } _ { \rho ^ { \pi } ( s , a ) } [ f ( s , a ) ] .
128
+ $$
129
+
130
+ 126 Note that, when the performance gap is maximized between the expert $\pi ^ { E }$ and the agent $\pi$ , we can
131
+ 127 observe that the worst-case reward function $f _ { \pi }$ induces a ranking between policy behaviors based
132
+ 128 on their performance: $\rho ^ { E } \succeq \rho ^ { \pi } : = \mathbb { E } _ { \rho ^ { E } ( s , a ) } [ f _ { \pi } ( s , a ) ] \geq \mathbb { E } _ { \rho ^ { \pi } ( s , a ) } [ f _ { \pi } ( s , a ) ]$ , $\forall \pi$ . Therefore, we can
133
+ 129 regard the above loss function that maximizes the performance gap (Eq.2) as an instantiation of the
134
+ 130 ranking-loss.We will refer to the implicit ranking between agent and the expert $\rho ^ { E } \succeq \rho ^ { \pi }$ as vanilla
135
+ 131 rankings and this variant of the ranking-loss function as the supremum-loss.
136
+ 132 Stackelberg Games: A Stackelberg game is a general-sum game between two agents where one agent
137
+ 133 is set to be the leader and the other a follower. The leaderin this game optimizes its objective under the
138
+ 134 assumption that the follower will choose the best response for its own optimization objective. More
139
+ 135 concretely, assume there are two players $A$ and $B$ with parameters $\theta _ { A } , \theta _ { B }$ and corresponding losses
140
+ 136 ${ \mathcal { L } } _ { A } ( \theta _ { A } , \theta _ { B } )$ and $\mathcal { L } _ { B } ( \theta _ { A } , \theta _ { B } )$ . A Stackelberg game solves the following bi-level optimization when
141
+ 137 $A$ is the leader and $B$ is the follower: $\begin{array} { r } { \operatorname* { m i n } _ { \theta _ { A } } \mathcal { L } _ { A } ( \theta _ { A } , \theta _ { B } ^ { * } ( \theta _ { A } ) ) } \end{array}$ s.t $\theta _ { B } ^ { * } ( \theta _ { A } ) = \arg \operatorname* { m i n } _ { \theta } \mathcal { L } _ { B } ( \theta _ { A } , \theta )$
142
+ 138 [51] showed that casting model-based RL as an approximate Stackelberg game [6] leads to
143
+ 139 performance benefits and reduces training instability in comparison to the commonly used GDA [56]
144
+ 140 and Best Reponse (BR)[12] methods. [17, 69] prove convergence of Stackelberg games under
145
+ 141 smooth player cost functions and show that they reduce the cycling behavior to find an equilibrium
146
+ 142 and allow for better convergence.
147
+
148
+ # 1434A Ranking Game for Imitation Learning
149
+
150
+ 144 In this section, we first formalize the notion of the proposed two-player general-sum ranking game
151
+ 145 for imitation learning. We then propose a practical instantiation of the ranking game through a
152
+ 146 novel ranking-loss $( L _ { k } )$ . The proposed ranking game gives us the flexibility to incorporate additional
153
+ 147 rankings—both auto-generated (a form of data augmentation mentioned as ‘auto’ in Fig. 1) and
154
+ 148 ofline (‘pref' in Fig. 1)—which improves learning efficiency. Finally, we discuss the Stackelberg
155
+ 149 formulation for the two-player ranking game and discuss two algorithms that naturally arise depending
156
+ 150 on which player is designated as the leader.
157
+
158
+ # 1514.1The Two-Player Ranking Game Formulation
159
+
160
+ i2We present a new framework, rank-game,for imitation learning which casts it as a general-sum i3ranking game between two players - a reward and a policy.
161
+
162
+ $$
163
+ \begin{array} { r l } { \underbrace { \mathrm { a r g m a x } _ { \pi \in \Pi } J ( R ; \pi ) } _ { \mathrm { P o l i c y ~ A g e n t } } } & { \underbrace { \mathrm { a r g m i n } _ { R \in { \mathcal R } } L ( \mathcal D ^ { p } ; R ) } _ { \mathrm { R e w a r d ~ A g e n t } } } \end{array}
164
+ $$
165
+
166
+ 154 In this formulation, the policy agent maximizes the reward by interacting with the environment, and
167
+ 155 the reward agent atempts to find a reward function that satisfies a set of pairwise behavior rankings
168
+ 156 in the given dataset $\mathcal { D } ^ { p }$ ; a reward function satisfies these rankings if $\mathbb { E } _ { \rho ^ { \pi ^ { i } } } [ R ( s , a ) ] \leq \mathbb { E } _ { \rho ^ { \pi ^ { j } } } [ R ( s , a ) ]$
169
+ 157 $\forall \rho ^ { \pi ^ { i } } \preceq \rho ^ { \pi ^ { j } } \in \mathcal { D } ^ { p }$ ,where $\rho ^ { \pi ^ { i } } , \rho ^ { \pi ^ { j } }$ can be state-action or state vistitations.
170
+ 158 The dataset of pairwise behavior rankings $\mathcal { D } ^ { p }$ can be comprised of the implicit ‘vanilla’ rankings
171
+ 159 between the learning agent and the expert's policy behaviors $( \rho ^ { \pi } \preceq \rho ^ { E } )$ , giving us the classical
172
+ 160 IRL methods when a specific ranking loss function - supremum-loss is used [28, 22, 34]. If
173
+ 161 rankings are provided between trajectories,they can be reduced to the equivalent ranking between the
174
+ 162 corresponding state-action/state visitations. In the case when $\mathcal { D } ^ { p }$ comprises purely of ofline trajectory
175
+ 163 performance rankings then, under a specific ranking loss function (Luce-shepard),the ranking game
176
+ 1: Initialize policy $\pi _ { \theta } ^ { 0 }$ , reward funtion $R _ { \phi }$ , empty dataset ${ \mathcal { D } } ^ { \pi }$ . empirical expert data $\hat { \rho } ^ { E }$
177
+ 2: for $t = 1 . . T$ iterations do
178
+ 3: Collect empirical visitation data $\hat { \rho } ^ { \pi _ { \theta } ^ { t } }$ with $\pi _ { \theta } ^ { t }$ in the environment. Set $\mathcal { D } ^ { \pi } = \{ ( \hat { \rho } ^ { \pi } \preceq \hat { \rho } ^ { E } ) \}$
179
+ 4: Train reward $R _ { \phi }$ to satisfy rankings in ${ \mathcal { D } } ^ { \pi }$ using ranking loss $L _ { k }$ in equation 3.
180
+ 5: Optimize policyunder the reward function: $\pi _ { \theta } ^ { t + 1 } \gets \operatorname * { a r g m a x } _ { \pi ^ { \prime } } J ( R _ { \phi } ; \pi ^ { \prime } )$
181
+ 6: end for
182
+
183
+ i4reduces to prior reward inference methods like T-REX [10,11,9,13]. Thus,the ranking game affords i5us a broader perspective of imitation learning, going beyond only using expert demonstrations.
184
+
185
+ # 4.2Ranking Loss $L _ { k }$ for the Reward Agent
186
+
187
+ We use a ranking-loss to train the reward function—an objective that minimizes the distortion [31] between the ground truth ranking for a pair of entities $\{ x , y \}$ and rankings induced by a parameterized function $R : \mathcal { X } \mathbb { R }$ for a pair of scalars $\{ R ( x ) , R ( y ) \}$ . One type of such a ranking-loss is the supremum-loss in the classical imitation learning setup.
188
+
189
+ 1We propose a class of ranking-loss functions $L _ { k }$ that attempt to induce a performance gap of $k$ for all
190
+ 2behavior preferences in the dataset. Formally,this can be implemented with the regresion loss:
191
+
192
+ $$
193
+ \begin{array} { r } { L _ { k } ( \mathcal { D } ^ { p } ; R ) = \mathbb { E } _ { ( \rho ^ { \pi ^ { i } } , \rho ^ { \pi ^ { j } } ) \sim \mathcal { D } ^ { p } } \Big [ \mathbb { E } _ { s , a \sim \rho ^ { \pi ^ { i } } } \big [ ( R ( s , a ) - 0 ) ^ { 2 } \big ] + \mathbb { E } _ { s , a \sim \rho ^ { \pi ^ { j } } } \big [ ( R ( s , a ) - k ) ^ { 2 } \big ] \Big ] . } \end{array}
194
+ $$
195
+
196
+ 173where $\mathcal { D } ^ { p }$ contains behavior pairs $( \rho ^ { \pi ^ { i } } , \rho ^ { \pi ^ { j } } )$ s.t $\rho ^ { \pi ^ { i } } \preceq \rho ^ { \pi ^ { j } }$ :
197
+
198
+ 174 The proposed ranking loss allows for learning bounded rewards with user-defined scale $k$ in the agent
199
+ 175 and the expert visitations as opposed to prior works in Adversarial Imitation Learning [28,20, 22].
200
+ 176 Reward scaling has been known to improve learning effciency in deep RL; a large reward scale can
201
+ 177 make the optimization landscape less smooth [27, 24] and a smallscale might make the action-gap
202
+ 178 small and increase susceptibility to extrapolation errors [7]. In contrast to the supremum loss, $L _ { k }$
203
+ 179 can also naturally incorporate rankings provided by additional sources by learning a reward function
204
+ 180 satisfying all specified pairwise preferences.The following theorem characterizes the equilibrium of
205
+ 181 the rank-game for imitation learning when $L _ { k }$ is used as the ranking-loss.
206
+ 182 Theorem 4.1. (Performance of the rank-game equilibrium pair) Consider an equilibrium of the
207
+ 183 imitation $\boldsymbol { x } a n k - g a m e \left( \hat { \boldsymbol { \pi } } , \hat { R } \right)$ ,such that the ranking loss $L _ { k }$ generalization error is bounded by
208
+ 184 $2 R _ { m a x } ^ { 2 } \epsilon _ { r }$ and the policy is near-optimal with $J ( \hat { R } ; \hat { \pi } ) \ge J ( \hat { R } ; \pi ) - \epsilon _ { \pi } \forall \pi ,$ then at this equilibrium
209
+ 185 pairundertheexpert'suknownrewrdfuction $R _ { g t }$ bounded in $[ 0 , R _ { m a x } ^ { E } ]$
210
+
211
+ $$
212
+ \left. J ( R _ { g t } , \pi ^ { E } ) - J ( R _ { g t } , \hat { \pi } ) \right. \leq \frac { 4 R _ { m a x } ^ { E } \sqrt { \frac { ( 1 - \gamma ) \epsilon _ { \pi } + 4 R _ { m a x } \sqrt { \epsilon _ { r } } } { k } } } { 1 - \gamma }
213
+ $$
214
+
215
+ 186If reward is a state-only function and only expert observations are available,the same bound applies
216
+ 187to the LfO setting.
217
+
218
+ BProof. We defer the proof to Appendix A.
219
+
220
+ 189 Theoretical properties: We now discuss some theoretical
221
+ 190 properties of $L _ { k }$ . Theorem 1 shows that rank-game has
222
+ 191 an equilibrium with bounded performance gap with the
223
+ 192 expert.An optimization step by the policy player, under a
224
+ 193 reward function optimized by the reward player, is equiva
225
+ 194 lent to minimizing an $f$ -divergence with the expert. Equiv
226
+ 195 alently, at iteration $t$ in Algorithm 1: $\begin{array} { r l } { \operatorname* { m a x } _ { \pi ^ { t } } \mathbb { E } _ { \rho ^ { \pi ^ { t } } } [ R _ { t } ^ { * } ] - } & { { } } \end{array}$
227
+ 196 $\begin{array} { r l } { \mathbb { E } _ { \rho ^ { \pi E } } [ R _ { t } ^ { * } ] = \operatorname* { m i n } _ { \pi ^ { t } } D _ { f } ( \rho ^ { \pi ^ { t } } \| \rho ^ { \pi ^ { E } } ) } \end{array}$ . We elaborate on the
228
+ 197 regret of this idealized algorithm in Appendix A.Theorem
229
+ 198 1 suggests that large values of $k$ can guarantee the agent's
230
+ 199 performance is close to the expert.In practice,we observe
231
+ 200 intermediate values of $k$ also preserve imitation equilib
232
+
233
+ ![](images/bbfe0894b3981f8eb9831936c317afbd1da48c9b5ae17d2ca34c489d7c46824a.jpg)
234
+ Figure 2:Figure shows learned reward function when agent and expert has a visitation shown by pink and black markers respectively.rank-game (auto) results in smooth reward functions more amenable to gradient-based policy optimization compared to GAIL.
235
+
236
+ 201rium optimality with a benefit of promoting sample efcient learning (as an efect of reward scaling
237
+
238
+ 202 described earlier). We discuss this observation further in Appendix D.9. rank-game naturally ex
239
+ 203 tends to the LfO regime under a state-only reward function where Theorem 4.1 results in a divergence
240
+ 204 bound between state-visitations of the expert and the agent. A state-only reward function is also a suf
241
+ 205 ficient and necessary condition to ensure that we learn a dynamics-disentangled reward function [20].
242
+
243
+ $L _ { k }$ can incorporate additional preferences that can help learn a regularized/shaped reward function that provides better guidance for policy optimization, reducing the exploration burden and increasing sample effciency for IRL. A better-guided policy optimization is also expected to incur a lower $\epsilon _ { \pi }$ . However, augmenting the ranking dataset can lead to decrease in the intended performance gap $( k _ { e f f } < k )$ between the agent and the expert (Appendix A). This can loosen the bound in Eq 4 and lead to non-optimal imitation learning. We hypothesize that given informative preferences, decreased $\epsilon _ { \pi }$ can compensate potentially decreased intended performance gap $k _ { e f f }$ to ensure near optimal imitation. In our experiments,we observe this hypothesis holds true; we enjoy sample efficiency benefits without losing any asymptotic performance. To leverage these benefits, we present two methods for augmenting the ranking dataset below and defer the implementation details to Appendix B.
244
+
245
+ # 4.2.1 Generating the Ranking Dataset
246
+
247
+ Reward loss w/ automatically generated rankings (auto): In this method, we assume access to the behavior generating trajectories in the ranking dataset. For each pairwise comparison $\rho _ { i } \preceq \rho _ { j }$ present in the dataset, $L _ { k }$ sets the regression targets for states in $\rho _ { i }$ to be O and for states visited by $\rho _ { j }$ to be $k$ . Equivalently, we can rewrite minimizing $L _ { k }$ as regressing an input of trajectory $\tau _ { i }$ to vector 0, and $\tau _ { j }$ to vector $k { \bf 1 }$ where $\tau _ { i } , \tau _ { j }$ are trajectories that generate the behavior $\rho _ { i } , \rho _ { j }$ respectively. We use the comparison $\rho _ { i } \preceq \rho _ { j }$ to generate additional behavior rankings $\rho _ { i } \preceq \rho _ { \lambda _ { 1 } , i j } \preceq \rho _ { \lambda _ { 2 } , i j } . . \textup { \preceq } \rho _ { \lambda _ { P } , i j } \preceq \rho _ { j }$ where $0 < \lambda _ { 1 } < \lambda _ { 2 } < . . . < \lambda _ { P } < 1$ The behavior $\rho _ { \lambda _ { p } , i j }$ is obtained by independently sampling the trajectories that generate the behaviors $\rho _ { i } , \rho _ { j }$ and taking convex combinations i.e $\tau _ { \lambda _ { p } , i j } =$ $\lambda _ { p } \tau _ { i } + ( 1 - \lambda _ { p } ) \tau _ { j }$ and their corresponding reward regressions targets are given by $\lambda _ { p } \mathbf { 0 } + ( 1 - \mathbf { \bar { \lambda } } ) k \mathbf { 1 }$
248
+
249
+ This form of data augmentation can be interpreted as mixup [68] regularization in the trajectory space.Mixup has been shown to improve generalization and adversarial robustness [25, 68] by regularizing the first and second order gradients of the parameterized function. Following the general principle of using a smoothed objective with respect to inputs to obtain effective gradient signals, explicit smoothing in the trajectory-space can also help reduce the policy optimization error $\epsilon _ { \pi }$ .A didactic example showing rewards learned using this method is shown in Figure 2. In a special case when the expert's unknown reward function is linear in observations,these rankings reflect the true underlying rankings of behaviors.
250
+
251
+ Reward loss w/ offline annotated rankings (pref): Another way of increasing learning efficiency is augmenting the ranking dataset containing the vanilla ranking $( \rho ^ { \pi } \preceq \rho ^ { E } )$ with offline annotated rankings. These rankings may be provided by a human observer or obtained using an offline dataset of behaviors with annotated reward information, similar to the datasets used in ofline RL [19,41]. We combine ofline rankings by using a weighted loss between $L _ { k }$ for satisfying vanilla rankings $( \rho ^ { \pi } \preceq \rho ^ { E } )$ and offline rankings, grounded by an expert. Providing offline rankings alone that are sufficient to explain the reward function of the expert [1O] is often a difficult task and the number of ofline preferences required depends on the complexity of the environment. In the LfO setting,learning from an expert's state visitation alone can be a hard problem due to exploration requirements [36]. This ranking-loss combines the benefits of using preferences to shape the reward function and guide policy improvement while using the expert to guarantee near-optimal performance.
252
+
253
+ # 4.3Optimizing the Two-Player General-Sum Ranking Game as a Stackelberg Game
254
+
255
+ Solving the ranking-game in the Stackelberg setup allows us to propose two diferent algorithms depending on which agent is set to be the leader and utilize the learning stability and eficiency afforded by the formulation as studied in [51, 69,17].
256
+
257
+ 49Policy as leader (PAL): Choosing policy as the leader implies the folowing optimization:
258
+
259
+ $$
260
+ \operatorname* { m a x } _ { \pi } \left\{ J ( \hat { R } ; \pi ) \ s . t . \ \hat { R } = \arg \operatorname* { m i n } _ { R } L ( \mathcal { D } ^ { \pi } ; R ) \right\}
261
+ $$
262
+
263
+ 250Reward as leader (RAL): Choosing reward as the leader implies the following optimization:
264
+
265
+ $$
266
+ \operatorname* { m i n } _ { \hat { R } } \left\{ L ( \mathcal { D } ^ { \pi } ; \hat { R } ) \ s . t \ \pi = \arg \operatorname* { m a x } _ { \pi } J ( \hat { R } ; \pi ) \right\}
267
+ $$
268
+
269
+ 251 We follow the first order gradient approximation for leader's update from previous work [51] to de
270
+ 252 velop practical algorithms. This strategy has been proven to be effective and avoids the computational
271
+ 253 complexity of calculating the implicit Jacobian term $( d \theta _ { B } ^ { * } / d \theta _ { A } )$ . PAL updates the reward to near con
272
+ 254 vergence on dataset ${ \mathcal { D } } ^ { \pi }$ ${ \mathcal { D } } ^ { \pi }$ contains rankings generated using the current policy agent only $\pi \preceq \pi ^ { E \cdot }$
273
+ 255 and takes a few policy steps. Note that even after the first-order approximation, this optimization
274
+ 256 strategy difers from GDA as often only a few iterations are used for training the reward even in hyper
275
+ 257 parameter studies like [46]. RAL updates the reward conservatively. This is achieved through aggregat
276
+ 258 ing the dataset of implicit rankings from al previous policies obtained during training. PAL's strategy
277
+ 259 of using on-policy data ${ \mathcal { D } } ^ { \pi }$ for reward training resembles that of methods including GAIL [28, 62],
278
+ 260 $f$ -MAX [22], and $f$ -IRL [45]. RAL uses the entire history of agent visitation to update the reward
279
+ 261 function and resembles methods such as apprenticeship learning and DAC [1,37]. PAL and RAL
280
+ 262 bring together two seemingly different algorithm classes under a unified Stackelberg game viewpoint.
281
+
282
+ # ;5Experimental Results
283
+
284
+ We compare rank-game against state-of-the-art LfO and LfD approaches on MuJoCo benchmarks having continuous state and action spaces. The LfO seting is more challenging since no actions are available,and is a crucial imitation learning problem that can be used in cases where action modalities differ between the expert and the agent, such as in robot learning. We focus on the LfO seting in this section and defer the LfD experiments to Appendix D.2. We denote the imitation learning algorithms that use the proposed ranking-loss $L _ { k }$ from Section 4.2 as RANK-{PAL,RAL}. We refer to the rank-game variants which use automatically generated rankings and ofline preferences as (auto) and (pref) respectively following Section 4.2. In all our methods,we rely on an off-policy model-free algorithm, Soft Actor-Critic (SAC) [26], for updating the policy agent.
285
+
286
+ We design experiments to answer the following questions:
287
+
288
+ 1. Asymptotic Performance and Sample Effciency: Is our method able to achieve near-expert performance given a limited number (1) of expert observations? Can our method learn using fewer environment interactions than prior state-of-the-art imitation learning (LfO) methods?
289
+ 2. Utility of preferences for imitation learning: Current LfO methods struggle to solve a number of complex manipulation tasks with sparse success signals. Can we leverage ofline annotated preferences through rank-game in such environments to achieve near-expert performance?
290
+ 3. Choosing between PAL and RAL methods: Can we characterize the benefits and pitfalls of each method,and determine when one method is preferable over the other?
291
+ 4. Ablations for the method components: Can we establish the importance of hyperparameters and design decisions in our experiments ?
292
+
293
+ Baselines: We compare RANK-PAL and RANK-RAL against 6 representative LfO approaches that covers a spectrum of on-policy and off-policy model-free methods from prior work: GAIfO [62, 28], DACfO [37], BCO [61], $f$ -IRL [45] and recently proposed OPOLO [71] and IQLearn [21]. We do not assume access to expert actions in this setting. Our LfD experiments compare to the IQLearn [21], DAC [37] and BC baselines.Detailed description for baselines can be found in Appendix D.2.
294
+
295
+ # 5.1Asymptotic Performance and Sample Efficiency
296
+
297
+ In this section, we compare RANK-PAL(auto) and RANK-RAL(auto) to baselines on a set of MuJoCo locomotion tasks of varying complexities: Swimmer-v2, Hopper-v2, HalfCheet ah-v2, Walker2d-v2, Ant-v2 and Humanoid-v2. In this experiment, we provide one expert trajectory for all methods and do not assume access to any offline annotated rankings.
298
+
299
+ 94 Asymptotic Performance: Table 2 shows that both rank-game methods are able to reach near
300
+ 95expert asymptotic performance with a single expert trajectory. BCO shows poor performance which
301
+ 296 can be attributed to the compounding error problem arising from its behavior cloning strategy. GAIfO
302
+ 297 and DACfO use GDA for optimization with a supremum loss and show high variance in their
303
+ 298 asymptotic performance whereas rank-game methods are more stable and low-variance.
304
+
305
+ <table><tr><td>Env</td><td>Hopper</td><td>HalfCheetah</td><td>Walker</td><td>Ant</td><td>Humanoid</td></tr><tr><td>BCO</td><td>20.10±2.15</td><td>5.12±3.82</td><td>4.00±1.25</td><td>12.80±1.26</td><td>3.90±1.24</td></tr><tr><td>GaIFO</td><td>81.13± 9.99</td><td>13.54±7.24</td><td>83.83±2.55</td><td>20.10±24.41</td><td>3.93±1.81</td></tr><tr><td>DACfO</td><td>94.73±3.63</td><td>85.03±5.09</td><td>54.70±44.64</td><td>86.45±1.67</td><td>19.31±32.19</td></tr><tr><td>f -IRL</td><td>97.45± 0.61</td><td>96.06±4.63</td><td>101.16±1.25</td><td>71.18±19.80</td><td>77.93±6.372</td></tr><tr><td>OPOLO</td><td>89.56±5.46</td><td>88.92±3.20</td><td>79.19±24.35</td><td>93.37± 3.78</td><td>24.87±17.04</td></tr><tr><td>RANK-PAL(ours)</td><td>87.14± 16.14</td><td>94.05±3.59</td><td>93.88±0.72</td><td>98.93±1.83</td><td>96.84±3.28</td></tr><tr><td>RANK-RAL(ours)</td><td>99.34±0.20</td><td>101.14±7.45</td><td>93.24±1.25</td><td>93.21±2.98</td><td>94.45±4.13</td></tr><tr><td>Expert</td><td>100.00±0</td><td>100.00±0</td><td>100.00±0</td><td>100.00±0</td><td>100.00±0</td></tr><tr><td>(S,A)</td><td>(11,3)</td><td>(17,6)</td><td>(17,6)</td><td>(111,8)</td><td>(376,17)</td></tr></table>
306
+
307
+ Table 2: Asymptotic normalized performance of LfO methods at 2 milion timesteps on MuJoCo locomotion tasks.The standard deviation is calculated with 5 different runs each averaging over 1O trajectory returns.For unnormalized score and more details,check Appendix D. We omit IQlearn due to poor performance.
308
+
309
+ ![](images/8cd92661657412571edf891d60596e0d84e49394db757855d744aecb40dd98bd.jpg)
310
+ Figure 3: Comparison of performance on OpenAI gym benchmark tasks.The shaded region represents standard deviation across 5 random runs.RANK-PAL and RANK-RAL substantially outperform the baselines in sample efficiency. Complete set of results can be found in Appendix D.1
311
+
312
+ Sample Efficiency: Figure 3 shows that RANK-RAL and RANK-PAL are among the most sample efficient methods for the LfO seting,outperforming the recent state-of-the-art method OPOLO [71] by a significant margin. We notice that IQLearn fails to learn in the LfO settng. This experiment demonstrates the benefit of the combined improvements of the proposed ranking-loss with automatically generated rankings. Our method is also simpler to implement than OPOLO,as we require fewer lines of code changes on top of SAC and need to maintain fewer parameterized networks compared to OPOLO which requires an additional inverse action model to regularize learning.
313
+
314
+ # 5.2Utility of Preferences in Imitation
315
+
316
+ Our experiments on complex manipulation environments—door opening with a paralleljaw gripper [7O] and pen manipulation with a dexterous adroit hand [5O] - reveal that none of the prior LfO methods are able to imitate the expert even under increasing amounts of expert data. This failure of LfO methods can be potentially attributed to the exploration requirements of LfO compared to LfD [36], coupled with the sparse successes encountered
317
+
318
+ ![](images/3383a9ca8d599317d524678385521192915b24a18bdfd44c87fdb7fc6353b13f.jpg)
319
+ Figure 4: Offline annotated preferences can help solve LfO tasks in the complex manipulation environments Pen-vO and Door, whereas prior LfO methods fail.Black dotted line shows asymptotic performance of RANKPAL (auto) method.
320
+
321
+ in these tasks,leading to poorly guided policy gradients. In these experiments,we show that rank-game can incorporate additional information in the form of ofline annotated rankings to guide the agent in solving such tasks. These offline rankings are obtained by uniformly sampling a small set of trajectories (1O) from the replay buffer of SAC [26] labeled with a ground truth reward function. We use a weighted ranking loss (pref) from Section 4.2.
322
+
323
+ 23Figure 4 shows that RANK-PAL/RAL(pref) method leveraging ofline ranking is the only method that
324
+ 24can solve these tasks, whereas prior LfO methods and RANK-PAL/RAL(auto) with automatically
325
+
326
+ generated rankings struggle even after a large amount of training. We also point out that T-REX, a method that learns using the preferences alone is unable to achieve near-expert performance,thereby highlighting the benefits of learning from expert demonstrations alongside a set of ofline preferences.
327
+
328
+ # 5.3Comparing PAL and RAL
329
+
330
+ PAL uses the agent's current visitation for reward learning,whereas RAL learns a reward consistent with al rankings arising from the history of the agent's visitation. These properties can present certain benefits depending on the task setting.To test the potential benefits of PAL and RAL, we consider two non-stationary imitation learning problems,similar to [5O] -one in which the expert changes it's intent and the other where dynamics of the environment change during training in the Hopper-v2 locomotion task. For changing intent, we present a new set of demonstrations where the hopper agent hops backwards rather than forward. For changing environment dynamics,we increase the mass of the hopper agent by a factor of 1.2. Changes are
331
+
332
+ ![](images/9d72d13be864a58d6a3348518ff57df950289fa865a15ca2ae2ad567082b034b.jpg)
333
+ Figure 5: We compare the relative strengths of PAL and RAL.Left plot shows a comparison when the goal is changed,and right plot shows a comparison when dynamics of the environment is changed. These changes occur at le5 timesteps into training.PAL adapts faster to changing intent and RAL adapts faster to changing dynamics.
334
+
335
+ introduced at 1e5 time steps during training at which point we notice a sudden performance drop. In Figure 5 (left), we notice that PAL adapts faster to intent changes, whereas RAL needs to unlearn the rankings obtained from the agent’s history and takes longer to adapt. Figure 5 (right) shows that RAL adapts faster to the changing dynamics of the system, as it has already learned a good global notion of the dynamics-disentangled reward function in the LfO seting, whereas PAL only has a local understanding of reward as a result of using ranking obtained only from the agent's current visitation.
336
+
337
+ Ablation of Method Components: Appendix D contains eight additional experiments to study the importance of hyperparameters and design decisions. Our ablations validate the importance of using automatically generated rankings, the benefit of ranking loss over supremum loss, and sensitivity to hyperparameters like the intended performance gap $k$ ,policy iterations,and the reward regularizer.
338
+
339
+ # 6Conclusion
340
+
341
+ In this work, we present a new framework for imitation learning that treats imitation as a two-player ranking-game between a policy and a reward function. Unlike prior works in imitation learning, the ranking game allows incorporation of rankings over suboptimal behaviors to aid policy learning. We instantiate the ranking game by proposing a novel ranking loss which guarantees agent's performance to be close to expert for imitation learning. Our experiments on simulated MuJoCo tasks reveal that utilizing additional ranking through our proposed ranking loss leads to improved sample efficiency for imitation learning, outperforming prior methods by a significant margin and solving some tasks which were unsolvable by previous LfO methods.
342
+
343
+ Limitations and Negative Societal Impacts:Preferences obtained in real world are usually noisy [40,32,8]and one limitation of rank-game is that it does not suggest a way to handle noisy preferences. Second, rank-game proposes modifications to learn a reward function amenable to policy optimization but these hyperparameters are set manually. Future work can explore methods to automate learning such reward functions. Third, despite learning effective policies we observed that we do not learn reusable robust reward functions [45]. Negative Societal Impact: Imitation learning can cause harm if given demonstrations of harmful behaviors,either accidentally or purposefully. Furthermore,even when given high-quality demonstrations of desirable behaviors,our algorithm does not provide guarantees of performance,and thus could cause harm if used in high-stakes domains without sufficient safety checks on learned behaviors.
344
+
345
+ 374References [1] Pieter Abbeel and Andrew Y Ng. Apprenticeship learning via inverse reinforcement learning. In Proceedings of the twenty-first international conference on Machine learning, page 1, 2004. [2] Joshua Achiam. Spinning Up in Deep Reinforcement Learning. 2018. [3] Riad Akrour, Marc Schoenauer,and Michele Sebag. Preference-based policy learning. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pages 12-27. Springer, 2011. [4] Syed Mumtaz Ali and Samuel D Silvey. A general class of coeficients of divergence of one distribution from another. Journal of the Royal Statistical Society: Series B (Methodological), 28(1):131-142, 1966. [5] Oleg Arenz and Gerhard Neumann. Non-adversarial imitation learning and its connections to adversarial methods.arXiv preprint arXiv:2008.03525,2020. [6] Tamer Basar and Geert Jan Olsder. Dynamic noncooperative game theory. SIAM,1998. [7] Marc G Bellmare, Georg Ostrovski, Arthur Guez, Philip Thomas,and Remi Munos. Increasing the action gap: New operators for reinforcement learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 30, 2016. [8] Erdem Biyik, Dylan P Losey, Malayandi Palan,Nicholas C Landolfi, Gleb Shevchuk, and Dorsa Sadigh. Learning reward functions from diverse sources of human feedback: Optimally integrating demonstrations and preferences. The International Journal of Robotics Research, page 02783649211041652, 2021. [9] Daniel Brown, Russell Coleman, Ravi Srinivasan, and Scott Niekum. Safe imitation learning via fast bayesian reward inference from preferences. In International Conference on Machine Learning, pages 1165-1177.PMLR,2020.
346
+ 397[10] Daniel S. Brown,Wonjoon Goo,Prabhat Nagarajan,and Scott Niekum. Extrapolating beyond suboptimal demonstrations via inverse reinforcement learning from observations. ArXiv, abs/1904.06387, 2019. [11] Daniel S Brown, Wonjoon Goo, and Scott Niekum. Beter-than-demonstrator imitation learning via automatically-ranked demonstrations. In Conference on robot learning, pages 330-359. PMLR,2020.
347
+ 403[12] Nicolo Cesa-Bianchi and Gabor Lugosi. Prediction, learning, and games. Cambridge university press,2006.
348
+ 405[13] Letian Chen,Rohan Paleja,and Matthew Gombolay. Learning from suboptimal demonstration via self-supervised reward regression. arXiv preprint arXiv:2010.11723,2020. [14] Paul Christiano, Jan Leike, Tom B Brown,Miljan Martic,Shane Legg,and Dario Amodei. Deep reinforcement learning from human preferences. arXiv preprint arXiv:1706.03741, 2017.
349
+ 409[15] Imre Csiszar. Information-type measures of difference of probability distributions and indirect observation. studia scientiarum Mathematicarum Hungarica, 2:229-318, 1967.
350
+ 411[16] Ashley Edwards,Himanshu Sahni, Yannick Schroecker,and Charles Isbell.Imitating latent policies from observation. In International Conference on Machine Learning, pages 1755-1763. PMLR, 2019.
351
+ 414[17] Tanner Fiez, Benjamin Chasnov, and Lillian JRatliff. Convergence of learning dynamics in stackelberg games. arXiv preprint arXiv:1906.01217, 2019.
352
+ 16[18] Chelsea Finn, Sergey Levine, and Pieter Abbeel. Guided cost learning: Deep inverse optimal control via policy optimization. In International conference on machine learning, pages 49-58. PMLR,2016.
353
+ 19[19] Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker,and Sergey Levine. D4rl: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020. [20] Justin Fu, Katie Luo,and Sergey Levine. Learning robust rewards with adversarial inverse reinforcement learning. arXiv preprint arXiv:1710.11248, 2017. [21] Divyansh Garg, Shuvam Chakraborty, Chris Cundy, Jiaming Song,and Stefano Ermon. Iq-learn: Inverse soft-q learning for imitation. Advances in Neural Information Processing Systems, 34, 2021. [22] Seyed Kamyar Seyed Ghasemipour, Richard Zemel, and Shixiang Gu. A divergence minimization perspective on imitation learning methods. In Conference on Robot Learning, pages 1259-1277. PMLR, 2020. [23] Gustavo Gilardoni. On the minimum f-divergence for given total variation. Comptes Rendus Mathematique - C R MATH,343:763-766,12 2006. [24] Xavier Glorot and Yoshua Bengio. Understanding the difficulty of training deep feedforward neural networks. In Proceedings of the thirteenth international conference on artificial intelligence and statistics, pages 249-256. JMLR Workshop and Conference Proceedings, 2010. [25] Hongyu Guo, Yongyi Mao,and Richong Zhang. Mixup as locally linear out-of-manifold regularization. In Proceedings of the AAAI Conference on Artificial Intellgence, volume 33, pages 3714-3722,2019. [26] Tuomas Haarnoja,Aurick Zhou, Pieter Abbeel,and Sergey Levine. Soft actor-critic: Offpolicy maximum entropy deep reinforcement learning with a stochastic actor. In International conference on machine learning, pages 1861-1870. PMLR, 2018. [27] Peter Henderson, Riashat Islam, Philip Bachman,Joelle Pineau, Doina Precup,and David Meger. Deep reinforcement learning that matters. In Proceedings of the AAAI conference on artificial intelligence, volume 32, 2018. [28] Jonathan Ho and Stefano Ermon. Generative adversarial imitation learning. Advances in neural information processing systems, 29:4565-4573, 2016. [29] Wassily Hoeffding.Probability inequalities for sums of bounded random variables. In The collected works of Wassily Hoeffding, pages 409-426. Springer,1994. [30] Borja Ibarz, Jan Leike,Tobias Pohlen, Geofrey Irving, Shane Legg,and Dario Amodei. Reward learning from human preferences and demonstrations in atari. arXiv preprint arXiv:1811.06521, 2018. [31] Rishabh Iyer and Jeff Bilmes. The submodular bregman and lovasz-bregman divergences with applications: Extended version. Citeseer, 2012. [32] Hong Jun Jeon, Smitha Milli, and Anca Dragan. Reward-rational (implicit) choice: A unifying formalism for reward learning. Advances in Neural Information Processing Systems,33:4415- 4426,2020.
354
+ 5[33] Sham Kakade and John Langford. Approximately optimal approximate reinforcement learning. In In Proc. 19th International Conference on Machine Learning. Citeseer, 2002. [34] Liyiming Ke, Sanjiban Choudhury, Matt Barnes, Wen Sun, Gilwoo Lee,and Siddhartha Srinivasa. Imitation learning as f-divergence minimization. In Algorithmic Foundations of Robotics XIV: Proceedings of the Fourteenth Workshop on the Algorithmic Foundations of Robotics 14, pages 313-329. Springer International Publishing,2021.
355
+ 61[35] Michael Kearns and Satinder Singh.Finite-sample convergence rates forq-learning and indirect algorithms. Advances in neural information processing systems, 11, 1998.
356
+ 63[36] Rahul Kidambi, Jonathan Chang,and Wen Sun. Mobile: Model-based imitation learning from observation alone. Advances in Neural Information Processing Systems,34,2021.
357
+ 65[37] Ilya Kostrikov, Kumar Krishna Agrawal, Debidatta Dwibedi, Sergey Levine, and Jonathan Tompson. Discriminator-actor-critic: Addressing sample ineficiency and reward bias in adversarial imitation learning. arXiv preprint arXiv:1809.02925, 2018. [38] Ilya Kostrikov, Ofir Nachum,and Jonathan Tompson. Imitation learning via off-policy distribution matching. arXiv preprint arXiv:1912.05032, 2019. [39] Victoria Krakovna. Specification gaming examples in ai. Available at vkrakovna. wordpress. com,2018.
358
+ 72[40] Minae Kwon, Erdem Biyik, Aditi Talati, Karan Bhasin,Dylan PLosey,and Dorsa Sadigh. When humans aren't optimal: Robots that collaborate with risk-aware humans.In 2020 15th ACM/IEEE International Conference on Human-Robot Interaction (HRI), pages 43-52. IEEE, 2020.
359
+ 76[41] Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Ofline reinforcement learning: Tutorial, review,and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020. [42] Friedrich Liese and Igor Vajda. On divergences and informations in statistics and information theory. IEEE Transactions on Information Theory,52(10):4394-4412, 2006. [43] Fangchen Liu, Zhan Ling, Tongzhou Mu, and Hao Su. State alignment-based imitation learning. arXiv preprint arXiv:1911.10947, 2019.
360
+ B2[44] Andrew Y Ng, Stuart J Russel, et al. Algorithms for inverse reinforcement learning. In Icml, volume 1, page 2, 2000. [45] Tianwei Ni, Harshit Sikchi, Yufei Wang,Tejus Gupta,Lisa Lee,and Benjamin Eysenbach. f-irl: Inverse reinforcement learning via state marginal matching. arXiv preprint arXiv:2Ol1.04709, 2020.
361
+ B7[46] Manu Orsini, Anton Raichuk,Leonard Hussenot, Damien Vincent, Robert Dadashi, Sertan Girgin, Mathieu Geist, Olivier Bachem, Olivier Pietquin,and Marcin Andrychowicz. What maters for adversarial imitation learning? Advances in Neural Information Processing Systems, 34,2021.
362
+ 91[47] Malayandi Palan,Nicholas CLandolfi, Gleb Shevchuk,and Dorsa Sadigh.Learning reward functions by integrating human demonstrations and preferences. arXiv preprint arXiv:1906.08928, 2019.
363
+ 94[48] Dean A Pomerleau. Efcient training of artificial neural networks for autonomous navigation. Neural computation, 3(1):88-97,1991. [49] Martin L Puterman. Markov decision processes: discrete stochastic dynamic programming. John Wiley & Sons,2014. [50] Aravind Rajeswaran, Vikash Kumar, Abhishek Gupta, Giulia Vezzani, John Schulman, Emanuel Todorov, and Sergey Levine. Learning complex dexterous manipulation with deep reinforcement learning and demonstrations. arXiv preprint arXiv:1709.10087, 2017.
364
+ 01[51] Aravind Rajeswaran,Igor Mordatch, and Vikash Kumar. A game theoretic framework for model based reinforcement learning. In ICML,2020.
365
+ [52] Siddharth Reddy, Anca D Dragan, and Sergey Levine. Sqil: Imitation learning via reinforcement learning with sparse rewards. arXiv preprint arXiv:1905.11108, 2019.
366
+ [53] Alfred Rényi. On measures of entropy and information. In Proceedings ofthe Fourth Berkeley Symposium on Mathematical Statistics and Probability, Volume 1: Contributions to the Theory of Statistics, pages 547-561. University of California Press,1961.
367
+ [54] Stephane Ross, Geoffrey Gordon, and Drew Bagnell. A reduction of imitation learning and structured prediction to no-regret online learning. In Proceedings of the fourteenth international conference on artificial intelligence and statistics, pages 627-635. JMLR Workshop and Conference Proceedings, 2011.
368
+ [55] Dorsa Sadigh, Anca D Dragan, Shankar Sastry, and Sanjit A Seshia. Active preference-based learning of reward functions. 2017.
369
+ [56] Florian Schafer and Anima Anandkumar. Competitive gradient descent. arXiv preprint arXiv:1905.12103,2019.
370
+ [57] Shai Shalev-Shwartz and Shai Ben-David. Understanding machine learning: From theory to algorithms. Cambridge university press,2014.
371
+ [58] Wen Sun,Anirudh Vemula, Byron Boots,and Drew Bagnell. Provably efcient imitation learning from observation alone. In International conference on machine learning, pages 6036-6045.PMLR,2019.
372
+ [59] Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
373
+ [60] Gokul Swamy, Sanjiban Choudhury, JAndrew Bagnell,and Steven Wu. Of moments and matching: A game-theoretic framework for closing the imitation gap. In International Conference on Machine Learning, pages 10022-10032. PMLR, 2021.
374
+ [61] Faraz Torabi, Garrett Warnell,and Peter Stone. Behavioral cloning from observation. arXiv preprint arXiv:1805.01954, 2018.
375
+ [62] Faraz Torabi, Garrett Warnell, and Peter Stone. Generative adversarial imitation from observation. arXiv preprint arXiv:1807.06158,2018.
376
+ [63] Faraz Torabi, Garrett Warnell,and Peter Stone. Recent advances in imitation learning from observation. arXiv preprint arXiv:1905.13566,2019.
377
+ [64] Igor Vajda. Note on discrimination information and variation (corresp.). IEEE Transactions on Information Theory,16(6):771-773,1970.
378
+ [65] Aaron Wilson, Alan Fern, and Prasad Tadepalli. A bayesian approach for policy learning from trajectory preference queries. Advances in neural information processing systems, 25:1133- 1141, 2012.
379
+ [66] Tian Xu, Ziniu Li, and Yang Yu. Error bounds of imitating policies and environments for reinforcement learning.IEEE Transactions on Pattern Analysis and Machine Intelligence,2021.
380
+ [67] Chao Yang, Xiaojian Ma, Wenbing Huang,Fuchun Sun, Huaping Liu, Junzhou Huang, and Chuang Gan. Imitation learning from observations by minimizing inverse dynamics disagreement. arXiv preprint arXiv:1910.04417,2019.
381
+ [68] Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
382
+ [69] Liyuan Zheng, Tanner Fiez, Zane Alumbaugh,Benjamin Chasnov, and Lillian J Ratliff. Stackelberg actor-critic: Game-theoretic reinforcement learning algorithms. arXiv preprint arXiv:2109.12286,2021.
383
+
384
+ 47 [70] Yuke Zhu, Josiah Wong,Ajay Mandlekar, and Roberto Martin-Martin. robosuite: A modular
385
+ 48 simulation framework and benchmark for robot learning. arXiv preprint arXiv:2Oo9.12293,
386
+ 49 2020.
387
+ 50 [71] Zhuangdi Zhu, Kaixiang Lin, Bo Dai, and Jiayu Zhou. Of-policy imitation learning from
388
+ 51 observations. Advances in Neural Information Processing Systems,33,2020.
389
+ 52 [72] Brian D Ziebart, Andrew L Maas, J Andrew Bagnell, Anind K Dey, et al. Maximum entropy
390
+ 53 inverse reinforcement learning. In Aaai, volume 8, pages 1433-1438. Chicago, IL, USA, 2008.
md/dev/JVzeOYEx6d/JVzeOYEx6d.md ADDED
The diff for this file is too large to render. See raw diff
 
md/dev/K2OixmPDou3/K2OixmPDou3.md ADDED
The diff for this file is too large to render. See raw diff
 
md/dev/Mspk_WYKoEH/Mspk_WYKoEH.md ADDED
The diff for this file is too large to render. See raw diff
 
md/dev/QFQoxCFYEkA/QFQoxCFYEkA.md ADDED
@@ -0,0 +1,380 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DENSE: Data-Free One-Shot Federated Learning
2
+
3
+ Jie Zhang1∗ Chen Chen1∗ Bo Li2‡ Lingjuan Lyu3‡ Shuang Wu2 Shouhong Ding2 Chunhua Shen1 Chao Wu1‡
4
+
5
+ 1Zhejiang University 2Youtu Lab, Tencent 3 Sony AI
6
+
7
+ {zj_zhangjie, chao.wu, cc33} $@$ zju.edu.cn, Lingjuan.Lv $@$ sony.com {libraboli, calvinwu, ericshding}@tencent.com, chunhua $@$ me.com
8
+
9
+ # Abstract
10
+
11
+ One-shot Federated Learning (FL) has recently emerged as a promising approach, which allows the central server to learn a model in a single communication round. Despite the low communication cost, existing one-shot FL methods are mostly impractical or face inherent limitations, e.g., a public dataset is required, clients’ models are homogeneous, and additional data/model information need to be uploaded. To overcome these issues, we propose a novel two-stage Data-freE oNeShot federated lEarning (DENSE) framework, which trains the global model by a data generation stage and a model distillation stage. DENSE is a practical one-shot FL method that can be applied in reality due to the following advantages: (1) DENSE requires no additional information compared with other methods (except the model parameters) to be transferred between clients and the server; (2) DENSE does not require any auxiliary dataset for training; (3) DENSE considers model heterogeneity in FL, i.e., different clients can have different model architectures. Experiments on a variety of real-world datasets demonstrate the superiority of our method. For example, DENSE outperforms the best baseline method Fed-ADI by $5 . 0 8 \%$ on CIFAR10 dataset.
12
+
13
+ # 1 Introduction
14
+
15
+ Deep neural networks (DNNs) have recently gained popularity as a powerful tool for advancing artificial intelligence in both established and emerging fields [25, 22, 13, 9, 8, 51, 52, 58, 5, 4, 16]. Federated learning (FL) [42] has emerged as a promising learning paradigm which allows multiple clients to collaboratively train a global model without exposing their private training data. In FL, each client trains a local model on its own data and is required to periodically share its high-dimensional model parameters with a central server. Recent years, FL has shown its potential to facilitate real-world applications in many fields, including medical image analysis [36, 6], recommender systems [34, 38], natural language processing [63, 46] and computer vision [27, 26].
16
+
17
+ The original FL framework requires participants to communicate frequently with the central server in order to exchange models. In real-world FL, such high communication cost may be intolerable and impractical. Reducing the communication cost between clients and the server is desired both for system efficiency and to support the privacy goals of federated learning [40, 41]. Recent research proposed some common methods to reduce communication costs, e.g., utilize multiple local updates [18], employ compression techniques [48], and one-shot FL [10]. Among them, one-shot FL is a promising solution which only allows one communication round. There are several motivations behind one-shot FL: 1) First of all, multi-round training is not practical in some scenarios such as model markets [45], in which users can only buy the pre-trained models from the market without any real data. 2) Furthermore, frequent communication poses a high risk of being attacked. For instance, frequent communication can be easily intercepted by attackers, who can launch man-in-the-middle attacks [47] or even reconstruct the training data from gradients [54]. In this way, one-shot FL can reduce the probability of being intercepted by malicious attackers due to the one-round property. Thus, in this paper, we mainly focus on one-shot FL.
18
+
19
+ However, existing one-shot FL studies [10, 30, 62, 7] are still hard to apply in real-world applications, due to impractical settings. For example, Guha et al. [10] and Li et al. [30] involved a public dataset for training, which may be impractical in very sensitive scenarios such as the biomedical domains. Zhu et al. [62] adopted dataset distillation [50] in one-shot FL, but they need to send distilled data to the central server, which causes additional communication cost and potential privacy leakage. Dennis et al. [7] utilized cluster-based method in one-shot FL, which requires to upload the cluster means to the server, causing additional communication cost. Additionally, none of these methods consider model heterogeneity, i.e., different clients have different model architectures [31], which is very common in practical scenarios. For instance, in model market, models sold by different sellers are likely to be heterogeneous. Besides, when several medical institutions participate in FL, they may need to design their own model to meet distinct specifications. Therefore, developing a practical one-shot FL method is in urgent need.
20
+
21
+ In this work, we propose a novel two-stage Data-freE oNe-Shot federated lEarning (DENSE) framework, which trains the global model by a data generation stage and a model distillation stage. In the first stage, we utilize the ensemble models (i.e., ensemble of local models uploaded by clients) to train a generator, which can generate synthetic data for training in the second stage. In the second stage, we distill the knowledge of the ensemble models to the global model. In contrast to traditional FL methods based on FedAvg [42], our method does not require averaging of model parameters, thus it can support heterogeneous models, i.e., clients can have different model architectures. In summary, our main contributions are summarized as follows:
22
+
23
+ • We propose a novel data-free one-shot FL framework named DENSE, which consists of two stages. In the first stage, we train a generator that considers similarity, stability, and transferability at the same time. In the second stage, we use the ensemble models and the data generated by the generator to train a global model.
24
+ The setting of DENSE is practical in the following aspects. First, DENSE requires no additional information (except the model parameters) to be transferred between clients and the server; Second, DENSE does not require any auxiliary dataset for training; Third, DENSE considers model heterogeneity, i.e., different clients can have different model architectures.
25
+ DENSE is a compatible approach, which can be combined with any local training techniques to further improve the performance of the global model. For instance, we can adopt LDAM [1] to train the clients’ local models, and improve the accuracy of the global model (refer to Section 2.3 and Section 3.2). Extensive experiments on various datasets verify the effectiveness of our proposed DENSE. For example, DENSE outperforms the best baseline method Fed-ADI [55] by $5 . 0 8 \%$ on CIFAR10 dataset.
26
+
27
+ # 2 Data-Free One-Shot Federated Learning
28
+
29
+ # 2.1 Framework Overview
30
+
31
+ To tackle the problems in recent one-shot FL methods as mentioned in Sec. 1, we propose a novel method named DENSE, which conducts one-shot FL without the need to share additional information or rely on any auxiliary dataset, while considering model heterogeneity. To simulate real-world applications, we consider a more challenging yet practical setting where the data on each client are not independent and identically distributed (non-IID).
32
+
33
+ The illustration of the learning procedure is demonstrated in Figure 1, and the whole training process of DENSE is shown in Algorithm 1. After clients upload their local models to the server, the server trains a global model with DENSE in two stages. In the data generation stage (first stage), we train an auxiliary generator that can generate synthetic data by the ensemble models, i.e., ensemble of local models uploaded by clients. In the model distillation stage (second stage), we use the ensemble models and the synthetic data (generated by the generator) to train the global model.
34
+
35
+ ![](images/2ce9636880a058cd0713d603581fa7f3e6acfe162a440e0ad227547b6544a41c.jpg)
36
+ Figure 1: An illustration of training process of DENSE on the server, which consists of two stages: (1) In data generation stage, we train an auxiliary generator that considers similarity, stability, and transferability at the same time; (2) In model distillation stage, we distill the knowledge of the ensemble models and transfer to the global model. Note that the fixed global model is used as an additional discriminator in the divergence loss $\mathcal { L } _ { d i v }$ .
37
+
38
+ # 2.2 Data Generation
39
+
40
+ In the first stage, we aim to train a generator to generate synthetic data. Specifically, given the ensemble of well-trained models uploaded by clients, our goal is to train a generator that can generate data that have similar distribution to the training data of clients. In addition, we aim not to leak private information from our generated data, i.e., attackers are not able to predict any sensitive information of clients from the generated data. Recent work [35] generated data by utilizing a pre-trained generative adversarial network (GAN). However, such a method is unable to generate data as the pre-trained GAN is trained on public datasets, which is likely to have different data distribution from the training data of clients. Moreover, we need to consider model heterogeneity, which makes the problem more complicated.
41
+
42
+ To solve these issues, we propose to train a generator that considers similarity\*, stability, and transferability. The data generation process is shown in line 8 to 11 in Algorithm 1. In particular, given a random noise $\mathbf { z }$ (generated from a standard Gaussian distribution) and a random one-hot label y (generated from a uniform distribution), the generator $G ( \cdot )$ aims to generate a synthetic data $\hat { \mathbf { x } } = G ( \mathbf { z } )$ such that $\hat { \bf x }$ is similar to the training data (with label $\mathbf { y }$ ) of clients.
43
+
44
+ Similarity. First, we need to consider the similarity between synthetic data $\hat { \bf x }$ and the training data. Since we are unable to access the training data of clients, we cannot compute the similarity between the synthetic data and the training data directly. Instead, we first compute the average logits (i.e., outputs of the last fully connected layer) of $\hat { \bf x }$ computed by the ensemble models.
45
+
46
+ $$
47
+ D ( \hat { \mathbf { x } } ; \{ \pmb { \theta } ^ { k } \} _ { k = 1 } ^ { m } ) = \frac { 1 } { m } \sum _ { k \in \mathcal { C } } f ^ { k } \left( \hat { \mathbf { x } } ; \pmb { \theta } ^ { k } \right) ,
48
+ $$
49
+
50
+ where $m = | \mathcal { C } |$ , and $D ( \hat { \mathbf { x } } ; \{ \pmb { \theta } ^ { k } \} _ { k = 1 } ^ { m } )$ is the average logits of $\hat { \bf x }$ , $\pmb { \theta } ^ { k }$ is the parameter of the $k$ -th client.
51
+ And $f ^ { k } \left( { \hat { \mathbf { x } } } ; \pmb { \theta } ^ { k } \right)$ is the prediction function of client $k$ that outputs the logits of $\hat { \bf x }$ given parameter $\theta ^ { k }$ .
52
+ For simplicity, we use $D ( \hat { \mathbf { x } } )$ to denote $D ( \hat { \mathbf { x } } ; \{ \pmb { \theta } ^ { k } \} _ { k = 1 } ^ { m } )$ in the rest of the paper.
53
+
54
+ Then, we minimize the average logits and the random label $y$ with the following cross-entropy (CE) loss.
55
+
56
+ $$
57
+ \mathcal { L } _ { C E } ( \hat { \mathbf { x } } , \mathbf { y } ; \pmb { \theta } _ { G } ) = C E ( D ( \hat { \mathbf { x } } ) , \mathbf { y } ) ,
58
+ $$
59
+
60
+ It is expected that the synthetic images can be classified into one particular class with a high probability by the ensemble models. In fact, during the training phase, the loss between $D ( \hat { \mathbf { x } } )$ and $\mathbf { y }$ can easily reduce to almost 0, which indicates the synthetic data matches the ensemble models perfectly. Moreover, we do not directly compute the similarity between the synthetic data and the training data, which can reduce the probability of leaking sensitive information of the clients.
61
+
62
+ However, by utilizing only the CE loss, we cannot achieve a high performance (please refer to Section 3.2 for detail). We conjecture this is because the ensemble models are trained on non-IID data, the generator may be unstable and trapped into sub-optimal local minima or overfit to the synthetic data [49, 32].
63
+
64
+ Stability. Second, to improve the stability of the generator, we propose to add an additional regularization to stabilize the training. In particular, we utilize the Batch Normalization (BN) loss to make the synthetic data conform with the batch normalization statistics [55].
65
+
66
+ $$
67
+ \mathcal { L } _ { B N } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { G } ) = \frac { 1 } { m } \sum _ { k \in \mathcal { C } } \sum _ { l } \left( \lVert \mu _ { l } ( \hat { \mathbf { x } } ) - \mu _ { k , l } \rVert + \lVert \sigma _ { l } ^ { 2 } ( \hat { \mathbf { x } } ) - \sigma _ { k , l } ^ { 2 } \rVert \right) ,
68
+ $$
69
+
70
+ where $\mu _ { l } ( \hat { \mathbf { x } } )$ and $\sigma _ { l } ^ { 2 } ( \hat { \mathbf { x } } )$ are the batch-wise mean and variance estimates of feature maps corresponding to the $l$ -th BN layer of the generator $G ( \cdot ) ^ { \dagger }$ , $\mu _ { k , l }$ and $\sigma _ { k , l } ^ { 2 }$ are the mean and variance of the $l$ -th BN layer [17] of $f ^ { k } ( \cdot )$ . The BN loss minimizes the distance between the feature map statistics of the synthetic data and the training data of clients. As a result, the synthetic data can have a similar distribution to the training data of clients, no matter if the data is non-IID or IID.
71
+
72
+ Transferability. By utilizing the CE loss and BN loss, we can train a generator that can generate synthetic data, but we observed that the synthetic data are likely to be far away from the decision boundary (of the ensemble models), which makes the ensemble models (teachers) hard to transfer their knowledge to the global model (student). We illustrate the observation in the left panel of Figure 2. S and T are the decision boundaries of the global model (the detail of the global model is introduced in Section 2.3) and ensemble models respectively. The essence of knowledge distillation is transferring the information of decision boundary from the teacher model to the student model [12]. We aim to learn the decision boundary of global model and have a high classification accuracy on the real test data (blue diamonds). However, the generated synthetic data (red circles) are likely to be on the same side of the two decision boundaries and unhelpful to the transfer of knowledge [12]. To solve this problem, we
73
+
74
+ ![](images/76d9a9a4dd165c97d9c6b81648bf69bc02c6b45b06c64e217312f1914f3b33a5.jpg)
75
+ Figure 2: The illustration of generated data and decision boundary of ensemble models (teachers) and global model (student). Left panel: Synthetic data (red circles) are far away from the decision boundary, which is less helpful to the transfer of knowledge. Right panel: By utilizing our boundary support loss, we can generate more synthetic data near the decision boundaries (black circles), which helps the student better learn the decision boundary of the teacher.
76
+
77
+ argue to generate more synthetic data that fall between the decision boundaries of the ensemble models and the global model. We illustrate our idea in the right panel of Figure 2. Red circles are synthetic data on the same side of the decision boundary, which are less helpful in learning the global model. Black circles are synthetic data between the decision boundaries, i.e., the global model and the ensemble models have different predictions on these data. Black circles can help the global model better learn the decision boundary of the ensemble models.
78
+
79
+ Motivated by the above observations, we introduce a new boundary support loss, which urges the generator to generate more synthetic data between the decision boundaries of the ensemble models and the global model. We divide the synthetic data into 2 sets: (1) the global model and the ensemble models have the same predictions on data in the first set $\begin{array} { r } { \arg \operatorname* { m a x } _ { c } D ^ { ( c ) } ( \hat { \mathbf { x } } ) = \arg \operatorname* { m a x } _ { c } f _ { S } ^ { ( c ) } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { S } ) ) . } \end{array}$ ; (2) different predictions on data in the second set ${ ( \arg \operatorname* { m a x } _ { c } D ^ { ( c ) } ( \hat { \bf x } ) \neq \arg \operatorname* { m a x } _ { c } f _ { S } ^ { ( c ) } ( \hat { \bf x } ; \pmb { \theta } _ { S } ) ) }$ , where $D ^ { ( c ) } ( \hat { \mathbf { x } } )$ and $f _ { S } ^ { ( c ) } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { S } )$ are the logits for the $c$ -th label of the ensemble models and the global model respectively. The data in the first set are on the same side of those two decision boundaries (red circles in Figure 2) while the data in the second set (black circles in Figure 2) are between the decision boundaries of the ensemble models and the global model. We maximize the differences of predictions of the global model and the ensemble models on data in the second set with Kullback-Leibler divergence loss as follows.
80
+
81
+ $$
82
+ \mathcal { L } _ { d i v } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { G } ) = - \omega K L \left( D ( \hat { \mathbf { x } } ) , f _ { S } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { S } ) \right) ,
83
+ $$
84
+
85
+ where $K L ( \cdot , \cdot )$ denotes the Kullback-Leibler (KL) divergence loss, $\omega = \mathbb { 1 } ( \arg \operatorname* { m a x } _ { c } D ^ { ( c ) } ( \hat { \mathbf { x } } ) \neq$ arg $\operatorname* { m a x } _ { c } f _ { S } ^ { ( c ) } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { S } ) )$ outputs 0 for data in the first set and 1 for data in the second set, and $\mathbb { 1 } ( a )$ is the indicator function that outputs 1 if $a$ is true and outputs 0 if $a$ is false. By maximizing the KL divergence loss, the generator can generate more synthetic data that are more helpful to the model distillation stage (refer to Section 2.3 for detail) and further improve the transferability of the ensemble models.
86
+
87
+ By combining the above losses, we can obtain the generator loss as follows,
88
+
89
+ $$
90
+ \begin{array} { r } { \mathcal { L } _ { g e n } ( \hat { \mathbf { x } } , \mathbf { y } ; \pmb { \theta } _ { G } ) = \mathcal { L } _ { C E } ( \hat { \mathbf { x } } , \mathbf { y } ; \pmb { \theta } _ { G } ) + \lambda _ { 1 } \mathcal { L } _ { B N } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { G } ) + \lambda _ { 2 } \mathcal { L } _ { d i v } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { G } ) , } \end{array}
91
+ $$
92
+
93
+ where $\lambda _ { 1 }$ and $\lambda _ { 2 }$ are scaling factors for the losses.
94
+
95
+ # Algorithm 1 Training process of DENSE
96
+
97
+ Input: Number of client $m$ , clients’ local models $\{ f ^ { 1 } ( ) , \cdots , f ^ { m } ( ) \}$ , generator $G ( \cdot )$ with parameter $\theta _ { G }$ , learning rate of the generator $\eta _ { G }$ , number of training rounds $T _ { G }$ for generator in each epoch, global model $f _ { S } ( \ u )$ with parameter $\theta _ { S }$ , learning rate of the global model $\eta _ { S }$ , global model training epochs $T$ , and batch size $b$ .
98
+
99
+ for each client $k \in { \mathcal { C } }$ in parallel do $\pmb { \theta } ^ { k } \mathbf { L o c a l U p d a t e } ( k )$
100
+ end for
101
+ Initialize parameter $\theta _ { G }$ and $\theta _ { S }$
102
+ for epoch $\scriptstyle 1 = 1 , \cdots , T$ do Sample a batch of noises and labels $\{ \mathbf { z } _ { i } , \mathbf { y } _ { i } \} _ { i = 1 } ^ { b }$ // data generation stage for $j = 1 , \cdots , T _ { G }$ do Generate $\{ \hat { \mathbf { x } } _ { i } \} _ { i = 1 } ^ { b }$ with $\{ { \mathbf { z } } _ { i } \} _ { i = 1 } ^ { b }$ and $G ( \cdot )$ enc $\begin{array} { r } { \pmb { \theta } _ { G } \pmb { \theta } _ { G } - \eta _ { G } \frac { 1 } { b } \sum _ { i = 1 } ^ { b } \nabla _ { \pmb { \theta } _ { G } } \ell _ { g e n } ( \hat { \mathbf { x } } _ { i } , \mathbf { y } _ { i } ; \pmb { \theta } _ { G } ) } \end{array}$ $/ /$ model distillation stage Generate $\{ \hat { \mathbf { x } } _ { i } \} _ { i = 1 } ^ { b }$ with $\mathbf { \bar { \{ z } } _ { i } \} _ { i = 1 } ^ { b }$ and $G ( \cdot )$ $\begin{array} { r } { \pmb { \theta } _ { S } = \pmb { \theta } _ { S } - \eta _ { S } \frac { 1 } { b } \sum _ { i = 1 } ^ { b } \nabla _ { \pmb { \theta } _ { S } } \ell _ { d i s } ( \hat { \bf x } _ { i } ; \pmb { \theta } _ { S } ) } \end{array}$
103
+ end for
104
+
105
+ Note that the generated synthetic data have similar features but different from the training data (of clients), which reduces the probability of leaking sensitive information of clients. More discussions of the privacy issues are in Section 3.3.3.
106
+
107
+ # 2.3 Model Distillation
108
+
109
+ In the second stage, we train the global model with the generator (discussed in the previous section) and the ensemble models. Previous research [60, 35] showed that model ensemble provides a general method for improving the accuracy and stability of learning models. Motivated by [60], we propose to use the ensemble models as a teacher to train a student (global) model. A straightforward method is to obtain the global model by aggregating the parameters of all client models (e.g., by FedAvg [42]). However, in real-world applications, clients are likely to have different model architectures [44], making FedAvg useless. Moreover, since the data in different clients are non-IID, FedAvg cannot deliver a good performance or even diverge [59, 32].
110
+
111
+ To this end, we follow [35] to distill the knowledge of the ensemble models to the global model by minimizing the predictions between the ensemble models (teacher) and the global model (student) on the same synthetic data. The model distillation process is shown in line 13 to 14 in Algorithm 1. First, we compute the average logits of the synthetic data according to Eq. (1), i.e., $D ( \hat { \mathbf { x } } ) =$ $\begin{array} { r } { \frac { 1 } { m } \sum _ { k \in \mathcal { C } } f ^ { k } \left( \hat { \mathbf { x } } ; \pmb { \theta } ^ { k } \right) } \end{array}$ . In contrast to traditional aggregation methods (e.g., FedAvg) that are unable to aggregate heterogeneous models, averaging logits can be easily applied to both heterogeneous and homogeneous FL systems.
112
+
113
+ Then, we use the average logits to distill the knowledge of the ensemble models by minimizing the following objective function.
114
+
115
+ $$
116
+ \mathcal { L } _ { d i s } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { S } ) = K L \left( D ( \hat { \mathbf { x } } ) , f _ { S } ( \hat { \mathbf { x } } ; \pmb { \theta } _ { S } ) \right) .
117
+ $$
118
+
119
+ By minimizing the KL loss, we can train a global model with the knowledge of the ensemble models and the synthetic data regardless of data and model heterogeneity.
120
+
121
+ Note that DENSE has no restriction on the clients’ local models, i.e., clients can train models with arbitrary techniques. Thus, DENSE is a compatible approach, which can be combined with any local training techniques to further improve the performance of the global model. We further discuss the combination of local training techniques in Section 3.2.
122
+
123
+ Discussions on privacy-preserving Research [15] has shown that it is possible to launch an attack where a malicious user uses GANs to recreate samples of another participant’s private datasets. Besides, in FL, exchanging models between the server and clients can result in potential privacy leakage. Note that our method prohibits the generator from seeing the real data directly, and there is only one communication round, which reduces the risk of privacy leakage. In addition, we display our generated images in Section 3.3.3, which does not directly reveal the information of real data. Several existing privacy-preserving methods can be incorporated into our framework to better protect clients from adversaries [37, 20]. We leave this as our future work.
124
+
125
+ Discussions on Knowledge Distillation in FL In traditional FL frameworks, all users have to agree on the specific architecture of the global model. To support model heterogeneity, Li et al. [28] proposed a new federated learning framework that enables participants to independently design their models by knowledge distillation [14]. With the use of a proxy dataset, knowledge distillation alleviates the model drift issue induced by non-IID data. However, the requirement of proxy data renders such a method impractical for many applications, since a carefully designed dataset is not always available on the server. Data-free knowledge distillation is a promising approach, which can transfer knowledge of a teacher model to a student model without any real data [2, 55]. Lin et al. [35] proposed data-free ensemble distillation for model fusion through synthetic data in each communication round, which requires high communication costs and computational costs. However, in this paper, we are more concerned with obtaining a good global model through only one round of communication in cases of heterogeneous models, which is more challenging and practical. Zhu et al. [64] also proposed a data-free knowledge distillation approach for FL, which learns a generator derived from the prediction of local models. However, the learned generator is later broadcasted to all clients, and then clients need to send their generators to the server, which increases the communication burden. More seriously, the generator has direct access to the local data (the generator can easily remember the training samples [39]), which can cause privacy concerns. As the generator used in our method is always stored in the central server, it never sees any real local data.
126
+
127
+ # 3 Experiments
128
+
129
+ # 3.1 Experimental Setup
130
+
131
+ # 3.1.1 Datasets
132
+
133
+ Our experiments are conducted on the following 6 real-world datasets: MNIST [24], FMNIST [53], SVHN [43], CIFAR10 [21], CIFAR100 [21], and Tiny-ImageNet [23].MNIST dataset contains binary images of handwritten digits. There are 60,000 training images and 10,000 testing images in MNIST dataset. CIFAR10 dataset consists of $6 0 , 0 0 0 \ 3 2 \mathrm { x } \ 3 2$ color images in 10 classes, with 6,000 images per class. There are 50,000 training images and 10,000 test images in CIFAR10 dataset. CIFAR100 dataset is similar to CIFAR10 dataset, except it has 100 classes containing 600 images each. There are 500 training images and 100 testing images per class. Tiny-ImageNet contains 100000 images of 200 classes (500 for each class) downsized to $6 4 { \times } 6 4$ colored images. Each class has 500 training images, 50 validation images and 50 test images.
134
+
135
+ Table 1: Accuracy of different methods across $\alpha = \{ 0 . 1 , 0 . 3 , 0 . 5 \}$ on different datasets.
136
+
137
+ <table><tr><td>Dataset</td><td colspan="3">MNIST</td><td colspan="3">FMNIST</td><td colspan="3">CIFAR10</td><td colspan="3">SVHN</td><td colspan="3">CIFAR100</td><td colspan="3">Tiny-ImageNet</td></tr><tr><td>Method</td><td>a=0.1</td><td>Q=0.3</td><td>a=0.5</td><td>α=0.1</td><td>Q=0.3</td><td>Q=0.5</td><td>α=0.1</td><td>a=0.3</td><td>α=0.5</td><td>α=0.1</td><td>Q=0.3</td><td>α=0.5</td><td>Q=0.1</td><td>a=0.3</td><td>α=0.5</td><td></td><td>a=0.1 a=0.3</td><td>a=0.5</td></tr><tr><td>FedAvg</td><td>48.24</td><td>72.94</td><td>90.55</td><td>41.69</td><td>82.96</td><td>83.72</td><td>23.93</td><td>27.72</td><td>43.67</td><td>31.65</td><td>61.51</td><td>56.09</td><td>4.58</td><td>11.61</td><td>12.11</td><td>3.12</td><td>10.46</td><td>11.89</td></tr><tr><td>FedDF</td><td>60.15</td><td>74.01</td><td>92.18</td><td>43.58</td><td>80.67</td><td>84.67</td><td>40.58</td><td>46.78</td><td>53.56</td><td>49.13</td><td>73.34</td><td>73.98</td><td>28.17</td><td>30.28</td><td>36.35</td><td>15.34</td><td>18.22</td><td>27.43</td></tr><tr><td>Fed-DAFL</td><td>64.38</td><td>74.18</td><td>93.01</td><td>47.14</td><td>80.59</td><td>84.02</td><td>47.34</td><td>53.89</td><td>58.59</td><td>53.23</td><td>76.56</td><td>78.03</td><td>28.89</td><td>34.89</td><td>38.19</td><td>18.38</td><td>22.18</td><td>28.22</td></tr><tr><td>Fed-ADI</td><td>64.13</td><td>75.03</td><td>93.49</td><td>48.49</td><td>81.15</td><td>84.19</td><td>48.59</td><td>54.68</td><td>59.34</td><td>53.45</td><td>77.45</td><td>78.85</td><td>30.13</td><td>35.18</td><td>40.28</td><td>19.59</td><td>25.34</td><td>30.21</td></tr><tr><td>DENSE (ours)</td><td>66.61</td><td>76.48</td><td>95.82</td><td>50.29</td><td>83.96</td><td>85.94</td><td>50.26</td><td>59.76</td><td>62.19</td><td>55.34</td><td>79.59</td><td>80.03</td><td>32.03</td><td>37.32</td><td>42.07</td><td>22.44</td><td>28.14</td><td>32.34</td></tr></table>
138
+
139
+ # 3.1.2 Data partition
140
+
141
+ To simulate real-world applications, we use Dirichlet distribution to generate non-IID data partition among clients [56, 29]. In particular, we sample $p _ { k } \sim D i r ( \alpha )$ and allocate a $p _ { k } ^ { i }$ proportion of the data of class $k$ to client $i$ . By varying the parameter $\alpha$ , we can change the degree of imbalance. A small $\alpha$ generates highly skewed data. We set $\alpha = 0 . 5$ as default.
142
+
143
+ # 3.1.3 Baselines
144
+
145
+ To ensure fair comparisons, we neglect the comparison with methods that require to download auxiliary models or datasets, such as FedBE [3] and FedGen [64]. Moreover, since there is only one communication round, aggregation methods that are based on regularization have no effect. Thus, we also omit the comparison with these regularization-based methods, e.g., FedProx [31], FedNova [49], and Scaffold [18]. Instead, we compare our proposed DENSE with FedAvg [42] and FedDF [35]. Furthermore, since DENSE is a data-free method, we derive some baselines from prevailing data-free knowledge distillation methods, including: 1) DAFL [2], a novel data-free learning framework based on generative adversarial networks; 2) ADI [55], an image synthesizing method that utilizes the image distribution to train a deep neural network without real data. We apply these methods to one-shot FL, and name these two baselines as Fed-DAFL and Fed-ADI.
146
+
147
+ # 3.1.4 Settings
148
+
149
+ For clients’ local training, we use the SGD optimizer with momentum $= 0 . 9$ and learning rate ${ \mathrm { \Omega } } { = } 0 . 0 1$ . We set the batch size $b = 1 2 8$ , the number of local epochs $E = 2 0 0$ , and the client number $m = 5$ . Following the setting of [2], we train the auxiliary generator $G ( \cdot )$ with a deep convolutional network. We use Adam optimizer with learning rate $\eta _ { G } = 0 . 0 0 1$ . We set the number of training rounds in each epoch as $T _ { G } = 3 0$ , and set the scaling factor $\lambda _ { 1 } = 1$ and $\lambda _ { 2 } = 0 . 5$ . For the training of the server model $f _ { S } ( \ v r )$ , we use the SGD optimizer with learning rate $\eta _ { S } = 0 . 0 1$ and momentum $\scriptstyle 1 = 0 . 9$ . The number of epochs for distillation $T = 2 0 0$ . All baseline methods use the same setting as ours.
150
+
151
+ # 3.2 Results
152
+
153
+ # 3.2.1 Evaluation on real-world datasets
154
+
155
+ To evaluate the effectiveness of our method, we conduct experiments under different non-IID settings by varying $\alpha = \{ 0 . 1 , 0 . 3 , 0 . 5 \}$ and report the performance on different datasets and different methods in Table 1. The results show that: (1) Our DENSE achieves the highest accuracy across all datasets. In particular, DENSE outperforms the best baseline method Fed-ADI [55] by $5 . 0 8 \%$ when $\alpha = 0 . 3$ on CIFAR10 dataset. (2) FedAvg has the worst performance, which implies that directly averaging the model parameters cannot achieve a good performance under nonIID setting in one-shot FL. (3) As $\alpha$ becomes smaller (i.e., data become more imbalanced), the performance of all methods decrease significantly, which shows that all methods suffer
156
+
157
+ ![](images/7afe915a39613e67bcc59c3ee4f8eec8f1486e67c0d910606b0ebda3e3ab2535.jpg)
158
+ Figure 3: Left panel: Accuracy of FedAvg and clients’ local models across different local training epochs $E = \{ 2 0 , 4 0 , 6 0 , \cdots , 4 0 0 \}$ . Right panel: The accuracy curve for local training. The dotted lines represent the best results of two one-shot FL methods (FedAvg and DENSE). Our DENSE outperforms FedAvg and local models consistently.
159
+
160
+ Table 2: Accuracy comparisons across heterogeneous client models on CIFAR10. There are five clients in total, and each client has a personalized model.
161
+
162
+ <table><tr><td rowspan="2">Model</td><td colspan="5">Client</td><td colspan="4">Server (ResNet-18)</td></tr><tr><td>ResNet-18</td><td>CNN1</td><td>CNN2</td><td>WRN-16-1</td><td>WRN-40-1</td><td>FedDF</td><td>Fed-DAFL</td><td>Fed-ADI</td><td>DENSE (ours)</td></tr><tr><td>Q=0.1</td><td>40.83</td><td>33.67</td><td>35.21</td><td>27.73</td><td>32.93</td><td>42.35</td><td>43.12</td><td>44.63</td><td>49.76</td></tr><tr><td>Q=0.3</td><td>51.49</td><td>52.78</td><td>44.96</td><td>47.35</td><td>37.24</td><td>52.72</td><td>57.72</td><td>58.96</td><td>63.25</td></tr><tr><td>α=0.5</td><td>59.96</td><td>58.67</td><td>54.28</td><td>53.39</td><td>58.14</td><td>60.05</td><td>61.56</td><td>63.24</td><td>67.42</td></tr></table>
163
+
164
+ ![](images/997f84347ee2f7b0394beb308bb0fc8e563a958887577e7c3d644b5d494bb0e8.jpg)
165
+ Figure 4: Visualization of the test accuracy and data distribution for CIFAR10 with $\alpha = \{ 0 . 3 , 0 . 5 \}$
166
+
167
+ from highly skewed data. Even under highly skewed setting, DENSE still significantly outperforms other methods, which further demonstrates the superiority of our proposed method.
168
+
169
+ # 3.2.2 Impact of model distillation
170
+
171
+ We show the impact of model distillation by comparing with FedAvg. We first conduct one-shot FL and use FedAvg to aggregate the local models. We show the results of the global model and clients’ local models across different local training epochs $E = \{ 2 0 , 4 0 , 6 0 , \cdots , 4 0 0 \}$ in the left panel of Figure 3. The global model achieves the best performance (test accuracy $= 3 4 \%$ ) when $E = 4 0$ , while a larger value of $E$ can cause the model to degrade even collapse. This result can be attributed to the inconsistent optimization objectives with non-IID data [49], which leads to weight divergence [61]. Then, we show the results of one-shot FL when $E = 4 0 0$ and report the performance of FedAvg and DENSE in the right panel of Figure 3. We also plot the performance of clients’ local models. DENSE outperforms each client’s local model while FedAvg underperforms each client’s local model. This validates that model distillation can enhance training while directly aggregating is harmful to the training under non-IID setting in one-shot FL.
172
+
173
+ # 3.2.3 Results in heterogeneous FL
174
+
175
+ Note that our proposed DENSE can support heterogeneous models. We apply five different CNN models on CIFAR10 dataset with Dirichlet distribution $\alpha = \{ 0 . 1 , 0 . 3 , 0 . 5 \}$ . The heterogeneous models include: 1) one ResNet-18 [11], 2) two small CNNs: CNN1 and CNN2; 3) two Wide-ResNets (WRN) [57]: WRN-16-1 and WRN-40-1. For knowledge distillation, we use ResNet-18 as the server’s global model. Detailed architecture information of the given deep networks can be found in Appendix. Table 2 evaluates all methods in heterogeneous one-shot FL under practical non-IID data settings. We omit the results for FedAvg as FedAvg does not support heterogeneous models. We remark that FL under both the non-IID data distribution and different model architecture setting is a quite challenging task. Even under this setting, our DENSE still significantly outperforms other baselines. In addition, we report the accuracy curve of global distillation. As shown in Figure 4, our method outperforms other baselines by a large margin.
176
+
177
+ # 3.3 Analysis of Our Method
178
+
179
+ # 3.3.1 Impact of the number of clients
180
+
181
+ Furthermore, we evaluate the performance of these methods on CIFAR10 and SVHN datasets by varying the number of clients $m = \{ 5 , 1 0 , 2 0 , 5 0 , 1 0 0 \}$ . According to [33], the server can become a bottleneck when the number of clients is very large, we are also concerned with the model performance when $m$ increases. Table 3 shows the results of different methods across different $m$ . The accuracy of all methods decreases as the number of clients $m$ increases, which is consistent with observations in [33, 42]. Even though the number of clients can affect the performance of one-shot FL, our method still outperforms other baselines. The increasing number of clients poses new challenges for ensemble distillation, which we leave for future investigation.
182
+
183
+ Table 3: Accuracy across different number of clients $m = \{ 5 , 1 0 , 2 0 , 5 0 , 1 0 0 \}$ on CIFAR10 and SVHN datasets.
184
+
185
+ <table><tr><td>Dataset</td><td colspan="5">CIFAR10</td><td colspan="5">SVHN</td></tr><tr><td>m</td><td>FedAvg</td><td>FedDF</td><td>Fed-DAFL</td><td>Fed-ADI</td><td>DENSE (ours)</td><td>FedAvg</td><td>FedDF</td><td>Fed-DAFL</td><td>Fed-ADI</td><td>DENSE (ours)</td></tr><tr><td>5</td><td>1 43.67</td><td>53.56</td><td>55.46</td><td>58.59</td><td>62.19</td><td>56.09</td><td>73.98</td><td>78.03</td><td>78.85</td><td>80.03</td></tr><tr><td>10</td><td>38.29</td><td>54.44</td><td>56.34</td><td>57.13</td><td>61.42</td><td>45.34</td><td>62.12</td><td>63.34</td><td>65.45</td><td>67.57</td></tr><tr><td>20</td><td>36.03</td><td>43.15</td><td>45.98</td><td>46.45</td><td>52.71</td><td>47.79</td><td>60.45</td><td>62.19</td><td>63.98</td><td>66.42</td></tr><tr><td>50</td><td>37.03</td><td>40.89</td><td>43.02</td><td>44.47</td><td>48.47</td><td>36.53</td><td>51.44</td><td>54.23</td><td>57.35</td><td>59.27</td></tr><tr><td>100</td><td>33.54</td><td>36.89</td><td>37.55</td><td>36.98</td><td>43.28</td><td>30.18</td><td>46.58</td><td>47.19</td><td>48.33</td><td>52.48</td></tr></table>
186
+
187
+ Table 4: Performance analysis of DENSE+LDAM.
188
+
189
+ <table><tr><td>Dataset</td><td colspan="3">CIFAR10</td><td colspan="3">SVHN</td></tr><tr><td>Method</td><td>α=0.1</td><td>a=0.3</td><td>a=0.5</td><td>a=0.1</td><td>α=0.3</td><td>Q=0.5</td></tr><tr><td>DENSE</td><td>50.26</td><td>59.76</td><td>62.19</td><td>55.34</td><td>79.59</td><td>80.03</td></tr><tr><td>DENSE+LDAM</td><td>57.24</td><td>63.13</td><td>64.76</td><td>58.04</td><td>81.28</td><td>81.77</td></tr></table>
190
+
191
+ # 3.3.2 Combination with imbalanced learning
192
+
193
+ The accuracy of federated learning reduces significantly with non-IID data, which has been broadly discussed in recent studies [29, 49]. Additionally, previous studies [1, 19] have demonstrated their superiority on imbalanced data. The combination of our method with these techniques to address imbalanced local data can lead to a more effective FL system. For example, by using LDAM [1] in clients’ local training, we can mitigate the impact of data imbalance, and thereby build a more powerful ensemble model. We compare the performance of the original DENSE and DENSE combined with LDAM (DENSE+LDAM) across $\alpha = \{ 0 . 1 , 0 . 3 , 0 . 5 \}$ on CIFAR10 and SVHN datasets.
194
+
195
+ As demonstrated in Table 4, DENSE+LDAM can significantly improve the performance, especially for highly skewed non-IID data (i.e. $\alpha = 0 . 1$ ). To help understand the performance gap and data skewness, in Figure 5, we visualize the accuracy curve and data distribution of CIFAR10 $( \alpha { = } 0 . 1 )$ in the left panel and right panel respectively. The number in the right panel stands for the number of examples associated with the corresponding label in one particular client. These figures imply that significant improvement can be achieved by combining DENSE with LDAM on highly skewed data.
196
+
197
+ ![](images/86839b766d8522061366b4faa54518774846b2b1c44f4ba7188558d299c00bfc.jpg)
198
+ Figure 5: Left panel: Accuracy curves of DENSE and DENSE $+$ LDAM. Right panel: Data distribution of different clients for CIFAR10 dataset $( \alpha { = } 0 . 1 )$ .
199
+
200
+ ![](images/c560833d9a5c700338ba1d8898f10c61b70db8bc9e23feb190e95096a4188af9.jpg)
201
+ Figure 6: Visualization of synthetic data on CIFAR10 and SVHN datasets.
202
+
203
+ # 3.3.3 Visualization of synthetic data
204
+
205
+ To compare the synthetic data with the training data, we visualize the synthetic data on CIFAR10 and SVHN datasets in Figure 6. As shown in the figure, the first / third row is the original data of CIFAR10 / SVHN dataset, and the second / last row is the synthetic data generated by the model trained on CIFAR10 / SVHN dataset. The synthetic data are not similar to the original data, which can effectively reduce the probability of leaking sensitive information of clients. Note that although the synthetic data look much different from the original data, our method still achieves a higher performance than other baseline methods by training with these synthetic data (as shown in Table 1). Note that the ideal synthetic data should be visually distinct from the real data.
206
+
207
+ # 3.3.4 Extend to multiple rounds
208
+
209
+ We also extend DENSE to multi-round FL to test its effectiveness, i.e., there are multiple communication rounds between clients and server. Table 5 demonstrates the results of DENSE across different communication rounds $T _ { c } =$ $\{ 1 , 2 , 3 , 4 , 5 \}$ on CIFAR10 and SVHN datasets. The local training epoch is fixed as $E = 1 0$ . The performance of
210
+
211
+ Table 5: Accuracy for multiple communication rounds.
212
+
213
+ <table><tr><td>Dataset</td><td colspan="3">CIFAR10</td><td colspan="3">SVHN</td></tr><tr><td>Communication rounds</td><td>α=0.1</td><td>α=0.3</td><td>α=0.5</td><td>a=0.1</td><td>α=0.3</td><td>α=0.5</td></tr><tr><td>Tc=1</td><td>50.72</td><td>59.41</td><td>63.89</td><td>54.344</td><td>79.87</td><td>80.14</td></tr><tr><td>T=2</td><td>63.08</td><td>65.90</td><td>71.16</td><td>56.13</td><td>79.75</td><td>85.18</td></tr><tr><td>Te=3</td><td>61.61</td><td>69.73</td><td>73.91</td><td>74.41</td><td>86.42</td><td>86.18</td></tr><tr><td>T=4</td><td>66.26</td><td>69.40</td><td>74.39</td><td>78.67</td><td>86.36</td><td>86.43</td></tr><tr><td>T=5</td><td>67.65</td><td>71.42</td><td>76.01</td><td>80.28</td><td>86.25</td><td>86.55</td></tr></table>
214
+
215
+ DENSE improves as $T _ { c }$ increases, and DENSE achieves the best performance when $T _ { c } = 5$ . This shows that DENSE can be extended to multi-round FL and the performance can be further enhanced by increasing the communication rounds.
216
+
217
+ # 3.3.5 Contribution of $\mathcal { L } _ { B N }$ and $\mathcal { L } _ { d i v }$
218
+
219
+ We investigate the contributions of different loss functions used in data generation. We conduct leave-one-out testing and show the results by removing $\mathcal { L } _ { d i v }$ (w/o $\mathcal { L } _ { d i v , }$ ), and removing $\mathcal { L } _ { B N }$ (w/o $\mathcal { L } _ { B N } \mathrm { . }$ ). Additionally, we report the result by removing both $\mathcal { L } _ { d i v }$ and $\mathcal { L } _ { B N }$ , i.e., using only $\mathcal { L } _ { C E }$ (w/ $\mathcal { L } _ { C E } )$ ). As illustrated in Table 6, using only $\mathcal { L } _ { C E }$ to train the generator leads to poor performance. Be
220
+
221
+ Table 6: Impact of loss functions in data generation.
222
+
223
+ <table><tr><td>Dataset</td><td>CIFAR10</td><td>SVHN</td><td>CIFAR100</td></tr><tr><td>DENSE</td><td>62.19</td><td>80.03</td><td>42.07</td></tr><tr><td>wlLcE</td><td>53.12</td><td>73.11</td><td>36.47</td></tr><tr><td>W/o LBN</td><td>61.05</td><td>78.36</td><td>39.89</td></tr><tr><td>w/o Ldiv</td><td>59.18</td><td>77.59</td><td>39.14</td></tr></table>
224
+
225
+ sides, removing either the $\mathcal { L } _ { B N }$ loss or $\mathcal { L } _ { d i v }$ loss also affects the accuracy of the global model. A combination of these loss functions leads to a high performance of global model, which shows that each part of the loss function plays an important role in enhancing the generator.
226
+
227
+ # 4 Conclusion
228
+
229
+ In this paper, we propose an effective one-shot federated learning method called DENSE, which trains the global model by a data generation stage and a model distillation stage. Extensive experiments across various settings validate the efficacy of our method. Overall, DENSE is by far the most practical framework that can conduct data-free one-shot FL with model heterogeneity. A promising future direction is to consider the potential privacy attacks in one-shot FL.
230
+
231
+ # 5 Acknowledgement
232
+
233
+ This work was supported by Sony AI, the National Key Research and Development Project of China (2021ZD0110400 No. 2018AAA0101900), National Natural Science Foundation of China (U19B2042), Zhejiang Lab (2021KE0AC02), Academy Of Social Governance Zhejiang University, Fundamental Research Funds for the Central Universities.
234
+
235
+ References
236
+ [1] Kaidi Cao, Colin Wei, Adrien Gaidon, Nikos Arechiga, and Tengyu Ma. Learning imbalanced datasets with label-distribution-aware margin loss, 2019.
237
+ [2] Hanting Chen, Yunhe Wang, Chang Xu, Zhaohui Yang, Chuanjian Liu, Boxin Shi, Chunjing Xu, Chao Xu, and Qi Tian. Dafl: Data-free learning of student networks. In ICCV, 2019.
238
+ [3] Hong-You Chen and Wei-Lun Chao. Fedbe: Making bayesian model ensemble applicable to federated learning, 2021.
239
+ [4] Zhaoyu Chen, Bo Li, Shuang Wu, Jianghe Xu, Shouhong Ding, and Wenqiang Zhang. Shape matters: Deformable patch attack. In European conference on computer vision, 2022.
240
+ [5] Zhaoyu Chen, Bo Li, Jianghe Xu, Shuang Wu, Shouhong Ding, and Wenqiang Zhang. Towards practical certifiable patch defense with vision transformer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 15148–15158, June 2022.
241
+ [6] Zhen Chen, Meilu Zhu, Chen Yang, and Yixuan Yuan. Personalized retrogress-resilient framework for real-world medical federated learning. In Marleen de Bruijne, Philippe C. Cattin, Stéphane Cotin, Nicolas Padoy, Stefanie Speidel, Yefeng Zheng, and Caroline Essert, editors, Medical Image Computing and Computer Assisted Intervention - MICCAI 2021 - 24th International Conference, Strasbourg, France, September 27 - October 1, 2021, Proceedings, Part III, volume 12903 of Lecture Notes in Computer Science, pages 347–356. Springer, 2021.
242
+ [7] Don Kurian Dennis, Tian Li, and Virginia Smith. Heterogeneity for the win: One-shot federated clustering, 2021.
243
+ [8] Jiahua Dong, Yang Cong, Gan Sun, Zhen Fang, and Zhengming Ding. Where and how to transfer: Knowledge aggregation-induced transferability perception for unsupervised domain adaptation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 11(1):1–17, 2021.
244
+ [9] Jiahua Dong, Yang Cong, Gan Sun, Bineng Zhong, and Xiaowei Xu. What can be transferred: Unsupervised domain adaptation for endoscopic lesions segmentation. In IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 4022–4031, June 2020.
245
+ [10] Neel Guha, Ameet Talwalkar, and Virginia Smith. One-shot federated learning. arXiv preprint arXiv:1902.11175, 2019.
246
+ [11] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition, 2015.
247
+ [12] Byeongho Heo, Minsik Lee, Sangdoo Yun, and Jin Young Choi. Knowledge distillation with adversarial samples supporting decision boundary. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3771–3778, 2019.
248
+ [13] Geoffrey Hinton, Oriol Vinyals, Jeff Dean, et al. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2(7), 2015.
249
+ [14] Geoffrey E. Hinton, Oriol Vinyals, and Jeffrey Dean. Distilling the knowledge in a neural network. CoRR, abs/1503.02531, 2015.
250
+ [15] Briland Hitaj, Giuseppe Ateniese, and Fernando Perez-Cruz. Deep models under the gan: information leakage from collaborative deep learning. In Proceedings of the 2017 ACM SIGSAC conference on computer and communications security, pages 603–618, 2017.
251
+ [16] Hao Huang, Yongtao Wang, Zhaoyu Chen, Yuze Zhang, Yuheng Li, Zhi Tang, Wei Chu, Jingdong Chen, Weisi Lin, and Kai-Kuang Ma. Cmua-watermark: A cross-model universal adversarial watermark for combating deepfakes. Proceedings of the AAAI Conference on Artificial Intelligence, 36(1):989–997, Jun. 2022.
252
+ [17] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift, 2015.
253
+
254
+ [18] 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.
255
+
256
+ [19] Jaehyung Kim, Jongheon Jeong, and Jinwoo Shin. M2m: Imbalanced classification via majorto-minor translation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
257
+
258
+ [20] Aashish Kolluri, Teodora Baluta, and Prateek Saxena. Private hierarchical clustering in federated networks. In Yongdae Kim, Jong Kim, Giovanni Vigna, and Elaine Shi, editors, CCS ’21: 2021 ACM SIGSAC Conference on Computer and Communications Security, Virtual Event, Republic of Korea, November 15 - 19, 2021, pages 2342–2360. ACM, 2021.
259
+
260
+ [21] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
261
+
262
+ [22] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Communications of the ACM, 60(6):84–90, 2017.
263
+
264
+ [23] Ya Le and Xuan Yang. Tiny imagenet visual recognition challenge. CS 231N, 7(7):3, 2015.
265
+
266
+ [24] Yann LeCun, Léon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
267
+
268
+ [25] Yann LeCun, Fu Jie Huang, and Leon Bottou. Learning methods for generic object recognition with invariance to pose and lighting. In Proceedings of the 2004 IEEE Computer Society Conference on Computer Vision and Pattern Recognition, 2004. CVPR 2004., volume 2, pages II–104. IEEE, 2004.
269
+
270
+ [26] Bo Li, Zhengxing Sun, and Yuqi Guo. Supervae: Superpixelwise variational autoencoder for salient object detection. In The Thirty-Third AAAI Conference on Artificial Intelligence, AAAI 2019, The Thirty-First Innovative Applications of Artificial Intelligence Conference, IAAI 2019, The Ninth AAAI Symposium on Educational Advances in Artificial Intelligence, EAAI 2019, Honolulu, Hawaii, USA, January 27 - February 1, 2019, pages 8569–8576. AAAI Press, 2019.
271
+
272
+ [27] Bo Li, Zhengxing Sun, Lv Tang, Yunhan Sun, and Jinlong Shi. Detecting robust co-saliency with recurrent co-attention neural network. In Sarit Kraus, editor, Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, IJCAI 2019, Macao, China, August 10-16, 2019, pages 818–825. ijcai.org, 2019.
273
+
274
+ [28] Daliang Li and Junpu Wang. Fedmd: Heterogenous federated learning via model distillation. arXiv preprint arXiv:1910.03581, 2019.
275
+
276
+ [29] Qinbin Li, Yiqun Diao, Quan Chen, and Bingsheng He. Federated learning on non-iid data silos: An experimental study, 2021.
277
+
278
+ [30] Qinbin Li, Bingsheng He, and Dawn Song. Practical one-shot federated learning for cross-silo setting. arXiv preprint arXiv:2010.01017, 2020.
279
+
280
+ [31] Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks, 2020.
281
+
282
+ [32] Xiaoxiao Li, Meirui JIANG, Xiaofei Zhang, Michael Kamp, and Qi Dou. Fedbn: Federated learning on non-iid features via local batch normalization. In International Conference on Learning Representations, 2020.
283
+
284
+ [33] Xiangru Lian, Ce Zhang, Huan Zhang, Cho-Jui Hsieh, Wei Zhang, and Ji Liu. Can decentralized algorithms outperform centralized algorithms? a case study for decentralized parallel stochastic gradient descent, 2017.
285
+
286
+ [34] Feng Liang, Weike Pan, and Zhong Ming. Fedrec++: Lossless federated recommendation with explicit feedback. In Thirty-Fifth AAAI Conference on Artificial Intelligence, AAAI 2021, Thirty-Third Conference on Innovative Applications of Artificial Intelligence, IAAI 2021, The Eleventh Symposium on Educational Advances in Artificial Intelligence, EAAI 2021, Virtual Event, February 2-9, 2021.
287
+
288
+ [35] Tao Lin, Lingjing Kong, Sebastian U. Stich, and Martin Jaggi. Ensemble distillation for robust model fusion in federated learning. In Hugo Larochelle, Marc’Aurelio Ranzato, Raia Hadsell, Maria-Florina Balcan, and Hsuan-Tien Lin, editors, Advances in Neural Information Processing Systems 33: Annual Conference on Neural Information Processing Systems 2020, NeurIPS 2020, December 6-12, 2020, virtual, 2020.
289
+
290
+ [36] Quande Liu, Cheng Chen, Jing Qin, Qi Dou, and Pheng-Ann Heng. Feddg: Federated domain generalization on medical image segmentation via episodic learning in continuous frequency space. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2021, virtual, June 19-25, 2021, pages 1013–1023. Computer Vision Foundation / IEEE, 2021.
291
+
292
+ [37] Ruixuan Liu, Yang Cao, Hong Chen, Ruoyang Guo, and Masatoshi Yoshikawa. FLAME: differentially private federated learning in the shuffle model. In Thirty-Fifth AAAI Conference on Artificial Intelligence, AAAI 2021, Thirty-Third Conference on Innovative Applications of Artificial Intelligence, IAAI 2021, The Eleventh Symposium on Educational Advances in Artificial Intelligence, EAAI 2021, Virtual Event, February 2-9, 2021, pages 8688–8696. AAAI Press, 2021.
293
+
294
+ [38] Shuchang Liu, Shuyuan Xu, Wenhui Yu, Zuohui Fu, Yongfeng Zhang, and Amélie Marian. Fedct: Federated collaborative transfer for recommendation. In Fernando Diaz, Chirag Shah, Torsten Suel, Pablo Castells, Rosie Jones, and Tetsuya Sakai, editors, SIGIR ’21: The 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, Virtual Event, Canada, July 11-15, 2021, pages 716–725. ACM, 2021.
295
+
296
+ [39] Yi Liu, Jialiang Peng, JQ James, and Yi Wu. Ppgan: Privacy-preserving generative adversarial network. In 2019 IEEE 25Th international conference on parallel and distributed systems (ICPADS), pages 985–989. IEEE, 2019.
297
+
298
+ [40] Lingjuan Lyu, Han Yu, Xingjun Ma, Chen Chen, Lichao Sun, Jun Zhao, Qiang Yang, and Philip S Yu. Privacy and robustness in federated learning: Attacks and defenses. arXiv preprint arXiv:2012.06337, 2020.
299
+
300
+ [41] Lingjuan Lyu, Han Yu, Jun Zhao, and Qiang Yang. Threats to federated learning. In Federated Learning, pages 3–16. Springer, 2020.
301
+
302
+ [42] H. Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Agüera y Arcas. Communication-efficient learning of deep networks from decentralized data, 2017.
303
+
304
+ [43] Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew $\mathrm { ~ Y ~ N ~ g ~ } _ { }$ Reading digits in natural images with unsupervised feature learning. 2011.
305
+
306
+ [44] Lichao Sun and Lingjuan Lyu. Federated model distillation with noise-free differential privacy. In IJCAI, 2021.
307
+
308
+ [45] Manasi Vartak. MODELDB: A system for machine learning model management. In 8th Biennial Conference on Innovative Data Systems Research, CIDR 2017, Chaminade, CA, USA, January 8-11, 2017, Online Proceedings. www.cidrdb.org, 2017.
309
+
310
+ [46] Chenghong Wang, Jieren Deng, Xianrui Meng, Yijue Wang, Ji Li, Fei Miao, Sanguthevar Rajasekaran, and Caiwen Ding. A secure and efficient federated learning framework for NLP. In Marie-Francine Moens, Xuanjing Huang, Lucia Specia, and Scott Wen-tau Yih, editors, Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, EMNLP 2021.
311
+
312
+ [47] Derui Wang, Chaoran Li, Sheng Wen, Surya Nepal, and Yang Xiang. Man-in-the-middle attacks against machine learning classifiers via malicious generative models. IEEE Transactions on Dependable and Secure Computing, 2020.
313
+
314
+ [48] Hongyi Wang, Saurabh Agarwal, and Dimitris S. Papailiopoulos. Pufferfish: Communicationefficient models at no extra cost. CoRR, abs/2103.03936, 2021.
315
+
316
+ [49] Jianyu Wang, Qinghua Liu, Hao Liang, Gauri Joshi, and H Vincent Poor. Tackling the objective inconsistency problem in heterogeneous federated optimization. arXiv preprint arXiv:2007.07481, 2020.
317
+
318
+ [50] Tongzhou Wang, Jun-Yan Zhu, Antonio Torralba, and Alexei A. Efros. Dataset distillation, 2020.
319
+
320
+ [51] Kun Wei, Da Chen, Yuhong Li, Xu Yang, Cheng Deng, and Dacheng Tao. Incremental embedding learning with disentangled representation translation. IEEE Transactions on Neural Networks and Learning Systems, 2022.
321
+
322
+ [52] Kun Wei, Cheng Deng, Xu Yang, and Maosen Li. Incremental embedding learning via zero-shot translation. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 10254–10262, 2021.
323
+
324
+ [53] Han Xiao, Kashif Rasul, and Roland Vollgraf. Fashion-mnist: a novel image dataset for benchmarking machine learning algorithms, 2017.
325
+
326
+ [54] Hongxu Yin, Arun Mallya, Arash Vahdat, Jose M Alvarez, Jan Kautz, and Pavlo Molchanov. See through gradients: Image batch recovery via gradinversion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 16337–16346, 2021.
327
+
328
+ [55] Hongxu Yin, Pavlo Molchanov, Jose M Alvarez, Zhizhong Li, Arun Mallya, Derek Hoiem, Niraj K Jha, and Jan Kautz. Dreaming to distill: Data-free knowledge transfer via deepinversion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8715–8724, 2020.
329
+
330
+ [56] Mikhail Yurochkin, Mayank Agarwal, Soumya Ghosh, Kristjan Greenewald, Trong Nghia Hoang, and Yasaman Khazaeni. Bayesian nonparametric federated learning of neural networks, 2019.
331
+
332
+ [57] Sergey Zagoruyko and Nikos Komodakis. Wide residual networks, 2017.
333
+
334
+ [58] Jie Zhang, Chen Chen, Jiahua Dong, Ruoxi Jia, and Lingjuan Lyu. Qekd: Query-efficient and data-free knowledge distillation from black-box models. arXiv preprint arXiv:2205.11158, 2022.
335
+
336
+ [59] Jie Zhang, Zhiqi Li, Bo Li, Jianghe Xu, Shuang Wu, Shouhong Ding, and Chao Wu. Federated learning with label distribution skew via logits calibration. In International Conference on Machine Learning, pages 26311–26329. PMLR, 2022.
337
+
338
+ [60] Shaofeng Zhang, Meng Liu, and Junchi Yan. The diversified ensemble neural network. Advances in Neural Information Processing Systems, 33, 2020.
339
+
340
+ [61] Yue Zhao, Meng Li, Liangzhen Lai, Naveen Suda, Damon Civin, and Vikas Chandra. Federated learning with non-iid data, 2018.
341
+
342
+ [62] Yanlin Zhou, George Pu, Xiyao Ma, Xiaolin Li, and Dapeng Wu. Distilled one-shot federated learning. arXiv preprint arXiv:2009.07999, 2020.
343
+
344
+ [63] Xinghua Zhu, Jianzong Wang, Zhenhou Hong, and Jing Xiao. Empirical studies of institutional federated learning for natural language processing. In Trevor Cohn, Yulan He, and Yang Liu, editors, Findings of the Association for Computational Linguistics: EMNLP 2020, Online Event, 16-20 November 2020, volume EMNLP 2020 of Findings of ACL, pages 625–634. Association for Computational Linguistics, 2020.
345
+
346
+ [64] Zhuangdi Zhu, Junyuan Hong, and Jiayu Zhou. Data-free knowledge distillation for heterogeneous federated learning. In Marina Meila and Tong Zhang, editors, 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, pages 12878–12889. PMLR, 2021.
347
+
348
+ # Checklist
349
+
350
+ 1. For all authors...
351
+
352
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
353
+ (b) Did you describe the limitations of your work? [Yes]
354
+ (c) Did you discuss any potential negative societal impacts of your work? [No]
355
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
356
+
357
+ 2. If you are including theoretical results...
358
+
359
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] (b) Did you include complete proofs of all theoretical results? [Yes]
360
+
361
+ 3. If you ran experiments...
362
+
363
+ (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]
364
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
365
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No]
366
+ (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]
367
+
368
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
369
+
370
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
371
+ (b) Did you mention the license of the assets? [N/A]
372
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
373
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
374
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
375
+
376
+ 5. If you used crowdsourcing or conducted research with human subjects...
377
+
378
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
379
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
380
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/R9KnuFlvnU/R9KnuFlvnU.md ADDED
@@ -0,0 +1,240 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # WebShop: Towards Scalable Real-World Web Interaction with Grounded Language Agents
2
+
3
+ Shunyu Yao⇤ Howard Chen⇤ John Yang Karthik Narasimhan Department of Computer Science, Princeton University {shunyuy, howardchen, jy1682, karthikn}@princeton.edu
4
+
5
+ # Abstract
6
+
7
+ Existing benchmarks for grounding language in interactive environments either lack real-world linguistic elements, or prove difficult to scale up due to substantial human involvement in the collection of data or feedback signals. To bridge this gap, we develop WebShop – a simulated e-commerce website environment with 1.18 million real-world products and 12, 087 crowd-sourced text instructions. Given a text instruction specifying a product requirement, an agent needs to navigate multiple types of webpages and issue diverse actions to find, customize, and purchase an item. WebShop provides several challenges for language grounding including understanding compositional instructions, query (re-)formulation, comprehending and acting on noisy text in webpages, and performing strategic exploration. We collect over 1, 600 human demonstrations for the task, and train and evaluate a diverse range of agents using reinforcement learning, imitation learning, and pre-trained image and language models. Our best model achieves a task success rate of $2 9 \%$ , which outperforms rule-based heuristics $( 9 . 6 \% )$ but is far lower than human expert performance $( 5 9 \% )$ . We also analyze agent and human trajectories and ablate various model components to provide insights for developing future agents with stronger language understanding and decision making abilities. Finally, we show that agents trained on WebShop exhibit non-trivial sim-to-real transfer when evaluated on amazon.com $\boxed { e b a y . c o m }$ , indicating the potential value of WebShop in developing practical web-based agents that can operate in the wild.
8
+
9
+ # 1 Introduction
10
+
11
+ Recent advances in natural language processing (NLP) and reinforcement learning (RL) have brought about several exciting developments in agents that can perform sequential decision making while making use of linguistic context $\boxed { 3 0 } \boxed { 5 0 } \boxed { 5 8 }$ . On the other hand, large-scale language models like GPT-3 $\boxed { 6 }$ and BERT $\mathbb { \ m }$ are excelling at traditional NLP benchmarks such as text classification, information extraction and question answering. While the former set of tasks are limited in their set of linguistic concepts and prove difficult to scale up, the latter tasks usually contain static, noninteractive datasets that lack adequate grounding to extra-linguistic concepts [4]. In order to make further progress in building grounded language models, we believe there is a need for scalable interactive environments that contain: (1) language elements that reflect rich, real-world usage and are collectible at scale, and (2) task feedback that is well-defined and automatically computable to facilitate interactive learning, without the constant need for expensive feedback from humans.
12
+
13
+ The world wide web (WWW) is a massive open-domain interactive environment that inherently satisfies the first aforementioned requirement through its interconnected set of pages with natural text, images and interactive elements. By being simultaneously scalable, semantic, interactive, dynamic and realistic, the web is uniquely different from existing environments for autonomous agents like games or 3D navigation. Moreover, the web also provides a practical environment to deploy trained agents, with great potential for alleviating human efforts in tedious tasks (e.g. buying products, booking appointments). While there has been prior work on building web-based tasks, they either lack depth in the transition and action spaces, or prove difficult to scale up. Some benchmarks only contain either a single classification task [39, 46, 31] or interactions containing only a handful of different pages in each episode $\mathbb { \oplus 3 } \mathbb { \mathbb { I } }$ . Others propose tasks with longer horizons but are either limited to following hyperlinks for web navigation $\overline { { \mathbb { B } 6 } }$ or require human-in-the-loop feedback due to the lack of an automated reward function [33].
14
+
15
+ ![](images/fd8ee216f8b0fd52e92c042aefc8a8be8bc5192291fc4b47cd444acca973f0b0.jpg)
16
+
17
+ ![](images/710bb4fa13c643a25fb697fab89b806f92ae1e1793c7d90052af77f21394a084.jpg)
18
+ Figure 1: The WebShop environment. A: An example task trajectory in HTML mode, where a user can (1) search a query in a search page, (2) click a product item in a results page, (3) choose a color option in a item page, (4) check item-detail pages and go back to the item page, and (5) finally buy the product to end the episode and receive a reward $r \in [ 0 , 1 ]$ $( \ S 3 . 2 )$ . B: the results page in simple mode for agent training and evaluation. The blue text indicates clickable actions and bold text indicates an action selected by the agent. C: The product notation used in $\ S \bigstar$ with corresponding examples from the product in A. The attributes $Y _ { \mathrm { a t t } }$ are hidden from the task performer.
19
+
20
+ In this paper, we introduce WebShop (Figure 1) – a large-scale interactive web-based environment for language understanding and decision making – and train autonomous agents to complete tasks on this benchmark. With the goals of being scalable and containing realistic language and visual elements, WebShop emulates the task of online shopping on an e-commerce website, where the agent’s goal is to understand a human-provided text instruction and purchase a product to match the specifications. To do so, the agent needs to query the website’s search engine, choose items to explore from search results, open and read their description and details, and select the necessary options (e.g. $3 2 \ \mathrm { o z } .$ ., red color) before clicking the ‘Buy’ button. In order to pick the optimal product that matches user requirements, the agent may need to view and compare various products (including backtracking between pages), and potentially perform multiple searches. WebShop contains over one million products scraped from $\mathtt {boxed { a m a z o n . c o m } }$ over 12 thousand crowdsourced instructions, and a diverse semantic action space of searching text queries and choosing text buttons. It is packaged into a convenient OpenAI Gym [5] environment and can be rendered in two modes (HTML or simple) with parallel observation spaces that are easy for human and model respectively. Rewards are automatically computed using a combination of programmatic matching functions that consider the attributes, type, options and price of the chosen product, alleviating the need for human evaluation and providing a path to scaling up interactive learning.
21
+
22
+ We develop several agents to perform this task, using both reinforcement learning (RL) and imitation learning (IL). We also leverage the latest pre-trained language models $\mathbb { P 2 6 , \overline { { 1 1 } } }$ for representing and generating text. Our modular architecture includes a factorized processing of state observations and action choices using ResNets (visual) and Transformers (text), followed by an attention fusion layer that helps the agent contextually score each action. Our best agent achieves an average score of 62.4 (out of 100) and successfully completes the task $2 8 . 7 \%$ of the time, significantly higher than a heuristic baseline that achieves 45.6 and $9 . 6 \%$ , respectively. While this demonstrates the potential for IL and RL, the agents are still much lower than human experts, who can achieve 82.1 and $5 9 . 6 \%$ on this task.\* We perform several analyses and ablation studies to identify the cause of this gap and find several avenues for agent improvement in the future including more robust search generation, explicit memory modules, and better handling of noisy web text. Finally, we also demonstrate an instance of sim-to-real transfer by deploying agents trained with WebShop to operate on $\mathtt { \boxed { a m a z o n . c o m } }$ and ebay.com, and find that they can achieve similar performances despite search engine and product differences, and consistently outperform the rule baseline of using the first result returned by the commercial search engines when directly searching the instruction texts. This demonstrates the practical potential of our work towards developing agents that can operate autonomously on the world wide web (WWW).
23
+
24
+ # 2 Related Work
25
+
26
+ Reinforcement learning on the web. Nogueira and Cho $\pmb { \mathbb { B } } 6 \|$ introduced WikiNav as a benchmark for RL agents navigating pages, but the task is purely navigational with the actions restricted to either choosing a hyperlink to follow or deciding to stop. The World of Bits (WoB) benchmark [43] enables training of RL agents to complete tasks on webpages using pixel and Document Object Model (DOM) observations. Several follow-up papers have tackled MiniWoB using techniques like workflow-guided exploration $\mathbb { \left| \left[ 2 9 \right] \right| }$ , curriculum and meta-learning $\mathbb { \lVert 1 5 \rVert }$ , DOM tree representation $\pmb { \mathbb { Z } } \pmb { \mathbb { 1 } }$ adversarial environment generation $[ \overline { { \left| 1 6 \right| } }$ and large-scale behavioral cloning $\left[ \left[ 2 0 \right] \right]$ . However, MiniWoB lacks long-range decision making across multiple different pages and does not scale easily in terms of difficulty or size due to its use of low-level mouse clicks and keystrokes as actions. In contrast, WebShop requires navigating longer paths with context-based action selection and backtracking, and it uses high-level search and choose actions that are more scalable and transferable to real settings. While not directly operating on web pages, AndroidEnv $\lVert \rVert \bigstar \ 8 \rVert$ and MoTIF $\textcircled { 8 }$ provide environments to train agents for interacting with apps and services on mobile platforms.
27
+
28
+ Non-interactive web-based tasks. Various supervised classification tasks on webpages have been proposed, including predicting web elements $\underline { { \bar { 1 3 9 } } }$ , generating API calls [46, 47, 54] and semantic parsing into concept-level navigation actions $\pmb { \mathbb { B } } \mathbf { \mathbb { 1 } }$ . Perhaps most similar content-wise to our work is the Klarna product page dataset $\boxed { 1 1 9 }$ which contains over 50, 000 product pages labeled with different element categories for supervised classification. All these works only consider supervised settings with a single decision, and may require the definition of web APIs or command templates for each domain. Our benchmark, WebShop, combines webpages with realistic text and image content with a rich and diverse interaction space for long-range sequential decision making.
29
+
30
+ Leveraging the web for traditional NLP tasks. Several papers have explored the use of the web for information extraction $\pmb { \Vert 3 4 \Vert }$ and retrieval $\mathbb { I I }$ , question answering $\pm 2 \sqrt { 2 5 } \pi$ , dialog $\lVert \boldsymbol { \mathsf { 4 5 } } \rVert$ , and training language models on webtext $\left[ \left[ 2 \right] \right]$ . These approaches primarily use web search engines as a knowledge retriever for gathering additional evidence for the task at hand. Perhaps most similar to our work is WebGPT $\bar { \textregistered 3 } \textcircled { 1 }$ , which uses a web interface integrated with a search engine to train RL agents to navigate the web and answer questions. However, our environment has a more diverse action and observation space (including images) and does not require human-in-the-loop evaluation.
31
+
32
+ # 3 The WebShop Environment
33
+
34
+ We create WebShop as a large-scale web-based interactive environment with over 1.1 million realworld products scraped from amazon.com. In this environment, an agent needs to find and purchase a product according to specifications provided in a natural language instruction. WebShop is designed
35
+
36
+ <table><tr><td>Type</td><td>Argument</td><td>State -→ Next State</td></tr><tr><td>search</td><td>[Query]</td><td>Search-Results</td></tr><tr><td>choose</td><td>Back to search</td><td>*→Search</td></tr><tr><td>choose</td><td>Prev/Next page</td><td>Results→Results</td></tr><tr><td>choose</td><td>[Product title]</td><td>Results →Item</td></tr><tr><td>choose</td><td>[Option]</td><td>Item →Item</td></tr><tr><td>choose</td><td>Desc/Overview</td><td>Item -→Item-Detail</td></tr><tr><td>choose</td><td>Previous</td><td>Item-Detail →Item</td></tr><tr><td>choose</td><td>Buy</td><td>Item →Episode End</td></tr></table>
37
+
38
+ Table 1: Actions in WebShop.
39
+
40
+ ![](images/79afb857713abe8a4992b6110c04289a2a0608008f193fa71a2e49f05439a117.jpg)
41
+ Figure 2: Item rank in search results when the instruction is directly used as search query.
42
+
43
+ in a modular fashion which disentangles the website transitions from the task-specific aspects like instructions and reward, allowing for easy extension to new tasks and domains.
44
+
45
+ # 3.1 Task Formulation
46
+
47
+ WebShop can be formulated as a partially observable Markov decision process (POMDP) $( S , { \mathcal { A } } , { \mathcal { T } } , { \mathcal { R } } , { \mathcal { U } } , { \mathcal { O } } )$ with state space $s$ , action space $\mathcal { A }$ , deterministic transition function $\tau : \mathcal { S } \times \mathcal { A } $ $s$ , reward function ${ \mathcal { R } } : S \times A \to [ 0 , 1 ] ,$ , instruction space $\mathcal { U }$ , and a state observation space $\mathcal { O }$ .
48
+
49
+ State and action. A state $s \in S$ represents a web page, which falls into one of the four types – the search page that contains a search bar, the results page that lists a set of products returned by a search engine, the item page that describes a product, or the item-detail page that shows further information about the product (Figure $1 \mathrm { A } ( 1 \ – 4 )$ respectively). We define the following notations for a product $y$ . We denote $\bar { y }$ to be the aggregation of the various text fields including product title, description, and overview. We denote $y _ { \mathrm { p r i c e } }$ to be the price, $Y _ { \mathrm { o p t } }$ to be a set of buying options, and $I$ to be a set of images, each corresponding to a specific option. Finally, each product is associated with $Y _ { \mathrm { a t t } }$ , a set of attributes hidden from the agent which is extracted from the title and the item-detail pages $( \ S _ { \perp } 3 . 2 )$ The attributes are used for the automatic reward calculation.
50
+
51
+ An action $a \in \mathcal { A } ( s )$ can either be searching a text query (e.g. search[Red shoes]) or choosing a text button (e.g. choose[Size 9]) as shown in Table $\bigstar \bigstar$ These two action types are not available simultaneously – search is only allowed when the agent is at the search page; on all other pages, click is the only action choice. The chosen action argument (button) will be clicked as a web link as opposed to the low-level mouse-click actions in previous environments such as World of Bits $\mathbb { \lVert \boldsymbol { 4 3 } \rVert }$ . The transitions initiated by clicks deterministically redirect the web page to one of the four page types (Table 1). The transition initiated by search is based on a deterministic search engine $( \ S _ { \bigcirc } 3 . 2 )$ .
52
+
53
+ Observation. Using Flask $\pm \amalg$ and OpenAI Gym [5], we provide two parallel observation modes to render the state and instruction $s \times \tau \to \mathcal { O }$ : (1) HTML mode that contains the HTML of the web page, allowing for interaction in a web browser(Figure $^ { 1 \mathrm { A } ) }$ , and (2) simple mode which strips away extraneous meta-data from raw HTML into a simpler format (Figure $1 \bar { \mathbf { B } } _ { \scriptscriptstyle , }$ ). The human performance scores in $\ S \boxed { 4 . 2 }$ are collected in the HTML mode, while all models are trained and evaluated in the simple mode. Note that while the environment allows for training reinforcement learning agents on raw pixels in HTML mode (like in Shi et al. $\mathbb { \lVert \vec { 4 . 3 } \rVert } ,$ ), we believe that it provides a very low-level non-semantic action space. Moreover, it is straightforward to write a translator that converts any new HTML page into simple format for use with trained agents, which enables sim-to-real transfer.
54
+
55
+ Instruction and reward. Each natural language instruction $u \in \mathcal { U }$ contains the following information: a non-empty set of attributes $U _ { \mathrm { a t t } }$ , a set of options $U _ { \mathrm { o p t } }$ , and a price $u _ { \mathrm { p r i c e } }$ . The instruction is generated based on a target product $y ^ { * }$ by human annotators. The instruction collection process is lightweight and scalable $( \bar { \ S } 3 . \bar { 2 } )$ . Concretely, $U _ { \mathrm { a t t } } \subseteq Y _ { \mathrm { a t t } } ^ { * }$ is a subset of the product attributes, $U _ { \mathrm { o p t } } \subseteq Y _ { \mathrm { o p t } } ^ { * }$ is a subset of the product option field-value pairs, $u _ { \mathrm { p r i c e } } > y _ { \mathrm { p r i c e } } ^ { \ast }$ is a price set to be higher than the target product price. For example, the instruction “Can you find me a pair of black-and-blue sneaker that is good in rain weather? I want it to have puffy soles, and price less than 90 dollars.” contains the aforementioned attributes $U _ { \mathrm { a t t } } = \{ $ “waterproof”, “soft sole” $\}$ and option $U _ { \mathrm { o p t } } = \{ { \stackrel { } { \mathrm { c o l o r } } } ^ { \mathrm { , } }$ : “black and blue” $\}$ . In each episode, the agent receives a reward $r = \mathcal { R } ( s _ { T } , a )$ in the end at timestep $T$ , where $a =$ choose[buy], $y$ is the product chosen by the agent in the final state $s _ { T }$ , and $Y _ { \mathrm { a t t } }$ and $Y _ { \mathrm { o p t } }$ are its corresponding
56
+
57
+ attributes and options. The reward is defined as:
58
+
59
+ $$
60
+ r = r _ { \mathrm { t y p e } } \cdot \frac { | U _ { \mathrm { a t t } } \cap Y _ { \mathrm { a t t } } | + | U _ { \mathrm { o p t } } \cap Y _ { \mathrm { o p t } } | + { \bf 1 } [ y _ { \mathrm { p r i c e } } \leq u _ { \mathrm { p r i c e } } ] } { | U _ { \mathrm { a t t } } | + | U _ { \mathrm { o p t } } | + 1 }
61
+ $$
62
+
63
+ where the type reward $r _ { \mathrm { t y p e } } = \tt T e x t M a t c h ( \bar { y } , \bar { y } ^ { \ast } )$ is based on text matching heuristics to assign low reward when $y$ and $y ^ { \ast }$ have similar attributes and options but are obviously different types of products. For example, “butter” and “plant-based meat” differ in types but may both contain attributes “cruelty-free”, “non-GMO”, and an option “size: pack of $2 ^ { \circ }$ . The exact formula for TextMatch $( \cdot )$ is in the Appendix $\ S [ \mathrm { A } . 5 ]$
64
+
65
+ Evaluation metrics. We use two evaluation metrics: (1) Task Score: defined as $\mathbf { 1 0 0 } \times \mathbf { a v g }$ . reward), which captures the average reward obtained across episodes; and (2) Success Rate (SR) defined as the portion of instructions where $r = 1$ . Note that it is possible to obtain $r = 1$ for an episode even if the final product is not $y ^ { * }$ — for example, there could be many items that satisfy the goal “I want a red shirt”, even if the goal is generated from a specific red shirt item.
66
+
67
+ # 3.2 Environment Implementation
68
+
69
+ Data scraping. We use ScraperAPI $\pmb { \Vert 3 5 } \Vert$ to scrape 1, 181, 436 products from amazon.com across 5 categories (fashion, makeup, electronics, furniture, and food) using 113 sub-category names as queries. The product texts (title and item details) have an average length of 262.9 and a vocabulary size 224, 041 (word frequency higher than 10). In addition, the products have a total of 842, 849 unique options, reflecting the scale and complexity of the data. More details about product scraping is in the Appendix §A.1.
70
+
71
+ Search engine. We use Pyserini $\left[ \left[ 2 8 \right] \right]$ for the search engine, where indices are built offline using a BM25 sparse retriever with text for each product concatenated from the title, description, overview, and customization options. The search engine is deterministic, which eases imitation learning and result reproducibility. More details in A.3.
72
+
73
+ Attribute mining and annotation. Each product is annotated with a set of hidden attributes, which are used to represent its latent characteristics as well as to calculate the reward as detailed in $\ S 3 .$ A n attribute is a short natural language phrase that describes the property of the product (see examples in Figure 1). We mine the attributes by calculating TF-IDF scores for all bi-grams in the concatenated titles and descriptions based on each product category. We review the top 200 bi-grams for each category, remove the noisy ones by inspection (decide based on whether the bi-gram is human understandable), and assign them to the products. We consolidate a pool of 670 attributes. See more details in the Appendix §A.2.
74
+
75
+ Natural language instructions. We use Amazon Mechanical Turk (AMT) to collect natural language instructions that specify goal products with appropriate options. Specifically, an AMT worker is presented with a sampled goal product, including the product title, category, attributes, and the buying options, and asked to write a command to instruct an automatic shopping agent to find the target. Workers are instructed to avoid being too specific such as including the entire title in the instruction, but stay faithful to describing the target product. We collect a total of 12, 087 linguistically diverse instructions with an overall vocabulary size of 9, 036 words and an average length of 15.9 words. We provide the detailed annotation process and interface in the Appendix §A.4.
76
+
77
+ Human demonstrations. We collect trajectories from humans performing the task in the HTML mode of WebShop to understand the task difficulty for humans and to analyze how humans would solve the task. We use qualification tests to train and select motivated workers to perform the task. We recruit and train a total of 13 workers for data collection, and among them we select the top 7 performing workers to be “experts” (see Appendix $\ S \mathbf { A } . 6$ for examples). We also leverage this data to perform imitation learning (described in $\bar { \ S } 4 . 2 )$ .
78
+
79
+ # 3.3 Research Challenges
80
+
81
+ WebShop brings together several research challenges for autonomous systems from various subfields in NLP and RL into a single benchmark. These include: 1) generation of good search queries [22, 59] and reformulation [37, 51], 2) strategic exploration for navigating through the website [55, 56, 29], 3) robust language understanding for textual state and action spaces [3, 7, 17, 44], and 4) long-term memory for comparing items or backtracking [53, 13, 23] (Figure 1). While we believe individual advances in each of these will improve agent performance, WebShop also provides an ideal testbed for the development of interdisciplinary techniques that tackle more than one of the above mentioned challenges simultaneously. For example, external memory modules may be very effective if combined with strategic exploration, or exploration could be helpful in information query reformulation. Further analysis based on human and model trajectories is in $\ S [ 5 . 3 ]$
82
+
83
+ ![](images/2070441b49dc8098d623316cc859941c8a50c1434ba11e6c13a60da9b88e21a5.jpg)
84
+ Figure 3: Architecture of our choice-based imitation learning (IL) model. The image $I$ is passed to a ResNet to obtain the image representation. The instruction text $u$ is passed to a transformer (initialized with BERT) to obtain the text representations. The concatenated bi-modal representations are fused with the action representations using the Attention Fusion Layer. The resulting fused-action representations are mean-pooled and reduced by an MLP layer to a scalar value $S ( o , a )$ denoting the logit value of the action choose[khaki].
85
+
86
+ # 4 Methods
87
+
88
+ We propose various models that combine language and image pre-training with imitation learning (IL) and reinforcement learning (RL). More details are provided in the Appendix §B.
89
+
90
+ # 4.1 Rule Baseline
91
+
92
+ A simple rule baseline is to search the exact instruction text, then choose and buy the first item in the results page without choosing any options. The heavy lifting of the lexical search engine makes it also a simple non-learnable information retrieval (IR) baseline, and would lead to a non-trivial attribute reward. However, simple heuristic rules cannot resolve noisy natural language options, strategically explore, or learn to generate what to search, so the total reward and task success rate should be low.
93
+
94
+ # 4.2 Imitation Learning $\mathbf { \Pi } ( \mathbf { I I L } )$
95
+
96
+ For the text generation and choice problems presented in WebShop, we propose using two pre-trained language models to separately learn how to search and choose from human demonstrations.
97
+
98
+ Imitating human search generation. We frame searching as a sequence-to-sequence text-generation problem: the agent generates a search action $a = \tt s e a r c h [ . . . ]$ given an instruction $u$ without considering any osearch pairs from ntext (e.g. past searches, visited items). We use training human trajectories to construct a datas $M = 1 , 4 2 1$ tion-and $1 , 0 1 2$ $\mathcal { D } = \{ ( u , a ) \} _ { i = 1 } ^ { M }$ fine-tune a BART model $[ \overline { { 2 6 } } ]$ parameterized by $\phi$ to perform conditional language modeling:
99
+
100
+ $$
101
+ \mathcal { L } _ { \mathrm { s e a r c h } } = \mathbb { E } _ { u , a \sim \mathcal { D } } \left[ - \log \pi _ { \phi } ( { a } \mid u ) \right]
102
+ $$
103
+
104
+ Imitating human choice. The choice-based imitation model (Figure $3$ ) predicts a probability distribution over all the available click actions $\scriptstyle A ( o )$ in observation $o$ and maximizes the likelihood of the human clicked button $a ^ { * } \in \mathcal { A } ( o )$ . We construct a dataset $\mathcal { D } ^ { \prime } = \{ ( o , \mathcal { A } ( o ) , a ^ { * } ) \} _ { i = 1 } ^ { M ^ { \prime } }$ of samples from the training human trajectories. We use a 12-layer pre-trained BERT model $\mathbb { \ m }$ parameterized by $\theta$ to encode the $o$ into an observation representation of contextualized token embeddings, and we similarly encode each action. Each action representation is passed into a cross-attention layer with the observation representation, then mean pooled into a single vector and multiplied with a matrix $W$ to obtain a scalar score $S ( o , a )$ . The policy $\pi _ { \boldsymbol { \theta } } \left( a \mid o , \boldsymbol { \mathcal { A } } ( o ) \right)$ is the softmax distribution over action scores $S ( o , a )$ :
105
+
106
+ $$
107
+ \begin{array} { r l } & { \qquad \mathcal { L } _ { \mathrm { c h o o s e } } = \mathbb { E } _ { o , A ( o ) , a ^ { * } \sim \mathcal { D } ^ { \prime } } \left[ - \log \pi _ { \theta } \left( a ^ { * } \mid o , \mathcal { A } ( o ) \right) \right] } \\ & { \qquad \pi _ { \theta } \left( a \mid o , \mathcal { A } ( o ) \right) \sim \exp \left( W ^ { \top } \mathrm { m e a n } \big [ \mathrm { c r o s s - a t t n } \big ( \mathrm { B E R T } ( o ; \theta ) , \mathrm { B E R T } ( a ; \theta ) \big ) \big ] \right) } \end{array}
108
+ $$
109
+
110
+ Handling Images. We use a pre-trained ResNet-50 [18] to pre-process images across different products and options into a 512 dimensional feature vector, which is then transformed into 768 dimensions with a learned linear layer and concatenated to $\mathrm { B E R T } ( o )$ as the observation representation.
111
+
112
+ Full pipeline. Combining the above during environment interaction, we use the BART model in the search page to generate the top-5 search queries via beam search and choose a random one. For other pages, we sample one action from $\bar { \pi _ { \boldsymbol { \theta } } ( \boldsymbol { a } \mid \boldsymbol { o } , \boldsymbol { A } ( \boldsymbol { o } ) ) }$ using the BERT model. We find these methods useful to encourage diverse actions. In contrast, an ineffective strategy that uses only the top generated search query or the button with the highest probability might lead to limited product candidates or being stuck (e.g. bouncing back and forth between pages).
113
+
114
+ # 4.3 Reinforcement Learning (RL)
115
+
116
+ We also fine-tune the choice-based IL model with online RL (i.e. $\mathrm { I L + R L }$ ). Prior work suggests that directly fine-tuning text generation via RL might lead to language drifting $\pmb { \Vert 2 4 \Vert }$ and deteriorated performance. Therefore, we freeze the BART model to provide the top-10 search generations as a refined action space for the choice-based $\mathrm { I L }$ model to learn to pick – an inspiration borrowed from previous work in text games $\mathbb { \left. \boldsymbol { \bar { 5 . 5 } } \right. }$ and referential games $\pmb { \Vert 2 4 \Vert }$ . We use the policy gradient method $\lVert \overline { { 3 2 } } \rVert$ with return-to-go $R _ { t } = \mathbb { E } _ { \pi } [ r _ { t } + \gamma R _ { t + 1 } ]$ and a learned value baseline $V \dot { ( o ) } \stackrel { \sim } { = } W _ { v } ^ { \top } \mathbf { B } \mathbf { E } \mathbf { R } \mathbf { T } ( o ; \theta )$ parameterized by $\{ W _ { v } , \theta \}$ (the BERT weights are tied with the policy):
117
+
118
+ $$
119
+ \mathcal { L } _ { \mathrm { P G } } = \mathbb { E } _ { \boldsymbol { \pi } } \left[ - \left( R _ { t } - V ( o _ { t } ) \right) \log \pi \left( a _ { t } \mid o _ { t } , \boldsymbol { A } ( o _ { t } ) \right) \right]
120
+ $$
121
+
122
+ The value $V ( o )$ is learned with an L2 loss ${ \mathcal { L } } _ { \mathrm { v a l u e } } = ( R _ { t } - V ( o _ { t } ) ) ^ { 2 }$ . We also add an entropy loss $\begin{array} { r } { \mathcal { L } _ { \mathrm { e n t r o p y } } = \sum _ { a \in A ( o _ { t } ) } \pi _ { \theta } \big ( a _ { t } \ | \ o _ { t } , A ( o _ { t } ) \big ) \log \pi _ { \theta } \big ( a _ { t } \ | \ o _ { t } , A ( o _ { t } ) \big ) } \end{array}$ to prevent premature convergence. 2A Our full RL model minimizes the total loss $\mathcal { L } _ { \mathrm { R L } } = \mathcal { L } _ { \mathrm { P G } } + \mathcal { L } _ { \mathrm { v a l u e } } + \mathcal { L } _ { \mathrm { e n t r o p y } }$ .
123
+
124
+ # 5 Experiments
125
+
126
+ # 5.1 Setup and task verification
127
+
128
+ We split a total of 12, 087 instructions into an i.i.d. distributed train / development $/$ test split of $1 0 , 5 8 7 / 1 , 0 0 0 / 5 0 0$ instances for all models. While future work can investigate splits with more generalization gaps (e.g. split by product category), we will show the i.i.d. split is already challenging for current models. We randomly sample a subset of the 10, 587 training instructions, then collect 1, 012 human demonstrations for task verification and imitation learning (IL) and a further 54 demonstrations from instances in the development set for IL hyperparameter tuning and checkpoint selection. We also collect human trajectories for all 500 test instructions and report human and model performances averaged across these 500 instructions. More setup details are in the Appendix §C.
129
+
130
+ # 5.2 Results
131
+
132
+ Task performance. From Figure $^ { 4 , }$ we observe that the rule baseline obtains a low score of 45.6 and a very low success rate of $1 0 \%$ since it cannot resolve options specified in language or explore more products, empirically demonstrating the non-trivial nature of the task. The IL model significantly outperforms the rule baseline on both metrics, achieving a score of 59.9. Further RL finetuning improves the score to 62.4 while slightly hurting the success rate $( 2 9 . 1 \% 2 8 . 7 \% )$ (analyzed further in $\textcircled { 5 . 3 }$ . We also observe a significant gap between models and humans – our best model’s success rate $\overline { { ( 2 9 . 1 \% } } )$ is less than half of expert humans $( 5 9 . 6 \% )$ and only $6 0 \%$ of the average human $( 5 0 \% )$ . This indicates a great room for model improvement by tackling reseach challenges in WebShop.
133
+
134
+ $\mathbf { I L }$ ablations. Figure 4 also contains several ablations that confirm important design choices for models. When the choice action model for the $\mathrm { I L }$ agent is randomly initialized $\mathbf { I L }$ (w/o LP Choice); $\mathrm { L P = }$ language-pretraining), the success rate drops by nearly two-thirds, indicating the importance of language pre-training for our task. When the search query generator in the IL agent is replaced by a simple rule, which always uses the instruction text $\mathbf { I L }$ (w/o LP Search)), both reward and success rate drop by around 3 points. This suggests the importance to explore by expanding the search space for exploration, but it is not as critical as learning to choose the right options. We experiment with incorporating history of one past observation and the last five actions into the model and find a slight degradation in the score from 59.9 to 57.3, suggesting more advanced techniques are needed to leverage past information. More ablations in §C.
135
+
136
+ ![](images/900ce25feb58106528e7d386109573628bf982ffef770c81587f12acfdbfced5.jpg)
137
+ Figure 4: Task scores and Success Rate $( \% )$ for our models on the test split of WebShop over 3 trials. LP Search uses a pre-trained BART model to generate the search query and IL w/o LP Search uses the rule-based heuristic. LP Choice uses pre-trained BERT weights to initialize the choice action model and IL w/o LP Choice trains a Transformer from scratch.
138
+
139
+ <table><tr><td></td><td colspan="5">Score</td><td colspan="3">Count</td></tr><tr><td></td><td>All</td><td>Att</td><td>Opt</td><td>Type</td><td>Price</td><td>State</td><td>Item</td><td>Search</td></tr><tr><td>Rule</td><td>45.6</td><td>66.6</td><td>0.0</td><td>80.5</td><td>86.0</td><td>3.0 (3/3)</td><td>1.0 (1/1)</td><td>1.0 (1/1)</td></tr><tr><td>IL</td><td>59.9</td><td>69.3</td><td>45.2</td><td>86.4</td><td>84.0</td><td>9.4 (90/3)</td><td>1.6 (11/1)</td><td>1.3 (17/1)</td></tr><tr><td>IL+RL</td><td>62.4</td><td>74.0</td><td>38.9</td><td>89.7</td><td>88.7</td><td>4.5 (5/1)</td><td>1.0 (1/1)</td><td>1.0(1/1)</td></tr><tr><td>Human Expert</td><td>82.1</td><td>81.8</td><td>73.9</td><td>94.4</td><td>97.7</td><td>11.3 (114 /4)</td><td>1.9 (16 / 1)</td><td>1.4 (16 /1)</td></tr></table>
140
+
141
+ Table 2: Left: Score breakdown. Right: average, maximum, and minimum number of states visited, items checks, and searches in a trajectory.
142
+
143
+ RL ablations. When we directly train an RL agent (RL) from pre-trained BERT parameters, the performance is even worse than the rule baseline. This suggests that IL warm-starting is critical, possibly because of the significant domain shift from traditional language tasks. We also consider a simple RL model with RNN text encoders instead of the Transformer (RL (RNN)), which has a success rate more than $1 0 \%$ worse than the $\mathrm { I L } + \mathrm { R L }$ model with a much larger variance. We hypothesize that RL with a more powerful architecture could help boost and stabilize the performance if the model is initialized with better language and task priors.
144
+
145
+ # 5.3 Analysis
146
+
147
+ To better understand the differences between the agents and human experts, we perform several fine-grained analyses. We first break down the overall score into its four sub-parts according to Eq. $( \mathbf { \bar { 1 } } )$ : 1) attribute score $( | U _ { \mathrm { a t t } } \cap Y _ { \mathrm { a t t } } | / | U _ { \mathrm { a t t } } | ) ,$ 2) option score $( | U _ { \mathrm { o p t } } \cap Y _ { \mathrm { o p t } } | / | U _ { \mathrm { o p t } } | )$ , 3) price score $( { \bf 1 } [ y _ { \mathrm { p r i c e } } ^ { - } \leq u _ { \mathrm { p r i c e } } ] )$ , and 4) type score $( r _ { \mathrm { t y p e } } )$ . We report trajectory statistics such as the average number of states, unique items visited, and number of searches per episode in Table 2 and provide qualitative examples of the trajectories in Table 3.
148
+
149
+ Human expert vs. agents. Human experts outperform the agents on all score sub-parts (Table 2), but the most significant boost comes from the option score (a $2 8 \%$ gap), revealing that agents have trouble selecting the correct product options. Humans also have longer trajectories, explore more items and perform more searches than the agents, with a higher variance, demonstrating their flexibility. Table $\triangledown$ provides some samples trajectories. In the first example, the human decides to search again after removing ‘inches’, ‘width’, ‘height’, and ‘white’ from the query since product texts often contain abbreviated symbols for these terms like ‘"’, ‘w’, and $\mathbf { \ddot { h } } ^ { \prime }$ . Thus, search generation is challenging for models since it involves reasoning and adapting to grounded environments, and ideas from query reformulation [37, 1] could help alleviate this. Agents also struggle to perform robust semantic matching, which is important in choosing options that contain noisy paraphrases of instruction spans. In the second example, the human explores several products first, and decides to return to the first explored product, demonstrating long-term memory that is lacking in the $\mathrm { I L + R L }$ model.
150
+
151
+ Table 3: Two example trajectories (showing only actions) from the human and the $\mathrm { I L + R L }$ model. We omit some human actions from instruction 2 for space and truncate the item names for readability. Red denotes options and blue denotes attributes.
152
+
153
+ <table><tr><td></td><td rowspan=1 colspan=1>Instruction 1</td><td rowspan=1 colspan=1>Instruction 2</td></tr><tr><td></td><td rowspan=1 colspan=1>I want to find white blackout shades that are 66inches in width and 66 inches in height. They needto be easy to install [...]</td><td rowspan=1 colspan=1>I need a gingko light and 2O&quot;x2O&quot; pillow cover that is hand painted [.]</td></tr><tr><td rowspan=1 colspan=2>Human Actions (r = 1.O,length = 8)search[66 inches in width and 66 inches in heightwhite shades ]choose[ item:CALYX... ]choose[Back to Search]search[66 x 66 blackout shades ]choose[item:Milin...]choose[opt : 66&quot;w x 66&quot;h]choose[opt : cordless bottom up-blackout-white ]choose[Buy]</td><td rowspan=1 colspan=1>Human Actions (r = 1.O,length = 8)search[66 inches in width and 66 inches in heightwhite shades ]choose[ item:CALYX... ]choose[Back to Search]search[66 x 66 blackout shades ]choose[item:Milin...]choose[opt : 66&quot;w x 66&quot;h]choose[opt : cordless bottom up-blackout-white ]</td></tr><tr><td rowspan=1 colspan=2>IL+RL Actions (r = O.2,length = 3)search[white blackout shades 65 inches in widthand 66 inches in height]choose[item:Window...]choose[Buy]</td><td rowspan=1 colspan=1>IL+RL Actions (r = O.25,length = 3)search[ gingko light and 2Ox2O pillow cover handpainted ]choose[ item :UPOOS..]choose[Buy]</td></tr></table>
154
+
155
+ <table><tr><td></td><td>Instr. text</td><td>IL BART</td><td>Human expert (first)</td><td>Human expert (last)</td></tr><tr><td>Score</td><td>79.7</td><td>83.0</td><td>82.1</td><td>84.4</td></tr><tr><td>Success Rate</td><td>52.6%</td><td>57.6%</td><td>57.9%</td><td>61.0%</td></tr></table>
156
+
157
+ Table 4: Task performance with the Choice oracle. first and last refer to the first and last search queries found in human demonstrations, respectively.
158
+
159
+ Effect of RL fine-tuning after IL. Table 2 also shows that RL fine-tuning adapts the IL model to become more ‘greedy’ and less ‘exploratory’, as the average trajectory length drops from 9.4 to 4.8, and the model explores fewer items and search queries. As a result, the attribute, type, and price scores all increase, but option score drops from 45.2 to 38.9. This points to the need for a better balance exploration with exploitation during RL, e.g. by using intrinsic bonuses.
160
+
161
+ Results with at Choice oracle. To disentangle the effects of learning to search from choosing the right actions, we construct a Choice oracle that has access to the hidden reward function as well as hidden attributes and options underlying each product and instruction.† Given a search query, the Choice oracle will perform an exhaustive search over every result item, try out all available options and finally choose the best item with options that maximize the reward — meaning each episode will take more than a hundred steps, as opposed to 4.5 and 11.3 steps on average for the $\mathrm { I L + R L }$ model and human experts (Table $2 )$ . We use 500 test instructions and consider four types of search queries: the instruction text (used by rule baseline), top IL BART generated query (used by all learning models), and the first and last queries from human experts in each test trajectory.‡ Choice improves the success rate of rule heuristics from $9 . 6 \%$ to $5 2 . { \bar { 6 } } \%$ , and the $\mathrm { I L }$ model from ${ \overline { { 2 9 } } } . 1 \%$ to $5 7 . 6 \%$ (Table $\textcircled { 4 }$ , confirming that choosing the right actions is indeed a major bottleneck for current models with great room for improvement. However, it does not impact human performance much since they are likely good at making good choices.
162
+
163
+ # 5.4 Zero-shot Sim-to-real Transfer
164
+
165
+ Finally, we conduct a ‘sim-to-real’ transfer experiment where our models trained on WebShop are tested on the real-world Amazon (amazon.com) and eBay (ebay.com) shopping websites without any fine-tuning. We sample 100 test instructions and deploy 3 WebShop models (rule, IL, $\mathrm { I L + R L }$ ) to interact with Amazon and eBay, and manually score each episode based on Eq. $\mathbb { \underline { { ( 1 ) } } }$ . As shown in Table $5 ,$ model performances on the two website are similar to WebShop performances in Figure 4, except for the rule baseline, likely due to the better search engine of Amazon than WebShop.
166
+
167
+ <table><tr><td></td><td colspan="4">Amazon</td><td colspan="6">eBay</td></tr><tr><td></td><td>Score /SR</td><td>Att</td><td>Opt</td><td>Type</td><td>Price</td><td>Score /SR</td><td>Att</td><td>Opt</td><td>Type</td><td>Price</td></tr><tr><td>Rule</td><td>45.8 /19%</td><td>45.6</td><td>38.0</td><td>66.2</td><td>90.0</td><td>31.7/ 7%</td><td>62.3</td><td>25.9</td><td>49.0</td><td>67.0</td></tr><tr><td>IL</td><td>61.5 / 27%</td><td>60.7</td><td>53.7</td><td>85.6</td><td>96.0</td><td>58.2/21%</td><td>60.2</td><td>52.3</td><td>85.1</td><td>96.9</td></tr><tr><td>IL+RL</td><td>65.9 / 25%</td><td>71.6</td><td>47.0</td><td>87.8</td><td>100.0</td><td>62.3 / 21%</td><td>69.1</td><td>39.5</td><td>91.7</td><td>97.0</td></tr><tr><td>Human</td><td>88.2 / 65%</td><td>86.2</td><td>76.3</td><td>99.0</td><td>100.0</td><td>79.7 /40%</td><td>80.3</td><td>70.1</td><td>99.5</td><td>100.0</td></tr></table>
168
+
169
+ Table 5: Zero-shot sim-to-real transfer to Amazon and eBay over 100 test instructions. The Score / SR (Success Rate) column indicates the overall performance. The remaining breakdown are in Score.
170
+
171
+ On $\boxed { \hat { \mathbf { a m a z o n . c o m } } }$ , $\mathrm { I L + R L }$ achieves a Score of 65.9 and SR of $2 5 \%$ , outperforming the Rule baseline’s Score of 45.8 and SR of $1 9 \%$ by large margin. Similarly, on ebay.com, $\mathrm { I L + R L }$ achieves a Score of 62.3 and SR of $2 1 \%$ , widely outperforming the Rule baseline’s Score of 31.7 and SR of $7 \%$ . These results confirm positive sim-to-real values of trained agents for real-world web tasks despite domain shifts in data (products) and dynamics (search engine). We also obtain a human average score of $8 8 . 0 / 7 9 . 7 $ and success rate of $6 5 \% / 4 0 \%$ by asking turkers $( \ S 3 . 2 )$ to find the instructed product on the Amazon and eBay websites respectively. While humans perform much better than agents, their web interactions are much slower — taking on average 815 seconds per episode as opposed to $< 8$ seconds per episode for our $\mathrm { I L }$ and $\mathrm { I L + R L }$ models on Amazon. This sim-to-real transfer only requires two minor coding additions, suggesting that environments like WebShop are suitable for developing practical grounded agents to reduce human effort on real-world web tasks. We provide additional performance and in-depth analysis in Appendix §D.
172
+
173
+ # 6 Discussion
174
+
175
+ We have developed WebShop, a new web-based benchmark for sequential decision making and language grounding, modeled on interaction with an e-commerce website. We performed an empirical evaluation of autonomous agents trained using imitation and reinforcement learning, and demonstrated promising results on sim-to-real transfer to real-world shopping websites. Our qualitative and quantitative analysis of model and human trajectories $( \ S [ \bar { 5 } . 3 )$ identified several research challenges in WebShop and provided insights for future model development by incorporating multidisciplinary techniques. For example, pre-training with multi-modal data $\vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla } \vec { \bf \nabla \nabla } \vec \nabla \vec { \bf \nabla } \vec \nabla \ m \ m \vec \nabla \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m \ m m \ m \ m m \ m \ m \ m \ m m \ m \ m \ m m \ m \ m m \ m \ m \ m m m \ m \ m \ m \ m m m \ m \ m m \ m m m \ m \ m m m \ m m \ m m \ m \ m m m m \ m \ m m m \ m m m m \ m m \ m m m m m \ m m m \ m m \ m m m m \ m m m m m \ m m \ m m m m m m m \ m m m m m m m m \ m m m m m m \ m m m m m m m m m \ m m m m m m m m m m m m \ m m m m m m m m m m m m m a n \ m m m m m m m m m a n \ m m m m m m m m m m m m a n \ m m m m m m m m m m m m m m a n c o n c o n c o n c o n c o n c o n c o n c o n c o n c o n c o n c o n c o n c c o n c o n c o n c c o n c o n c c c c c o n c o n c o n c o n c c o m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m a n c c c c c c c c c c c c c c c c c c c c o n c o n c c o n c c c c c o m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m a n c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c c o m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m m a n c c c$ , web hypertext $\left[ \left[ 2 \right] \right]$ , or web instruction-action mapping $\left[ \left[ 3 8 \right] \right]$ could help agents better understand and leverage rich semantics of webpage content, actions, and instructions. Ideas from query (re)formulation [22, 59, 37, 51] may help agents expand the range of search exploration, and improved action exploration [40, 12, 49] and memory $[ \sqrt { 5 3 } , \sqrt { 1 3 } , \sqrt { 2 3 } ]$ mechanisms could help agents make better decisions over the long horizon and large action space. The modular design of WebShop also allows for new web tasks and domains to be easily incorporated, which we hope will help shape future research into grounded language agents with stronger capabilities for real-world web interaction.
176
+
177
+ # Acknowledgements
178
+
179
+ We thank Alexander Wettig, Ameet Deshpande, Austin Wang, Jens Tuyls, Jimmy Yang, Mengzhou Xia, Tianyu Gao, and Vishvak Murahari from the Princeton NLP Group for proofreading and providing comments. This material is based upon work supported by the National Science Foundation under Grant No. 2107048. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.
180
+
181
+ References
182
+ [1] L. Adolphs, B. Boerschinger, C. Buck, M. C. Huebscher, M. Ciaramita, L. Espeholt, T. Hofmann, and Y. Kilcher. Boosting Search Engines with Interactive Agents. arXiv preprint arXiv:2109.00527, 2021.
183
+ [2] A. Aghajanyan, D. Okhonko, M. Lewis, M. Joshi, H. Xu, G. Ghosh, and L. Zettlemoyer. Htlm: Hyper-text pre-training and prompting of language models. ArXiv, abs/2107.06955, 2021.
184
+ [3] J. Andreas, J. Bufe, D. Burkett, C. Chen, J. Clausman, J. Crawford, K. Crim, J. DeLoach, L. Dorner, J. Eisner, et al. Task-oriented dialogue as dataflow synthesis. Transactions of the Association for Computational Linguistics, 8:556–571, 2020.
185
+ [4] E. M. Bender and A. Koller. Climbing towards NLU: On Meaning, Form, and Understanding in the Age of Data. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 5185–5198, 2020.
186
+ [5] G. Brockman, V. Cheung, L. Pettersson, J. Schneider, J. Schulman, J. Tang, and W. Zaremba. OpenAI Gym. arXiv preprint arXiv:1606.01540, 2016.
187
+ [6] T. Brown, B. Mann, N. Ryder, M. Subbiah, J. D. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
188
+ [7] P. Budzianowski, T.-H. Wen, B.-H. Tseng, I. Casanueva, S. Ultes, O. Ramadan, and M. Gašic.´ Multiwoz–a large-scale multi-domain wizard-of-oz dataset for task-oriented dialogue modelling. arXiv preprint arXiv:1810.00278, 2018.
189
+ [8] A. Burns, D. Arsan, S. Agrawal, R. Kumar, K. Saenko, and B. A. Plummer. Interactive Mobile App Navigation with Uncertain or Under-specified Natural Language Commands. arXiv preprint arXiv:2202.02312, 2022.
190
+ [9] J. Chung, Çaglar Gülçehre, K. Cho, and Y. Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. ArXiv, abs/1412.3555, 2014.
191
+ [10] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding. ArXiv, abs/1810.04805, 2019.
192
+ [11] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT (1), 2019.
193
+ [12] A. Ecoffet, J. Huizinga, J. Lehman, K. O. Stanley, and J. Clune. Go-explore: a new approach for hard-exploration problems. arXiv preprint arXiv:1901.10995, 2019.
194
+ [13] M. Fortunato, M. Tan, R. Faulkner, S. Hansen, A. Puigdomènech Badia, G. Buttimore, C. Deck, J. Z. Leibo, and C. Blundell. Generalization of reinforcement learners with working and episodic memory. Advances in neural information processing systems, 32, 2019.
195
+ [14] X. Guo, M. Yu, Y. Gao, C. Gan, M. Campbell, and S. Chang. Interactive fiction game playing as multi-paragraph reading comprehension with reinforcement learning. arXiv preprint arXiv:2010.02386, 2020.
196
+ [15] I. Gur, U. Rueckert, A. Faust, and D. Hakkani-Tur. Learning to Navigate the Web. arXiv preprint arXiv:1812.09195, 2018.
197
+ [16] I. Gur, N. Jaques, K. Malta, M. Tiwari, H. Lee, and A. Faust. Adversarial Environment Generation for Learning to Navigate the Web. arXiv preprint arXiv:2103.01991, 2021.
198
+ [17] M. Hausknecht, P. Ammanabrolu, M.-A. Côté, and X. Yuan. Interactive fiction games: A colossal adventure. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 7903–7910, 2020.
199
+ [18] K. He, X. Zhang, S. Ren, and J. Sun. Deep Residual Learning for Image Recognition. 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778, 2016.
200
+ [19] A. Hotti, R. S. Risuleo, S. Magureanu, A. Moradi, and J. Lagergren. The Klarna Product Page Dataset: A RealisticBenchmark for Web Representation Learning. arXiv preprint arXiv:2111.02168, 2021.
201
+ [20] P. C. Humphreys, D. Raposo, T. Pohlen, G. Thornton, R. Chhaparia, A. Muldal, J. Abramson, P. Georgiev, A. Goldin, A. Santoro, et al. A data-driven approach for learning to control computers. arXiv preprint arXiv:2202.08137, 2022.
202
+ [21] S. Jia, J. Kiros, and J. Ba. Dom-q-net: Grounded RL on Structured Language. arXiv preprint arXiv:1902.07257, 2019.
203
+ [22] M. Komeili, K. Shuster, and J. Weston. Internet-augmented dialogue generation. arXiv preprint arXiv:2107.07566, 2021.
204
+ [23] A. Lampinen, S. Chan, A. Banino, and F. Hill. Towards mental time travel: a hierarchical memory for reinforcement learning agents. Advances in Neural Information Processing Systems, 34:28182–28195, 2021.
205
+ [24] A. Lazaridou, A. Potapenko, and O. Tieleman. Multi-agent Communication meets Natural Language: Synergies between Functional and Structural Language Learning. In ACL, 2020.
206
+ [25] A. Lazaridou, E. Gribovskaya, W. Stokowiec, and N. Grigorev. Internet-augmented language models through few-shot prompting for open-domain question answering. ArXiv, abs/2203.05115, 2022.
207
+ [26] M. Lewis, Y. Liu, N. Goyal, M. Ghazvininejad, A. Mohamed, O. Levy, V. Stoyanov, and L. Zettlemoyer. BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension. arXiv preprint arXiv:1910.13461, 2019.
208
+ [27] X. Li, X. Yin, C. Li, P. Zhang, X. Hu, L. Zhang, L. Wang, H. Hu, L. Dong, F. Wei, et al. Oscar: Object-semantics aligned pre-training for vision-language tasks. In European Conference on Computer Vision, pages 121–137. Springer, 2020.
209
+ [28] J. Lin, X. Ma, S.-C. Lin, J.-H. Yang, R. Pradeep, and R. Nogueira. Pyserini: An Easy-to-Use Python Toolkit to Support Replicable IR Research with Sparse and Dense Representationss. arXiv preprint arXiv:2102.10073, 2021.
210
+ [29] E. Z. Liu, K. Guu, P. Pasupat, T. Shi, and P. Liang. Reinforcement Learning on Web Interfaces using Workflow-Guided Exploration. arXiv preprint arXiv:1802.08802, 2018.
211
+ [30] J. Luketina, N. Nardelli, G. Farquhar, J. N. Foerster, J. Andreas, E. Grefenstette, S. Whiteson, and T. Rocktäschel. A survey of reinforcement learning informed by natural language. In IJCAI, 2019.
212
+ [31] S. Mazumder and O. Riva. FLIN: A Flexible Natural Language Interface for Web Navigation. arXiv preprint arXiv:2010.12844, 2020.
213
+ [32] V. Mnih, A. P. Badia, M. Mirza, A. Graves, T. Lillicrap, T. Harley, D. Silver, and K. Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pages 1928–1937. PMLR, 2016.
214
+ [33] R. Nakano, J. Hilton, S. Balaji, J. Wu, L. Ouyang, C. Kim, C. Hesse, S. Jain, V. Kosaraju, W. Saunders, et al. WebGPT: Browser-Assisted Question-Answering with Human Feedback. arXiv preprint arXiv:2112.09332, 2021.
215
+ [34] K. Narasimhan, A. Yala, and R. Barzilay. Improving Information Extraction by Acquiring External Evidence with Reinforcement Learning. In Proceedings of the 2016 Conference on Empirical Methods in Natural Language Processing, pages 2355–2365, 2016.
216
+ [35] D. Ni. ScraperAPI, 2015. URL https://www.scraperapi.com/.
217
+ [36] R. Nogueira and K. Cho. End-to-End Goal-Driven Web Navigation. Advances in Neural Information Processing Systems, 29, 2016.
218
+ [37] R. Nogueira and K. Cho. Task-Oriented Query Reformulation with Reinforcement Learning. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 574–583, 2017.
219
+ [38] P. Pasupat, T.-S. Jiang, E. Z. Liu, K. Guu, and P. Liang. Mapping natural language commands to web elements. In Empirical Methods in Natural Language Processing (EMNLP), 2018.
220
+ [39] P. Pasupat, T.-S. Jiang, E. Z. Liu, K. Guu, and P. Liang. Mapping natural language commands to web elements. In EMNLP, 2018.
221
+ [40] D. Pathak, P. Agrawal, A. A. Efros, and T. Darrell. Curiosity-driven exploration by selfsupervised prediction. In International conference on machine learning, pages 2778–2787. PMLR, 2017.
222
+ [41] A. Ronacher. Flask API, 2010. URL https://flask.palletsprojects.com/en/2.1.x/.
223
+ [42] M. Seo, A. Kembhavi, A. Farhadi, and H. Hajishirzi. Bidirectional attention flow for machine comprehension. arXiv preprint arXiv:1611.01603, 2016.
224
+ [43] T. Shi, A. Karpathy, L. Fan, J. Hernandez, and P. Liang. World of Bits: An Open-Domain platform for web-based agents. In International Conference on Machine Learning, pages 3135–3144. PMLR, 2017.
225
+ [44] M. Shridhar, J. Thomason, D. Gordon, Y. Bisk, W. Han, R. Mottaghi, L. Zettlemoyer, and D. Fox. Alfred: A benchmark for interpreting grounded instructions for everyday tasks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 10740–10749, 2020.
226
+ [45] K. Shuster, M. Komeili, L. Adolphs, S. Roller, A. D. Szlam, and J. Weston. Language models that seek for knowledge: Modular search & generation for dialogue and prompt completion. ArXiv, abs/2203.13224, 2022.
227
+ [46] Y. Su, A. H. Awadallah, M. Khabsa, P. Pantel, M. Gamon, and M. Encarnacion. Building Natural Language Interfaces to Web APIs. In Proceedings of the 2017 ACM on Conference on Information and Knowledge Management, pages 177–186, 2017.
228
+ [47] Y. Su, A. Hassan Awadallah, M. Wang, and R. W. White. Natural Language Interfaces with Fine-Grained User Interaction: A Case Study on Web APIs. In The 41st International ACM SIGIR Conference on Research & Development in Information Retrieval, pages 855–864, 2018.
229
+ [48] D. Toyama, P. Hamel, A. Gergely, G. Comanici, A. Glaese, Z. Ahmed, T. Jackson, S. Mourad, and D. Precup. AndroidEnv: A Reinforcement Learning Platform for Android. arXiv preprint arXiv:2105.13231, 2021.
230
+ [49] J. Tuyls, S. Yao, S. Kakade, and K. Narasimhan. Multi-stage episodic control for strategic exploration in text games. arXiv preprint arXiv:2201.01251, 2022.
231
+ [50] V. Uc-Cetina, N. Navarro-Guerrero, A. Martin-Gonzalez, C. Weber, and S. Wermter. Survey on reinforcement learning for language processing. arXiv preprint arXiv:2104.05565, 2021.
232
+ [51] X. Wang, C. Macdonald, and I. Ounis. Deep reinforced query reformulation for information retrieval. arXiv preprint arXiv:2007.07987, 2020.
233
+ [52] Z. Wang, J. Yu, A. W. Yu, Z. Dai, Y. Tsvetkov, and Y. Cao. Simvlm: Simple visual language model pretraining with weak supervision. arXiv preprint arXiv:2108.10904, 2021.
234
+ [53] G. Wayne, C.-C. Hung, D. Amos, M. Mirza, A. Ahuja, A. Grabska-Barwinska, J. Rae, P. Mirowski, J. Z. Leibo, A. Santoro, et al. Unsupervised predictive memory in a goal-directed agent. arXiv preprint arXiv:1803.10760, 2018.
235
+ [54] K. Williams, S. H. Hashemi, and I. Zitouni. Automatic Task Completion Flows from Web APIs. In Proceedings of the 42nd International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 1009–1012, 2019.
236
+ [55] S. Yao, R. Rao, M. J. Hausknecht, and K. Narasimhan. Keep CALM and Explore: Language Models for Action Generation in Text-based Games. ArXiv, abs/2010.02903, 2020.
237
+ [56] S. Yao, K. Narasimhan, and M. Hausknecht. Reading and acting while blindfolded: The need for semantics in text game agents. arXiv preprint arXiv:2103.13552, 2021.
238
+ [57] X. Yuan, J. Fu, M.-A. Côté, Y. Tay, C. J. Pal, and A. Trischler. Interactive machine comprehension with information seeking agents. In ACL, 2020.
239
+ [58] V. Zhong, A. W. Hanjie, S. Wang, K. Narasimhan, and L. Zettlemoyer. Silg: The multidomain symbolic interactive language grounding benchmark. Advances in Neural Information Processing Systems, 34:21505–21519, 2021.
240
+ [59] S. Zhuang, H. Ren, L. Shou, J. Pei, M. Gong, G. Zuccon, and D. Jiang. Bridging the gap between indexing and retrieval for differentiable search index with query generation. arXiv preprint arXiv:2206.10128, 2022.
md/dev/RhB1AdoFfGE/RhB1AdoFfGE.md ADDED
@@ -0,0 +1,312 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SAMPLE AND COMPUTATION REDISTRIBUTION FOR EFFICIENT FACE DETECTION
2
+
3
+ Jia $\mathbf { G u o ^ { 2 } }$ , Jiankang Deng1,2 ∗, Alexandros Lattas1,3, Stefanos Zafeiriou1,3 1Huawei, 2InsightFace, 3Imperial College London {guojia,jiankangdeng}@gmail.com, {a.lattas,s.zafeiriou}@imperial.ac.uk
4
+
5
+ # ABSTRACT
6
+
7
+ Although tremendous strides have been made in uncontrolled face detection, accurate face detection with a low computation cost remains an open challenge. In this paper, we point out that computation distribution and scale augmentation are the keys to detecting small faces from low-resolution images. Motivated by these observations, we introduce two simple but effective methods: (1) Computation Redistribution (CR), which reallocates the computation between the backbone, neck and head of the model; and (2) Sample Redistribution (SR), which augments training samples for the most needed stages. The proposed Sample and Computation Redistribution for Face Detection (SCRFD) is implemented by a random search in a meticulously designed search space. Extensive experiments conducted on WIDER FACE demonstrate the state-of-the-art accuracy-efficiency trade-off for the proposed SCRFD family across a wide range of compute regimes. In particular, SCRFD-34GF outperforms the best competitor, TinaFace, by ${ \mathrm { 4 . 7 8 \% } }$ (AP at hard set) while being more than $3 \times$ faster on GPUs with VGA-resolution images. Code is available at: https://github.com/deepinsight/insightface/ tree/master/detection/scrfd.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Face detection is a long-standing problem in computer vision with many applications, such as face alignment (Bulat & Tzimiropoulos, 2017; Deng et al., 2019b), face reconstruction (Feng et al., 2018; Gecer et al., 2021), face attribute analysis (Zhang et al., 2018; Pan et al., 2018), and face recognition (Schroff et al., 2015; Deng et al., 2019a; 2020a). Following the pioneering work of (Viola & Jones, 2004), numerous face detection algorithms have been designed. Among them, the single-shot anchor-based approaches (Najibi et al., 2017; Zhang et al., 2017b; Tang et al., 2018; Li et al., 2019; Ming et al., 2019; Deng et al., 2020b; Liu et al., 2020; Zhu et al., 2020) have recently demonstrated very promising performance. In particular, on the most challenging face detection dataset, WIDER FACE (Yang et al., 2016), the average precision (AP) on its hard validation set has been boosted to $9 3 . 4 \%$ by TinaFace (Zhu et al., 2020).
12
+
13
+ Even though TinaFace (Zhu et al., 2020) achieves impressive results on unconstrained face detection, it employs large-scale (e.g. 1, 650 pixels) testing, which consumes huge amounts of computational resources. In addition, TinaFace design is based on a generic object detector (i.e. RetinaNet (Lin et al., 2017b)), directly taking the classification network as the backbone, tiling dense anchors on the multi-scale feature maps (i.e. P2 to P7 of neck), and adopting heavy head designs. Without considering the prior of faces, the network design of TinaFace is thus redundant and sub-optimal.
14
+
15
+ One approach of optimizing such networks’ performance is computation redistribution. Since directly taking the backbone of the classification network for object detection is sub-optimal, the recent CR-NAS (Liang et al., 2020) reallocates the computation across different resolutions to obtain a more balanced Effective Receptive Field (ERF), leading to higher detection performance. In BFbox (Liu & Tang, 2020), a face-appropriate search space is designed, based on the observation of scale distribution gap between general object detection and face detection. In ASFD (Zhang et al.,
16
+
17
+ ![](images/de52ea51250fbfa9ed12b4e6278e41cf2b8096c9949ecbd0a4b05a2e1e88a31c.jpg)
18
+ Figure 1: (a) Cumulative face scale distribution on the WIDER FACE validation dataset (Easy $\subset$ Medium $\subset$ Hard). When the long edge is fixed as 640 pixels, most of the easy faces are larger than $3 2 \times 3 2$ , and most of the medium faces are larger than $1 6 \times 1 6$ . For the hard track, $7 8 . 9 3 \%$ faces are smaller than $3 2 \times 3 2$ , $5 1 . 8 5 \%$ faces are smaller than $1 6 \times 1 6$ , and $1 3 . 3 6 \%$ faces are smaller than $8 \times 8$ . (b) Performance-computation trade-off on the WIDER FACE validation hard set for different face detectors. Flops and APs are reported by using the VGA resolution $( 6 4 0 \times 4 8 0 )$ during testing. The proposed SCRFD outperforms a range of state-of-the-art open-sourced methods by using much fewer flops.
19
+
20
+ 2020a), a differential architecture search is employed to discover optimized feature enhance modules for efficient multi-scale feature fusion and context enhancement. Even though (Liu & Tang, 2020; Zhang et al., 2020a) have realized the limitation of directly applying general backbone, neck and head settings to face detection, CR-NAS (Liang et al., 2020) only focuses the optimization on backbone, BFbox (Liu & Tang, 2020) neglects the optimization of head, and ASFD (Zhang et al., 2020a) only explores the best design for neck.
21
+
22
+ Another optimization approach, is the sample redistribution across different scales. Due to the extremely large scale variance of faces in real-world scenarios, different scale augmentation strategies are employed to introduce scale adaptation into the face detector. The most widely used scale augmentation approaches include random square crop (Zhang et al., 2017b; Deng et al., 2020b; Zhu et al., 2020) and data anchor sampling (Tang et al., 2018). Nevertheless, the scale augmentation parameters in these methods are manually designed for all different network structures. Therefore, traditional multi-scale training in face detection is also tedious and sub-optimal.
23
+
24
+ Since VGA resolution $6 4 0 \times 4 8 0 )$ is widely used for efficient face detection on numerous mobile phones and digital cameras, we focus on efficient face detection from low-resolution images in this paper. In Fig 1(a), we give the cumulative face scale distribution on the WIDER FACE validation dataset. Under the VGA resolution, most of the faces $( 7 8 . 9 3 \% )$ in WIDER FACE are smaller than $3 2 \times 3 2$ pixels. Under this specific scale distribution, both network structure and scale augmentation need to be optimized.
25
+
26
+ In this work, we present a meticulously designed methodology of search space optimization, that addresses both the redistribution between the backbone, neck and head, and the sample redistribution between the most needed scales. As the structure of a face detector determines the distribution of computation and is the key in determining its accuracy and efficiency, we first discover principles of computation distribution under different flop regimes. Inspired by (Radosavovic et al., 2020), we control the degrees of freedom and reduce the search space. More specifically, we randomly sample model architectures with different configurations on backbone (stem and four stages), neck and head. Based on the statistics of these models, we compute the empirical bootstrap (Efron & Tibshirani, 1994) and estimate the likely range in which the best models fall. To further decrease the complexity of the search space, we divide the computation ratio estimation for backbone and the whole detector into two steps. To handle extreme scale variations in face detection, we also design a search-able zoom-in and zoom-out space, specified by discrete scales and binary probabilities. In experiments, the proposed computation redistribution and sample redistribution yield significant and consistent improvement on various compute regimes, even surpassing a range of state-of-the-art face detectors by using much fewer flops as shown in Fig. 1(b).
27
+
28
+ To sum up, this paper makes following contributions:
29
+
30
+ • We have proposed a simplified search space, as well as a two-step search strategy for computation redistribution across different components (backbone, neck and head) of a face detector. The proposed computation redistribution method can easily boost detection performance through random search.
31
+ • We have designed a search-able zoom-in and zoom-out space for face-specific scale augmen
32
+ tation, which automatically redistributes more training samples for shallow stages, enhancing the detection performance on small faces.
33
+ • Extensive experiments conducted on WIDER FACE demonstrate the significantly improved accuracy and efficiency trade-off of the proposed SCRFD across a wide range of compute regimes.
34
+
35
+ # 2 RELATED WORK
36
+
37
+ Face Detection. To deal with extreme variations (e.g. scale, pose, illumination and occlusion) in face detection (Yang et al., 2016), most of the recent single-shot face detectors focus on improving the anchor sampling/matching or feature enhancement. SSH (Najibi et al., 2017) builds detection modules on different feature maps with a rich receptive field. $\mathrm { S ^ { 3 } F D }$ (Zhang et al., 2017b) introduces an anchor compensation strategy by offsetting anchors for outer faces. PyramidBox (Tang et al., 2018) formulates a data-anchor-sampling strategy to increase the proportion of small faces in the training data. DSFD (Li et al., 2019) introduces small faces supervision signals on the backbone, which implicitly boosts the performance of pyramid features. Group sampling (Ming et al., 2019) emphasizes the importance of the ratio for matched and unmatched anchors. RetinaFace (Deng et al., 2020b) employs deform-able context modules and additional landmark annotations to improve the performance of face detection. HAMBox (Liu et al., 2020) finds that many unmatched anchors in the training phase also have strong localization ability and proposes an online high-quality anchor mining strategy to assign high-quality anchors for outer faces. BFbox (Liu & Tang, 2020) employs a single-path one-shot search method (Guo et al., 2019) to jointly optimize the backbone and neck for face detector. ASFD (Zhang et al., 2020a) explores a differential architecture search to discover optimized feature enhance modules for efficient multi-scale feature fusion and context enhancement. All these methods are either designed by expert experience or partially optimized on backbone, neck and head. By contrast, we search for computation redistribution across different components (backbone, neck and head) of a face detector across a wide range of compute regimes.
38
+
39
+ Neural Architecture Search. Given a fixed search space of possible networks, Neural Architecture Search (NAS) automatically finds a good model within the search space. DetNAS (Chen et al., 2019b) adopts the evolution algorithm for the backbone search to boost object detection on COCO (Lin et al., 2014). By contrast, CR-NAS (Liang et al., 2020) reallocates the computation across different stages within the backbone to improve object detection. NAS-FPN (Ghiasi et al., 2019) uses reinforcement learning to search the proper FPN for general object detection. As there is an obvious distribution gap between COCO (Lin et al., 2014) and WIDER FACE (Yang et al., 2016), the experience in the above methods is not directly applicable for face detection but gives us an inspiration that the backbone, neck and head can be optimized to enhance the performance of face detection. Inspired by RegNet (Radosavovic et al., 2020), we optimize the computation distribution on backbone, neck and head based on the statistics from a group of random sampled models. We successfully reduce the search space and find the stable computation distribution under a particular complex regime, which significantly improves the model’s performance.
40
+
41
+ # 3 METHODOLOGY
42
+
43
+ To efficiently and accurately detect small faces from low-resolution images (e.g. VGA $6 4 0 \times 4 8 0$ ), we propose two methodologies that, when combined, outperform the state-of-the-art. In Sec. 3.1, we explore the computation redistribution across different stages of backbone, as well as different components (i.e. backbone, neck and head) of the whole detector, given a pre-defined computation budget. Then, in Sec. 3.2, we investigate the redistribution of positive training samples across different scales of feature maps by searching optimized scale augmentations.
44
+
45
+ ![](images/9f2d04b9cf96da52e5f42081a6b7b01621d8787ad4636ca7e082264423137472.jpg)
46
+ Figure 2: Computation redistribution among the backbone, neck and head. The backbone search space contains four stages, each stage having two parameters: the block number $d _ { i }$ and block width $w _ { i }$ . The neck search space only includes the channel number $n$ . The head is shared for the three-scale of feature maps $( N _ { i } )$ , and the search space consists of the block number $m$ and channel number $h$ .
47
+
48
+ # 3.1 COMPUTATION REDISTRIBUTION
49
+
50
+ As illustrated in Fig. 2, we apply our search method on a network consisting of (1) RetinaNet (Lin et al., 2017a), with ResNet (He et al., 2016) as the backbone, (2) Path Aggregation Feature Pyramid Network (PAFPN) (Liu et al., 2018) as the neck, and (3) stacked $3 \times 3$ convolutional layers for the head. Despite the generally simple structure, the total number of possible network configurations of the search space becomes unwieldy. Therefore, we attempt to simplify the tremendous search space and arrive at a low-dimensional design space, consisting of simple and effective networks.
51
+
52
+ # 3.1.1 SEARCH SPACE DESIGN
53
+
54
+ Inspired by RegNet (Radosavovic et al., 2020), we explore the structures of face detectors, assuming fixed standard network blocks (i.e., basic residual or bottleneck blocks with a fixed bottleneck ratio of 4). In our case, the structure of a face detector includes:
55
+
56
+ • the backbone stem, three $3 \times 3$ convolutional layers with $w _ { 1 }$ output channels (He et al., 2019a).
57
+ • the backbone body, four stages (i.e. C2, C3, C4 and C5) operating at progressively reduced resolution, with each stage consisting of a sequence of identical blocks. For each stage $i$ , the degrees of freedom include the number of blocks $d _ { i }$ (i.e. network depth) and the block width $w _ { i }$ (i.e. number of channels).
58
+ • the neck, a multi-scale feature aggregation module by a top-down path and a bottom-up path with $n$ channels (Liu et al., 2018).
59
+ • the head, with $h _ { i }$ channels of $m$ blocks to predict face scores and regress face boxes.
60
+
61
+ The search space can be initially designed as follows. As the channel number of the stem is equal to the block width of the first residual block in C2, the degree of freedom of the stem $w _ { 1 }$ can be merged into $w _ { 2 }$ . In addition, we employ a shared head design for three-scale of feature maps and fix the channel number for all $3 \times 3$ convolutional layers within the heads. Therefore, we reduce the degrees of freedom to three within our neck and head design: (1) output channel number $n$ for neck, (2) output channel number $h$ for head, and (3) the number of $3 \times 3$ convolutional layers $m$ . We perform uniform sampling of $n \leq 2 5 6$ , $h \leq 2 5 6$ , and $m \leq 6$ (both $n$ and $h$ are divisible by 8).
62
+
63
+ The backbone search space has 8 degrees of freedom as there are 4 stages and each stage $i$ has 2 parameters: the number of blocks $d _ { i }$ and block width $w _ { i }$ . Following RegNet (Radosavovic et al., 2020), we perform uniform sampling of $d _ { i } \leq 2 4$ and $w _ { i } \leq 5 1 2$ $\mathbf { \dot { \boldsymbol { w } } } _ { i }$ is divisible by 8). As state-ofthe-art backbones have increasing widths (Radosavovic et al., 2020), we also constrain the search space, according to the principle of $w _ { i + 1 } \geq w _ { i }$ .
64
+
65
+ # 3.1.2 ESTIMATION METRIC
66
+
67
+ Based on above simplifications, our search space becomes more compact and efficient. We repeat the random sampling in our search space until we obtain 320 models in our target complexity regime, and train each model on the WIDER FACE (Yang et al., 2016) training set for 80 epochs. Then, we test the Average Precision (AP) of each model on the validation set. Based on these 320 pairs of model statistics $( x _ { i } , A P _ { i } )$ , where $x _ { i }$ is the computation ratio of a particular component and $A P _ { i }$ the corresponding performance, we can compute the empirical bootstrap (Efron & Tibshirani, 1994) to estimate the likely range in which the best models fall. More specifically, we repeatedly sample with replacement $2 5 \%$ of the pairs for $1 0 ^ { 3 }$ times and select the pair with maximum AP in each sampling. Afterwards, we compute the $9 5 \%$ confidence interval for the maximum value and the median gives the most likely best computation ratio.
68
+
69
+ ![](images/19b59afc11ccdb68c11410dc946bc69d00ae5a8c236cb90d2e2cf00d18617336.jpg)
70
+ Figure 3: Computation redistribution on the backbone (stem, C2, C3, C4 and C5) with fixed neck and head under the constraint of 2.5 GFlops. For each component within the backbone, the range of computation ratio in which the best models may fall is estimated by the empirical bootstrap.
71
+
72
+ ![](images/286f034459d2218a92b6e02a21adc6b2c6297684d9ee34cc8806301efd999849.jpg)
73
+ Figure 4: Computation redistribution and architecture sketches under the constraint of 2.5 GFlops. The computation distribution of CRFD-2.5GF within backbone follows Fig. 3. In (d), the yellow rectangles in C2 to C5 represents the basic residual block. The width of rectangles corresponds to the computation cost. After computation redistribution, more computations are allocated to shallow stages (i.e. C2 and C3).
74
+
75
+ # 3.1.3 TWO-STEP SEARCH
76
+
77
+ To further decrease the complexity of search space, we divide our network structure search into the following two steps: (1) $\mathrm { C R F D _ { 1 } }$ : search the computational distribution for the backbone only, while fixing the settings of the neck and head to the default configuration, and (2) $\mathrm { C R F D } _ { 2 }$ : search the computational distribution over the whole face detector (i.e. backbone, neck and head), with the computational distribution within the backbone, following the optimized $\mathrm { C R E D _ { 1 } }$ . By optimizing in both manners, we achieve the final optimized network design for the computation-constrained face detection. In the example below, we constrain CRFD to 2.5 GFlops (CRFD-2.5GF), in order to illustrate our two-step searching strategy.
78
+
79
+ Computation redistribution on backbone. For $\mathrm { C R F D } _ { 1 } { - } 2 . 5 \mathrm { G F }$ , we fix the output channel of the neck at 32 and use two stacked $3 \times 3$ convolutions with 96 output channels. As the neck and head configurations do not change in the whole search process of $\mathrm { C R E D _ { 1 } }$ , we can easily find the best computation distribution of the backbone. As described in Fig. 3, we show the distribution of 320 model APs (on the WIDER FACE hard validation set) versus the computation ratio over each component (i.e. stem, C2, C3, C4 and C5) of backbone. After applying an empirical bootstrap (Efron & Tibshirani, 1994), a clear trend emerges, showing that the backbone computation is reallocated to the shallow stages (i.e. C2 and C3).
80
+
81
+ Computation redistribution on backbone, neck and head. In this step, we only keep the randomly generated network configurations whose backbone settings follow the computation distribution from $\mathrm { C R E D _ { 1 } }$ as shown in Fig. 3. In this case, there are another three degrees of freedom (i.e. output channel number $n$ for neck, output channel number $h$ for head, and the number $m$ of $3 \times 3$ convolutional layers in head). We repeat the random sampling in our search space, until we obtain 320 qualifying models in our target complexity regime (i.e. 2.5 GFlops). As evident in Fig. 4, most
82
+
83
+ ![](images/25b8612e331e663183c0a48468dae5c11e5c281c02929c98ef72bc0922e49c75.jpg)
84
+ Figure 5: Computation redistribution and the searched network structures under different computation constraints. Network diagram legends in the second row contain all information required to implement the CRFD models that we have optimized the computation across stages and components. of the computation is allocated in the backbone, with the head following and the neck having the lowest computation ratio. Fig. 4(d) also depicts the comparison between the hand-crafted model architecture and the computation redistributed network, under the constraint of 2.5 GFlops.
85
+
86
+ # 3.2 SAMPLE REDISTRIBUTION
87
+
88
+ As face detection features large scale variations (from several pixels to thousand pixels), there exist two widely used scale augmentation strategies, random square crop (Zhang et al., 2017b; Deng et al., 2020b; Zhu et al., 2020) and data anchor sampling (Tang et al., 2018). In the random square crop strategy, square patches are cropped from the original image with a random size between [0.3, 1] of the short edge and then resized into $6 4 0 \times 6 4 0$ to generate larger training faces. By contrast, data anchor sampling strategy aims to generate more small scale faces by down-sampling the original image, bringing a large amount of padded area. Even though both random square crop and data anchor sampling can achieve promising results on the WIDER FACE dataset, the scale augmentation parameters are manually designed for all different network structures. Therefore, the training sample distribution on the feature pyramids can be sub-optimal for a particular network structure.
89
+
90
+ To handle extreme scale variations in face detection, we also design a search-able zoom-in and zoom-out space, specified by the scale $s _ { i }$ and probability $p _ { i }$ . The scale $s _ { i }$ represents the zooming ratio, sampled from a discrete set $\mathbb { S } = \{ s _ { m i n } , s _ { m i n } + 0 . 1 , \cdot \cdot \cdot , s _ { m a x } - 0 . 1 , s _ { m a x } \}$ . For a particular training image in each iteration, square patches are cropped from the original images with a zooming ratio $s _ { i }$ of the short edge of the original images. If the square patch is larger than the original image, average RGB values will fill the missing pixels. To shrink the scale search space, we employ a binary probability set $p _ { i } \in \{ 0 , 1 \}$ . Under this setting, the probability-based scale search is simplified into a discrete scale sampling from a fixed set. As the interval of the discrete scale set is only 0.1, adjacent scales will have the probability of 1.0 to approximate a higher probability around a particular scale. In this paper, we employ random search under the estimation metric of AP on WIDER FACE to construct the best scale augmentation set. More specifically, we set $s _ { m i n } = 0 . 1$ and $s _ { m a x } = 3 . 0$ . Then, we randomly select 8 to 20 discrete scale values to construct each scale augmentation set and train CRFD models under 320 different scale augmentation sets. Finally, the scale augmentation set with the highest detection performance is selected for optimized scale augmentation.
91
+
92
+ # 4 EXPERIMENTS
93
+
94
+ # 4.1 IMPLEMENTATION DETAILS
95
+
96
+ Training. For the scale augmentation, square patches are cropped from the original images with a random size from a pre-defined scale set, and then these patches are resized to $6 4 0 \times 6 4 0$ for training. Besides scale augmentation, the training data are also augmented by color distortion and random horizontal flipping, with a probability of 0.5. For the anchor setting, we tile anchors of $\{ 1 6 , 3 2 \}$ , $\{ 6 4 , 1 2 8 \}$ , and $\{ 2 5 6 , 5 1 2 \}$ on the feature maps of stride 8, 16, and 32, respectively. The anchor ratio is set as 1.0. In this paper, we employ Adaptive Training Sample Selection (ATSS)
97
+
98
+ Table 1: Ablation experiments of SCRFD-2.5GF (i.e. CR $@$ two-step $\mathrm { \ s { + } } \mathrm { S R }$ ) on the WIDER FACE validation subset. “CR” and “SR” denote the proposed computation and sample redistribution, respectively. Results are reported on the single-scale VGA resolution.
99
+
100
+ <table><tr><td>Method</td><td>Scale Augmentation Set</td><td>Easy</td><td>Medium</td><td>Hard</td></tr><tr><td>ResNet-2.5GF BFBox-2.5GF (Liu&amp; Tang,2020) Evolutionary-2.5GF</td><td>[0.3, 1.0] [0.3, 1.0] [0.3,1.0]</td><td>91.87 92.22 92.30</td><td>89.49 90.19 90.21</td><td>67.32 69.41 69.62</td></tr><tr><td>CR@backbone CR@detector CR@two-steps (CRFD-2.5GF)</td><td>[0.3,1.0] [0.3, 1.0] [0.3, 1.0]</td><td>92.32 92.61 92.66</td><td>90.25 90.74 90.72</td><td>69.78 70.98 71.37</td></tr><tr><td>ResNet-2.5GF ResNet-2.5GF</td><td>[0.3,2.0] SR</td><td>93.21 93.17</td><td>91.11 91.14</td><td>74.47 74.93</td></tr><tr><td>CR@two-steps CR@tw0-steps (SCRFD-2.5GF)</td><td>[0.3,2.0] SR</td><td>93.78 93.76</td><td>92.16 92.17</td><td>77.87 78.35</td></tr></table>
101
+
102
+ (Zhang et al., 2020b) for positive anchor matching. In the detection head, weight sharing and Group Normalization (Wu & He, 2018) are used. The losses of classification and regression branches are Generalized Focal Loss (GFL) (Li et al., 2020) and DIoU loss (Zheng et al., 2020), respectively.
103
+
104
+ Our experiments are implemented in PyTorch, based on the open-source MMDetection (Chen et al., 2019a). We adopt the SGD optimizer (momentum 0.9, weight decay 5e-4) with a batch size of $8 \times 8$ and train on eight Tesla V100. The learning rate is linearly warmed up to 0.015 within the first 3 epochs. During network search, the learning rate is multiplied by 0.1 at the 55-th, and 68-th epochs. The learning process terminates on the 80-th epoch. For training of both baselines and searched configurations, the learning rate decays by a factor of 10 at the 440-th and 544-th epochs, and the learning process terminates at the 640-th epoch. All the models are trained from scratch without any pre-training.
105
+
106
+ Testing. For fair comparisons with other methods, we employ three testing strategies, including single-scale VGA resolution $6 4 0 \times 4 8 0 )$ ), single-scale original resolution, and multi-scale testing. The results of DSFD (Li et al., 2019), RetinaFace (Deng et al., 2020b), TinaFace (Zhu et al., 2020), Faceboxes (Zhang et al., 2017a), libfacedetection (Feng et al., 2021) and LFFD (He et al., 2019b) are reported by testing the released models, while the HAMBox (Liu et al., 2020) and BFBox (Liu & Tang, 2020) models are shared from the author.
107
+
108
+ # 4.2 ABLATION STUDY
109
+
110
+ In Tab. 1, we present the performance of models on the WIDER FACE dataset by gradually including the proposed computation and sample redistribution methods. Our manually-designed baseline model, ResNet-2.5GF, gets APs of $9 1 . { \bar { 8 } } 7 \%$ , $8 9 . 4 9 \%$ , and $6 7 . 3 2 \%$ under three validation scenarios.
111
+
112
+ Computation redistribution. After separately employing the proposed computation redistribution on the backbone and the whole detector, the AP on the hard set improves to $6 9 . 7 8 \%$ and $7 0 . 9 8 \%$ . This indicates that (1) the network structure directly inherited from the classification task is suboptimal for the face detection task, and (2) joint computation reallocation on the backbone, neck and head outperforms computation optimization applied only on the backbone. Furthermore, the proposed two-step computation redistribution strategy achieves AP of $7 1 . 3 7 \%$ , surpassing one-step computation reallocation on the whole detector by $0 . { \dot { 3 } } 9 \%$ . As we shrink the whole search space by the proposed two-step strategy and our random model sampling number is fixed at 320, the twostep method is possible to find better network configurations from the large search space. In Tab. 1, we also compare our method with the single path one-shot NAS method (BFBox (Liu & Tang, 2020)) and the evolutionary search method (Appendix A.2), under the constraint of 2.5 GFlops. BFBox aims to design a face-appropriate search space by combing some excellent block designs, such as bottleneck block, densenet block and shufflenet block. However, such a combination generates a complex and redundant search space, which inevitably involves a vast body of low-performance candidate architectures. The evolutionary approach iteratively adopts mutations and crossover to gradually generate better architecture candidates from the randomly initialized search space, which also contains a large number of under-performing architectures. By contrast, CRFD-2.5GF utilizes an empirical bootstrap to estimate the optimized computation distribution of the best-performing architecture candidates, which directly eliminates the low-quality architectures from the initialized search space. Therefore, CRFD-2.5GF can obviously outperform the BFBox and evolutionary method by $\bar { 1 . 9 6 \% }$ and $1 . 7 5 \%$ on the hard track.
113
+
114
+ Table 2: Accuracy and efficiency of different methods on the WIDER FACE validation set. #Params and #Flops denote the number of parameters and multiply-adds. “Infer” refers to network inference latency on NVIDIA 2080TI.
115
+
116
+ <table><tr><td>Method</td><td>Backbone</td><td>Easy</td><td>Medium</td><td>Hard</td><td>#Params(M)</td><td>#Flops(G)</td><td>Infer(ms)</td></tr><tr><td>DSFD@VGA</td><td>ResNet152</td><td>94.29</td><td>91.47</td><td>71.39</td><td>120.06</td><td>259.55</td><td>55.6</td></tr><tr><td>DSFD @Multi-Scale</td><td>ResNet152</td><td>96.6</td><td>95.7</td><td>90.4</td><td>120.06</td><td>15928.5</td><td></td></tr><tr><td>RetinaFace@VGA</td><td>ResNet50</td><td>94.92</td><td>91.90</td><td>64.17</td><td>29.50</td><td>37.59</td><td>21.7</td></tr><tr><td>RetinaFace@Multi-Scale</td><td>ResNet50</td><td>96.7</td><td>96.1</td><td>91.4</td><td>29.50</td><td>4585.98</td><td></td></tr><tr><td>BFBox@VGA</td><td>1</td><td>94.2</td><td>92.1</td><td>70.4</td><td>28.6</td><td>39.4</td><td>22.4</td></tr><tr><td>BFBox @Multi-Scale</td><td>-</td><td>96.5</td><td>95.7</td><td>91.7</td><td>28.6</td><td>4732.8</td><td>=</td></tr><tr><td>HAMBox @VGA</td><td>ResNet50</td><td>95.27</td><td>93.76</td><td>76.75</td><td>30.24</td><td>43.28</td><td>25.9</td></tr><tr><td>HAMBox @Multi-Scale</td><td>ResNet50</td><td>97.0</td><td>96.4</td><td>93.3</td><td>30.24</td><td>5246.23</td><td>=</td></tr><tr><td>TinaFace@VGA</td><td>ResNet50</td><td>95.61</td><td>94.25</td><td>81.43</td><td>37.98</td><td>172.95</td><td>38.9</td></tr><tr><td>TinaFace@Multi-Scale</td><td>ResNet50</td><td>97.0</td><td>96.3</td><td>93.4</td><td>37.98</td><td>42333.64</td><td>■</td></tr><tr><td>ResNet-34GF@VGA</td><td>ResNet50</td><td>95.64</td><td>94.22</td><td>84.02</td><td>24.81</td><td>34.16</td><td>11.8</td></tr><tr><td>CRFD-34GF@VGA</td><td>Bottleneck Res</td><td>96.06</td><td>94.92</td><td>85.29</td><td>9.80</td><td>34.13</td><td>11.7</td></tr><tr><td>SCRFD-34GF@VGA</td><td>Bottleneck Res</td><td>96.05</td><td>94.96</td><td>86.21</td><td>9.80</td><td>34.13</td><td>11.7</td></tr><tr><td>SCRFD-34GF@Multi-Scale</td><td>Bottleneck Res</td><td>97.20</td><td>96.58</td><td>93.53</td><td>9.80</td><td>2098.98</td><td>-</td></tr><tr><td>ResNet-10GF@VGA</td><td>ResNet34x0.5</td><td>94.69</td><td>92.90</td><td>80.42</td><td>6.85</td><td>10.18</td><td>6.3</td></tr><tr><td>CRFD-10GF@VGA</td><td>Basic Res</td><td>95.16</td><td>93.87</td><td>83.05</td><td>3.86</td><td>9.98</td><td>4.9</td></tr><tr><td>SCRFD-10GF@VGA</td><td>Basic Res</td><td>95.14</td><td>93.96</td><td>83.43</td><td>3.86</td><td>9.98</td><td>4.9</td></tr><tr><td>SCRFD-10GF@Multi-Scale</td><td>Basic Res</td><td>95.93</td><td>94.95</td><td>90.81</td><td>3.86</td><td>614.14</td><td>1</td></tr><tr><td>ResNet-2.5GF@VGA</td><td>ResNet34x0.25</td><td>93.21</td><td>91.11</td><td>74.47</td><td>1.62</td><td>2.57</td><td>5.4</td></tr><tr><td>CRFD-2.5GF@VGA</td><td>Basic Res</td><td>93.78</td><td>92.16</td><td>77.87</td><td>0.67</td><td>2.53</td><td>4.2</td></tr><tr><td>SCRFD-2.5GF@VGA</td><td>Basic Res</td><td>93.76</td><td>92.17</td><td>78.35</td><td>0.67</td><td>2.53</td><td>4.2</td></tr><tr><td>SCRFD-2.5GF@Multi-Scale</td><td>Basic Res</td><td>95.21</td><td>94.44</td><td>89.92</td><td>0.67</td><td>155.69</td><td>-</td></tr></table>
117
+
118
+ Sample redistribution. For scale augmentation, we first manually extend the default scale set $\{ 0 . 3 , 0 . 4 5 , 0 . 6 , 0 . 8 , 1 . 0 \}$ by adding larger scales $\{ 1 . 2 , 1 . 4 , 1 . 6 , 1 . 8 , 2 . 0 \}$ . By adding this hand-crafted sample redistribution, the hard set APs significantly increase by $7 . 1 \dot { 5 } \%$ for the baseline and $6 . 5 \%$ for the proposed CRFD, indicating the benefit from allocating more training samples on the feature map of stride 8. By employing the optimized scale augmentation from searching, the hard set AP further increases by $0 . { \dot { 4 } } { \ 8 } \%$ for the proposed CRFD. For SCRFD-2.5GF, the best scale augmentation set searched is $\{ 0 . 5 , 0 . 7 , 0 . 8 , 1 . 0 , 1 . 1 , 1 . 2 , 1 . 4 , 1 . 5 , 1 . 8 , 2 . 0 , 2 . 3 , 2 . 6 \}$ . As we can see from these discrete scales, faces around the original scale are preferred for training, along with an appropriate probability and ratio of zooming-out.
119
+
120
+ # 4.3 COMPUTATION REDISTRIBUTION ACROSS DIFFERENT COMPUTE REGIMES
121
+
122
+ Besides the complexity constraint of 2.5 GFlops, we also utilize the same two-step computation redistribution method to explore the network structure optimization for higher compute regimes (e.g. 10 GFlops and 34 GFlops) and lower compute regimes (e.g. 0.5 GFlops and 1.0 GFlops). In Fig. 5, we show the computation redistribution and the optimized network structures under different computation constraints.
123
+
124
+ Our final architectures have almost the same flops as the baseline networks. From these redistribution results, we can draw the following conclusions: (1) more computation is allocated in the backbone and the computation on the neck and head is compressed; (2) more capacity is reallocated in shallow stages due to the specific scale distribution on WIDER FACE; (3) for the high compute regime (e.g. 34 GFlops), the explored structure utilizes the bottleneck residual block and we observe significant depth scaling, instead of width scaling in shallow stages. Scaling the width is subject to over-fitting due to the larger increase in parameters (Bello et al., 2021). By contrast, scaling the depth, especially in the earlier layers, introduces fewer parameters compared to scaling the width; (4) for the mobile regime (0.5 GFlops), allocating the limited capacity in the deep stage (e.g. C5) for the discriminative features captured in the deep stage, can benefit the shallow small face detection by the top-down neck pathway.
125
+
126
+ Table 3: Accuracy and efficiency of different light-weight models on the WIDER FACE validation set. #Params and #Flops denote the number of parameters and multiply-adds. “Infer” refers to network inference latency on NVIDIA 2080TI.
127
+
128
+ <table><tr><td>Method</td><td>Backbone</td><td>Easy</td><td>Medium</td><td>Hard</td><td>#Params(M)</td><td>#Flops(G)</td><td>Infer(ms)</td></tr><tr><td>RetinaFace@VGA</td><td>MobileNet0.25</td><td>87.78</td><td>81.16</td><td>47.32</td><td>0.44</td><td>0.802</td><td>7.9</td></tr><tr><td>RetinaFace @Original</td><td>MobileNet0.25</td><td>89.58</td><td>87.11</td><td>69.12</td><td>0.44</td><td>2.358</td><td>-</td></tr><tr><td>RetinaFace@Multi-Scale</td><td>MobileNet0.25</td><td>91.4</td><td>89.2</td><td>82.5</td><td>0.44</td><td>49.28</td><td>-</td></tr><tr><td>FaceBoxes @VGA</td><td>=</td><td>76.17</td><td>57.17</td><td>24.18</td><td>1.01</td><td>0.275</td><td>2.5</td></tr><tr><td>FaceBoxes @Original</td><td></td><td>84.5</td><td>77.7</td><td>40.4</td><td>1.01</td><td>0.809</td><td>-</td></tr><tr><td>FaceBoxes @Multi-Scale</td><td></td><td>85.9</td><td>81.6</td><td>55.7</td><td>1.01</td><td>16.93</td><td>-</td></tr><tr><td>libfacedetection @ Original</td><td></td><td>85.6</td><td>84.2</td><td>72.7</td><td>2.33</td><td>3.25</td><td>-</td></tr><tr><td>LFFD@Original</td><td></td><td>91.0</td><td>88.0</td><td>77.8</td><td>2.15</td><td>27.20</td><td>-</td></tr><tr><td>MobileNet-1.0GF@VGA</td><td>MobileNet0.25</td><td>91.66</td><td>89.28</td><td>70.46</td><td>0.63</td><td>1.024</td><td>4.9</td></tr><tr><td>CRFD-1.0GF@VGA</td><td>Depth-wise Conv</td><td>92.38</td><td>90.57</td><td>74.80</td><td>0.64</td><td>0.982</td><td>4.1</td></tr><tr><td>SCRFD-1.0GF@VGA</td><td>Depth-wise Conv</td><td>92.36</td><td>90.58</td><td>76.03</td><td>0.64</td><td>0.982</td><td>4.1</td></tr><tr><td>SCRFD-1.0GF@ Original</td><td>Depth-wise Conv</td><td>91.89</td><td>89.96</td><td>84.70</td><td>0.64</td><td>2.89</td><td>1</td></tr><tr><td>SCRFD-1.0GF@Multi-Scale</td><td>Depth-wise Conv</td><td>93.87</td><td>92.99</td><td>88.74</td><td>0.64</td><td>60.39</td><td>-</td></tr><tr><td>MobileNet-0.5GF@VGA</td><td>MobileNet0.25</td><td>90.38</td><td>87.05</td><td>66.68</td><td>0.37</td><td>0.507</td><td>3.7</td></tr><tr><td>CRFD-0.5GF@VGA</td><td>Depth-wise Conv</td><td>90.57</td><td>88.12</td><td>68.51</td><td>0.57</td><td>0.508</td><td>3.6</td></tr><tr><td>SCRFD-0.5GF@VGA</td><td>Depth-wise Conv</td><td>90.80</td><td>88.43</td><td>68.82</td><td>0.57</td><td>0.508</td><td>3.6</td></tr><tr><td>SCRFD-0.5GF@Original</td><td>Depth-wise Conv</td><td>90.35</td><td>88.21</td><td>81.46</td><td>0.57</td><td>1.49</td><td>-</td></tr><tr><td>SCRFD-0.5GF@Multi-Scale</td><td>Depth-wise Conv</td><td>92.71</td><td>91.45</td><td>86.23</td><td>0.57</td><td>31.24</td><td>-</td></tr></table>
129
+
130
+ 4.4 ACCURACY AND EFFICIENCY COMPARISONS ON WIDER FACE
131
+
132
+ As shown in Tab. 2 and Tab. 3, we compared the proposed SCRFD with other state-of-the-art face detection algorithms (e.g. DSFD (Li et al., 2019), RetinaFace (Deng et al., 2020b), BFBox (Liu & Tang, 2020), HAMBox (Liu et al., 2020) and TinaFace (Zhu et al., 2020)) as well as light-weight face methods (e.g. Faceboxes (Zhang et al., 2017a), libfacedetection (Feng et al., 2021) and LFFD (He et al., 2019b)). Overall, all of the proposed SCRFD models provide considerable improvements compared to the hand-crafted baseline models (e.g. ResNet-2.5GF and MobileNet-0.5GF), by optimizing the network structure as well as the scale augmentation, across a wide range of compute regimes.
133
+
134
+ When we fix the testing scale at 640 as in Tab. 2, the proposed SCRFD-34GF outperforms all these state-of-the-art methods on the three subsets, especially for the hard track, which contains a large number of tiny faces. More specifically, SCRFD-34GF surpasses TinaFace by $4 . 7 8 \%$ while being more than $3 \times$ faster on GPUs. In addition, the computation cost of SCRFD-34GF is only around $2 0 \%$ of TinaFace. As SCRFD-34GF scales the depth in the earlier layers, it also introduces fewer parameters, resulting in a much smaller model size $( 9 . 8 0 M )$ . Compared to the hand-crafted baseline (ResNet-34GF), the proposed computation redistribution and sample redistribution improve the AP by $1 . 2 7 \%$ and $0 . 9 2 \%$ , indicating the superiority of SCRFD over manual designs. Compared to the single path one-shot NAS method, SCRFD-34GF outperforms BFBox by $1 5 . 8 1 \%$ , while using a more compact model size. As the search space of BFBox is complex, there exists a large number of low-performance architectures. In addition, BFBox only searches the backbone and neck without considering the optimization on the head. For multi-scale testing, SCRFD-34GF slightly outperforms TinaFace but consumes much less computation. For the low-compute regimes in Tab. 3, SCRFD-0.5GF significantly outperforms RetinaFace-MobileNet0.25 by $2 1 . 1 9 \%$ on the hard AP, while consuming only $6 3 . { \dot { 3 } } 4 \%$ computation and $4 5 . 5 7 \%$ inference time under the VGA resolution. When the evaluation is conducted on the original image, SCRFD-0.5GF surpasses LFFD by $3 . 6 \%$ on the hard AP, while consuming only $5 . 5 \%$ flops.
135
+
136
+ # 5 CONCLUSIONS
137
+
138
+ In this work, we present a sample and computation redistribution paradigm for efficient face detection. Our results show significantly improved accuracy and efficiency trade-off by the proposed SCRFD across a wide range of compute regimes, when compared to the current state-of-the-art.
139
+
140
+ Acknowledgements. We would like to thank Hui Ni from Tencent for preparing the mobile demo of SCRFD https://github.com/nihui/ncnn-android-scrfd. Stefanos Zafeiriou acknowledges support from the EPSRC Fellowship DEFORM (EP/S010203/1), FACER2VM (EP/N007743/1) and a Google Faculty Fellowship.
141
+
142
+ # REFERENCES
143
+
144
+ Irwan Bello, William Fedus, Xianzhi Du, Ekin Cubuk, Aravind Srinivas, Tsung-Yi Lin, Jonathon Shlens, and Barret Zoph. Revisiting resnets: Improved training and scaling strategies. arXiv:2103.07579, 2021.
145
+
146
+ Adrian Bulat and Georgios Tzimiropoulos. How far are we from solving the 2d & 3d face alignment problem?(and a dataset of 230,000 3d facial landmarks). In ICCV, 2017.
147
+
148
+ Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, et al. Mmdetection: Open mmlab detection toolbox and benchmark. arXiv:1906.07155, 2019a.
149
+
150
+ Yukang Chen, Tong Yang, Xiangyu Zhang, Gaofeng Meng, Chunhong Pan, and Jian Sun. Detnas: Neural architecture search on object detection. arXiv:1903.10979, 2019b.
151
+
152
+ 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.
153
+
154
+ Jiankang Deng, Jia Guo, Niannan Xue, and Stefanos Zafeiriou. Arcface: Additive angular margin loss for deep face recognition. In CVPR, 2019a.
155
+
156
+ Jiankang Deng, Anastasios Roussos, Grigorios Chrysos, Evangelos Ververas, Irene Kotsia, Jie Shen, and Stefanos Zafeiriou. The menpo benchmark for multi-pose 2d and 3d facial landmark localisation and tracking. IJCV, 2019b.
157
+
158
+ Jiankang Deng, Jia Guo, Tongliang Liu, Mingming Gong, and Stefanos Zafeiriou. Sub-center arcface: Boosting face recognition by large-scale noisy web faces. In ECCV, 2020a.
159
+
160
+ Jiankang Deng, Jia Guo, Yuxiang Zhou, Jinke Yu, Irene Kotsia, and Stefanos Zafeiriou. Retinaface: Single-stage dense face localisation in the wild. In CVPR, 2020b.
161
+
162
+ Bradley Efron and Robert J Tibshirani. An introduction to the bootstrap. CRC press, 1994.
163
+
164
+ Yao Feng, Fan Wu, Xiaohu Shao, Yanfeng Wang, and Xi Zhou. Joint 3d face reconstruction and dense alignment with position map regression network. In ECCV, 2018.
165
+
166
+ Yuantao Feng, Shiqi Yu, Hanyang Peng, Yan ran Li, and Jianguo Zhang. Detect faces efficiently: A survey and evaluations. IEEE Transactions on Biometrics, Behavior, and Identity Science, 2021.
167
+
168
+ Baris Gecer, Jiankang Deng, and Stefanos Zafeiriou. Ostec: one-shot texture completion. In CVPR, 2021.
169
+
170
+ Golnaz Ghiasi, Tsung-Yi Lin, and Quoc V Le. Nas-fpn: Learning scalable feature pyramid architecture for object detection. In CVPR, 2019.
171
+
172
+ Zichao Guo, Xiangyu Zhang, Haoyuan Mu, Wen Heng, Zechun Liu, Yichen Wei, and Jian Sun. Single path one-shot neural architecture search with uniform sampling. arXiv:1904.00420, 2019.
173
+
174
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In CVPR, 2016.
175
+
176
+ Tong He, Zhi Zhang, Hang Zhang, Zhongyue Zhang, Junyuan Xie, and Mu Li. Bag of tricks for image classification with convolutional neural networks. In CVPR, 2019a.
177
+
178
+ Yonghao He, Dezhong Xu, Lifang Wu, Meng Jian, Shiming Xiang, and Chunhong Pan. Lffd: A light and fast face detector for edge devices. arXiv:1904.10633, 2019b.
179
+
180
+ Vidit Jain and Erik Learned-Miller. Fddb: A benchmark for face detection in unconstrained settings. Technical report, UMass Amherst technical report, 2010.
181
+
182
+ Jian Li, Yabiao Wang, Changan Wang, Ying Tai, Jianjun Qian, Jian Yang, Chengjie Wang, Jilin Li, and Feiyue Huang. Dsfd: dual shot face detector. In CVPR, 2019.
183
+
184
+ Xiang Li, Wenhai Wang, Lijun Wu, Shuo Chen, Xiaolin Hu, Jun Li, Jinhui Tang, and Jian Yang. Generalized focal loss: Learning qualified and distributed bounding boxes for dense object detection. arXiv:2006.04388, 2020.
185
+
186
+ Feng Liang, Chen Lin, Ronghao Guo, Ming Sun, Wei Wu, Junjie Yan, and Wanli Ouyang. Computation reallocation for object detection. In ICLR, 2020.
187
+
188
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ ECCV, 2014.
189
+
190
+ Tsung-Yi Lin, Piotr Dollar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie.´ Feature pyramid networks for object detection. In CVPR, 2017a.
191
+
192
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. In ICCV, 2017b.
193
+
194
+ Shu Liu, Lu Qi, Haifang Qin, Jianping Shi, and Jiaya Jia. Path aggregation network for instance segmentation. In CVPR, 2018.
195
+
196
+ Yang Liu and Xu Tang. Bfbox: Searching face-appropriate backbone and feature pyramid network for face detector. In CVPR, 2020.
197
+
198
+ Yang Liu, Xu Tang, Xiang Wu, Junyu Han, Jingtuo Liu, and Errui Ding. Hambox: Delving into online high-quality anchors mining for detecting outer faces. In CVPR, 2020.
199
+
200
+ Markus Mathias, Rodrigo Benenson, Marco Pedersoli, and Luc Van Gool. Face detection without bells and whistles. In ECCV, 2014.
201
+
202
+ Xiang Ming, Fangyun Wei, Ting Zhang, Dong Chen, and Fang Wen. Group sampling for scale invariant face detection. In CVPR, 2019.
203
+
204
+ Mahyar Najibi, Pouya Samangouei, Rama Chellappa, and Larry S Davis. Ssh: Single stage headless face detector. In ICCV, 2017.
205
+
206
+ Hongyu Pan, Hu Han, Shiguang Shan, and Xilin Chen. Mean-variance loss for deep age estimation from a face. In CVPR, 2018.
207
+
208
+ Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollar. Designing ´ network design spaces. In CVPR, 2020.
209
+
210
+ Esteban Real, Alok Aggarwal, Yanping Huang, and Quoc V Le. Regularized evolution for image classifier architecture search. In AAAI, 2019.
211
+
212
+ Florian Schroff, Dmitry Kalenichenko, and James Philbin. Facenet: A unified embedding for face recognition and clustering. In CVPR, 2015.
213
+
214
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, 2015.
215
+
216
+ Xu Tang, Daniel K Du, Zeqiang He, and Jingtuo Liu. Pyramidbox: A context-assisted single shot face detector. In ECCV, 2018.
217
+
218
+ Paul Viola and Michael J Jones. Robust real-time face detection. IJCV, 2004.
219
+
220
+ Yuxin Wu and Kaiming He. Group normalization. In ECCV, 2018.
221
+
222
+ Shuo Yang, Ping Luo, Chen-Change Loy, and Xiaoou Tang. Wider face: A face detection benchmark. In CVPR, 2016.
223
+
224
+ Bin Zhang, Jian Li, Yabiao Wang, Ying Tai, Chengjie Wang, Jilin Li, Feiyue Huang, Yili Xia, Wenjiang Pei, and Rongrong Ji. Asfd: Automatic and scalable face detector. arXiv:2003.11228, 2020a.
225
+
226
+ Feifei Zhang, Tianzhu Zhang, Qirong Mao, and Changsheng Xu. Joint pose and expression modeling for facial expression recognition. In CVPR, 2018.
227
+ Shifeng Zhang, Xiangyu Zhu, Zhen Lei, Hailin Shi, Xiaobo Wang, and Stan Z Li. Faceboxes: A cpu real-time face detector with high accuracy. In IJCB, 2017a.
228
+ Shifeng Zhang, Xiangyu Zhu, Zhen Lei, Hailin Shi, Xiaobo Wang, and Stan Z Li. S3fd: Single shot scale-invariant face detector. In ICCV, 2017b.
229
+ Shifeng Zhang, Cheng Chi, Yongqiang Yao, Zhen Lei, and Stan Z Li. Bridging the gap between anchor-based and anchor-free detection via adaptive training sample selection. In CVPR, 2020b.
230
+ Zhaohui Zheng, Ping Wang, Wei Liu, Jinze Li, Rongguang Ye, and Dongwei Ren. Distance-iou loss: Faster and better learning for bounding box regression. In AAAI, 2020.
231
+ Xiangxin Zhu and Deva Ramanan. Face detection, pose estimation, and landmark localization in the wild. In CVPR, 2012.
232
+ Yanjia Zhu, Hongxiang Cai, Shuhan Zhang, Chenhao Wang, and Yichao Xiong. Tinaface: Strong but simple baseline for face detection. arXiv:2011.13183, 2020.
233
+ C Lawrence Zitnick and Piotr Dollar. Edge boxes: Locating object proposals from edges. In ´ ECCV, 2014.
234
+
235
+ # A APPENDIX
236
+
237
+ # A.1 TINAFACE REVISITED
238
+
239
+ Based on RetinaNet (Lin et al., 2017a), TinaFace (Zhu et al., 2020) employs ResNet-50 (He et al., 2016) as backbone, and Feature Pyramid Network (FPN) (Lin et al., 2017a) as neck to construct the feature extractor. For the head design, TinaFace first uses a feature enhancement module on each feature pyramid to learn surrounding context through different receptive fields in the inception block (Szegedy et al., 2015). Then, four consecutive $3 \times 3$ convolutional layers are appended on each feature pyramid. Focal loss (Lin et al., 2017b) is used for the classification branch, DIoU loss (Zheng et al., 2020) for the box regression branch and cross-entropy loss for the IoU prediction branch.
240
+
241
+ To detect tiny faces, TinaFace tiles anchors of three different scales, over each level of the FPN (i.e. $\{ 2 ^ { 4 / 3 } , 2 ^ { \dot { 5 } / 3 } , 2 ^ { 6 / 3 } \} \times \{ 4 , 8 , 1 6 , 3 2 , 6 4 , 1 2 8 \}$ , from level $P _ { 2 }$ to $P _ { 7 }$ ). The aspect ratio is set as 1.3. During training, square patches are cropped from the original image and resized to $6 4 0 \times 6 4 0$ , using a scaling factor randomly sampled from $[ 0 . 3 , 0 . 4 5 , 0 . 6 , 0 . 8 , 1 . 0 ]$ , multiplied by the length of the original image’s short edge. During testing, TinaFace employs single scale testing, when the short and long edges of the image do not surpass [1100, 1650]. Otherwise, it employs with short edge scaling at [500, 800, 1100, 1400, 1700], shift with directions $[ ( 0 , 0 ) , ( 0 , 1 ) , ( \bar { 1 } , \dot { 0 } ) , ( 1 , 1 ) ]$ and horizontal flip.
242
+
243
+ As shown in Fig. 6(a) and Tab. 4, we compare the performance of TinaFace under different testing scales. For the multi-scale testing, TinaFace achieves an impressive AP of $9 3 . 4 \%$ , which is the current best performance on the WIDER FACE leader-board. For large single-scale testing (1650), the AP slightly drops at $9 3 . 0 \%$ but the computation significantly decreases to 1021.82 GFlops. On the original scale (1024), the performance of TinaFace is still very high, obtaining an AP of $9 1 . 4 \%$ with 508.47 GFlops. Moreover, when the testing scale decreases to VGA level (640), the AP significantly reduces to $8 \bar { 1 } . 4 \%$ , with the computation further decreasing at 172.95 GFlops.
244
+
245
+ In Fig. 6(b), we illustrate the computation distribution of TinaFace on the backbone, neck and head components with a testing scale of 640. From the view of different scales of the feature pyramid, the majority of the computational costs (about $6 8 \%$ ) are from stride 4, as the resolution of feature map is quite large $( 1 2 0 \times 1 6 0 )$ . From the view of the different components of the face detector, most of the computational costs (about $7 9 \%$ ) are from the head, since the backbone structure is directly borrowed from the ImageNet classification task (Deng et al., 2009), without any modification.
246
+
247
+ Even though TinaFace achieves state-of-the-art performance on tiny face detection, the heavy computational cost renders it unsuitable for real-time applications.
248
+
249
+ # A.2 DETAILS OF EVOLUTIONARY BASELINE
250
+
251
+ To compare the proposed SCRFD with the other network search methods in Tab. 1, we design the evolutionary baseline (Real et al., 2019) as follows:
252
+
253
+ 1. A population of networks $\mathbf { P }$ are randomly initialized. We set $| \mathbf { P } | = 5 0$ .
254
+ 2. Each network architecture from $\mathbf { P }$ is trained on the WIDER FACE training data and then the APs on the WIDER FACE validation dataset are tested.
255
+ 3. Architectures with top performance are selected from $\mathbf { P }$ as parents $\mathcal { P }$ . To generate child networks $\mathbf { C }$ , we employ the mutation and crossover policies. Here, we set $| \mathcal { P } | = 1 0$ and $| \mathbf { C } | = 5 0$ .
256
+ 4. Each network architecture from $\mathbf { C }$ is trained on the WIDER FACE training data and then the APs on the WIDER FACE validation dataset are calculated.
257
+ 5. The worst 50 individuals from the populations of $\mathbf { P } \cup \mathbf { C }$ are dropped and then we get the new evolutionary population $\mathbf { P }$ .
258
+ 6. We repeat steps 3, 4 and 5 for 20 times, resulting in 1000 network architectures as well as their validation APs. The architecture with the highest AP is selected as the final result.
259
+
260
+ ![](images/d427e4838e322d87b399490645a7a18ee68ee235863d7c646a69a7cdaaec32ac.jpg)
261
+ Figure 6: (a) Precision-recall curves of TinaFace-ResNet50 on the WIDER FACE hard validation subset, under different testing scales. (b) Computation distribution of TinaFace on backbone, neck and head with $6 4 0 \times 4 8 0$ as the testing scale.
262
+
263
+ # A.3 ALGORITHM OF COMPUTATION REDISTRIBUTION
264
+
265
+ In Algorithm 1, we show the details of the proposed two-step computation redistribution method.
266
+
267
+ <table><tr><td>Algorithm1: Search algorithm for computation redistribution</td></tr><tr><td>Input: Constraint of computation cost Y (in GFlops); Number of random network architectures N; Dataset for training Dtrain and validation Dual; Evaluation metric AP. Output: Best architecture A* Initialize the architecture set A = O whilelength(A)&lt;Ndo</td></tr><tr><td>net=RandomSampling({di,wi}); /* di and wi denote block number and channel number,i =2,3,4,5. */ if net.Flops≤1.02 *Y And net.Flops≥ 0.98 *Y then |A.Append(net) end</td></tr><tr><td>end ParallelTrain(A,Dtrain) CR1= Bootstrap(A,APs) | APs = Evaluate(A,Dvat) Initialize the architecture set A=</td></tr><tr><td>while length(A)&lt;N do net= RandomSampling({CRl,n,m,h});</td></tr><tr><td>/* n,m,and h denote channel in neck, block and channel in head. */</td></tr><tr><td>if net.Flops ≤1.02 *Y And net.Flops ≥ 0.98 *Y then</td></tr><tr><td>|A.Append(net) end</td></tr></table>
268
+
269
+ # A.4 DETAILED NETWORK CONFIGURATIONS
270
+
271
+ In Tab. 5, we give the detailed network configurations for baselines and the proposed CRFD across different compute regimes.
272
+
273
+ # A.5 STATISTICS AFTER SAMPLE REDISTRIBUTION
274
+
275
+ As illustrated in Fig. 7(a), there are more faces below the scale of 32 after the proposed automatic scale augmentation strategy is used. Moreover, even though there will be more extremely tiny faces (e.g. $< 4 \times 4$ ) under the proposed scale augmentation, these ground-truth faces will be neglected during training due to unsuccessful anchor matching. As shown in Fig. 7(b), positive anchors within one epoch significantly increase at the scale of 16 and 32. With more training samples redistributed to the small scale, the branch to detect tiny faces can be trained more adequately.
276
+
277
+ Table 4: Performance and computation comparisons of TinaFace under different testing scales. The average scale of original images is around $8 8 2 \times 1 0 2 4$ .
278
+
279
+ <table><tr><td>Testing Scale</td><td>AP</td><td>#Flops(G)</td></tr><tr><td>Multi-scale</td><td>0.934</td><td>42333.64</td></tr><tr><td>1650</td><td>0.930</td><td>1021.82</td></tr><tr><td>Original(1024)</td><td>0.914</td><td>508.47</td></tr><tr><td>640</td><td>0.814</td><td>172.95</td></tr></table>
280
+
281
+ Table 5: Detailed network configurations for baselines and the proposed CRFD across different compute regimes. Basic residual blocks are used in ResNet-2.5GF and ResNet-10GF, while bottleneck residual blocks are used in ResNet-34GF. For MobileNet-1.0GF and MobileNet-0.5GF, depth-wise convolution is used in both backbone and head.
282
+
283
+ <table><tr><td>Name</td><td>Conv Type</td><td>Stem</td><td>Backbone Depth</td><td>Backbone Width</td><td>Neck</td><td>Head</td></tr><tr><td>ResNet-34GF</td><td>Bottleneck Res</td><td>256</td><td>[3,4,6,3]</td><td>[256,512,1024,2048]</td><td>128</td><td>[256,256]</td></tr><tr><td>CRFD-34GF</td><td>Bottleneck Res</td><td>56</td><td>[17,16,2,8]</td><td>[56,56,144,184]</td><td>128</td><td>[256,256]</td></tr><tr><td>ResNet-10GF</td><td>Basic Res</td><td>32</td><td>[3,4,6,3]</td><td>[32,64,128,256]</td><td>128</td><td>[160,160]</td></tr><tr><td>CRFD-10GF</td><td>Basic Res</td><td>56</td><td>[3,4,2,3]</td><td>[56,88,88,224]</td><td>56</td><td>[80,80,80]</td></tr><tr><td>ResNet-2.5GF</td><td>Basic Res</td><td>16</td><td>[3,4,6,3]</td><td>[16,32,64,128]</td><td>48</td><td>[96,96]</td></tr><tr><td>CRFD-2.5GF</td><td>Basic Res</td><td>24</td><td>[3,5,3,2]</td><td>[24,48,48,80]</td><td>24</td><td>[64,64]</td></tr><tr><td>MobileNet-1.0GF</td><td>Depth-wise Conv</td><td>16</td><td>[3,3,7,3]</td><td>[32,64,128,256]</td><td>64</td><td>[128,128]</td></tr><tr><td>CRFD-1.0GF</td><td>Depth-wise Conv</td><td>48</td><td>[3,2,1,5]</td><td>[48,160,216,312]</td><td>24</td><td>[96,96]</td></tr><tr><td>MobileNet-0.5GF</td><td>Depth-wise Conv</td><td>16</td><td>[2,2,6,3]</td><td>[32,64,128,256]</td><td>32</td><td>[80,80]</td></tr><tr><td>CRFD-0.5GF</td><td>Depth-wise Conv</td><td>16</td><td>[2,3,2,6]</td><td>[40,72,152,288]</td><td>16</td><td>[64,64]</td></tr></table>
284
+
285
+ ![](images/a73313d9a459236a2ce796f0441686e7da347734c72755e9a8561c966da3b12a.jpg)
286
+ Figure 7: Ground-truth and positive anchor distribution within one epoch for the SCRFD-2.5GF training. The baseline method employs a scale augmentation based on the hand-crafted set [0.3, 1.0] and [0.3, 2.0], while our method uses a searched scale set for optimized scale augmentation. The number of small faces $( < 3 2 \times 3 2 )$ ) significantly increases after the automatic scale augmentation strategy is used.
287
+
288
+ Table 6: Performance comparisons between different models on AFW, PASCAL, and FDDB datasets. The proposed SCRFD is tested on the single-scale VGA resolution.
289
+
290
+ <table><tr><td>Methods</td><td>AFW</td><td>PASCAL</td><td>FDDB</td></tr><tr><td>BFBox (Liu &amp; Tang,2020) HAMBox (Liu et al., 2020)</td><td>99.68 99.90</td><td>99.43 99.50</td><td>98.9 99.10</td></tr><tr><td>SCRFD-34GF</td><td>99.945</td><td>99.597</td><td>99.25</td></tr><tr><td>SCRFD-10GF</td><td>99.900</td><td>99.461</td><td>99.07</td></tr><tr><td>SCRFD-2.5GF</td><td>99.821</td><td>98.911</td><td>99.02</td></tr><tr><td>SCRFD-1.0GF</td><td>99.696</td><td></td><td></td></tr><tr><td></td><td></td><td>98.601</td><td>98.69</td></tr><tr><td>SCRFD-0.5GF</td><td>98.603</td><td>98.537</td><td>98.14</td></tr></table>
291
+
292
+ ![](images/37c9caa09d85c9a5b1ec1d3a892c3e2165230f01cbf4fd0aa9be1fd206395850.jpg)
293
+ Figure 8: Precision-recall curves on AFW, PASCAL, and FDDB datasets. The proposed SCRFD is tested on the single-scale VGA resolution.
294
+
295
+ # A.6 DATASETS
296
+
297
+ WIDER FACE The WIDER FACE dataset (Yang et al., 2016) consists of 32, 203 images and 393, 703 face bounding boxes with a high degree of variability in scale, pose, expression, occlusion and illumination. The WIDER FACE dataset is split into training $( 4 0 \% )$ , validation $( 1 0 \% )$ and testing $( 5 0 \% )$ subsets by randomly sampling from 61 scene categories. Based on the detection rate of EdgeBox (Zitnick & Dollar, 2014), three levels of difficulty ( ´ i.e. Easy, Medium and Hard) are defined by incrementally incorporating hard samples.
298
+
299
+ AFW The AFW dataset (Zhu & Ramanan, 2012) contains 205 high-resolution images with 473 faces (Mathias et al., 2014) collected from Flickr. Images in this dataset contain cluttered backgrounds with large variations in viewpoint.
300
+
301
+ PASCAL The PASCAL face dataset (Mathias et al., 2014) is collected from the PASCAL 2012 person layout subset, includes 1, 335 labeled faces in 851 images with large facial appearance and pose variations (e.g. large in-plane rotation).
302
+
303
+ FDDB The FDDB dataset (Jain & Learned-Miller, 2010) is a collection of labeled faces from Faces in the Wild dataset. It contains a total of 5, 171 face annotations on 2, 845 images. The dataset incorporates a range of challenges, including difficult pose angles, out-of-focus faces and low-resolution.
304
+
305
+ # A.7 CROSS DATASET EVALUATION AND VISUALIZATION
306
+
307
+ Besides the evaluation on the WIDER FACE (Yang et al., 2016) data set, we also conduct cross dataset evaluation and test the proposed SCRFD models on AFW (Zhu & Ramanan, 2012), PASCAL (Mathias et al., 2014) and FDDB (Jain & Learned-Miller, 2010), under the VGA resolution. As shown in Fig 8, SCRFD-34GF achieves $9 9 . 9 4 5 \%$ AP on AFW, $9 9 . 5 9 7 \%$ AP on PASCAL, and $9 9 . 2 5 \%$ on FDDB, surpassing BFBox (Liu & Tang, 2020) and HAMBox (Liu et al., 2020). Even though the face scale distributions on these three datasets are different from WIDER FACE, the proposed SCRFD-34GF still obtains state-of-the-art performance across different datasets, showing impressive robustness of the proposed computation and sample redistribution approaches. In addition, SCRFD-2.5GF also obtains impressive performance on different datasets with much lower computation cost $( 9 9 . 8 2 1 \%$ AP on AFW, $9 8 . 9 1 \mathrm { { \bar { 1 } } \% }$ AP on PASCAL, and $9 9 . 0 2 \%$ AP on FDDB).
308
+
309
+ Fig. 9 shows qualitative results generated by SCRFD-2.5GF. As can be seen, our face detector works very well in both indoor and outdoor crowded scenes under different conditions (e.g. appearance variations from pose, occlusion and illumination). The impressive performance across a wide range of scales indicate that SCRFD-2.5GF has a very high recall and can detect faces accurately even without large scale testing.
310
+
311
+ ![](images/e0a8078128b341d34062f56436ac57f43a9c9398bd974bb53f9e5427b27c19d6.jpg)
312
+ Figure 9: Qualitative results on AFW, PASCAL, FDDB and WIDER FACE datasets. The proposed SCRFD-2.5GF is tested on the VGA resolution. Yellow rectangles show the detection results and brightness encodes the detection confidence.
md/dev/RriDjddCLN/RriDjddCLN.md ADDED
@@ -0,0 +1,291 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # LANGUAGE-DRIVEN SEMANTIC SEGMENTATION
2
+
3
+ Boyi Li Cornell University, Cornell Tech
4
+
5
+ Kilian Q. Weinberger Cornell University
6
+
7
+ Serge Belongie University of Copenhagen
8
+
9
+ Vladlen Koltun Apple
10
+
11
+ René Ranftl Intel Labs
12
+
13
+ # ABSTRACT
14
+
15
+ We present LSeg, a novel model for language-driven semantic image segmentation. LSeg uses a text encoder to compute embeddings of descriptive input labels (e.g., “grass” or “building”) together with a transformer-based image encoder that computes dense per-pixel embeddings of the input image. The image encoder is trained with a contrastive objective to align pixel embeddings to the text embedding of the corresponding semantic class. The text embeddings provide a flexible label representation in which semantically similar labels map to similar regions in the embedding space (e.g., “cat” and “furry”). This allows LSeg to generalize to previously unseen categories at test time, without retraining or even requiring a single additional training sample. We demonstrate that our approach achieves highly competitive zero-shot performance compared to existing zero- and few-shot semantic segmentation methods, and even matches the accuracy of traditional segmentation algorithms when a fixed label set is provided. Code and demo are available at https://github.com/isl-org/lang-seg.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Semantic segmentation is a core problem in computer vision, with the aim of partitioning an image into coherent regions with their respective semantic class labels. Most existing methods for semantic segmentation assume a limited set of semantic class labels that can potentially be assigned to a pixel. The number of class labels is dictated by the training dataset and typically ranges from tens (Everingham et al., 2015) to hundreds (Zhou et al., 2019; Mottaghi et al., 2014) of distinct categories. As the English language defines several hundred thousand nouns (Li et al., 2020c), it is likely that the limited size of the label set severely hinders the potential recognition performance of existing semantic segmentation models.
20
+
21
+ The main reason for the restricted label sets in existing methods is the cost of annotating images to produce sufficient training data. To create training datasets, human annotators must associate every single pixel in thousands of images with a semantic class label – a task that is extremely labor intensive and costly even with small label sets. The complexity of the annotation rises significantly as the number of labels increases since the human annotator has to be aware of the fine-grained candidate labels. Additionally, inter-annotator consistency becomes an issue when objects are present in an image that could fit multiple different descriptions or are subject to a hierarchy of labels.
22
+
23
+ Zero- and few-shot semantic segmentation methods have been proposed as a potential remedy for this problem. Few-shot approaches (Shaban et al., 2017; Rakelly et al., 2018; Siam et al., 2019; Wang et al., 2019; Zhang et al., 2019; Nguyen & Todorovic, 2019; Liu et al., 2020b; Wang et al., 2020; Tian et al., 2020; Boudiaf et al., 2021; Min et al., 2021) offer ways to learn to segment novel classes based on only a few labeled images. However, these approaches still require labeled data that includes the novel classes in order to facilitate transfer. Zero-shot methods, on the other hand, commonly leverage word embeddings to discover or generate related features between seen and unseen classes (Bucher et al., 2019; Gu et al., 2020) without the need for additional annotations. Existing works in this space use standard word embeddings (Mikolov et al., 2013) and focus on the image encoder.
24
+
25
+ In this work, we present a simple approach to leveraging modern language models to increase the flexibility and generality of semantic segmentation models. Our work is inspired by the CLIP model for image classification (Radford et al., 2021), which pairs high-capacity image and text encoders to produce robust zero-shot classifiers. We propose to use state-of-the-art text encoders that have been co-trained on visual data, such as CLIP, to embed labels from the training set into an embedding space and to train a visual encoder to produce per-pixel embeddings from an input image that are close to the corresponding label embeddings. Since the text encoder is trained to embed closely related concepts near one another (for example, “dog” is closer to “pet” than to “vehicle”), we can transfer the flexibility of the text encoder to the visual recognition module while only training on the restricted label sets that are provided by existing semantic segmentation datasets. An example is shown in Figure 1 (top row), where the model can successfully label pixels belonging to the class “pet” although the training set did not contain this label.
26
+
27
+ ![](images/5fd6e535054b2a96d5e4fa6fcf85f0c73592192aafab1de45da0787f34bb102d.jpg)
28
+ Figure 1: Example results. LSeg is able to handle unseen labels as well as label sets of arbitrary length and order. This enables flexible synthesis of zero-shot semantic segmentation models on the fly. From left to right, labels that are removed between runs are underlined, whereas labels that are added are marked in bold red.
29
+
30
+ Our approach enables the synthesis of zero-shot semantic segmentation models on the fly. That is, a user can arbitrarily expand, shrink, or reorder the label set for any image at test time. We further introduce an output module that can spatially regularize the predictions while maintaining this flexibility. We demonstrate several examples of the flexibility of our model in Figure 1. LSeg is able to output different segmentation maps based on the provided label set. For instance, in the last row, output (a) recognizes the chair and identifies all non-chair objects as “other” since these are the only two labels provided to the model. When labels are added, as in (b) and (c), the model is able to successfully segment other objects with the expanded label set.
31
+
32
+ We conduct quantitative evaluation on a variety of zero- and few-shot semantic segmentation tasks. Our approach outperforms existing methods in zero-shot settings and is competitive across multiple few-shot benchmarks. Unlike the state-of-the-art baselines we compare to, our approach does not require additional training samples. Our experiments also show that introducing the text embeddings incurs only a negligible loss in performance when compared to standard fixed-label segmentation methods.
33
+
34
+ # 2 RELATED WORK
35
+
36
+ Generalized semantic segmentation. The majority of existing semantic segmentation models are restricted to a fixed label set that is defined by the labels that are present in the training dataset (Minaee et al., 2021). Few-shot semantic segmentation methods aim to relax the restriction of a fixed label set when one or a few annotated examples of novel classes are available at test time. These approaches learn to find reliable visual correspondences between a query image that is to be labeled and labeled support images that may contain novel semantic classes (Shaban et al., 2017; Rakelly et al., 2018; Siam et al., 2019; Wang et al., 2019; Zhang et al., 2019; Nguyen & Todorovic, 2019; Liu et al., 2020b; Wang et al., 2020; Tian et al., 2020; Wang et al., 2020; Tian et al., 2020; Boudiaf et al., 2021; Min et al., 2021). While this strategy can significantly enhance the generality of the resulting model, it requires the availability of at least one labeled example image with the target label set, something that is not always practical.
37
+
38
+ Zero-shot semantic segmentation approaches aim to segment unseen objects without any additional samples of novel classes. Text embeddings of class labels play a central role in these works. Bucher et al. (2019) and Gu et al. (2020) propose to leverage word embeddings together with a generative model to generate visual features of unseen categories, while Xian et al. (2019) propose to project visual features into a simple word embedding space and to correlate the resulting embeddings to assign a label to a pixel. Hu et al. (2020) propose to use uncertainty-aware learning to better handle noisy labels of seen classes, while Li et al. (2020b) introduce a structured learning approach to better exploit the relations between seen and unseen categories. While all of these leverage text embeddings, our paper is, to the best of our knowledge, the first to show that it is possible to synthesize zero-shot semantic segmentation models that perform on par with fixed-label and few-shot semantic segmentation methods.
39
+
40
+ A variety of solutions have been proposed (Zhang et al., 2020b; Liu et al., 2020a; Perera et al., 2020; Zhou et al., 2021) for open-set recognition (Scheirer et al., 2012; Geng et al., 2020). These aim to provide a binary decision about whether or not a given sample falls outside the training distribution, but do not aim to predict the labels of entirely new classes.
41
+
42
+ Finally, a different line of work explores cross-domain adaptation methods for semantic segmentation by using feature alignment, self-training, and information propagation strategies (Yang et al., 2021; Wang et al., 2021). The target of these works is to enhance the transferability of models to novel visual domains, but they do not address the issue of a restricted label set. As such they are orthogonal to our work.
43
+
44
+ Language-driven recognition. Language-driven recognition is an active area of research. Common tasks in this space include visual question answering (Antol et al., 2015), image captioning (Vinyals et al., 2014), and image-text retrieval (Li et al., 2020a). CLIP (Radford et al., 2021) demonstrated that classic recognition tasks that are not commonly associated with language can strongly benefit from language assistance. CLIP uses contrastive learning together with high-capacity language models and visual feature encoders to synthesize extremely robust models for zero-shot image classification. Recent works have extended this basic paradigm to perform flexible object detection. ViLD (Gu et al., 2021) introduces an advanced zero-shot object detection method that leverages CLIP, whereas MDETR (Kamath et al., 2021) proposes an end-to-end approach that modulates a transformer-based baseline detector with text features that are obtained from a state-of-the-art language model. Like CLIP, these works have shown that the robustness and generality of object detection models can be strongly improved by language assistance. Our work is inspired by these approaches and presents, to the best of our knowledge, the first approach to flexibly synthesize zero-shot semantic segmentation models by leveraging high-capacity language models.
45
+
46
+ # 3 LANGUAGE-DRIVEN SEMANTIC SEGMENTATION
47
+
48
+ Our approach, Language driven Semantic segmentation $( L S e g )$ embeds text labels and image pixels into a common space, and assigns the closest label to each pixel. We illustrate the framework in Figure 2 and describe each part in detail below.
49
+
50
+ Text encoder. The text encoder embeds the set of $N$ potential labels into a continuous vector space $\mathbb { R } ^ { C }$ , producing $N$ vectors $T _ { 1 } , \dots , T _ { n } \in \mathbb { R } ^ { C }$ as outputs (blue vectors in Figure 2). Multiple network architectures are possible, and we use the pretrained Contrastive Language–Image Pre-training (CLIP) throughout (Radford et al., 2021). By design, the set of output vectors is invariant to the ordering of the input labels and allows their number, $N$ , to vary freely.
51
+
52
+ Image encoder. Similar to the text encoder, the image encoder produces an embedding vector for every input pixel (after downsampling). We leverage dense prediction transformers (DPT) (Ranftl
53
+
54
+ ![](images/10c93ac97895bbc2e73ed6e0b0f5d749175e6e1be9999753631ed85cda2a414d.jpg)
55
+ Figure 2: Overview. A text encoder embeds labels into a vector space. An image encoder extracts per-pixel embeddings from the image and correlates the feature of each pixel to all label embeddings. The image encoder is trained to maximize the correlation between the text embedding and the image pixel embedding of the ground-truth class of the pixel. A final spatial regularization block spatially regularizes and cleans up the predictions.
56
+
57
+ et al., 2021) as the underlying architecture. Assume $H \times W$ is the input image size and $s$ is a
58
+ user-defined downsampling output is a dense embedding $s = 2$ our implementation). We define (green tensor in Figure 2). We re $\begin{array} { r } { \tilde { H } = \frac { H } { s } } \end{array}$ , e $\begin{array} { r } { \tilde { W } = \frac { W } { s } } \end{array}$ . Theng of $I \in \mathbb { R } ^ { \tilde { H } \times \tilde { W } \times C }$
59
+ pixel $( i , j )$ as $I _ { i j }$ .
60
+
61
+ Word-pixel correlation tensor. After the image and the labels are embedded, we correlate them by the inner product, creating a tensor of size $\tilde { H } \times \tilde { W } \times N$ (orange tensor in Figure 2), defined as
62
+
63
+ $$
64
+ f _ { i j k } = I _ { i j } \cdot T _ { k } .
65
+ $$
66
+
67
+ We refer to the $N$ -dimensional vector of inner products between the embedding of pixel $( i , j )$ and all $N$ words as $F _ { i j } \in \mathbb { R } ^ { N }$ , where $F _ { i j } = ( f _ { i j 1 } , f _ { i j 2 } , . . . , f _ { i j k } ) ^ { T }$ . During training, we encourage the image encoder to provide pixel embeddings that are close to the text embedding of the corresponding groundtruth class. Specifically, given the text embeddings $T _ { k } \in \mathbb { R } ^ { C }$ of $N$ labels and the image embedding $I _ { i j } \in \mathbb { R } ^ { C }$ of pixel $i , j$ , we aim to maximize the dot product of the entry $f _ { i j k }$ that corresponds to the ground-truth label $k = y _ { i j }$ of pixel $i , j$ . We achieve this by defining a pixelwise softmax objective over the whole image:
68
+
69
+ $$
70
+ \sum _ { i , j = 1 } ^ { H , W } \mathrm { s o f t m a x } _ { y _ { i j } } \left( \frac { F _ { i j } } { t } \right) ,
71
+ $$
72
+
73
+ where $t$ is a user-defined temperature parameter that we set to $t = 0 . 0 7$ (Wu et al., 2018; Radford et al., 2021). During training, we minimize a per-pixel softmax with cross-entropy loss (with temperature scaling) as is standard in semantic segmentation1.
74
+
75
+ Spatial regularization. Due to memory constraints, the image encoder predicts pixel embeddings at lower resolution than the input image resolution. We use an additional post-processing module that spatially regularizes and upsamples the predictions to the original input resolution. During this process, we have to ensure that all operations stay equivariant with respect to the labels. In other words, there should be no interactions between the input channels, whose order is defined by the order of the words and can thus be arbitrary. We evaluate two functions that fulfill this property: a simple cascade of depthwise convolutions (Chollet, 2017) followed by non-linear activations (DepthwiseBlock), and another block that additionally augments the depthwise convolutions with the result of a max-pooling operation over the set of labels (BottleneckBlock) (Li et al., 2019). In a final step we use bilinear interpolation to recover predictions at the original resolution. We refer to these functions as “spatial regularization blocks” and illustrate them in Figure 3.
76
+
77
+ Training details. We initialize the backbone of the image encoder with the official ImageNet pretrained weights from ViT (Dosovitskiy et al., 2021) or ResNet (He et al., $2 0 1 6 ) ^ { 2 }$ and initialize the decoder of DPT randomly. During training we freeze the text encoder and only update the weights of the image encoder. We provide the full label set that is defined by each training set to the text encoder for each image.
78
+
79
+ Our model can be trained on any semantic segmentation dataset and supports flexible mixing of multiple datasets through the text encoder. Existing semantic segmentation models assign a fixed channel in the output to represent the probability of a pixel being the corresponding semantic class. In contrast, our approach can dynamically handle label sets with varying length, content, and order. This property allows synthesizing arbitrary zero-shot semantic segmentation models by simply changing the labels that are fed to the text encoder.
80
+
81
+ ![](images/c91a6f7e288d7c64b0aae4ee593edb9e5d2de80c5293995625624f17bdf1d013.jpg)
82
+ Figure 3: Illustration of BottleneckBlock and DepthwiseBlock.
83
+
84
+ # 4 EXPERIMENTS
85
+
86
+ We designed LSeg primarily for the zero-shot setting, where labels that are used for inference have never been seen during training. However, due to a lack of a standardized protocol and sufficient datasets and baselines for the zero-shot setting, we compare LSeg to zero- and few-shot semantic segmentation models on few-shot benchmarks. Note that few-shot methods have access to more information and are thus expected to yield higher accuracy. However, the need for labeled samples severely restricts their flexibility compared to our approach.
87
+
88
+ # 4.1 EXPERIMENTAL SETUP
89
+
90
+ We follow the protocol of the recent state-of-the-art few-shot method HSNet (Min et al., 2021) and evaluate on three widely-used few-shot semantic segmentation benchmarks: PASCAL- $. 5 ^ { i }$ (Everingham et al., 2015), $\mathrm { C O C O - } 2 0 ^ { i }$ (Lin et al., 2014), and FSS-1000 (Li et al., 2020c). Following a standard protocol for few-shot segmentation, we use the mean intersection over union (mIoU) and foreground-background intersection of union (FB-IoU) as the evaluation metrics. The mIoU calculates the average IoU over all classes, FB-IoU computes mean value of foreground and background IoUs in fold $i$ and ignores the object classes.
91
+
92
+ When not stated otherwise we use an LSeg model with the text encoder provided by CLIP-ViT-B/32 and leverage DPT with a ViT-L/16 backbone as the image encoder. For datasets that provide a background or unknown class, we set the corresponding background label to “other”. We use SGD with momentum 0.9 and a polynomial learning rate scheduler with decay rate 0.9. We train with a batch size of 6 on six Quadro RTX 6000.
93
+
94
+ # 4.2 PASCAL- $. 5 ^ { i }$ AND COCO- $2 0 ^ { i }$
95
+
96
+ PASCAL- $. 5 ^ { i }$ and $\mathrm { C O C O - } 2 0 ^ { i }$ are few-shot segmentation datasets that have been created from PASCAL VOC 2012 (Everingham et al., 2015) and the COCO dataset (Lin et al., 2014), respectively. PASCAL$5 ^ { i }$ is composed of 20 object classes with corresponding mask annotations and has been evenly divided into 4 folds of 5 classes each. We denote different folds by $5 ^ { i }$ , where $i \in \{ 0 , 1 , 2 , 3 \}$ . Similarly, COCO- $2 0 ^ { i }$ is composed of 4 folds of 20 classes each.
97
+
98
+ We compare LSeg to various state-of-the-art few-shot models: OSLSM (Shaban et al., 2017), CoFCN (Rakelly et al., 2018), AMP-2 (Siam et al., 2019), PANet (Wang et al., 2019), PGNet (Zhang et al., 2019), FWB (Nguyen & Todorovic, 2019), PPNet (Liu et al., 2020b), DAN (Wang et al., 2020), PFENet (Tian et al., 2020), RePRI (Boudiaf et al., 2021), and HSNet (Min et al., 2021). These few-shot methods propose strategies to segment unseen objects based on pretraining on seen categories and finetuning with a few images from the target class. In addition, we also compare to the competitive zero-shot baseline ZS3Net (Bucher et al., 2019), which adopts the DeepLabv $^ { 3 + }$ framework and to Xian et al. (2019) which leverages DeepLabv2. We follow their official code, training setting and training steps on the basis of their provided model pretrained on ImageNet (Deng et al., 2009). We follow the common experimental setup (Nguyen & Todorovic, 2019) and conduct cross-validation over all folds. Assuming that $n _ { i }$ is the number of classes in fold $i$ , for each fold $i$ we use images of other folds for training and randomly sampled 1000 images of target fold $i$ for evaluation. We show PASCAL- $. 5 ^ { i }$ and $\bar { \mathrm { C O C O - 2 0 ^ { i } } }$ results in Tables 1 and 2. Our model (with the same ResNet101 backbone) outperforms the zero-shot baseline by a considerable margin across folds and datasets and is even competitive with several few-shot methods. We also observe an obvious edge of LSeg by using a larger backbone (ViT-L/16).
99
+
100
+ Table 1: Comparison of mIoU and FB-IoU (higher is better) on PASCAL- $5 ^ { i }$ .
101
+
102
+ <table><tr><td>Model</td><td>Backbone</td><td>Method</td><td>50</td><td>51</td><td>52</td><td>53</td><td>mean</td><td>FB-IoU</td></tr><tr><td>OSLSM co-FCN AMP-2</td><td>VGG16</td><td>1-shot 1-shot 1-shot</td><td>33.6 36.7 41.9</td><td>55.2 50.6 50.2</td><td>40.9 44.9 46.7</td><td>33.5 32.4 34.7</td><td>40.8 41.1 43.4</td><td>61.3 60.1 61.9</td></tr><tr><td>PANet PGNet</td><td>ResNet50</td><td>1-shot 1-shot</td><td>44.0 56.0</td><td>57.5 66.9</td><td>50.8 50.6</td><td>44.0 50.4</td><td>49.1 56.0</td><td>- 69.9</td></tr><tr><td>FWB PPNet DAN PFENet RePRI</td><td>ResNet101</td><td>1-shot 1-shot 1-shot 1-shot 1-shot</td><td>51.3 52.7 54.7 60.5 59.6</td><td>64.5 62.8 68.6 69.4 68.6</td><td>56.7 57.4 57.8 54.4 62.2</td><td>52.2 47.7 51.6 55.9 47.2</td><td>56.2 55.2 58.2 60.1</td><td>1 70.9 71.9 72.9</td></tr><tr><td>HSNet SPNet ZS3Net</td><td>ResNet101</td><td>1-shot zero-shot zero-shot</td><td>67.3 23.8 40.8</td><td>72.3 17.0 39.4</td><td>62.0 14.1 39.3</td><td>63.1 18.3 33.6</td><td>66.2 18.3 38.3</td><td>77.6 44.3 57.7</td></tr><tr><td>LSeg LSeg</td><td>ResNet101 ViT-L/16</td><td>zero-shot zero-shot</td><td>52.8 61.3</td><td>53.8 63.6</td><td>44.4 43.1</td><td>38.5 41.0</td><td>47.4 52.3</td><td>64.1 67.0</td></tr></table>
103
+
104
+ Table 2: Comparison of mIoU and FB-IoU (higher is better) on $\mathrm { C O C O - 2 0 ^ { i } }$
105
+
106
+ <table><tr><td>Model</td><td>Backbone</td><td>Method</td><td>200</td><td>201</td><td>20²</td><td>203</td><td>mean</td><td>FB-IoU</td></tr><tr><td>PPNet PMM RPMM RePRI</td><td>ResNet50</td><td>1-shot 1-shot 1-shot 1-shot</td><td>28.1 29.3 29.5</td><td>30.8 34.8 36.8</td><td>29.5 27.1 28.9</td><td>27.7 27.3 27.0</td><td>29.0 29.6 30.6</td><td></td></tr><tr><td>FWB DAN PFENet</td><td>ResNet101</td><td>1-shot 1-shot 1-shot</td><td>32.0 17.0 1 36.8</td><td>38.7 18.0 1 41.8</td><td>32.7 21.0 - 38.7</td><td>33.1 28.9 1 36.7</td><td>34.1 21.2 24.4 38.5</td><td>1 62.3</td></tr><tr><td>HSNet ZS3Net</td><td>ResNet101</td><td>1-shot zero-shot</td><td>37.2 18.8</td><td>44.1 20.1</td><td>42.4 24.8</td><td>41.3 20.5</td><td>41.2 21.1</td><td>63.0 69.1</td></tr><tr><td>LSeg LSeg</td><td>ResNet101 ViT-L/16</td><td>zero-shot zero-shot</td><td>22.1 28.1</td><td>25.1 27.5</td><td>24.9 30.0</td><td>21.5 23.2</td><td>23.4 27.2</td><td>55.1 57.9 59.9</td></tr></table>
107
+
108
+ # 4.3 FSS-1000
109
+
110
+ FSS-1000 (Li et al., 2020c) is a recent benchmark dataset for few-shot segmentation. It consists of 1000 object classes with pixelwise annotated segmentation masks. It contains a significant number of unseen or unannotated objects in comparison to previous datasets such as PASCAL and COCO. Following the standard protocol, we split the 1000 classes into training, validation, and test classes, with 520, 240, and 240 classes, respectively. We use a base learning rate of 0.05 and train the model for 60 epochs.
111
+
112
+ Table 3 compares our approach to state-of-theart few-shot models. Notably, under the same ResNet101, LSeg could achieve comparative results of the state-of-the-art one-shot method. Also, LSeg even outperforms a state-of-the-art one-shot method: 87.8 mIoU (ours) vs. 86.5 mIoU (HSNet) with a larger backbone ViT-L/16, indicating that LSeg generalizes very well to unseen categories. Figure 4 shows examples of segmentation results on unseen categories.
113
+
114
+ Table 3: Comparison of mIoU on FSS-1000.
115
+
116
+ <table><tr><td rowspan=1 colspan=4>Model Backbone Method mIoU</td></tr><tr><td rowspan=2 colspan=1>OSLSMGNetFSSDoG-LSTM</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>1-shot</td><td rowspan=1 colspan=1>70.3</td></tr><tr><td rowspan=1 colspan=1>VGG16</td><td rowspan=1 colspan=1>1-shot1-shot1-shot</td><td rowspan=1 colspan=1>71.973.580.8</td></tr><tr><td rowspan=1 colspan=1>DANHSNet</td><td rowspan=1 colspan=1>ResNet101</td><td rowspan=1 colspan=1>1-shot1-shot</td><td rowspan=1 colspan=1>85.286.5</td></tr><tr><td rowspan=1 colspan=1>LSegLSeg</td><td rowspan=1 colspan=1>ResNet101ViT-L/16</td><td rowspan=1 colspan=1>zero-shotzero-shot</td><td rowspan=1 colspan=1>84.787.8</td></tr></table>
117
+
118
+ ![](images/6833d60fc73bd13ae84ec7057055a23092d3cd6221213a36ed7431441c85c57d.jpg)
119
+ Figure 4: LSeg zero-shot semantic segmentation results on unseen categories of FSS-1000 dataset.
120
+
121
+ 5 EXPLORATION AND DISCUSSION
122
+
123
+ # 5.1 ABLATION STUDIES
124
+
125
+ We further empirically explore various properties of LSeg. We conduct experiments on the ADE20K dataset (Zhou et al., 2019), which is a standard semantic segmentation dataset that includes a diversity of images and provides pixelwise segmentation of 150 different categories. We set the base learning rate to 0.004 and train the model for 240 iterations. We use SGD with momentum 0.9 and a polynomial learning rate scheduler with decay rate 0.9. We use LSeg with DPT and a smaller ViT-B/32 backbone together with the CLIP ViT-B/32 text encoder unless stated otherwise.
126
+
127
+ Spatial regularization blocks. We first conduct an ablation study on the two variants of the spatial regularization blocks for cleaning up the output. We ablate the different types of blocks as well as stacking various numbers of blocks $( N \in [ 0 , \bar { 1 } , 2 , 4 ] )$ ). The results are shown in Table 4. We notice that a consistent improvement can be achieved by adding a few regularization blocks. The strongest improvement is achieved by stacking two BottleneckBlocks, an addition to the architecture that incurs little overhead.
128
+
129
+ Text encoders. LSeg supports arbitrary text encoders in principle. We show the influence of using different text encoders in Table 5, where we ablate various encoders that are provided by the CLIP zero-shot image classification model (Radford et al., 2021). Note that all text encoders feature the same transformer-based architecture that purely operates on text. The main difference between the encoders is the image encoder that was paired during CLIP pretraining (for example, the text encoder denoted by “ViT-B/32” was trained in conjunction with a ViT-B/32 image encoder) and the size of the embedding dimension.
130
+
131
+ Table 4: Ablation study on the depth of BottleneckBlock and DepthwiseBlock before the last layer. For both Pixel Accuracy (pixAcc) and mIoU, higher is better. For depth $_ { | = 1 }$ , we directly feed the output to reshape without activation.
132
+
133
+ <table><tr><td rowspan="2">Block Type</td><td rowspan="2">Metric</td><td colspan="4">#depth</td></tr><tr><td>0</td><td>1</td><td>2</td><td>4</td></tr><tr><td rowspan="3">DepthwiseBlock</td><td>pixAcc [%]</td><td>79.70</td><td>79.72</td><td>79.78</td><td>7.67</td></tr><tr><td>mIoU[%]</td><td>37.83</td><td>39.19</td><td>39.45</td><td>0.18</td></tr><tr><td>pixAcc [%]</td><td>79.70</td><td>79.64</td><td>79.70</td><td>79.68</td></tr><tr><td>BottleneckBlock</td><td>mIoU[%]</td><td>37.83</td><td>39.16</td><td>39.79</td><td>38.78</td></tr></table>
134
+
135
+ We observe that using $\mathrm { R N } 5 0 \times 1 6$ achieves the best performance among all text encoders and surpasses the weakest ViT-B/32 text encoder by $2 . 5 \%$ . We conjecture that this is because of the larger size of the embedding that is provided by this encoder.
136
+
137
+ Comparison on a fixed label set. Language assistance helps boost the recognition performance on unannotated or unseen classes. However, there might be a concern that this flexibility hurts the performance on tasks that have a fixed label set. To test this, we train LSeg on ADE20K using the standard protocol on this dataset, where the training and test labels are fixed (that is, there are no unseen class labels at test time). We compare the results to highly competitive standard semantic segmentation models, including OCNet (Yuan et al., 2020), ACNet (Fu et al., 2019), DeeplabV3 (Chen et al., 2017; Zhang et al., 2020a), and DPT (Ranftl et al., 2021). The results are listed in Table 6. We find that LSeg performs competitively when using the $\mathrm { R N } 5 0 \times 1 6$ text encoder and incurs only a negligible loss in performance when compared to the closest fixed-label segmentation method (DPT).
138
+
139
+ # 5.2 QUALITATIVE FINDINGS
140
+
141
+ We finally train LSeg on a mix of 7 different datasets (Lambert et al., 2020), including ADE20K (Zhou et al., 2019), BDD (Yu et al., 2020), Cityscapes (Cordts et al., 2016), COCO-Panoptic (Lin et al., 2014; Caesar et al., 2018), IDD (Varma et al., 2019), Mapillary Vistas (Neuhold et al., 2017), and SUN RGBD (Song et al., 2015). Note that we train our model on the original label sets that are provided by these datasets without any preprocessing or relabeling. We follow the same training protocol as on ADE20K and train LSeg with a ViT-L/16 backbone and a ViT-B/32 text encoder for 200 epochs with a base learning rate of 0.004. If there are multiple labels for one class, we only use the first label that is provided during training. We select images from the web and show the results in Figure 5 to illustrate the use of the resulting model.
142
+
143
+ Related but previously unseen labels. We illustrate some salient examples of the capabilities of LSeg to generalize to new classes in Figure 5(a). In the first row, on the left we first start with the label set "sky", "road", "house", and "plant", and observe that the model is capable of segmenting the image into the provided classes. We then change the label "house" to "building" and the label "plant" to "greenery". The model produces a similar segmentation as before on this different but semantically related label set. This is despite the fact that the label "greenery" or even "green" was not present in any of the training images. A similar effect is shown in the second row, where LSeg successfully segments the image and correctly assigns the labels "cake" or "dessert" (again, the label "dessert" was not seen during training), while successfully suppressing the label "bread" which is both visually and semantically related.
144
+
145
+ Table 5: Ablation study on LSeg with fixed text encoders of different CLIP pretrained models.
146
+
147
+ <table><tr><td>Method</td><td>Backbone</td><td>Text Encoder (fixed)</td><td>embedding dimension</td><td>pixAcc [%]</td><td>mIoU [%]</td></tr><tr><td>LSeg</td><td>ViT-B/32</td><td>ViT-B/32</td><td>512</td><td>79.70</td><td>37.83</td></tr><tr><td>LSeg</td><td>ViT-B/32</td><td>ViT-B/16</td><td>512</td><td>79.77</td><td>38.69</td></tr><tr><td>LSeg</td><td>ViT-B/32</td><td>RN50×4</td><td>640</td><td>79.85</td><td>38.93</td></tr><tr><td>LSeg</td><td>ViT-B/32</td><td>RN50 ×16</td><td>768</td><td>80.26</td><td>40.36</td></tr></table>
148
+
149
+ <table><tr><td>Method</td><td>Backbone</td><td>Text Encoder</td><td>pixAcc [%]</td><td>mIoU[%]</td></tr><tr><td>OCNet</td><td>ResNet101</td><td></td><td></td><td>45.45</td></tr><tr><td>ACNet</td><td>ResNet101</td><td></td><td>81.96</td><td>45.90</td></tr><tr><td>DeeplabV3</td><td>ResNeSt101</td><td></td><td>82.07</td><td>46.91</td></tr><tr><td>DPT</td><td>ViT-L/16</td><td></td><td>82.70</td><td>47.63</td></tr><tr><td>LSeg</td><td>ViT-L/16</td><td>ViT-B/32</td><td>82.46</td><td>46.28</td></tr><tr><td>LSeg</td><td>ViT-L/16</td><td>RN50 ×16</td><td>82.78</td><td>47.25</td></tr></table>
150
+
151
+ Table 6: Comparison of semantic segmentation results on the ADE20K validation set. For LSeg, we conduct experiments with fixed text encoders of ViT-B/32 and $\mathrm { R N } 5 0 \times 1 6$ CLIP pretrained models.
152
+
153
+ ![](images/0c46ce1d27e753185f3612fcc74234e251e3fc9e9ce28f4ef8635cb6e0538da4.jpg)
154
+ Figure 5: LSeg examples with related but previously unseen labels, and hierarchical labels. Going from left to right, labels that are removed between runs are underlined, whereas labels that are added are marked in bold red.
155
+
156
+ Hierarchical unseen labels. Figure 5(b) demonstrates that LSeg can implicitly provide correct segmentation maps for hierarchies of labels. In the first row, the model is able to recognize the "cat", "plant" and "grass" segments of the image, as expected since these labels are present in the training set. When replacing "cat" with the label "furry", we notice that the model is able to successfully recognize this parent category (that is, most cats are furry, but not all furry objects are cats). Similarly, when removing the label "grass", we notice that the original "grass" region is merged into "plant", again an indication of an implicit hierarchy that is afforded by the flexibility of the text embeddings. The second row illustrates a similar scenario, where LSeg recognizes the sofa and other objects. However, the small shelf on the left is segmented as the unknown category "other". When we change "sofa" to "furniture", LSeg successfully identifies both the sofa and the small shelf as "furniture". Note that "furniture" never appeared in the training label set.
157
+
158
+ Failure cases. While LSeg in general achieves very promising results, we also observe some failure cases, as illustrated in Figure 6. The left image illustrates that LSeg is only trained with positive samples from a class. When the testtime input labels do not contain any of the true labels for the corresponding pixel, the model assigns the highest probability to the closest label in the text embedding space. In this specific example, the model assigns the label "toy" since
159
+
160
+ ![](images/6a4152fa10080b2dbeb23a0e9ff17643d65ec0293c89db3483ce5bcf5044a2b8.jpg)
161
+ Figure 6: Failure cases.
162
+
163
+ the visual features of the dog are apparently closer to "toy" than to "grass" in the embedding space and there is no other label that can explain the visual features. A second failure case is shown on the right, where the model focuses on a single most likely object when multiple explanations are consistent with the label set. In this specific example, the windows of the house are labeled as "house" instead of window, even thought the label "window" is available as a choice. We hope that these failure cases can inform future work, which could involve augmenting training with negative samples or building fine-grained language-driven semantic segmentation models that can potentially assign multiple labels when multiple explanations fit the data well.
164
+
165
+ # 6 CONCLUSION
166
+
167
+ We introduced LSeg, a novel method and architecture for training language-driven semantic segmentation models. LSeg enables a flexible label representation that maps semantically similar labels to similar regions in an embedding space and learns to correlate visual concepts in this space to produce semantic segmentations. Our formulation enables the synthesis of zero-shot semantic segmentation models with arbitrary label sets on the fly. Our empirical results show that the resulting models are strong baselines for zero-shot semantic segmentation and can even rival few-shot segmentation models while not sacrificing accuracy on existing fixed label sets.
168
+
169
+ # ACKNOWLEDGEMENT
170
+
171
+ This work was supported in part by the Pioneer Centre for AI, DNRF grant number P1. KQW is supported by grants from the National Science Foundation NSF (IIS-2107161, III-1526012, IIS1149882, and IIS-1724282), the Cornell Center for Materials Research with funding from the NSF MRSEC program (DMR-1719875), and SAP America.
172
+
173
+ # ETHICS STATEMENT
174
+
175
+ We proposed a novel approach to solve the generalized semantic segmentation problem. We use public computer vision datasets and leverage pretrained language models for our experiments. We do not believe that our code or method are inherently subject to concerns of discrimination / bias / fairness, inappropriate potential applications, impact, privacy and security issues, legal compliance, research integrity or research practice issues. However, image datasets and language models may be subject to bias that may be inherited by models trained with our approach.
176
+
177
+ # REPRODUCIBILITY
178
+
179
+ Our code is reproducible and can be implemented based on the method description in Section 3 as well as training details in Section 4 and 5. We provide an interactive demo for people to try with input images of their choosing.
180
+
181
+ # REFERENCES
182
+
183
+ Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C. Lawrence Zitnick, and Devi Parikh. VQA: Visual Question Answering. In International Conference on Computer Vision, 2015.
184
+
185
+ Malik Boudiaf, Hoel Kervadec, Ziko Imtiaz Masud, Pablo Piantanida, Ismail Ben Ayed, and Jose Dolz. Few-shot segmentation without meta-learning: A good transductive inference is all you need? In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 13979–13988, 2021.
186
+
187
+ Maxime Bucher, Tuan-Hung Vu, Matthieu Cord, and Patrick Pérez. Zero-shot semantic segmentation. Advances in Neural Information Processing Systems, 32:468–479, 2019.
188
+
189
+ Holger Caesar, Jasper Uijlings, and Vittorio Ferrari. Coco-stuff: Thing and stuff classes in context. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1209–1218, 2018.
190
+
191
+ Liang-Chieh Chen, George Papandreou, Florian Schroff, and Hartwig Adam. Rethinking atrous convolution for semantic image segmentation. arXiv preprint arXiv:1706.05587, 2017.
192
+
193
+ François Chollet. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1251–1258, 2017.
194
+
195
+ 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.
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
+ 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.
200
+
201
+ M. Everingham, S. M. A. Eslami, L. Van Gool, C. K. I. Williams, J. Winn, and A. Zisserman. The pascal visual object classes challenge: A retrospective. International Journal of Computer Vision, 111(1):98–136, January 2015.
202
+
203
+ 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.
204
+
205
+ Chuanxing Geng, Sheng-jun Huang, and Songcan Chen. Recent advances in open set recognition: A survey. IEEE transactions on pattern analysis and machine intelligence, 2020.
206
+
207
+ Xiuye Gu, Tsung-Yi Lin, Weicheng Kuo, and Yin Cui. Zero-shot detection via vision and language knowledge distillation. arXiv preprint arXiv:2104.13921, 2021.
208
+
209
+ Zhangxuan Gu, Siyuan Zhou, Li Niu, Zihan Zhao, and Liqing Zhang. Context-aware feature generation for zero-shot semantic segmentation. In ACM International Conference on Multimedia, 2020.
210
+
211
+ 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.
212
+
213
+ Ping Hu, Stan Sclaroff, and Kate Saenko. Uncertainty-aware learning for zero-shot semantic segmentation. In Advances in Neural Information Processing Systems, 2020.
214
+
215
+ Aishwarya Kamath, Mannat Singh, Yann LeCun, Ishan Misra, Gabriel Synnaeve, 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.
216
+
217
+ John Lambert, Zhuang Liu, Ozan Sener, James Hays, and Vladlen Koltun. Mseg: A composite dataset for multi-domain semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2879–2888, 2020.
218
+
219
+ Boyi Li, Felix Wu, Kilian Q Weinberger, and Serge Belongie. Positional normalization. In Advances in Neural Information Processing Systems, pp. 1620–1632, 2019.
220
+
221
+ Gen Li, Nan Duan, Yuejian Fang, Ming Gong, and Daxin Jiang. Unicoder-vl: A universal encoder for vision and language by cross-modal pre-training. In AAAI, 2020a.
222
+
223
+ Peike Li, Yunchao Wei, and Yi Yang. Consistent structural relation learning for zero-shot segmentation. Advances in Neural Information Processing Systems, 33, 2020b.
224
+
225
+ Xiang Li, Tianhan Wei, Yau Pun Chen, Yu-Wing Tai, and Chi-Keung Tang. Fss-1000: A 1000-class dataset for few-shot segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2869–2878, 2020c.
226
+
227
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pp. 740–755. Springer, 2014.
228
+
229
+ Bo Liu, Hao Kang, Haoxiang Li, Gang Hua, and Nuno Vasconcelos. Few-shot open-set recognition using meta-learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8798–8807, 2020a.
230
+
231
+ Yongfei Liu, Xiangyi Zhang, Songyang Zhang, and Xuming He. Part-aware prototype network for few-shot semantic segmentation. In European Conference on Computer Vision, pp. 142–158. Springer, 2020b.
232
+
233
+ Tomás Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient estimation of word representations in vector space. In Yoshua Bengio and Yann LeCun (eds.), 1st International Conference on Learning Representations, ICLR 2013, Scottsdale, Arizona, USA, May 2-4, 2013, Workshop Track Proceedings, 2013. URL http://arxiv.org/abs/1301.3781.
234
+
235
+ Juhong Min, Dahyun Kang, and Minsu Cho. Hypercorrelation squeeze for few-shot segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021.
236
+
237
+ Shervin Minaee, Yuri Y Boykov, Fatih Porikli, Antonio J Plaza, Nasser Kehtarnavaz, and Demetri Terzopoulos. Image segmentation using deep learning: A survey. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2021.
238
+
239
+ 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 IEEE Conference on Computer Vision and Pattern Recognition, 2014.
240
+
241
+ Gerhard Neuhold, Tobias Ollmann, Samuel Rota Bulo, and Peter Kontschieder. The mapillary vistas dataset for semantic understanding of street scenes. In Proceedings of the IEEE international conference on computer vision, pp. 4990–4999, 2017.
242
+
243
+ Khoi Nguyen and Sinisa Todorovic. Feature weighting and boosting for few-shot segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 622–631, 2019.
244
+
245
+ 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 Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11814–11823, 2020.
246
+
247
+ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In Proceedings of the 38th International Conference on Machine Learning, pp. 8748–8763, 2021.
248
+
249
+ Kate Rakelly, Evan Shelhamer, Trevor Darrell, Alyosha Efros, and Sergey Levine. Conditional networks for few-shot semantic segmentation. In International Conference on Learning Representations Workshop, 2018.
250
+
251
+ René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. In The IEEE International Conference on Computer Vision, 2021.
252
+
253
+ Walter J Scheirer, Anderson de Rezende Rocha, Archana Sapkota, and Terrance E Boult. Toward open set recognition. IEEE transactions on pattern analysis and machine intelligence, 35(7):1757–1772, 2012.
254
+
255
+ Amirreza Shaban, Shray Bansal, Zhen Liu, Irfan Essa, and Byron Boots. One-shot learning for semantic segmentation. In British Machine Vision Conference, 2017.
256
+
257
+ Mennatullah Siam, Boris N Oreshkin, and Martin Jagersand. Amp: Adaptive masked proxies for few-shot segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 5249–5258, 2019.
258
+
259
+ Shuran Song, Samuel P Lichtenberg, and Jianxiong Xiao. Sun rgb-d: A rgb-d scene understanding benchmark suite. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 567–576, 2015.
260
+
261
+ Zhuotao Tian, Hengshuang Zhao, Michelle Shu, Zhicheng Yang, Ruiyu Li, and Jiaya Jia. Prior guided feature enrichment network for few-shot segmentation. IEEE Transactions on Pattern Analysis & Machine Intelligence, (01):1–1, 2020.
262
+
263
+ Girish Varma, Anbumani Subramanian, Anoop Namboodiri, Manmohan Chandraker, and CV Jawahar. Idd: A dataset for exploring problems of autonomous navigation in unconstrained environments. In 2019 IEEE Winter Conference on Applications of Computer Vision, pp. 1743–1751. IEEE, 2019.
264
+
265
+ Oriol Vinyals, Alexander Toshev, Samy Bengio, and Dumitru Erhan. Show and tell: A neural image caption generator. CoRR, abs/1411.4555, 2014. URL http://arxiv.org/abs/1411.4555.
266
+
267
+ Haochen Wang, Xudong Zhang, Yutao Hu, Yandan Yang, Xianbin Cao, and Xiantong Zhen. Few-shot semantic segmentation with democratic attention networks. In Computer Vision–ECCV 2020: 16th European Conference, Glasgow, UK, August 23–28, 2020, Proceedings, Part XIII 16, pp. 730–746. Springer, 2020.
268
+
269
+ Kaixin Wang, Jun Hao Liew, Yingtian Zou, Daquan Zhou, and Jiashi Feng. Panet: Few-shot image semantic segmentation with prototype alignment. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9197–9206, 2019.
270
+
271
+ Yuxi Wang, Jian Liang, and Zhaoxiang Zhang. Give me your trained model: Domain adaptive semantic segmentation without source data. arXiv preprint arXiv:2106.11653, 2021.
272
+
273
+ Zhirong Wu, Yuanjun Xiong, Stella Yu, and Dahua Lin. Unsupervised feature learning via non-parametric instance-level discrimination. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3733–3742, 2018.
274
+
275
+ Yongqin Xian, Subhabrata Choudhury, Yang He, Bernt Schiele, and Zeynep Akata. Semantic projection network for zero-and few-label semantic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 8256–8265, 2019.
276
+
277
+ Jinyu Yang, Chunyuan Li, Weizhi An, Hehuan Ma, Yuzhi Guo, Yu Rong, Peilin Zhao, and Junzhou Huang. Exploring robustness of unsupervised domain adaptation in semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, 2021.
278
+
279
+ Fisher Yu, Haofeng Chen, Xin Wang, Wenqi Xian, Yingying Chen, Fangchen Liu, Vashisht Madhavan, and Trevor Darrell. Bdd100k: A diverse driving dataset for heterogeneous multitask learning. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2636–2645, 2020.
280
+
281
+ 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, 2020.
282
+
283
+ Chi Zhang, Guosheng Lin, Fayao Liu, Jiushuang Guo, Qingyao Wu, and Rui Yao. Pyramid graph networks with connection attentions for region-based one-shot semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 9587–9595, 2019.
284
+
285
+ Hang Zhang, Chongruo Wu, Zhongyue Zhang, Yi Zhu, Zhi Zhang, Haibin Lin, Yue Sun, Tong He, Jonas Muller, R. Manmatha, Mu Li, and Alexander Smola. Resnest: Split-attention networks. arXiv preprint arXiv:2004.08955, 2020a.
286
+
287
+ Hongjie Zhang, Ang Li, Jie Guo, and Yanwen Guo. Hybrid models for open set recognition. In European Conference on Computer Vision, pp. 102–117. Springer, 2020b.
288
+
289
+ 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.
290
+
291
+ Da-Wei Zhou, Han-Jia Ye, and De-Chuan Zhan. Learning placeholders for open-set recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4401–4410, 2021.
md/dev/SfXjt1FtMQ/SfXjt1FtMQ.md ADDED
@@ -0,0 +1,424 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GmGM: a fast Gaussian graphical model for multi-modal data
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 This paper introduces the Gaussian multi-Graphical Model, a model to construct
11
+ 2 sparse graph representations of matrix- and tensor-variate data. We generalize
12
+ 3 prior work in this area by simultaneously learning this representation across several
13
+ 4 tensors that share axes, which is necessary to allow the analysis of multimodal
14
+ 5 datasets such as those encountered in multi-omics. Our algorithm uses only a
15
+ 6 single eigendecomposition per axis, achieving an order of magnitude speedup over
16
+ 7 prior work in the ungeneralized case. This allows the use of our methodology
17
+ 8 on large multi-modal datasets such as single-cell multi-omics data, which was
18
+ 9 challenging with previous approaches. We validate our model on synthetic data
19
+ 10 and five real-world datasets.
20
+
21
+ # 11 1 Introduction
22
+
23
+ 12 A number of modern applications require the estimation of networks (graphs) exploring the de
24
+ 13 pendency structures underlying the data. In this paper, we propose a new approach for estimating
25
+ 14 conditional dependency graphs. Two datapoints $x , y$ are conditionally independent (with respect to
26
+ 15 a dataset $\mathcal { D }$ ) if knowing one provides no information about the other that is not already contained
27
+ 16 in the rest of the dataset: $\mathbb { P } ( \bar { x } | y , \mathcal { D } _ { \backslash x y } ) = \mathbb { P } ( x | \mathcal { D } _ { \backslash x y } )$ . For normally distributed data, conditional
28
+ 17 dependencies are encoded in the inverse of the covariance matrix (the ‘precision’ matrix). Two
29
+ 18 datapoints are conditionally dependent on each other if and only if their corresponding element in the
30
+ 19 precision matrix is not zero. If our dataset were in the form of a vector $\mathbf { d }$ , we could then model it as
31
+ 20 $\mathbf { \dot { d } } \sim \mathcal { N } ( \mathbf { 0 } , \Psi ^ { - 1 } )$ for precision matrix $\Psi$ . This is a Gaussian Graphical Model (GGM); $\Psi$ encodes
32
+ 21 the graph.
33
+ 22 However, datasets are often more structured than vectors. For example, single-cell RNA sequencing
34
+ 23 datasets (scRNA-seq) come in the form of a matrix of gene expression counts whose rows are cells
35
+ 24 and columns are genes. Video data naturally requires a third-order tensor of pixels to represent
36
+ 25 it - rows, columns, and frames. Furthermore multi-omics datasets such as those including both
37
+ 26 scRNA-seq and scATAC-seq may require two or more matrices to be properly represented; one for
38
+ 27 each modality.
39
+ 28 We could assume that each row of our matrix is an i.i.d. sample drawn from our model. However,
40
+ 29 independence is a strong and often incorrect assumption. If we wanted to make no independence
41
+ 30 assumptions, we could vectorize the dataset $\mathcal { D }$ and estimate $\Psi$ in $\mathrm { v e c } [ \mathcal { D } ] \sim \mathcal { N } ( \mathbf { 0 } , \Psi ^ { - 1 } )$ . However,
42
+ 31 this produces intractably large $\Psi$ , whose number of elements is quadratic in the product of the lengths
43
+ 32 of our dataset’s axes.
44
+ 33 Thankfully, tensors are highly structured, and we are often interested in the dependency structure
45
+ 34 of each axis individually - i.e. the dependencies between samples or the dependencies between
46
+ 35 features - rather than the dependencies between the elements of the tensor themselves. To model this,
47
+ 36 we can represent $\Psi$ as some deterministic combination of the axis-wise dependencies: $\mathrm { v e c } [ \mathbf { D } ] \sim$
48
+ 37 $\mathcal { N } ( \mathbf { 0 } , \zeta ( \Psi _ { \mathrm { r o w } } , \Psi _ { \mathrm { c o l } } ) ^ { - 1 } )$ , for some function $\zeta$ . The strategy is to estimate $\Psi _ { \mathrm { r o w } }$ , $\Psi _ { \mathrm { c o l } }$ directly, without
49
+ 38 computing the intractable $\zeta ( \Psi _ { \mathrm { r o w } } , \Psi _ { \mathrm { c o l } } ) ^ { - \mathrm { i } }$ . While there are multiple choices for $\zeta$ , this paper
50
+ 39 considers only the Kronecker sum.
51
+
52
+ ![](images/33ca9ec56b1460ae7897b2c4509fe84fab43453d8ccbfec3701b0b0a8e8e6934.jpg)
53
+ Figure 1: The two matrices of the LifeLines-DEEP dataset. As both matrices include data for the same people, the learned graph between people should be the same.
54
+
55
+ # 40 1.1 Prior work
56
+
57
+ 41 The Kronecker sum BiGraphical Lasso (BiGLasso) model was first considered by Kalaitzis et al.
58
+ 42 [14]. BiGLasso is the multi-axis analog to graphical lasso methods [10], which are used to estimate
59
+ 43 covariance matrices of data drawn from a multivariate Gaussian distribution. The Kronecker sum
60
+ 44 of two matrices, $\mathbf { A } \oplus \mathbf { B }$ , can be expressed in terms of Kronecker products: $\mathbf { A } \otimes \mathbf { I } + \mathbf { I } \otimes \mathbf { B }$ . When
61
+ 45 the matrices $\mathbf { A } , \mathbf { B }$ are adjacency matrices of graphs, the Kronecker sum has the interpretation as
62
+ 46 the Cartesian product of those graphs. This sum is one choice $\zeta$ to combine the per-axis precision
63
+ 47 matrices into the precision matrix of the vectorized dataset, $\mathrm { v e c } [ \mathbf { \bar { D } } ] \sim \mathcal { N } ( \mathbf { 0 } , ( \Psi _ { \mathrm { r o w } } \mathbf { \hat { \boldsymbol { \Phi } } } \boldsymbol { \Psi } _ { \mathrm { c o l } } \mathbf { \bar { \rho } } ) ^ { - 1 } )$ .
64
+ 48 Other choices for $\zeta$ have been considered, such as using the Kronecker product [23, 8], or the square
65
+ 49 of the Kronecker sum [24, 25]. Each method has its strengths; the benefits of a Kronecker sum
66
+ 50 structure are its interpretability as a graph product, stronger sparsity, and its allowance of inter-task
67
+ 51 transfer [14].
68
+ 52 The original BiGLasso model was very slow to converge to a solution, in large part due to its non
69
+ 53 optimal space complexity of $O ( n ^ { 2 } p ^ { 2 } )$ . This prohibited its use on large datasets (measuring in a
70
+ 54 couple hundred samples and/or features). Numerous modifications have been made to the algorithm
71
+ 55 to improve its speed and achieve an optimal space complexity of $O ( n ^ { 2 } + p ^ { 2 } )$ , such as scBiGLasso
72
+ 56 [17], TeraLasso [12], and EiGLasso [27]. Of these, TeraLasso is notable in that it generalizes to an
73
+ 57 arbitrary number of axes, i.e. $\zeta ( \Psi _ { 1 } , . . . , \Psi _ { k } ) = \Psi _ { 1 } \oplus . . . \oplus \Psi _ { k }$ . TeraLasso and EiGLasso, the fastest
74
+ 58 prior work, both rely on computing an eigendecomposition every iteration.
75
+ 59 All of these algorithms and models, including our own, rely on a normality assumption. We are most
76
+ 60 interested in the case of omics data, in which case a log-transform renders our dataset sufficiently
77
+ 61 Gaussian-like for our algorithm to achieve good performance. An overview of the use of GGMs in
78
+ 62 omics data is given by Altenbuchinger et al. [2].
79
+
80
+ # 63 1.2 Unmet need
81
+
82
+ 64 Many datasets, especially those in multi-omics, are representable as a collection of matrices or tensors.
83
+ 65 As a case study, we consider (a subset of) the Lifelines-DEEP dataset from Tigchelaar et al. [22],
84
+ 66 which is summarized graphically in Figure 1.
85
+ 67 In this dataset, two different modalities of data were gathered from the same people: counts of
86
+ 68 microbial species found in their stools (metagenomics) and counts of metabolites found in their
87
+ 69 blood plasma (metabolomics). While different matrices, each modality shares an axis. If we were to
88
+ 70 estimate a graph of people on each modality independently, they would likely yield different graphs.
89
+ 71 This is not ideal; if our aim is to estimate the true graph of conditional dependencies, there should be
90
+ 72 only one resultant graph. To estimate it, we should be considering both modalities simultaneously.
91
+ 73 One way to do this would be to concatenate the modalities, producing a matrix of people by
92
+ 74 "species+metabolites". This could yield interesting results, if one is interested in connections between
93
+ 75 individual species and a metabolite. However, it would increase the size of the output graph, which
94
+ 76 grows quadratically in the length of the axis. Furthermore, it is not always possible or feasible; some
95
+ 77 datasets may not be concatenatable. We visually demonstrate some cases where concatenation fails
96
+ 78 in Figure 2.
97
+
98
+ ![](images/6cef0776eb7b7093f0d7fbe7a289d4f8e68f9a96bf213d83b77dd9502809aeb6.jpg)
99
+ Figure 2: (A) A hypothetical dataset whose structure cannot be reduced to a single tensor by concatenation. Concatenating would lead to a block of missing values for a hypothetical (and nonsensical) species by elements matrix. (B) A hypothetical single-cell RNA-sequencing dataset procured from multiple patients. Concatenation is possible, but would lead to a very large output graph for a modest number of patients.
100
+
101
+ # 79 1.3 Our contributions
102
+
103
+ 80 We introduce a novel method to extend the use of Gaussian Graphical Models to multi-tensor datasets.
104
+ 81 This extension is essential to model conditional dependencies in multimodal datasets such as those
105
+ 82 frequently occurring in multi-omics. We present an efficient algorithm to estimate these conditional
106
+ 83 dependencies. When restricted to the single-tensor case, our algorithm is much faster than previous
107
+ 84 algorithms that estimated conditional dependency graphs for each axis, such as TeraLasso[12] and
108
+ 85 EiGLasso[27].
109
+
110
+ # 2 Methods
111
+
112
+ # 2.1 Notation
113
+
114
+ In prior work, a single-tensor dataset $\mathcal { D }$ is modelled as vec $[ \mathcal { D } ] \sim \mathcal { N } \left( \mathbf { 0 } , ( \oplus _ { \ell } \Psi _ { \ell } ) ^ { - 1 } \right)$ , also written as $\mathcal { D } \sim \mathcal { N } _ { K S } \left( \{ \Psi _ { \ell } \} _ { \ell } \right)$ .
115
+
116
+ 90 Our model considers multiple tensors, each with their own (potentially shared) axes. We aim to
117
+ 91 estimate the precision matrices $\Psi _ { \ell }$ for each axis $\ell$ of each tensor $\mathcal { D } ^ { \gamma }$ , indexed by $\gamma \in \mathbb { N }$ . To describe
118
+ 92 that an axis $\ell$ is one of the axes of a tensor $\mathcal { D } ^ { \gamma }$ , we will write $\ell \in \gamma$ . Some values will be indexed
119
+ 93 by both an axis and a tensor; for consistency we will use subscripts to denote axes (typically $\ell$ ) and
120
+ 94 superscripts to denote tensors (typically $\gamma$ ). $d _ { \breve { \breve { \breve { \breve { \tau } } } } } ^ { \gamma }$ will represent the number of elements in $\mathcal { D } ^ { \gamma }$ , and
121
+ 95 $\begin{array} { r } { d \check { \forall } = \sum _ { \gamma } \dot { d } _ { \forall } ^ { \gamma } } \end{array}$ .
122
+ 96 An important concept is the Gram matrix $\mathbf { S } _ { \ell } ^ { \gamma }$ . In the single-tensor case, this is a sufficient statistic; all
123
+ 97 prior work first computes these matrices as the first step in their algorithm. Let $\mathrm { m a t } _ { \ell } \left[ \mathcal { D } ^ { \gamma } \right]$ represent
124
+ 98 the "matricization" of $\mathcal { D } ^ { \gamma }$ along axis $\ell$ , then $\mathbf { S } _ { \ell } ^ { \gamma } = \operatorname* { m a t } _ { \ell } \left[ \mathcal { D } ^ { \gamma } \right] \operatorname* { m a t } _ { \ell } \left[ \mathcal { D } ^ { \gamma } \right] ^ { T }$ . The matricization of a
125
+ 99 tensor picks one axis, $\ell$ , to index the rows, and flattens the rest out into columns. Note that for
126
+ 100 a matrix $\mathbf { M } , \mathrm { m a t } _ { \mathrm { c o l u m n s } } \left[ \mathbf { M } \right] = \mathbf { M } ^ { T }$ . Rather than $\mathbf { S } _ { \ell } ^ { \gamma }$ , we consider the "effective Gram matrices"
127
+ 101 $\begin{array} { r } { \mathbf { S } _ { \ell } = \sum _ { \gamma | \ell \in \gamma } \mathbf { S } _ { \ell } ^ { \gamma } } \end{array}$ , as these fulfill the role of the Gram matrices in the multi-tensor case.
128
+
129
+ # 02 2.2 The model
130
+
131
+ 103 To properly handle sets of tensors, we propose modelling each tensor as being drawn independently
132
+ 104 from a Kronecker-sum normal distribution. If the tensors share an axis $\ell$ , then they will still be drawn
133
+ 105 independently - but their distributions will be parameterized by the same $\Psi _ { \ell }$ . For an arbitrary set of
134
+ 106 tensors, the model is:
135
+
136
+ $$
137
+ \begin{array} { r } { \mathcal { D } ^ { \gamma } \sim \mathcal { N } _ { K S } \left( \{ \Psi _ { \ell } \} _ { \ell \in \gamma } \right) } \\ { \mathrm { f o r } \mathcal { D } ^ { \gamma } \in \{ \mathcal { D } ^ { \gamma } \} _ { \gamma } } \end{array}
138
+ $$
139
+
140
+ 107 We call this model the "Gaussian multi-Graphical Model" (GmGM) as it extends Gaussian Graphical
141
+ 108 Models to estimate multiple graphs from a set of tensors. In this paper, we will make the assumption
142
+ 109 that no tensor in our set contains the same axis twice - notably, covariance matrices would violate
143
+ 110 this assumption. Any tensor with a repeated axis would naturally be interpretable as a graph - such
144
+ 111 datasets are rare, and if one already has a graph the need for an algorithm such as this is diminished.
145
+
146
+ As an example, we model the LifeLines-DEEP dataset Dmetagenomics and Dmetabolomics 112 indepen113 dently as:
147
+
148
+ $$
149
+ \begin{array} { r l } & { \mathbf { D } ^ { \mathrm { m e t a g e n o m i c s } } \sim \mathcal { N } _ { K S } \left( \Psi _ { \mathrm { p e o p l e } } , \Psi _ { \mathrm { s p e c i e s } } \right) } \\ & { \mathbf { D } ^ { \mathrm { m e t a b o l o m i c s } } \sim \mathcal { N } _ { K S } \left( \Psi _ { \mathrm { p e o p l e } } , \Psi _ { \mathrm { m e t a b o l i t e s } } \right) } \end{array}
150
+ $$
151
+
152
+ # 114 2.3 The algorithm
153
+
154
+ 115 Here, we present an algorithm to compute the maximum likelihood estimate (MLE) jointly for all
155
+ 116 parameters $\Psi _ { \ell }$ of the GmGM. The general idea is to produce an analytic estimate for the eigenvectors
156
+ 117 of $\Psi _ { \ell }$ , and then iterate to solve for the eigenvalues; this is summed up graphically in Figure 3.
157
+
158
+ 118 In the supplementary material, we derive the following:
159
+
160
+ $$
161
+ \begin{array} { r } { p ( \{ \mathcal { D } ^ { \gamma } \} ) = \frac { \displaystyle \prod _ { \gamma } \sqrt { \left| \bigoplus _ { \ell \in \gamma } \Psi _ { \ell } \right| } } { \displaystyle ( 2 \pi ) ^ { \frac { d _ { \psi } } { 2 } } } e ^ { \frac { - 1 } { 2 } \sum _ { \ell } \mathrm { t r } [ \Psi _ { \ell } \mathbf { S } _ { \ell } ] } } \\ { \mathrm { N L L } \left[ \{ \mathcal { D } ^ { \gamma } \} \right] \propto \displaystyle \sum _ { \ell } \mathrm { t r } \left[ \Psi _ { \ell } \mathbf { S } _ { \ell } \right] - \sum _ { \gamma } \log \left| \bigoplus _ { \ell \in \gamma } \Psi _ { \ell } \right| } \end{array}
162
+ $$
163
+
164
+ (pdf of GmGM)
165
+
166
+ (negative log likelihood)
167
+
168
+ 119 From this, we can observe that the effective Gram matrices $\mathbf { S } _ { \ell }$ form a set of sufficient statistics for
169
+ 120 our distribution. Furthermore, the log-likelihood is the sum of log-likelihoods in the single-axis case,
170
+ 121 thus preserving convexity of the loss function.
171
+ 22 Theorem 1. Let $\mathbf { V } _ { \ell } \mathbf { e } _ { \ell } \mathbf { V } _ { \ell } ^ { T }$ be the eigendecomposition of $\mathbf { S } _ { \ell }$ (where $\mathbf { V } _ { \ell } \in \mathbb { R } ^ { d _ { \ell } \times d _ { \ell } }$ and $\mathbf { e } _ { \ell } \in \mathbb { R } ^ { d _ { \ell } \times d _ { \ell } }$
172
+ 123 is a diagonal matrix). Then $\mathbf { V } _ { \ell }$ are the eigenvectors of the maximum likelihood estimate of $\Psi _ { \ell }$ .
173
+ 124 Theorem 1 is critical to allowing efficient estimation of $\Psi _ { \ell }$ , as it not only allows us to extract the
174
+ 125 computationally intensive eigendecomposition operation from the iterative portion of the algorithm,
175
+ 126 but also reduces the number of parameters to be linear in the length of an axis.
176
+
177
+ 127 To find the eigenvalues $\mathbf { \Delta } \Lambda _ { \ell }$ of $\Psi _ { \ell }$ , we produce the second theorem:
178
+
179
+ ![](images/c745f0a60bb4d1028aa6fe2aa662f9c81b432db1e0664152bfb36f4164dab7f9.jpg)
180
+ Figure 3: A graphical overview of how the GmGM algorithm works. We use $\gamma$ to represent an arbitrary modality, and $\ell$ to represent an arbitrary axis. Proofs are given in the supplementary material.
181
+
182
+ Theorem 2. Let $\{ \mathbf { G } _ { \ell } ^ { \gamma } \}$ be matrices such that the expression $\oplus _ { \ell \in \gamma } \mathbf { G } _ { \ell } ^ { \gamma }$ is the best Frobenius-norm approximation of $\left( \oplus _ { \ell \in \gamma } \mathbf { \Lambda } \mathbf { \Lambda } \mathbf { \Lambda } \mathbf { \Lambda } _ { \ell } ^ { t } \right) ^ { - 1 }$ . Then, for a learning rate $\mu _ { t }$ , gradient descent can be performed with the update equation $\begin{array} { r } { \pmb { \Lambda } _ { \ell } ^ { t + 1 } = \pmb { \Lambda } _ { \ell } ^ { t } - \mu _ { t } \left[ \mathbf { e } _ { \ell } - \sum _ { \gamma | \ell \in \gamma } \mathbf { G } _ { \ell } ^ { \gamma } \right] } \end{array}$ . As $\Psi _ { \ell }$ is positive definite, $\mu _ { t }$ must be chosen to prevent $\Lambda _ { \ell } ^ { t }$ from becoming negative.
183
+
184
+ 132 While the definition of $\mathbf { G } _ { \ell } ^ { \gamma }$ is technical, it is analogous to the notion of the blockwise-trace from
185
+ 133 Kalaitzis et al. [14] and $\mathrm { p r o j } _ { \kappa }$ from Greenewald, Zhou, and Hero III [12]. Proofs of Theorems 1
186
+ 134 and 2, along with a method to compute $\mathbf { G } _ { \ell } ^ { \gamma }$ , are given in the supplementary material. Overall, our
187
+ 135 algorithm is described in the pseudocode at the top of the next page.
188
+ 136 For regularization, one can choose to either keep the top $p \%$ of edges, or keep the top $k$ edges per
189
+ 137 vertex (for parameters $p , k )$ . The incorporation of more advanced regularizers, such as Lasso, would
190
+ 138 require an eigen-recomposition on each iteration, which would be much slower. As we demonstrate
191
+ 139 empirically in Section 3, it is not necessary to use advanced regularizers to recover the graph structure
192
+ 140 to the same precision as prior work.
193
+
194
+ # The GmGM algorithm
195
+
196
+ Input: $\{ \mathcal { D } _ { i } ^ { \gamma } \}$ , tolerance
197
+ Output: $\{ \Psi _ { \ell } \}$
198
+ 1: for 1 ≤ ℓ ≤ K
199
+ 2: Sℓ ← Pγ |ℓ∈γ 1nγ Pnγi matℓ [Dγi ] matℓ [Dγi ]T
200
+ 3: Vℓ ← eigenvectors[Sℓ]
201
+ 4: eℓ ← eigenvalues[Sℓ]
202
+ 5: end for
203
+ 6 $\vdots \stackrel { \wedge } { \underset { \mu 1 } { \longrightarrow } } [ 1 \quad \cdots \quad 1 ] ^ { T }$
204
+ 7
205
+ 8: while not converged
206
+ 9: for $1 \leq \ell \leq \bar { K }$
207
+ 10: $\begin{array} { r l } & { \mathbf { \mu } _ { \mathbf { G } _ { \ell } ^ { \gamma } } ^ { \mathbf { 1 } } \mathrm { p r o j } _ { K S } [ ( \bigoplus _ { \ell ^ { \prime } \in \gamma } \mathbf { \Lambda } _ { \Lambda _ { \ell } } ) ^ { - 1 } ] } \\ & { \mathbf { \Lambda } _ { \mathbf { A } _ { \ell } ^ { \prime } } ^ { \mathbf { 1 } } \mathbf { \Lambda } _ { \mathbf { A } _ { \ell } } - \mu [ \mathbf { e } _ { \ell } - \sum _ { \gamma | \ell \in \gamma } \mathbf { G } _ { \ell _ { \ell } } ^ { \gamma } ] } \end{array}$
208
+ 11:
209
+ 12: end for
210
+ 13: for 1 ≤ ℓ ≤ K
211
+ 14: Λℓ ← Λ′ℓ
212
+ 15: end for
213
+ 16: for $\gamma$
214
+ 17: if $\sum _ { \ell \in \gamma } \operatorname* { m i n } \pmb { \Lambda } _ { \ell } <$ < tolerance then
215
+ 18: decrease $\mu$ so that this result is sufficiently far from zero
216
+ 19: end if
217
+ 20: end for
218
+ 21: end while
219
+ 22: for 1 ≤ ℓ ≤ K
220
+ 23: ${ \Psi } _ { \ell } \gets { \bf V } _ { \ell } { \bf A } _ { \ell } { \bf V } _ { \ell } ^ { T }$
221
+ 24: end for
222
+
223
+ # 3 Results
224
+
225
+ We tested our algorithm on synthetic data and five real-world datasets. Explanations of data generation, collection, preprocessing, and regularization are given in the supplementary material.
226
+
227
+ # 3.1 Synthetic Data
228
+
229
+ We verified that our algorithm was indeed faster on matrix-variate data compared to prior work (Figure 4) on our computer (Ubuntu 20.04 with Intel Core i7 Processor and 8GB RAM). Our results on matrix data are encouraging - extrapolating the runtimes, datasets up to size 16,000 by 16,000 could have their graphs estimated in less than an hour. Larger datasets would require more than 6GB of memory for our algorithm to run, pushing the limits of RAM. Our algorithm was not significantly faster on higher-order tensor data (see the supplementary material). This is due to the complexity of computing the Gram matrices, which grows exponentially with the number of axes.
230
+
231
+ 152 In addition to these speed improvements, we show that we perform equivalently to state-of-the-art
232
+ 153 on matrix data (Figure 5a). On higher-order tensor data, we are outperformed by TeraLasso, which
233
+ 154 is able to achieve near-perfect recovery of the graphs. We believe this is due to our algorithm’s use
234
+ 155 of thresholding rather than a more advanced regularization technique. Since our speed gains are
235
+ 156 not significant relative to TeraLasso, on higher-order tensor data without shared axes one should
236
+ 157 prefer TeraLasso to GmGM. Finally, we demonstrate that taking into account shared axes does indeed
237
+ 158 improve performance (see blue line, Figure 5b). Prior work could not take this into account.
238
+
239
+ # 3.2 Real Data
240
+
241
+ 160 We tested our method on various real datasets. These include two video datasets (COIL-20 [19] and
242
+ 161 EchoNet-Dynamic [20]), a transcriptomics dataset (E-MTAB-2805 [5]), and two multi-omics datasets
243
+ 162 (LifeLines-DEEP [22] and a $1 0 \mathrm { x }$ Genomics dataset [1]).
244
+ 163 The E-MTAB-2805 dataset consists of transcriptomics data for individual cells split into three groups
245
+ 164 by their stage in the cell cycle (G, S, and G2/M). If our estimated precision matrices had a 3x3
246
+ 165 block-diagonal structure, this would indicate that it had recreated this grouping. This is not what we
247
+ 166 see, but we do see a 3x3 block matrix structure (Figure 6a). We found that cells in the DNA synthesis
248
+ 167 stage (S) had few connections between them, and that there were many connections between the G1
249
+ 168 and G2/M stages. This result is biologically plausible, as cells in the synthesis stage are the most
250
+ 169 variable.
251
+ 170 The results on EchoNet-Dynamic (Figure 6b) are much more encouraging, as we would expect a
252
+ 171 periodic structure due to the beating of the heart. A precision matrix with repeating diagonals is what
253
+ 172 we would expect to see in this case, which is what our algorithm produces. In the supplementary
254
+ 173 material, we further verify that this corresponds to a heartbeat by using the repetition to accurately
255
+ 174 predict the opening of the mitral valve in the video.
256
+ 175 The duck video in the COIL-20 dataset was considered in the original BiGLasso paper [14], in which
257
+ 176 they showed that their algorithm could recover the ordering of the frames of the video. To do this they
258
+ 177 had to heavily downsample the image (to a $9 \mathrm { x } 9$ image with half the frames), and flatten the rows and
259
+ 178 frames into a single axis. Due to the speed improvements of our algorithm, and its ability to handle
260
+ 179 tensor-variate data, we were able to run our algorithm on the raw, unprocessed data and achieve a
261
+ 180 similar result in negligible time. Specifically, the reconstruction of the frames had an accuracy of
262
+ 181 $9 9 \%$ .
263
+ 182 Prior work by Prost, Gazut, and Brüls [21] used assortativity to assess their validity of the species
264
+ 183 graph estimated by their model on the LifeLines-DEEP metagenomics dataset. Assortativity repre
265
+ 184 sents the tendency of related species to cluster together in the graph. A random graph would have
266
+ 185 an assortativity of zero, but we would expect moderate assortativity in the true network as similar
267
+ 186 species may fulfill similar roles in the gut microbiome. Our assortativity is comparable to prior work
268
+ 187 (Figure 7). We also found that our graphs were more robust to noise than prior work; we analyze this
269
+ 188 in the supplementary material.
270
+ 189 Finally, we tested our approach on a 10x Genomics single-cell (RNA $+$ ATAC) dataset taken from a
271
+ 190 B Cell lymphoma tumour. We demonstrate that the clusters we find (using Louvain clustering[3])
272
+ 191 on the graph remain visually cohesive when projected into lower-dimensional space by UMAP[18]
273
+ 192 (Figure 8). In particular, the disconnected “islands” in UMAP correspond to their own cluster on the
274
+ 193 graph as well. As these island-clusters were arrived at independently through two methods, UMAP
275
+ 194 and our algorithm, it increases our confidence in the validity of the clustering. In the supplementary
276
+ 195 material, we verify that these clusters do represent distinct groups via a GO term enrichment analysis.
277
+ 196 Our overall approach has been implemented in Python. All of the code to run the algorithm and
278
+ 197 recreate the experiments has been made publicly available on GitHub; https://github.com/NeurIPS
279
+ 198 GmGM-Paper/GmGM.
280
+
281
+ ![](images/adf75c680df1627b4e583204f9c235d92619010c815d66d9cc9ac33e931b16d9.jpg)
282
+ Figure 4: A comparison of the runtimes of our algorithm against (a) bi-graphical and (b) tensorgraphical prior work. Runtimes were averaged over 5 runs.
283
+
284
+ ![](images/fe28e6abee872ced025d8f211a7d3a9623c3b39d9451928e3d9e90a6e829f38f.jpg)
285
+ Figure 5: (a) Precision-recall curves comparing various algorithms on synthetic $5 0 \mathrm { x } 5 0$ matrix data. (b) Precision-recall curves comparing our algorithm on two $5 0 \mathrm { x } 5 0$ matrices with one shared axis. We considered both modalities simultaneously (blue) and an individual modality (red, orange). In both subfigures, each edge of the true graphs was generated independently with probability $\frac { 1 } { 5 }$ .
286
+
287
+ ![](images/fbc2cd5b1d52cd96c55ea92f177245ea6f124c0513023e7e67a96549ef2821d7.jpg)
288
+ Figure 6: The estimated precision matrices on the E-MTAB-2805 dataset (a) and the EchoNetDynamic dataset (b). Yellow represents an edge and purple represents the lack of an edge. The E-MTAB-2805 cells have been grouped together by cell cycle stage, in the order G, S, and G2/M.
289
+
290
+ ![](images/860cbfbc342cbb12b6484a8c57d4f69382fce3aa91bdbc76442be0f97d273bb1.jpg)
291
+ Figure 7: Assortativity with increasing regulatization in the LifeLines-DEEP dataset, comparing our method with the Zero-inflated Log-Normal (ZiLN) model. In one case we show the performance of our algorithm restricted to the metagenomics dataset (a) and when augmented with the metabolomics dataset (b). In both cases, ZiLN is only trained on the metagenomics dataset, as it is a single-axis model.
292
+
293
+ ![](images/bc6bf907b9b5296b0c6fbfd071d89fc068a9ca33994ea71c4f3433b32778adf6.jpg)
294
+ Figure 8: Two plots of the same cells from the $1 0 \mathrm { x }$ Genomics dataset, displayed via UMAP [18] (a) and the Fruchterman-Reingold layout algorithm[11] (b). Colors are based on Louvain clustering[3] of the graph, and represent the same clustering in both figures.
295
+
296
+ # 199 4 Limitations
297
+
298
+ 200 Our method uses thresholding rather than more sophisticated regularizers. However, there is no
299
+ 201 fundamental barrier preventing our algorithm from allowing regularizers at the cost of an eigen
300
+ 202 recomposition per iteration. This would increase the asymptotic complexity of the iterative portion
301
+ 203 of our algorithm, making it questionable whether any gains in precision would be worth the loss in
302
+ 204 efficiency.
303
+ 205 Our method assumes that no tensor has a repeated axis (i.e. a matrix of people by people rather than
304
+ 206 people by species). If there is a repeated axis, one can no longer analytically find the eigenvectors of
305
+ 207 the MLE, at least by our methods. This is not a substantial issue, as such datasets are uncommon and
306
+ 208 already represent graphs. Rather than extending the algorithm to work with repeated-axis tensors, it
307
+ 209 would be more fruitful to extend it to work with priors.
308
+ 210 When considering multi-tensor datasets, it may be the case that two axes only partially overlap. For
309
+ 211 example, the full LifeLines-DEEP dataset contains a second (follow-up) metagenomics dataset for a
310
+ 212 third of the study participants; two thirds of the patients are missing from this dataset. We do not
311
+ 213 make an attempt to handle this type of missing data, even though missing data shows up in many
312
+ 214 applications. The lack of ability to handle missing data is a major limitation of our algorithm. It is
313
+ 215 nontrivial to extend the algorithm to handle this case, as it renders Theorem 1 ineffective and hence
314
+ 216 removes the speed advantage we attained. Prior work has not addressed this problem, as it only exists
315
+ 217 in multi-tensor datasets and we are the first to consider this case.
316
+
317
+ # 218 5 Conclusion
318
+
319
+ We have created a novel model, GmGM, which successfully generalizes Gaussian graphical models to the common scenario of multi-tensor datasets. Furthermore, we demonstrated that our algorithm is significantly faster than prior work focusing on Gaussian tensor-graphical models such as EiGLasso and TeraLasso while still preserving state-of-the-art performance. These speed improvements allow tensor-graphical models to be applied to datasets with axes of length in the thousands. Finally, we demonstrated the application of our algorithm on five real-world datasets to prove its efficacy.
320
+
321
+ 225 References
322
+ 226 [1] 10x Genomics. Flash-Frozen Lymph Node with B Cell Lymphoma (14k sorted nuclei). en. May
323
+ 227 2021. URL: https://www.10xgenomics.com/resources/datasets/fresh-frozen
324
+ 228 lymph-node-with-b-cell-lymphoma-14-k-sorted-nuclei-1-standard-2-0-0
325
+ 229 (visited on 05/10/2023).
326
+ 230 [2] Michael Altenbuchinger et al. “Gaussian and Mixed Graphical Models as (multi-)omics
327
+ 231 data analysis tools”. en. In: Biochimica et Biophysica Acta (BBA) - Gene Regulatory
328
+ 232 Mechanisms. Transcriptional Profiles and Regulatory Gene Networks 1863.6 (June 2020),
329
+ 233 p. 194418. ISSN: 1874-9399. DOI: 10 . 1016 / j . bbagrm . 2019 . 194418. URL: https :
330
+ 234 //www.sciencedirect.com/science/article/pii/S187493991930224X (visited on
331
+ 235 02/24/2023).
332
+ 236 [3] Vincent D. Blondel et al. “Fast unfolding of communities in large networks”. In: Journal of
333
+ 237 Statistical Mechanics: Theory and Experiment 2008.10 (Oct. 2008). arXiv:0803.0476 [cond
334
+ 238 mat, physics:physics], P10008. ISSN: 1742-5468. DOI: 10.1088/1742- 5468/2008/10/
335
+ 239 P10008. URL: http://arxiv.org/abs/0803.0476 (visited on 05/16/2023).
336
+ 240 [4] Danila Bredikhin, Ilia Kats, and Oliver Stegle. “MUON: multimodal omics analysis frame
337
+ 241 work”. In: Genome Biology 23.1 (Feb. 2022), p. 42. ISSN: 1474-760X. DOI: 10.1186/s13059-
338
+ 242 021- 02577- 8. URL: https://doi.org/10.1186/s13059- 021- 02577- 8 (visited on
339
+ 243 05/16/2023).
340
+ 244 [5] Florian Buettner et al. “Computational analysis of cell-to-cell heterogeneity in single-cell
341
+ 245 RNA-sequencing data reveals hidden subpopulations of cells”. en. In: Nature Biotechnology
342
+ 246 33.2 (Feb. 2015). Number: 2 Publisher: Nature Publishing Group, pp. 155–160. ISSN: 1546-
343
+ 247 1696. DOI: 10.1038/nbt.3102. URL: https://www.nature.com/articles/nbt.3102
344
+ 248 (visited on 05/10/2023).
345
+ 249 [6] Thomas A. Caswell et al. matplotlib/matplotlib: REL: v3.7.1. Mar. 2023. DOI: 10.5281/
346
+ 250 zenodo.7697899. URL: https://zenodo.org/record/7697899 (visited on 05/16/2023).
347
+ 251 [7] Gabor Csardi and Tamas Nepusz. “The Igraph Software Package for Complex Network
348
+ 252 Research”. In: InterJournal Complex Systems (Nov. 2005), p. 1695.
349
+ 253 [8] Andy Dahl et al. Network inference in matrix-variate Gaussian models with non-independent
350
+ 254 noise. arXiv:1312.1622 [stat]. Dec. 2013. DOI: 10.48550/arXiv.1312.1622. URL: http:
351
+ 255 //arxiv.org/abs/1312.1622 (visited on 02/27/2023).
352
+ 256 [9] Pan Du, Warren A. Kibbe, and Simon M. Lin. “Improved peak detection in mass spectrum by
353
+ 257 incorporating continuous wavelet transform-based pattern matching”. In: Bioinformatics 22.17
354
+ 258 (Sept. 2006), pp. 2059–2065. ISSN: 1367-4803. DOI: 10.1093/bioinformatics/btl355.
355
+ 259 URL: https://doi.org/10.1093/bioinformatics/btl355 (visited on 05/11/2023).
356
+ 260 [10] Jerome Friedman, Trevor Hastie, and Robert Tibshirani. “Sparse inverse covariance estima
357
+ 261 tion with the graphical lasso”. In: Biostatistics 9.3 (July 2008), pp. 432–441. ISSN: 1465-
358
+ 262 4644. DOI: 10 . 1093 / biostatistics / kxm045. URL: https : / / doi . org / 10 . 1093 /
359
+ 263 biostatistics/kxm045 (visited on 05/09/2023).
360
+ 264 [11] Thomas M. J. Fruchterman and Edward M. Reingold. “Graph drawing by force
361
+ 265 directed placement”. en. In: Software: Practice and Experience 21.11 (1991). _eprint:
362
+ 266 https://onlinelibrary.wiley.com/doi/pdf/10.1002/spe.4380211102, pp. 1129–1164. ISSN: 1097-
363
+ 267 024X. DOI: 10.1002/spe.4380211102. URL: https://onlinelibrary.wiley.com/
364
+ 268 doi/abs/10.1002/spe.4380211102 (visited on 05/16/2023).
365
+ 269 [12] Kristjan Greenewald, Shuheng Zhou, and Alfred Hero III. Tensor Graphical Lasso (TeraLasso).
366
+ 270 arXiv:1705.03983 [stat]. Sept. 2019. URL: http://arxiv.org/abs/1705.03983 (visited
367
+ 271 on 02/24/2023).
368
+ 272 [13] Charles R. Harris et al. “Array programming with NumPy”. en. In: Nature 585.7825 (Sept.
369
+ 273 2020). Number: 7825 Publisher: Nature Publishing Group, pp. 357–362. ISSN: 1476-4687. DOI:
370
+ 274 10.1038/s41586-020-2649-2. URL: https://www.nature.com/articles/s41586-
371
+ 275 020-2649-2 (visited on 05/16/2023).
372
+ 276 [14] Alfredo Kalaitzis et al. “The Bigraphical Lasso”. en. In: Proceedings of the 30th International
373
+ 277 Conference on Machine Learning. ISSN: 1938-7228. PMLR, May 2013, pp. 1229–1237. URL:
374
+ 278 https://proceedings.mlr.press/v28/kalaitzis13.html (visited on 02/24/2023).
375
+ 279 [15] Tamara Kolda. Multilinear operators for higher-order decompositions. en. Tech. rep.
376
+ 280 SAND2006-2081, 923081. Apr. 2006, SAND2006–2081, 923081. DOI: 10.2172/923081.
377
+ 281 URL: https://www.osti.gov/servlets/purl/923081/ (visited on 05/05/2023).
378
+ 282 [16] Tamara G. Kolda and Brett W. Bader. “Tensor Decompositions and Applications”. en. In:
379
+ 283 SIAM Review 51.3 (Aug. 2009), pp. 455–500. ISSN: 0036-1445, 1095-7200. DOI: 10.1137/
380
+ 284 07070111X. URL: http : / / epubs . siam . org / doi / 10 . 1137 / 07070111X (visited on
381
+ 285 02/26/2023).
382
+ 286 [17] Sijia Li et al. Scalable Bigraphical Lasso: Two-way Sparse Network Inference for Count
383
+ 287 Data. arXiv:2203.07912 [cs, stat]. Mar. 2022. URL: http://arxiv.org/abs/2203.07912
384
+ 288 (visited on 02/24/2023).
385
+ 289 [18] Leland McInnes, John Healy, and James Melville. UMAP: Uniform Manifold Approximation
386
+ 290 and Projection for Dimension Reduction. arXiv:1802.03426 [cs, stat]. Sept. 2020. DOI: 10.
387
+ 291 48550/arXiv.1802.03426. URL: http://arxiv.org/abs/1802.03426 (visited on
388
+ 292 05/10/2023).
389
+ 293 [19] Sameer A Nene, Shree K Nayar, and Hiroshi Murase. “Columbia Object Image Library
390
+ 294 (COIL-20)”. en. In: ().
391
+ 295 [20] David Ouyang et al. “Video-based AI for beat-to-beat assessment of cardiac function”. en. In:
392
+ 296 Nature 580.7802 (Apr. 2020). Number: 7802 Publisher: Nature Publishing Group, pp. 252–256.
393
+ 297 ISSN: 1476-4687. DOI: 10.1038/s41586-020-2145-8. URL: https://www.nature.com/
394
+ 298 articles/s41586-020-2145-8 (visited on 05/10/2023).
395
+ 299 [21] Vincent Prost, Stéphane Gazut, and Thomas Brüls. “A zero inflated log-normal model for
396
+ 300 inference of sparse microbial association networks”. en. In: PLOS Computational Biology
397
+ 301 17.6 (June 2021). Publisher: Public Library of Science, e1009089. ISSN: 1553-7358. DOI: 10.
398
+ 302 1371/journal.pcbi.1009089. URL: https://journals.plos.org/ploscompbiol/
399
+ 303 article?id ${ \tt = } 1 0$ .1371/journal.pcbi.1009089 (visited on 02/24/2023).
400
+ 304 [22] Ettje F. Tigchelaar et al. “Cohort profile: LifeLines DEEP, a prospective, general population
401
+ 305 cohort study in the northern Netherlands: study design and baseline characteristics”. en. In:
402
+ 306 BMJ Open 5.8 (Aug. 2015). Publisher: British Medical Journal Publishing Group Section: Epi
403
+ 307 demiology, e006772. ISSN: 2044-6055, 2044-6055. DOI: 10.1136/bmjopen-2014-006772.
404
+ 308 URL: https://bmjopen.bmj.com/content/5/8/e006772 (visited on 04/30/2023).
405
+ 309 [23] Theodoros Tsiligkaridis, Alfred O. Hero III, and Shuheng Zhou. “Convergence Properties
406
+ 310 of Kronecker Graphical Lasso Algorithms”. In: IEEE Transactions on Signal Processing
407
+ 311 61.7 (Apr. 2013). arXiv:1204.0585 [stat], pp. 1743–1755. ISSN: 1053-587X, 1941-0476. DOI:
408
+ 312 10.1109/TSP.2013.2240157. URL: http://arxiv.org/abs/1204.0585 (visited on
409
+ 313 02/27/2023).
410
+ 314 [24] Yu Wang and Alfred Hero. “SG-PALM: a Fast Physically Interpretable Tensor Graphical
411
+ 315 Model”. en. In: Proceedings of the 38th International Conference on Machine Learning.
412
+ 316 ISSN: 2640-3498. PMLR, July 2021, pp. 10783–10793. URL: https://proceedings.mlr.
413
+ 317 press/v139/wang21k.html (visited on 02/27/2023).
414
+ 318 [25] Yu Wang, Byoungwook Jang, and Alfred Hero. The Sylvester Graphical Lasso (SyGlasso).
415
+ 319 arXiv:2002.00288 [cs, stat]. Feb. 2020. DOI: 10.48550/arXiv.2002.00288. URL: http:
416
+ 320 //arxiv.org/abs/2002.00288 (visited on 02/27/2023).
417
+ 321 [26] F. Alexander Wolf, Philipp Angerer, and Fabian J. Theis. “SCANPY: large-scale single-cell
418
+ 322 gene expression data analysis”. In: Genome Biology 19.1 (Feb. 2018), p. 15. ISSN: 1474-760X.
419
+ 323 DOI: 10.1186/s13059-017-1382-0. URL: https://doi.org/10.1186/s13059-017-
420
+ 324 1382-0 (visited on 05/16/2023).
421
+ 325 [27] Jun Ho Yoon and Seyoung Kim. “EiGLasso: Scalable Estimation of Cartesian Product of Sparse
422
+ 326 Inverse Covariance Matrices”. en. In: Proceedings of the 36th Conference on Uncertainty
423
+ 327 in Artificial Intelligence (UAI). ISSN: 2640-3498. PMLR, Aug. 2020, pp. 1248–1257. URL:
424
+ 328 https://proceedings.mlr.press/v124/ho-yoon20a.html (visited on 02/24/2023).
md/dev/TW7d65uYu5M/TW7d65uYu5M.md ADDED
@@ -0,0 +1,447 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VOS: LEARNING WHAT YOU DON’T KNOW BY VIRTUAL OUTLIER SYNTHESIS
2
+
3
+ Xuefeng Du, Zhaoning Wang, Mu Cai, Yixuan Li
4
+
5
+ Department of Computer Sciences University of Wisconsin - Madison {xfdu,mucai,sharonli}@cs.wisc.edu
6
+
7
+ # ABSTRACT
8
+
9
+ Out-of-distribution (OOD) detection has received much attention lately due to its importance in the safe deployment of neural networks. One of the key challenges is that models lack supervision signals from unknown data, and as a result, can produce overconfident predictions on OOD data. Previous approaches rely on real outlier datasets for model regularization, which can be costly and sometimes infeasible to obtain in practice. In this paper, we present VOS, a novel framework for OOD detection by adaptively synthesizing virtual outliers that can meaningfully regularize the model’s decision boundary during training. Specifically, VOS samples virtual outliers from the low-likelihood region of the class-conditional distribution estimated in the feature space. Alongside, we introduce a novel unknownaware training objective, which contrastively shapes the uncertainty space between the ID data and synthesized outlier data. VOS achieves competitive performance on both object detection and image classification models, reducing the FPR95 by up to $9 . 3 6 \%$ compared to the previous best method on object detectors.
10
+
11
+ Code is available at https://github.com/deeplearning-wisc/vos.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Modern deep neural networks have achieved unprecedented success in known contexts for which they are trained, yet they often struggle to handle the unknowns. In particular, neural networks have been shown to produce high posterior probability for out-of-distribution (OOD) test inputs (Nguyen et al., 2015), which arise from unknown categories and should not be predicted by the model. Taking self-driving car as an example, an object detection model trained to recognize in-distribution objects (e.g., cars, stop signs) can produce a high-confidence prediction for an unseen object of a moose; see Figure 1(a). Such a failure case raises concerns in model reliability, and worse, may lead to catastrophe when deployed in safety-critical applications.
16
+
17
+ The vulnerability to OOD inputs arises due to the lack explicit knowledge of unknowns during training time. In particular, neural networks are typically optimized only on the in-distribution (ID) data. The resulting decision boundary, despite being useful on ID tasks such as classification, can be ill-fated for OOD detection. We illustrate this in Figure 1. The ID data (gray) consists of three classconditional Gaussians, on which a three-way softmax classifier is trained. The resulting classifier is overconfident for regions far away from the ID data (see the red shade in Figure 1(b)), causing trouble for OOD detection. Ideally, a model should learn a more compact decision boundary that produces low uncertainty for the ID data, with high OOD uncertainty elsewhere (e.g., Figure 1(c)). However, achieving this goal is non-trivial due to the lack of supervision signal of unknowns. This motivates the question: Can we synthesize virtual outliers for effective model regularization?
18
+
19
+ In this paper, we propose a novel unknown-aware learning framework dubbed VOS (Virtual Outlier Synthesis), which optimizes the dual objectives of both ID task and OOD detection performance. In a nutshell, VOS consists of three components tackling challenges of outlier synthesis and effective model regularization with synthesized outliers. To synthesize the outliers, we estimate the class-conditional distribution in the feature space, and sample outliers from the low-likelihood region of ID classes (Section 3.1). Key to our method, we show that sampling in the feature space is more tractable than synthesizing images in the high-dimensional pixel space (Lee et al., 2018a).
20
+
21
+ ![](images/73fc33f5046e146e335bd4ac940959fdf98346fb318ab82f769f2183d83f37cd.jpg)
22
+ Figure 1: (a) A Faster-RCNN (Ren et al., 2015) model trained on BDD-100k dataset (Yu et al., 2020) produces overconfident predictions for OOD object (e.g., moose). (b)-(c) The uncertainty measurement with and without virtual outlier training. The in-distribution data $\mathbf { x } \in \mathcal { X } = \mathbb { R } ^ { 2 }$ is sampled from a Gaussian mixture model). Regularizing the model with virtual outliers (c) better captures the OOD uncertainty than without (b).
23
+
24
+ Alongside, we propose a novel unknown-aware training objective, which contrastively shapes the uncertainty surface between the ID data and synthesized outliers (Section 3.2). During training, VOS simultaneously performs the ID task (e.g., classification or object detection) as well as the OOD uncertainty regularization. During inference time, the uncertainty estimation branch produces a larger probabilistic score for ID data and vice versa, which enables effective OOD detection (Section 3.3).
25
+
26
+ VOS offers several compelling advantages compared to existing solutions. (1) VOS is a general learning framework that is effective for both object detection and image classification tasks, whereas previous methods were primarily driven by image classification. Image-level detection can be limiting as an image could be OOD in certain regions while being in-distribution elsewhere. Our work bridges a critical research gap since OOD detection for object detection is timely yet underexplored in literature. (2) VOS enables adaptive outlier synthesis, which can be flexibly and conveniently used for any ID data without manual data collection or cleaning. In contrast, previous methods using outlier exposure (Hendrycks et al., 2019) require an auxiliary image dataset that is sufficiently diverse, which can be arguably prohibitive to obtain. Moreover, one needs to perform careful data cleaning to ensure the auxiliary outlier dataset does not overlap with ID data. (3) VOS synthesizes outliers that can estimate a compact decision boundary between ID and OOD data. In contrast, existing solutions use outliers that are either too trivial to regularize the OOD estimator, or too hard to be separated from ID data, resulting in sub-optimal performance. Our key contributions and results are summarized as follows:
27
+
28
+ • We propose a new framework VOS addressing a pressing issue—unknown-aware deep learning that optimizes for both ID and OOD performance. VOS establishes state-of-the-art results on a challenging object detection task. Compared to the best method, VOS reduces the FPR95 by up to $9 . 3 6 \%$ while preserving the accuracy on the ID task. • We conduct extensive ablations and reveal important insights by contrasting different outlier synthesis approaches. We show that VOS is more advantageous than generating outliers directly in the high-dimensional pixel space (e.g., using GAN (Lee et al., 2018a)) or using noise as outliers. • We comprehensively evaluate our method on common OOD detection benchmarks, along with a more challenging yet underexplored task in the context of object detection. Our effort facilitates future research to evaluate OOD detection in a real-world setting.
29
+
30
+ # 2 PROBLEM SETUP
31
+
32
+ We start by formulating the problem of OOD detection in the setting of object detection. Our framework can be easily generalized to image classification when the bounding box is the entire image (see Section 4.2). Most previous formulations of OOD detection treat entire images as anomalies, which can lead to ambiguity shown in Figure 1. In particular, natural images are composed of numerous objects and components. Knowing which regions of an image are anomalous could allow for safer handling of unfamiliar objects. This setting is more realistic in practice, yet also more challenging as it requires reasoning OOD uncertainty at the fine-grained object level.
33
+
34
+ ![](images/b443aa7d1468ffdc293cea5b4af7222e7ab192fa270261f47f20a507728104e6.jpg)
35
+ Figure 2: The framework of VOS. We model the feature representation of ID objects as class-conditional Gaussians, and sample virtual outliers $\mathbf { v }$ from the low-likelihood region. The virtual outliers, along with the ID objects, are used to produce the uncertainty loss for regularization. The uncertainty estimation branch (Luncertainty) is jointly trained with the object detection loss $( \mathcal { L } _ { \mathrm { l o c } } , \mathcal { L } _ { \mathrm { c l s } } )$ .
36
+
37
+ Specifically, we denote the input and label space by $\mathcal { X } = \mathbb { R } ^ { d }$ and $\mathcal { V } = \{ 1 , 2 , . . . , K \}$ , respectively. Let $\mathbf { x } \in \mathcal { X }$ be the input image, $\mathbf { b } \in \mathbb { R } ^ { 4 }$ be the bounding box coordinates associated with object instances in the image, and $y \in \mathcal { V }$ be the semantic label for $K$ -way classification. An object detection model is trained on in-distribution data $\mathcal { D } = \{ ( \mathbf { x } _ { i } , \mathbf { b } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ drawn from an unknown joint distribution $\mathcal { P }$ . We use neural networks with parameters $\theta$ to model the bounding box regression $p _ { \theta } ( \mathbf { b } | \mathbf { x } )$ and the classification $p _ { \theta } ( y | \mathbf { x } , \mathbf { b } )$ .
38
+
39
+ The OOD detection can be formulated as a binary classification problem, which distinguishes between the in- vs. out-of-distribution objects. Let $P _ { \mathcal { X } }$ denote the marginal probability distribution on $\mathcal { X }$ . Given a test input $\mathbf { x } ^ { * } \sim P _ { \mathcal { X } }$ , as well as an object instance $\mathbf { b } ^ { * }$ predicted by the object detector, the goal is to predict $p _ { \theta } ( g | \mathbf { x } ^ { * } , \mathbf { b } ^ { * } )$ . We use $g = 1$ to indicate a detected object being in-distribution, and $g = 0$ being out-of-distribution, with semantics outside the support of $\mathcal { V }$ .
40
+
41
+ # 3 METHOD
42
+
43
+ Our novel unknown-aware learning framework is illustrated in Figure 2. Our framework encompasses three novel components and addresses the following questions: (1) how to synthesize the virtual outliers (Section 3.1), (2) how to leverage the synthesized outliers for effective model regularization (Section 3.2), and (3) how to perform OOD detection during inference time (Section 3.3)?
44
+
45
+ # 3.1 VOS: VIRTUAL OUTLIER SYNTHESIS
46
+
47
+ Our framework VOS generates virtual outliers for model regularization, without relying on external data. While a straightforward idea is to train generative models such as GANs (Goodfellow et al., 2014; Lee et al., 2018a), synthesizing images in the high-dimensional pixel space can be difficult to optimize. Instead, our key idea is to synthesize virtual outliers in the feature space, which is more tractable given lower dimensionality. Moreover, our method is based on a discriminatively trained classifier in the object detector, which circumvents the difficult optimization process in training generative models.
48
+
49
+ Specifically, we assume the feature representation of object instances forms a class-conditional multivariate Gaussian distribution (see Figure 3):
50
+
51
+ $$
52
+ p _ { \theta } ( h ( \mathbf { x } , \mathbf { b } ) | y = k ) = \mathcal { N } ( \pmb { \mu _ { k } } , \pmb { \Sigma } ) ,
53
+ $$
54
+
55
+ where $\pmb { \mu } _ { k }$ is the Gaussian mean of class $k \in \{ 1 , 2 , . . , \mathrm { K } \}$ , $\pmb { \Sigma }$ is the tied covariance matrix, and $h ( \mathbf { x } , \mathbf { b } ) \in \mathbb { R } ^ { m }$ is the latent representation of an object instance $( \mathbf { x } , \mathbf { b } )$ . To extract the latent representation, we use the penultimate layer of the neural network. The dimensionality $m$ is significantly smaller than the input dimension $d$ .
56
+
57
+ To estimate the parameters of the class-conditional Gaussian, we comlass mean : $\widehat { \mu } _ { k }$ and covariance $\widehat { \pmb { \Sigma } }$ of training samples $\left\{ ( \mathbf { x } _ { i } , \mathbf { b } _ { i } , y _ { i } ) \right\} _ { i = 1 } ^ { N }$
58
+
59
+ $$
60
+ \begin{array} { l } { \displaystyle \widehat { \pmb { \mu } } _ { k } = \frac { 1 } { N _ { k } } \displaystyle \sum _ { i : y _ { i } = k } h ( { \bf x } _ { i } , { \bf b } _ { i } ) } \\ { \displaystyle \widehat { \pmb { \Sigma } } = \frac { 1 } { N } \displaystyle \sum _ { k } \sum _ { i : y _ { i } = k } \left( h ( { \bf x } _ { i } , { \bf b } _ { i } ) - \widehat { \pmb { \mu } } _ { k } \right) \left( h ( { \bf x } _ { i } , { \bf b } _ { i } ) - \widehat { \pmb { \mu } } _ { k } \right) ^ { \top } , } \end{array}
61
+ $$
62
+
63
+ where $N _ { k }$ is the number of objects in class $k$ , and $N$ is the total number of objects. We use online estimation for efficient training, where we maintain a class-conditional queue with $\left| Q _ { k } \right|$ object instances from each class. In each iteration, we enqueue the embeddings of objects to their corresponding class-conditional queues, and dequeue the same number of object embeddings.
64
+
65
+ ![](images/53ac19c202c91f2f57e9f02afae5e48f564617eb559fde4ce16440fa68bc34b7.jpg)
66
+ Figure 3: UMAP visualization of feature embeddings of PASCAL-VOC (on a subset of 10 classes).
67
+
68
+ Sampling from the feature representation space. We propose sampling the virtual outliers from the feature representation space, using the multivariate distributions estimated above. Ideally, these virtual outliers should help estimate a more compact decision boundary between ID and OOD data. To achieve this, we propose sampling the virtual outliers $\nu _ { k }$ from the $\epsilon$ -likelihood region of the estimated class-conditional distribution:
69
+
70
+ $$
71
+ \mathcal { V } _ { k } = \big \{ { \mathbf { v } } _ { k } \big \vert \frac { 1 } { ( 2 \pi ) ^ { m / 2 } | \widehat { \mathbf { \xi } } | ^ { 1 / 2 } } \exp \left( - \frac { 1 } { 2 } ( { \mathbf { v } } _ { k } - \widehat { \pmb { \mu } } _ { k } ) ^ { \top } \widehat { \pmb { \Sigma } } ^ { - 1 } ( { \mathbf { v } } _ { k } - \widehat { \pmb { \mu } } _ { k } ) \right) < \epsilon \big \} ,
72
+ $$
73
+
74
+ where $\mathbf { v } _ { k } \sim \mathcal { N } ( \widehat { \pmb { \mu } } _ { k } , \widehat { \pmb { \Sigma } } )$ denotes the sampled virtual outliers for class $k$ , which are in the sublevel set bbased on the likelihood. $\epsilon$ is sufficiently small so that the sampled outliers are near class boundary.
75
+
76
+ Classification outputs for virtual outliers. For a given sampled virtual outlier $\mathbf { v } \in \mathbb { R } ^ { m }$ , the output of the classification branch can be derived through a linear transformation:
77
+
78
+ $$
79
+ f ( \mathbf { v } ; \boldsymbol { \theta } ) = W _ { \mathrm { c l s } } ^ { \top } \mathbf { v } ,
80
+ $$
81
+
82
+ where $W _ { \mathrm { c l s } } \in \mathbb { R } ^ { m \times K }$ is the weight of the last fully connected layer. We proceed with describing how to regularize the output of virtual outliers for improved OOD detection.
83
+
84
+ # 3.2 UNKNOWN-AWARE TRAINING OBJECTIVE
85
+
86
+ We now introduce a new training objective for unknown-aware learning, leveraging the virtual outliers in Section 3.1. The key idea is to perform visual recognition task while regularizing the model to produce a low OOD score for ID data, and a high OOD score for the synthesized outlier.
87
+
88
+ Uncertainty regularization for classification. For simplicity, we first describe the regularization in the multi-class classification setting. The regularization loss should ideally optimize for the separability between the ID vs. OOD data under some function that captures the data density. However, directly estimating $\log p ( \mathbf { x } )$ can be computationally intractable as it requires sampling from the entire space $\mathcal { X }$ . We note that the log partition function $\begin{array} { r } { E ( \mathbf { x } ; \boldsymbol { \theta } ) : = - \log \sum _ { k = 1 } ^ { K } e ^ { f _ { k } ( \mathbf { x } ; \boldsymbol { \theta } ) } } \end{array}$ is proportional to $\log p ( \mathbf { x } )$ with some unknown factor, which can be seen from the following:
89
+
90
+ $$
91
+ p ( y | \mathbf { x } ) = \frac { p ( \mathbf { x } , y ) } { p ( \mathbf { x } ) } = \frac { e ^ { f _ { y } ( \mathbf { x } ; \theta ) } } { \sum _ { k = 1 } ^ { K } e ^ { f _ { k } ( \mathbf { x } ; \theta ) } } ,
92
+ $$
93
+
94
+ where $f _ { y } ( \mathbf { x } ; \theta )$ denotes the $y \cdot$ -th element of logit output corresponding to the label $y$ . The negative log partition function is also known as the free energy, which was shown to be an effective uncertainty measurement for OOD detection (Liu et al., 2020a).
95
+
96
+ Our idea is to explicitly perform a level-set estimation based on the energy function (threshold at 0), where the ID data has negative energy values and the synthesized outlier has positive energy:
97
+
98
+ $$
99
+ \mathcal { L } _ { \mathrm { u n c e r t a i n t y } } = \mathbb { E } _ { \mathbf { v } \sim \mathcal { V } } ~ \mathbb { 1 } \left\{ E ( \mathbf { v } ; \theta ) > 0 \right\} + \mathbb { E } _ { \mathbf { x } \sim \mathcal { D } } ~ \mathbb { 1 } \left\{ E ( \mathbf { x } ; \theta ) \leq 0 \right\}
100
+ $$
101
+
102
+ This is a simpler objective than estimating density. Since the $0 / 1$ loss is intractable, we replace it with the binary sigmoid loss, a smooth approximation of the $0 / 1$ loss, yielding the following:
103
+
104
+ $$
105
+ \mathcal { L } _ { \mathrm { u n c e r t a i n t y } } = \mathbb { E } _ { { \mathbf { v } } \sim \mathcal { V } } \left[ - \log \frac { 1 } { 1 + \exp ^ { - \phi ( E ( { \mathbf { v } } ; \theta ) ) } } \right] + \mathbb { E } _ { { \mathbf { x } } \sim \mathcal { D } } \left[ - \log \frac { \exp ^ { - \phi ( E ( { \mathbf { x } } ; \theta ) ) } } { 1 + \exp ^ { - \phi ( E ( { \mathbf { x } } ; \theta ) ) } } \right] .
106
+ $$
107
+
108
+ Here $\phi ( \cdot )$ is a nonlinear MLP function, which allows learning flexible energy surface. The learning process shapes the uncertainty surface, which predicts high probability for ID data and low probability for virtual outliers $\mathbf { v }$ . Liu et al. (2020a) employed energy for model uncertainty regularization, however, the loss function is based on the squared hinge loss and requires tuning two margin hyperparameters. In contrast, our uncertainty regularization loss is completely hyperparameter-free and is much easier to use in practice. Moreover, VOS produces probabilistic score for OOD detection, whereas Liu et al. (2020a) relies on non-probabilistic energy score.
109
+
110
+ Object-level energy score. In case of object detection, we can replace the image-level energy with object-level energy score. For ID object $( \mathbf { x } , \mathbf { b } )$ , the energy is defined as:
111
+
112
+ $$
113
+ E ( \mathbf { x } , \mathbf { b } ; \theta ) = - \log \sum _ { k = 1 } ^ { K } w _ { k } \cdot \exp ^ { f _ { k } ( ( \mathbf { x } , \mathbf { b } ) ; \theta ) } ,
114
+ $$
115
+
116
+ where $f _ { k } ( \mathbf { ( x , b ) } ; \theta ) = W _ { \mathrm { c l s } } ^ { \top } h ( \mathbf { x , b } )$ is the logit output for class $k$ in the classification branch. The energy score for the virtual outlier can be defined in a similar way as above. In particular, we will show in Section 4 that a learnable w is more flexible than a constant w, given the inherent class imbalance in object detection datasets. Additional analysis on $w _ { k }$ is in Appendix G.
117
+
118
+ Overall training objective. In the case of object detection, the overall training objective combines the standard object detection loss, along with a regularization loss in terms of uncertainty:
119
+
120
+ $$
121
+ \operatorname* { m i n } _ { \theta } \mathbb { E } _ { ( \mathbf { x } , \mathbf { b } , y ) \sim \mathcal { D } } \ \left[ \mathcal { L } _ { \mathrm { c l s } } + \mathcal { L } _ { \mathrm { l o c } } \right] + \beta \cdot \mathcal { L } _ { \mathrm { u n c e r t a i n t y } } ,
122
+ $$
123
+
124
+ where $\beta$ is the weight of the uncertainty regularization. ${ \mathcal L } _ { \mathrm { c l s } }$ and $\mathcal { L } _ { \mathrm { l o c } }$ are losses for classification and bounding box regression, respectively. This can be simplified to classification task without $\mathcal { L } _ { \mathrm { l o c } }$ . We provide ablation studies in Section 4.1 demonstrating the superiority of our loss function.
125
+
126
+ # 3.3 INFERENCE-TIME OOD DETECTION
127
+
128
+ During inference, we use the output of the logistic regression uncertainty branch for OOD detection. In particular, given a test input $\mathbf { x } ^ { * }$ , the object detector produces a bounding box prediction $\mathbf { b } ^ { * }$ . Th e OOD uncertainty score for the predicted object $( \mathbf { x } ^ { * } , \mathbf { b } ^ { * } )$ is given by:
129
+
130
+ $$
131
+ p _ { \theta } ( g \mid \mathbf { x } ^ { * } , \mathbf { b } ^ { * } ) = \frac { \exp ^ { - \phi ( E ( \mathbf { x } ^ { * } , \mathbf { b } ^ { * } ) ) } } { 1 + \exp ^ { - \phi ( E ( \mathbf { x } ^ { * } , \mathbf { b } ^ { * } ) ) } } .
132
+ $$
133
+
134
+ For OOD detection, one can exercise the thresholding mechanism to distinguish between $\mathrm { I D }$ and OOD objects:
135
+
136
+ $$
137
+ G ( \mathbf { x } ^ { * } , \mathbf { b } ^ { * } ) = { \left\{ \begin{array} { l l } { 1 } & { { \mathrm { ~ i f ~ } } p _ { \theta } ( g \mid \mathbf { x } ^ { * } , \mathbf { b } ^ { * } ) \geq \gamma , } \\ { 0 } & { { \mathrm { ~ i f ~ } } p _ { \theta } ( g \mid \mathbf { x } ^ { * } , \mathbf { b } ^ { * } ) < \gamma . } \end{array} \right. }
138
+ $$
139
+
140
+ The threshold $\gamma$ is typically chosen so that a high fraction of ID data (e.g., $9 5 \%$ ) is correctly classified. Our framework VOS is summarized in Algorithm 1.
141
+
142
+ # Algorithm 1 VOS: Virtual Outlier Synthesis for OOD detection
143
+
144
+ Input: ID data $\mathcal { D } = \{ ( \mathbf { x } _ { i } , \mathbf { b } _ { i } , y _ { i } ) \} _ { i = 1 } ^ { N }$ , randomly initialized detector with parameter $\theta$ , queue size $\left| Q _ { k } \right|$ for Gaussian density estimation, weight for uncertainty regularization $\beta$ , and $\epsilon$ .
145
+
146
+ Output: Object detector with parameter $\theta ^ { * }$ , and OOD detector $G$ .
147
+
148
+ # while train do
149
+
150
+ Update the ID queue $Q _ { k }$ with the training objects $\left\{ ( { \bf x } , { \bf b } , y ) \right\}$ . Estimate the multivariate distributions based on ID training objects using Equation 1 and 2. Sample virtual outliers $\mathbf { v }$ using Equation 3. Calculate the regularization loss using Equation 5, update the parameters $\theta$ based on Equation 7. end while eval do Calculate the OOD uncertainty score using Equation 8. Perform thresholding comparison using Equation 9. end
151
+
152
+ <table><tr><td>In-distribution D Method</td><td></td><td>FPR95↓</td><td>AUROC 个</td><td>mAP (ID)↑</td></tr><tr><td rowspan="10">PASCAL-VOC</td><td>MSP (Hendrycks &amp; Gimpel, 2017)</td><td></td><td>OOD:MS-COCO/OpenImages 83.45/81.91</td><td>48.7</td></tr><tr><td>ODIN (Liang et al.,2018)</td><td>70.99/73.13 59.82/63.14</td><td>82.20/82.59</td><td>48.7</td></tr><tr><td></td><td>96.46/96.27</td><td></td><td></td></tr><tr><td>Mahalanobis (Lee et al.,2018b) Energy score (Liu et al.,2020a)</td><td></td><td>59.25 /57.42</td><td>48.7</td></tr><tr><td></td><td>56.89 / 58.69</td><td>83.69 /82.98</td><td>48.7</td></tr><tr><td>Gram matrices (Sastry &amp; Oore,2020)</td><td>62.75 /67.42</td><td>79.88 /77.62</td><td>48.7</td></tr><tr><td>Generalized ODIN (Hsu et al.,2020)</td><td>59.57 /70.28</td><td>83.12/79.23</td><td>48.1</td></tr><tr><td>CSI (Tack et al.,2020)</td><td>59.91/ 57.41</td><td>81.83 /82.95</td><td>48.1</td></tr><tr><td>GAN-synthesis (Lee et al.,2018a)</td><td>60.93 /59.97</td><td>83.67 /82.67</td><td>48.5</td></tr><tr><td>VOS-ResNet50 (ours) VOS-RegX4.0 (ours)</td><td>47.53±2.9 /51.33±1.6 47.77±1.1 / 48.33±1.6</td><td>88.70±1.2/ 85.23± 0.6 89.00±0.4/87.59±0.2</td><td>48.9±0.2 51.6±0.1</td></tr><tr><td rowspan="10">Berkeley DeepDrive-100k</td><td></td><td></td><td></td><td></td></tr><tr><td>MSP (Hendrycks &amp; Gimpel, 2017)</td><td>80.94 / 79.04</td><td>75.87 /77.38</td><td>31.2</td></tr><tr><td>ODIN (Liang et al.,2018)</td><td>62.85 / 58.92</td><td>74.44 /76.61</td><td>31.2</td></tr><tr><td>Mahalanobis (Lee et al.,2018b)</td><td>57.66/ 60.16</td><td>84.92/86.88</td><td>31.2</td></tr><tr><td>Energy score (Liu et al.,2020a)</td><td>60.06 /54.97</td><td>77.48 /79.60</td><td>31.2</td></tr><tr><td>Gram matrices (Sastry &amp; Oore,2020)</td><td>60.93 / 77.55</td><td>74.93/59.38</td><td>31.2</td></tr><tr><td>Generalized ODIN(Hsu et al.,2020)</td><td>57.27/50.17</td><td>85.22/87.18</td><td>31.8</td></tr><tr><td>CSI (Tack et al., 2020)</td><td>47.10/37.06</td><td>84.09 /87.99</td><td>30.6</td></tr><tr><td>GAN-synthesis (Lee et al.,2018a)</td><td>57.03 /50.61</td><td>78.82 /81.25</td><td>31.4</td></tr><tr><td>VOS-ResNet50 (ours) VOS-RegX4.0 (ours)</td><td>44.27±2.0/35.54±1.7 36.61±0.9 /27.24±1.3</td><td>86.87±2.1/ 88.52±1.3 89.08±0.6 /92.13±0.5</td><td>31.3±0.0 32.5±0.1</td></tr></table>
153
+
154
+ Table 1: Main results. Comparison with competitive out-of-distribution detection methods. All baseline methods are based on a model trained on ID data only using ResNet-50 as the backbone, without using any real outlier data. $\uparrow$ indicates larger values are better and $\downarrow$ indicates smaller values are better. All values are percentages. Bold numbers are superior results. We report standard deviations estimated across 3 runs. $\mathrm { R e g } \mathrm { X } 4 . 0$ denotes the backbone of RegNetX-4.0GF (Radosavovic et al., 2020) for the object detector.
155
+
156
+ # 4 EXPERIMENTAL RESULTS
157
+
158
+ In this section, we present empirical evidence to validate the effectiveness of VOS on several realworld tasks, including both object detection (Section 4.1) and image classification (Section 4.2).
159
+
160
+ # 4.1 EVALUATION ON OBJECT DETECTION
161
+
162
+ Experimental details. We use PASCAL VOC1 (Everingham et al., 2010) and Berkeley DeepDrive $\mathbf { \Gamma } ( \mathbf { B } \mathbf { \hat { D } } \mathbf { D } \mathbf { - } \mathbf { 1 0 0 } \mathbf { k } ^ { 2 }$ ) (Yu et al., 2020) datasets as the ID training data. For both tasks, we evaluate on two OOD datasets that contain subset of images from: MS-COCO (Lin et al., 2014) and OpenImages (validation set) (Kuznetsova et al., 2020). We manually examine the OOD images to ensure they do not contain ID category. We have open-sourced our benchmark data that allows the community to easily evaluate future methods on object-level OOD detection.
163
+
164
+ We use the Detectron2 library (Girshick et al., 2018) and train on two backbone architectures: ResNet-50 (He et al., 2016) and RegNetX-4.0GF (Radosavovic et al., 2020). We employ a twolayer MLP with a ReLU nonlinearity for $\phi$ in Equation 5, with hidden layer dimension of 512. For each in-distribution class, we use 1,000 samples to estimate the class-conditional Gaussians. Since the threshold $\epsilon$ can be infinitesimally small, we instead choose $\epsilon$ based on the $t$ -th smallest likelihood in a pool of 10,000 samples (per-class), generated from the class-conditional Gaussian distribution. A larger $t$ corresponds to a larger threshold $\epsilon$ . As shown in Table 6, a smaller $t$ yields good performance. We set $t = 1$ for all our experiments. Extensive details on the datasets are described in Appendix A, along with a comprehensive sensitivity analysis of each hyperparameter (including the queue size $\left| Q _ { k } \right|$ , coefficient $\beta$ , and threshold ) in Appendix $C$ .
165
+
166
+ Metrics. For evaluating the OOD detection performance, we report: (1) the false positive rate (FPR95) of OOD samples when the true positive rate of ID samples is at $9 5 \%$ ; (2) the area under the receiver operating characteristic curve (AUROC). For evaluating the object detection performance on the ID task, we report the common metric of mAP.
167
+
168
+ VOS outperforms existing approaches. In Table 1, we compare VOS with competitive OOD detection methods in literature. For a fair comparison, all the methods only use ID data without using auxiliary outlier dataset. Our proposed method, VOS, outperforms competitive baselines, including Maximum Softmax Probability (Hendrycks & Gimpel, 2017), ODIN (Liang et al., 2018), energy score (Liu et al., 2020a), Mahalanobis distance (Lee et al., 2018b), Generalized ODIN (Hsu et al., 2020), CSI (Tack et al., 2020) and Gram matrices (Sastry & Oore, 2020). These approaches rely on a classification model trained primarily for the ID classification task, and can be naturally extended to the object detection model due to the existence of a classification head. The comparison precisely highlights the benefits of incorporating synthesized outliers for model regularization.
169
+
170
+ Table 2: Ablation on outlier synthesis approaches (on backbone of ResNet-50, COCO is the OOD data).
171
+
172
+ <table><tr><td>Method</td><td></td><td>AUROC↑</td><td>mAP↑</td></tr><tr><td rowspan="3">Image synthesis</td><td>GAN (Lee et al.,2018a)</td><td>83.67</td><td>48.5</td></tr><tr><td>Mixup (Zhang et al.,2018) (mixing ratio 0.4)</td><td>61.23</td><td>44.3</td></tr><tr><td>Mixup (Zhang et al.,2018) (mixing ratio 1)</td><td>63.99</td><td>46.9</td></tr><tr><td rowspan="3">Noise as outliers</td><td> Additive Gaussian noise to ID features</td><td>68.02</td><td>48.7</td></tr><tr><td>Trainable noise added to the ID features</td><td>66.67</td><td>48.6</td></tr><tr><td>Gaussian noise</td><td>85.98</td><td>48.5</td></tr><tr><td rowspan="3">Negative proposals</td><td>+All negative proposals</td><td>63.45</td><td>48.1</td></tr><tr><td>*Random negative proposals</td><td>66.03</td><td>48.5</td></tr><tr><td>*Proposals with large background prob (Joseph et al., 2021)</td><td>77.26</td><td>48.5</td></tr><tr><td></td><td>VOS (ours)</td><td>88.70</td><td>48.9</td></tr></table>
173
+
174
+ Closest to our work is the GAN-based approach for synthesizing outliers (Lee et al., 2018a). Compare to GAN-synthesis, VOS improves the OOD detection performance (FPR95) by $1 2 . 7 6 \%$ o n BDD-100k and $1 3 . 4 0 \%$ on Pascal VOC (COCO as OOD). Moreover, we show in Table 1 that VOS achieves stronger OOD detection performance while preserving a high accuracy on the original indistribution task (measured by mAP). This is in contrast with CSI, which displays degradation, with mAP decreased by $0 . 7 \%$ on BDD-100k. Details of reproducing baselines are in Appendix E.
175
+
176
+ Ablation on outlier synthesis approaches. We compare VOS with different synthesis approaches in Table 2. Specifically, we consider three types of synthesis approach: $( \mathrm { i } ^ { \circ } )$ synthesizing outliers in the pixel space, $( \mathrm { i i } ^ { \sharp } )$ using noise as outliers, and $( \mathrm { i i i } ^ { \pmb { \mathscr { s } } } )$ ) using negative proposals from RPN as outliers. For type I, we consider GAN-based (Lee et al., 2018a) and mixup (Zhang et al., 2018) methods. The outputs of the classification branch for outliers are forced to be closer to a uniform distribution. For mixup, we consider two different beta distributions Beta(0.4) and Beta(1), and interpolate ID objects in the pixel space. For Type II, we use noise perturbation to create virtual outliers. We consider adding fixed Gaussian noise to the ID features, adding trainable noise to the ID features where the noise is trained to push the outliers away from ID features, and using fixed Gaussian noise as outliers. Lastly, for type III, we directly use the negative proposals in the ROI head as the outliers for Equation 5, similar to Joseph et al. (2021). We consider three variants: randomly sampling $n$ negative proposals $\dot { n }$ is the number of positive proposals), sampling $n$ negative proposals with a larger probability, and using all the negative proposals. All methods are trained under the same setup, with PASCAL-VOC as in-distribution data and ResNet-50 as the backbone. The loss function is the same as Equation 7 for all variants, with the only difference being the synthesis method.
177
+
178
+ The results are summarized in Table 2, where VOS outperforms alternative synthesis approaches both in the feature space $( \clubsuit , \natural )$ or the pixel space $( \diamond )$ . Generating outliers in the pixel space $( \diamond )$ is either unstable (GAN) or harmful for the object detection performance (mixup). Introducing noise (\), especially using Gaussian noise as outliers is promising. However, Gaussian noise outliers are relatively simple, and may not effectively regularize the decision boundary between ID and OOD as VOS does. Exploiting the negative proposals $( \clubsuit )$ is not effective, because they are distributionally close to the ID data.
179
+
180
+ Ablation on the uncertainty loss. We perform ablation on several variants of VOS, trained with different uncertainty loss $\mathcal { L } _ { \mathrm { u n c e r t a i n t y } }$ . Particularly, we consider: (1) using the squared hinge loss for regularization as in Liu et al., (2) using constant weight $\mathbf { w } = [ 1 , 1 , . . . , 1 ] ^ { \top }$ for energy score in Equation 6, and (3) classifying the virtual outliers as an additional $K + 1$ class in the classification branch. The performance comparison is summarized in Table 3. Compared to the hinge loss, our proposed logistic loss reduces the FPR95 by $1 0 . 0 2 \%$ on BDD-100k. While the squared hinge loss in Liu et al. requires tuning the hyperparameters, our uncertainty loss is completely hyperparameter free. In addition, we find that a learnable w for energy score is more desirable than a constant w, given the inherent class imbalance in object detection datasets. Finally, classifying the virtual outliers as
181
+
182
+ <table><tr><td>D</td><td>Method</td><td>FPR95 ↓</td><td>AUROC 个</td><td>object detection mAP (ID) 个</td></tr><tr><td rowspan="4">PASCAL-VOC</td><td>VOS w/ hinge loss</td><td>49.75</td><td>87.90</td><td>46.5</td></tr><tr><td>VOS w/ constant w</td><td>51.59</td><td>88.64</td><td>48.9</td></tr><tr><td>VOS w/ K+1class</td><td>65.25</td><td>85.26</td><td>47.0</td></tr><tr><td>VOS (ours)</td><td>47.53</td><td>88.70</td><td>48.9</td></tr><tr><td rowspan="4">Berkeley DeepDrive-100k</td><td>VOS w/ hinge loss</td><td>54.29</td><td>83.47</td><td>29.5</td></tr><tr><td>VOS w/ constant w</td><td>49.25</td><td>85.35</td><td>30.9</td></tr><tr><td>VOS w/K+1class</td><td>52.98</td><td>85.91</td><td>30.1</td></tr><tr><td>VOS (ours)</td><td>44.27</td><td>86.87</td><td>31.3</td></tr></table>
183
+
184
+ Table 3: Ablation study. Comparison with different regularization loss functions (on backbone of ResNet-50, COCO is the OOD data).
185
+
186
+ an additional class increases the difficulty of object classification, which does not outperform either.
187
+ This ablation demonstrates the superiority of the uncertainty loss employed by VOS.
188
+
189
+ VOS is effective on alternative architecture. Lastly, we demonstrate that VOS is effective on alternative neural network architectures. In particular, using RegNet (Radosavovic et al., 2020) as backbone yields both better ID accuracy and OOD detection performance. We also explore using intermediate layers for outlier synthesis, where we show using VOS on the penultimate layer is the most effective. This is expected since the feature representations are the most discriminative at deeper layers. We provide details in Appendix F.
190
+
191
+ Comparison with training on real outlier data. We also compare with Outlier Exposure (Hendrycks et al., 2019) (OE). OE serves as a strong baseline since it relies on the real outlier data. We train the object detector on PASCAL-VOC using the same architecture ResNet-50, and use the OE objective for the classification branch. The real outliers for OE training are sampled from the OpenImages dataset (Kuznetsova et al., 2020). We perform careful deduplication to ensure there is no overlap between the outlier training data and PASCAL-VOC. Our method achieves OOD detection performance on COCO (AUROC: $8 8 . 7 0 \%$ ) that favorably matches OE (AUROC: $9 0 . 1 8 \%$ ), and does not require external data.
192
+
193
+ # 4.2 EVALUATION ON IMAGE CLASSIFICATION
194
+
195
+ Going beyond object detection, we show that VOS is also suitable and effective on common image classification benchmark. We use CIFAR-10 (Krizhevsky & Hinton, 2009) as the ID training data, with standard train/val splits. We train on WideResNet40 (Zagoruyko & Komodakis, 2016) and DenseNet101 (Huang et al., 2017), where we substitute the object detection loss in Equation 7 with the crossentropy loss. We evaluate on six OOD datasets: Textures (Cimpoi et al., 2014), SVHN (Netzer et al., 2011), Places365 (Zhou et al., 2018), LSUN-C (Yu et al., 2015), LSUN-Resize (Yu et al., 2015), and iSUN (Xu et al., 2015). The comparisons are shown in Table 4, with results averaged over six test datasets. VOS demonstrates competitive OOD detection results on both architectures without sacrificing the ID test classification accuracy $( 9 4 . 8 4 \%$ on pre-trained WideResNet vs. $9 4 . 6 8 \%$ using VOS).
196
+
197
+ Table 4: OOD detection results of VOS and comparison with competitive baselines on two architectures: WideResNet-40 and DenseNet-101.
198
+
199
+ <table><tr><td>Method</td><td>FPR95↓ AUROC↑</td></tr><tr><td>MSP</td><td>WideResNet /DenseNet 90.90792.46</td></tr><tr><td>ODIN Mahalanobis</td><td>51.05/48.73 35.71/24.57 91.09/93.71</td></tr><tr><td>Energy.</td><td>37.08 /36.26 93.27/87.12 91.88/94.51</td></tr><tr><td>Gram Matrices</td><td>33.01/27.44 27.33/23.13 93.00/89.83</td></tr><tr><td>Generalized ODIN</td><td></td></tr><tr><td>CSI</td><td>39.94/26.97 92.44/93.76 92.45 /85.31</td></tr><tr><td>GAN-synthesis</td><td>35.66/47.83 37.30/83.71 89.60/54.14</td></tr><tr><td>VOS (ours)</td><td>24.87/22.47 94.06/95.33</td></tr></table>
200
+
201
+ # 4.3 QUALITATIVE ANALYSIS
202
+
203
+ In Figure 4, we visualize the prediction on several OOD images, using object detection models trained without virtual outliers (top) and with VOS (bottom), respectively. The in-distribution data is BDD- $1 0 0 \mathrm { k }$ . VOS performs better in identifying OOD objects (in green) than a vanilla object detector, and reduces false positives among detected objects. Moreover, the confidence score of the false-positive objects of VOS is lower than that of the vanilla model (see the truck in the 3rd column). Additional visualizations are in Appendix $D$ and $H$ .
204
+
205
+ # 5 RELATED WORK
206
+
207
+ OOD detection for classification can be broadly categorized into post hoc and regularization-based approaches. In Bendale & Boult (2016), the OpenMax score is developed for OOD detection based
208
+
209
+ ![](images/6c35f9d22cc02852687af308f43c33cbf0135334961151079201d9274ee24b92.jpg)
210
+ Figure 4: Visualization of detected objects on the OOD images (from MS-COCO) by a vanilla Faster-RCNN (top) and VOS (bottom). The in-distribution is BDD-100k dataset. Blue: Objects detected and classified as one of the ID classes. Green: OOD objects detected by VOS, which reduce false positives among detected objects. on the extreme value theory (EVT). Subsequent work (Hendrycks & Gimpel, 2017) proposed a simple baseline using maximum softmax probability. Improved algorithms have been proposed, such as ensembling (Lakshminarayanan et al., 2017), ODIN (Liang et al., 2018), energy score (Liu et al., 2020a), Mahalanobis distance (Lee et al., 2018b), Gram matrices based score (Sastry & Oore, 2020), and GradNorm score (Huang et al., 2021). Very recently, Sun et al. (2021) showed that a simple activation rectification strategy termed ReAct can significantly improve test-time OOD detection. Theoretical understandings on different post-hoc detection methods are provided in (Morteza & Li, 2022). Different from Lee et al. (2018b), VOS performs dynamic estimation of class-conditional Gaussian during training, which shapes the uncertainty surface over time using our proposed loss.
211
+
212
+ Another line of approaches explore model regularization using natural outlier images (Hendrycks et al., 2019; Mohseni et al., 2020; Zhang et al., 2021) or images synthesized by GANs (Lee et al., 2018a). However, real outlier data is often infeasible to obtain. Instead, VOS automatically synthesizes virtual outliers which allows greater flexibility and generality. Tack et al. (2020) applied self-supervised learning for OOD detection, which we compare in Section 4. Blum et al. (2021); Jung et al. (2021); Besnier et al. (2021) proposed to detect outliers for semantic segmentation task. Grcic et al. (2021) trained a generative model and synthesize outliers in the pixel space, which cannot be applied to object detection where a scene consists of both known and unknown objects. The regularization is based on entropy maximization, which is different from VOS.
213
+
214
+ OOD detection for object detection is currently underexplored. Joseph et al. (2021) used energy score (Liu et al., 2020a) to identify the OOD data and then labeled them for incremental object detection. In contrast, VOS focuses on OOD detection and adopts a new unknown-aware training objective with a new test-time detection score. Our learning framework is generally applicable to both object detectors and classification models. Moreover, Joseph et al. (2021) used the negative proposals as unknown samples for model regularization, which is suboptimal as we show in Table 2. Harakeh & Waslander (2021); Riedlinger et al. (2021) focused on uncertainty estimation for the localization regression, rather than OOD detection for classification problems. Several works (Dhamija et al., 2020; Miller et al., 2019; 2018; Hall et al., 2020; Deepshikha et al., 2021) used approximate Bayesian methods, such as MC-Dropout (Gal & Ghahramani, 2016) for OOD detection. They require multiple inference passes to generate the uncertainty score, which are computationally expensive on larger datasets and models.
215
+
216
+ Open-world object detection includes out-of-domain generalization (Kim et al., 2021; Wang et al., 2021), zero-shot object detection (Gu et al., 2022; Rahman et al., 2020) and incremental object detection (Liu et al., 2020b; Perez-R ´ ua et al., 2020). Most of them either developed measures to ´ mitigate catastraphic forgetting (Joseph et al., 2020) or used auxiliary information (Rahman et al., 2020), such as class attributes to perform object detection on unseen data, which is different from our focus of OOD detection.
217
+
218
+ #
219
+
220
+ In this paper, we propose VOS, a novel unknown-aware training framework for OOD detection. Different from methods that require real outlier data, VOS adaptively synthesizes outliers during training by sampling virtual outliers from the low-likelihood region of the class-conditional distributions. The synthesized outliers meaningfully improve the decision boundary between the ID data and OOD data, resulting in superior OOD detection performance while preserving the performance of the ID task. VOS is effective and suitable for both object detection and classification tasks. We hope our work will inspire future research on unknown-aware deep learning in real-world settings.
221
+
222
+ # REPRODUCIBILITY STATEMENT
223
+
224
+ The authors of the paper recognize the importance and value of reproducible research. We summarize our efforts below to facilitate reproducible results:
225
+
226
+ 1. Datasets. We use publicly available datasets, which are described in detail in Section 4.1, Section 4.2, and Appendix A.
227
+ 2. Baselines. The description and hyperparameters of the OOD detection baselines are explained in Appendix $E$ .
228
+ 3. Model training. Our model training on object detection is based on the publicly available Detectron2 codebase: https://github.com/facebookresearch/ detectron2. Hyperparamters are specified in Section 4.1, with a thorough ablation study provided in Appendix C.
229
+ 4. Methodology. Our method is fully documented in Section 3, with the pseudo algorithm detailed in Algorithm 1.
230
+ 5. Open Source. The codebase and the dataset will be released for reproducible research. Code is available at https://github.com/deeplearning-wisc/vos.
231
+
232
+ # ETHICS STATEMENT
233
+
234
+ Our project aims to improve the reliability and safety of modern machine learning models. Our study can lead to direct benefits and societal impacts, particularly for safety-critical applications such as autonomous driving. Our study does not involve any human subjects or violation of legal compliance. We do not anticipate any potentially harmful consequences to our work. Through our study and releasing our code, we hope to raise stronger research and societal awareness towards the problem of out-of-distribution detection in real-world settings.
235
+
236
+ # ACKNOWLEDGEMENT
237
+
238
+ Research is supported by Wisconsin Alumni Research Foundation (WARF). We sincerely thank Ziyang (Jack) Cai for helping with inspect the OOD datasets, and members in Li’s lab for valuable discussions.
239
+
240
+ # REFERENCES
241
+
242
+ Abhijit Bendale and Terrance E Boult. Towards open set deep networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1563–1572, 2016.
243
+
244
+ Victor Besnier, Andrei Bursuc, David Picard, and Alexandre Briot. Triggering failures: Out-ofdistribution detection by learning from local adversarial attacks in semantic segmentation. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 15701– 15710, October 2021.
245
+
246
+ Hermann Blum, Paul-Edouard Sarlin, Juan I. Nieto, Roland Siegwart, and Cesar Cadena. The fishyscapes benchmark: Measuring blind spots in semantic segmentation. Int. J. Comput. Vis., 129(11):3119–3135, 2021. doi: 10.1007/s11263-021-01511-6.
247
+
248
+ Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2014, pp. 3606–3613, 2014.
249
+
250
+ Kumari Deepshikha, Sai Harsha Yelleni, P. K. Srijith, and C. Krishna Mohan. Monte carlo dropblock for modelling uncertainty in object detection. CoRR, abs/2108.03614, 2021.
251
+
252
+ Akshay Raj Dhamija, Manuel Gunther, Jonathan Ventura, and Terrance E. Boult. The overlooked ¨ elephant of object detection: Open set. In IEEE Winter Conference on Applications of Computer Vision, WACV 2020, pp. 1010–1019, 2020.
253
+
254
+ Mark Everingham, Luc Van Gool, Christopher K. I. Williams, John M. Winn, and Andrew Zisserman. The pascal visual object classes (VOC) challenge. International Journal of Computer Vision, 88(2):303–338, 2010.
255
+
256
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In international conference on machine learning, pp. 1050–1059. PMLR, 2016.
257
+
258
+ Ross Girshick, Ilija Radosavovic, Georgia Gkioxari, Piotr Dollar, and Kaiming He. Detectron. ´ https://github.com/facebookresearch/detectron, 2018.
259
+
260
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680, 2014.
261
+
262
+ Matej Grcic, Petra Bevandic, and Sinisa Segvic. Dense open-set recognition with synthetic outliers generated by real NVP. In Proceedings of the 16th International Joint Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications, VISIGRAPP 2021, Volume 4: VISAPP, Online Streaming, February 8-10, 2021, pp. 133–143. SCITEPRESS, 2021. doi: 10.5220/0010260701330143.
263
+
264
+ Xiuye Gu, Tsung-Yi Lin, Weicheng Kuo, and Yin Cui. Zero-shot detection via vision and language knowledge distillation. In 10th International Conference on Learning Representations, ICLR 2022, 2022.
265
+
266
+ David Hall, Feras Dayoub, John Skinner, Haoyang Zhang, Dimity Miller, Peter Corke, Gustavo Carneiro, Anelia Angelova, and Niko Sunderhauf. Probabilistic object detection: Definition and ¨ evaluation. In IEEE Winter Conference on Applications of Computer Vision, WACV 2020, pp. 1020–1029, 2020.
267
+
268
+ Ali Harakeh and Steven L. Waslander. Estimating and evaluating regression predictive uncertainty in deep object detectors. In International Conference on Learning Representations, 2021.
269
+
270
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Identity mappings in deep residual networks. In European conference on computer vision, pp. 630–645. Springer, 2016.
271
+
272
+ Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. In International Conference on Learning Representations, ICLR 2017, 2017.
273
+
274
+ Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. In International Conference on Learning Representations, 2019.
275
+
276
+ Yen-Chang Hsu, Yilin Shen, Hongxia Jin, and Zsolt Kira. Generalized odin: Detecting outof-distribution image without learning from out-of-distribution data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10951–10960, 2020.
277
+
278
+ 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.
279
+
280
+ Rui Huang, Andrew Geng, and Yixuan Li. On the importance of gradients for detecting distributional shifts in the wild. In Advances in Neural Information Processing Systems, 2021.
281
+
282
+ K. J. Joseph, Jathushan Rajasegaran, Salman H. Khan, Fahad Shahbaz Khan, Vineeth Balasubramanian, and Ling Shao. Incremental object detection via meta-learning. arXiv preprint arXiv:2003.08798, 2020.
283
+
284
+ K. J. Joseph, Salman Khan, Fahad Shahbaz Khan, and Vineeth N. Balasubramanian. Towards open world object detection. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2021, 2021.
285
+
286
+ Sanghun Jung, Jungsoo Lee, Daehoon Gwak, Sungha Choi, and Jaegul Choo. Standardized max logits: A simple yet effective approach for identifying unexpected road obstacles in urban-scene segmentation. In IEEE International Conference on Computer Vision, ICCV, 2021.
287
+
288
+ Dahun Kim, Tsung-Yi Lin, Anelia Angelova, In So Kweon, and Weicheng Kuo. Learning openworld object proposals without learning to classify. CoRR, abs/2108.06753, 2021.
289
+
290
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In 3rd International Conference on Learning Representations, ICLR 2015, 2015.
291
+
292
+ Alex Krizhevsky and Geoffrey Hinton. Learning multiple layers of features from tiny images. Technical Report, 2009.
293
+
294
+ Alina Kuznetsova, Hassan Rom, Neil Alldrin, Jasper Uijlings, Ivan Krasin, Jordi Pont-Tuset, Shahab Kamali, Stefan Popov, Matteo Malloci, Alexander Kolesnikov, et al. The open images dataset v4. International Journal of Computer Vision, pp. 1–26, 2020.
295
+
296
+ Balaji Lakshminarayanan, Alexander Pritzel, and Charles Blundell. Simple and scalable predictive uncertainty estimation using deep ensembles. In Advances in Neural Information Processing Systems, pp. 6402–6413, 2017.
297
+
298
+ Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Shin. Training confidence-calibrated classifiers for detecting out-of-distribution samples. In International Conference on Learning Representations, 2018a.
299
+
300
+ Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. In Advances in Neural Information Processing Systems, pp. 7167–7177, 2018b.
301
+
302
+ Shiyu Liang, Yixuan Li, and Rayadurgam Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. In International Conference on Learning Representations, ICLR 2018, 2018.
303
+
304
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755, 2014.
305
+
306
+ Weitang Liu, Xiaoyun Wang, John Owens, and Yixuan Li. Energy-based out-of-distribution detection. Advances in Neural Information Processing Systems, 2020a.
307
+
308
+ Xialei Liu, Hao Yang, Avinash Ravichandran, Rahul Bhotika, and Stefano Soatto. Continual universal object detection. CoRR, abs/2002.05347, 2020b.
309
+
310
+ Dimity Miller, Lachlan Nicholson, Feras Dayoub, and Niko Sunderhauf. Dropout sampling for ¨ robust object detection in open-set conditions. In IEEE International Conference on Robotics and Automation, ICRA 2018, pp. 1–7, 2018. doi: 10.1109/ICRA.2018.8460700.
311
+
312
+ Dimity Miller, Feras Dayoub, Michael Milford, and Niko Sunderhauf. Evaluating merging strategies ¨ for sampling-based uncertainty techniques in object detection. In International Conference on Robotics and Automation, ICRA 2019, pp. 2348–2354, 2019.
313
+
314
+ Sina Mohseni, Mandar Pitale, JBS Yadawa, and Zhangyang Wang. Self-supervised learning for generalizable out-of-distribution detection. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 5216–5223, 2020.
315
+
316
+ Peyman Morteza and Yixuan Li. Provable guarantees for understanding out-of-distribution detection. Proceedings of the AAAI Conference on Artificial Intelligence, 2022.
317
+
318
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011.
319
+
320
+ Anh Nguyen, Jason Yosinski, and Jeff Clune. Deep neural networks are easily fooled: High confidence predictions for unrecognizable images. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 427–436, 2015.
321
+
322
+ Juan-Manuel Perez-R ´ ua, Xiatian Zhu, Timothy M. Hospedales, and Tao Xiang. Incremental few- ´ shot object detection. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, pp. 13843–13852, 2020. doi: 10.1109/CVPR42600.2020.01386.
323
+
324
+ Ilija Radosavovic, Raj Prateek Kosaraju, Ross B. Girshick, Kaiming He, and Piotr Dollar. De- ´ signing network design spaces. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, pp. 10425–10433, 2020.
325
+
326
+ Shafin Rahman, Salman H. Khan, and Fatih Porikli. Zero-shot object detection: Joint recognition and localization of novel concepts. International Journal of Computer Vision, 128(12):2979– 2999, 2020. doi: 10.1007/s11263-020-01355-6.
327
+
328
+ 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, pp. 91–99, 2015.
329
+
330
+ Tobias Riedlinger, Matthias Rottmann, Marius Schubert, and Hanno Gottschalk. Gradient-based quantification of epistemic uncertainty for deep object detectors. CoRR, abs/2107.04517, 2021.
331
+
332
+ Chandramouli Shama Sastry and Sageev Oore. Detecting out-of-distribution examples with gram matrices. In Proceedings of the 37th International Conference on Machine Learning, ICML 2020, volume 119, pp. 8491–8501, 2020.
333
+
334
+ Yiyou Sun, Chuan Guo, and Yixuan Li. React: Out-of-distribution detection with rectified activations. In Advances in Neural Information Processing Systems, 2021.
335
+
336
+ Jihoon Tack, Sangwoo Mo, Jongheon Jeong, and Jinwoo Shin. Csi: Novelty detection via contrastive learning on distributionally shifted instances. In Advances in Neural Information Processing Systems, 2020.
337
+
338
+ Xin Wang, Thomas E. Huang, Benlin Liu, Fisher Yu, Xiaolong Wang, Joseph E. Gonzalez, and Trevor Darrell. Robust object detection via instance-level temporal cycle confusion. In Proceedings of the IEEE International Conference on Computer Vision (ICCV), 2021.
339
+
340
+ Pingmei Xu, Krista A Ehinger, Yinda Zhang, Adam Finkelstein, Sanjeev R Kulkarni, and Jianxiong Xiao. Turkergaze: Crowdsourcing saliency with webcam based eye tracking. arXiv preprint arXiv:1504.06755, 2015.
341
+
342
+ Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
343
+
344
+ Fisher Yu, Haofeng Chen, Xin Wang, Wenqi Xian, Yingying Chen, Fangchen Liu, Vashisht Madhavan, and Trevor Darrell. BDD100K: A diverse driving dataset for heterogeneous multitask learning. In IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, pp. 2633–2642, 2020.
345
+
346
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. arXiv preprint arXiv:1605.07146, 2016.
347
+
348
+ Hongyi Zhang, Moustapha Cisse, Yann N. Dauphin, and David Lopez-Paz. mixup: Beyond empiri- ´ cal risk minimization. In 6th International Conference on Learning Representations, ICLR 2018, 2018.
349
+
350
+ Jingyang Zhang, Nathan Inkawhich, Yiran Chen, and Hai Li. Fine-grained out-of-distribution detection with mixup outlier exposure. CoRR, abs/2106.03917, 2021.
351
+
352
+ Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 \` million image database for scene recognition. IEEE Transactions Pattern Analysis and Machine Intelligence., 40(6):1452–1464, 2018. doi: 10.1109/TPAMI.2017.2723009.
353
+
354
+ # Supplementary Material
355
+
356
+ # A EXPERIMENTAL DETAILS
357
+
358
+ We summarize the OOD detection evaluation task in Table 5. The OOD test dataset is selected from MS-COCO and OpenImages dataset, which contains disjoint labels from the respective ID dataset. The PASCAL model is trained for a total of 18,000 iterations, and the BDD- $1 0 0 \mathrm { k }$ model is trained for 90,000 iterations. We add the uncertainty regularizer (Equation 5) starting from 2/3 of the training. The weight $\beta$ is set to 0.1. See detailed ablations on the hyperparameters in Appendix $C$ .
359
+
360
+ Table 5: OOD detection evaluation tasks.
361
+
362
+ <table><tr><td></td><td>Task 1</td><td>Task 2</td></tr><tr><td>ID train dataset</td><td>VOC train</td><td>BDD train</td></tr><tr><td>ID val dataset</td><td>VOC val</td><td>BDD val</td></tr><tr><td>OOD dataset</td><td>COCO and OpenImages val</td><td>COCO and OpenImages val</td></tr><tr><td>#ID train images</td><td>16,551</td><td>69,853</td></tr><tr><td>#ID val images</td><td>4,952</td><td>10.000</td></tr><tr><td>#OOD images for COCO</td><td>930</td><td>1,880</td></tr><tr><td>#OOD images for OpenImages</td><td>1,761</td><td>1,761</td></tr></table>
363
+
364
+ # B SOFTWARE AND HARDWARE
365
+
366
+ We run all experiments with Python 3.8.5 and PyTorch 1.7.0, using NVIDIA GeForce RTX 2080Ti GPUs.
367
+
368
+ # C EFFECT OF HYPERPARAMETERS
369
+
370
+ Below we perform sensitivity analysis for each important hyperparameter1. We use ResNet-50 as the backbone, trained on in-distribution dataset PASCAL-VOC.
371
+
372
+ Effect of $\epsilon$ . Since the threshold $\epsilon$ can be infinitesimally small, we instead choose $\epsilon$ based on the $t$ -th smallest likelihood in a pool of 10,000 samples (per-class), generated from the class-conditional Gaussian distribution. A larger $t$ corresponds to a larger threshold . As shown in Table 6, a smaller $t$ yields good performance. We set $t = 1$ for all our experiments.
373
+
374
+ Table 6: Ablation study on the number of selected outliers $t$ (per class).
375
+
376
+ <table><tr><td>t</td><td>mAP↑</td><td>FPR95↓</td><td>AUROC↑ AUPR↑</td></tr><tr><td>1</td><td>48.7</td><td>54.69</td><td>83.41</td></tr><tr><td></td><td>48.2</td><td>57.96</td><td>82.31</td></tr><tr><td></td><td>48.3</td><td>62.39</td><td>82.20</td></tr><tr><td></td><td>48.8</td><td>69.72</td><td>80.86</td></tr><tr><td></td><td>48.7</td><td>57.57</td><td>89.54 78.66 88.20</td></tr><tr><td></td><td>48.7</td><td>74.03</td><td>78.06</td></tr><tr><td></td><td>48.8</td><td>60.12</td><td>91.17 79.53 92.53</td></tr><tr><td></td><td>47.2</td><td>76.25</td><td>74.33 90.42</td></tr></table>
377
+
378
+ Effect of queue size $\left| Q _ { k } \right|$ . We investigate the effect of ID queue size $\left| Q _ { k } \right|$ in Table 7, where we vary $| Q _ { k } | = \{ 5 0 , 1 0 0 , 2 0 0 , 4 0 0 , 6 0 0 , 8 0 0 , 1 0 0 0 \}$ . Overall, a larger $\left| Q _ { k } \right|$ is more beneficial since the estimation of Gaussian distribution parameters can be more precise. In our experiments, we set the queue size $\left| Q _ { k } \right|$ to $1 , 0 0 0$ for PASCAL and 300 for BDD-100k. The queue size is smaller for BDD because some classes have a limited number of object boxes.
379
+
380
+ Effect of $\beta$ . As shown in Table 8, a mild value of $\beta$ generally works well. As expected, a large value (e.g., $\beta = 0 . 5 )$ will over-regularize the model and harm the performance.
381
+
382
+ Table 7: Ablation study on the ID queue size $\left| Q _ { k } \right|$
383
+
384
+ <table><tr><td></td><td>IQk1|mAP↑</td><td>FPR95↓</td><td>AUROC↑ AUPR↑</td></tr><tr><td>50</td><td>48.6</td><td>68.42</td><td>77.04 92.30</td></tr><tr><td>100</td><td>48.9</td><td>59.77</td><td>79.96 89.18</td></tr><tr><td>200</td><td>48.8</td><td>57.80</td><td>80.20 89.92</td></tr><tr><td>400</td><td>48.9</td><td>66.85</td><td>77.68 89.83</td></tr><tr><td>600</td><td>48.5</td><td>57.32</td><td>81.99 91.07</td></tr><tr><td>800</td><td>48.7</td><td>51.43</td><td>82.26 91.80</td></tr><tr><td>1000</td><td>48.7</td><td>54.69</td><td>83.41 92.56</td></tr></table>
385
+
386
+ Table 8: Ablation study on regularization weight $\beta$
387
+
388
+ <table><tr><td>β</td><td>|mAP↑</td><td>FPR95↓</td><td>AUROC↑ AUPR↑</td></tr><tr><td>0.01</td><td>48.8</td><td>59.20</td><td>82.64 90.08</td></tr><tr><td>0.05</td><td>48.9</td><td>57.21</td><td>83.27 91.00</td></tr><tr><td>0.1</td><td>48.7</td><td>54.69</td><td>83.41 92.56</td></tr><tr><td>0.15</td><td>48.5</td><td>59.32</td><td>77.47 89.06</td></tr><tr><td>0.5</td><td>36.4</td><td>99.33</td><td>57.46 85.25</td></tr></table>
389
+
390
+ Effect of starting iteration for the regularizer. Importantly, we show that uncertainty regularization should be added in the middle of the training. If it is added too early, the feature space is not sufficiently discriminative for Gaussian distribution estimation. See Table 9 for the effect of starting iteration $Z$ . We use $Z = 1 2 , 0 0 0$ for the PASCAL-VOC model, which is trained for a total of 18,000 iterations.
391
+
392
+ <table><tr><td>Z</td><td>mAP↑</td><td>FPR95↓</td><td>AUROC↑</td><td>AUPR↑</td></tr><tr><td>2000</td><td>48.5</td><td>60.01</td><td>78.55</td><td>87.62</td></tr><tr><td>4000</td><td>48.4</td><td>61.47</td><td>79.85</td><td>89.41</td></tr><tr><td>6000</td><td>48.5</td><td>59.62</td><td>79.97</td><td>89.74</td></tr><tr><td>8000</td><td>48.7</td><td>56.85</td><td>80.64</td><td>90.71</td></tr><tr><td>10000</td><td>48.6</td><td>49.55</td><td>83.22</td><td>92.49</td></tr><tr><td>12000</td><td>48.7</td><td>54.69</td><td>83.41</td><td>92.56</td></tr><tr><td>14000</td><td>49.0</td><td>55.39</td><td>81.37</td><td>93.00</td></tr><tr><td>16000</td><td>48.9</td><td>59.36</td><td>82.70</td><td>92.62</td></tr></table>
393
+
394
+ Table 9: Ablation study on the starting iteration $Z$ . Model is trained for a total of 18,000 iterations.
395
+
396
+ # D ADDITIONAL VISUALIZATION RESULTS
397
+
398
+ We provide additional visualization of the detected objects on different OOD datasets with models trained on different in-distribution datasets. The results are shown in Figures 5-8.
399
+
400
+ ![](images/adb15a15f4708b510aa659b866246a3e95e2dcf89b63560c5f8e423f7a3c84b1.jpg)
401
+ Figure 5: Additional visualization of detected objects on the OOD images (from MS-COCO) by a vanilla Faster-RCNN (top) and VOS (bottom). The in-distribution is Pascal VOC dataset. Blue: Objects detected and classified as one of the ID classes. Green: OOD objects detected by VOS, which reduce false positives among detected objects.
402
+
403
+ # E BASELINES
404
+
405
+ To evaluate the baselines, we follow the original methods in MSP (Hendrycks & Gimpel, 2017), ODIN (Liang et al., 2018), Generalized ODIN (Hsu et al., 2020), Mahalanobis distance (Lee et al., 2018b), CSI (Tack et al., 2020), energy score (Liu et al., 2020a) and gram matrices (Sastry & Oore, 2020) and apply them accordingly on the classification branch of the object detectors. For ODIN, the temperature is set to be $T = 1 0 0 0$ following the original work. For both ODIN and Mahalanobis distance Lee et al. (2018b), the noise magnitude is set to 0 because the region-based object detector is not end-to-end differentiable given the existence of region cropping and ROIAlign. For GAN (Lee et al., 2018a), we follow the original paper and use a GAN to generate OOD images. The prediction of the OOD images/objects is regularized to be close to a uniform distribution, through a KL divergence loss with a weight of 0.1. We set the shape of the generated images to be $1 0 0 \times 1 0 0$ and resize them to have the same shape as the real images. We optimize the generator and discriminator using Adam (Kingma & Ba, 2015), with a learning rate of 0.001. For CSI (Tack et al., 2020), we use the rotations $( 0 ^ { \circ } , 9 0 ^ { \circ } , 1 8 0 ^ { \circ } , 2 7 0 ^ { \circ } )$ as the self-supervision task. We set the temperature in the contrastive loss to 0.5. We use the features right before the classification branch (with the dimension to be 1024)
406
+
407
+ ![](images/991957e306a543cf3ae848bdd25bff6d1fb35a132e6b9a3739d2b63db9ba1d85.jpg)
408
+ Figure 6: Additional visualization of detected objects on the OOD images (from OpenImages) by a vanilla Faster-RCNN (top) and VOS (bottom). The in-distribution is Pascal VOC dataset. Blue: Objects detected and classified as one of the ID classes. Green: OOD objects detected by VOS, which reduce false positives among detected objects.
409
+
410
+ to perform contrastive learning. The weights of the losses that are used for classifying shifted instances and instance discrimination are both set to 0.1 to prevent training collapse. For Generalized ODIN Hsu et al. (2020), we replace and train the classification head of the object detector by the most effective Deconf-C head shown in the original paper.
411
+
412
+ # F VIRTUAL OUTLIER SYNTHESIS USING EARLIER LAYER
413
+
414
+ In this section, we investigate the effect of using VOS on an earlier layer within the network. Our main results in Table 1 are based on the penultimate layer of the network. Here, we additionally evaluate the performance using the layer before the penultimate layer, with a feature dimension of 1, 024. The results are summarized in Table 10. As observed, synthesizing virtual outliers in the penultimate layer achieves better OOD detection performance than the earlier layer, since the feature representations are more discriminative at deeper layers.
415
+
416
+ # G VISUALIZATION OF THE LEARNABLE WEIGHT COEFFICIENT $w$ I N GENERALIZED ENERGY SCORE
417
+
418
+ To observe whether the learnable weight coefficient $w _ { k }$ in Equation 6 captures dataset-specific statistics during uncertainty regularization, we visualize $w _ { k }$ w.r.t each in-distribution class and the number of training objects of that class in Figure 9. We use the BDD-100k dataset (Yu et al., 2020) as the indistribution dataset and the RegNetX-4.0GF (Radosavovic et al., 2020) as the backbone network. As can be observed, the learned weight coefficient displays a consistent trend with the number of training objects per class, which indicates the advantage of using learnable weights rather than constant weight vector with all 1s.
419
+
420
+ ![](images/e5bd4c935e72204d83370350f96f38d702bcef172b34d0620d8859dda9736947.jpg)
421
+ Figure 7: Additional visualization of detected objects on the OOD images (from MS-COCO) by a vanilla Faster-RCNN (top) and VOS (bottom). The in-distribution is BDD-100k dataset. Blue: Objects detected and classified as one of the ID classes. Green: OOD objects detected by VOS, which reduce false positives among detected objects.
422
+ Table 10: Performance comparison of employing VOS on different layers. COCO is the OOD data.
423
+
424
+ <table><tr><td>Models</td><td>FPR95↓</td><td>AUROC↑</td><td>mAP个</td></tr><tr><td colspan="4">PASCAL VOC</td></tr><tr><td>VOS-final</td><td>47.53</td><td>88.70</td><td>48.9</td></tr><tr><td>VOS-earlier</td><td>50.24</td><td>88.24</td><td>48.6</td></tr><tr><td colspan="4">BDD-100k</td></tr><tr><td>VOS-final</td><td>44.27</td><td>86.87</td><td>31.3</td></tr><tr><td>VOS-earlier</td><td>49.66</td><td>86.08</td><td>30.6</td></tr></table>
425
+
426
+ ![](images/271e82129346aace8ffcc1fe545a2a566af12942760def4cede4649fc9ce17d2.jpg)
427
+ Figure 8: Additional visualization of detected objects on the OOD images (from OpenImages) by a vanilla Faster-RCNN (top) and VOS (bottom). The in-distribution is BDD-100k dataset. Blue: Objects detected and classified as one of the ID classes. Green: OOD objects detected by VOS, which reduce false positives among detected objects.
428
+
429
+ ![](images/c5f86d7a4ac73f45976d7c4461ac7cd640f9ae54c96e3cc8a6cb654af26b8bce.jpg)
430
+ Figure 9: Visualization of learnable weight coefficient in the generalized energy score and the number of training objects per in-distribution class. The value of the weight coefficient is averaged over three different runs.
431
+
432
+ # H VISUALIZATION OF THE VIRTUAL OUTLIERS
433
+
434
+ In this section, we visualize the synthesized virtual outliers by VOS using UMAP in Figure 10. The in-distribution dataset is the Pascal VOC dataset with the backbone of ResNet-50. Note that we
435
+
436
+ cannot visualize virtual outliers in the pixel space since they are synthesized in low-dimensional feature space.
437
+
438
+ ![](images/ff0c7a39c84ff9e74339db16eb0970158026124085ef6e19d7dd3a9a43758891.jpg)
439
+ Figure 10: UMAP visualization of the synthesized virtual outliers. The blue points denote the object features from the in-distribution class of Person. The green points denote the synthesized virtual outliers from the low-density space w.r.t the features from that class.
440
+
441
+ From Figure 10, the virtual outliers reside in the near-boundary region of the in-distribution feature cluster, which helps the model to learn a compact decision boundary between ID and OOD objects.
442
+
443
+ # I DISCUSSION ON THE DETECTED, REJECTED AND IGNORED OOD OBJECTS DURING INFERENCE
444
+
445
+ The focus of VOS is to mitigate the undesirable cases when an OOD object is detected and classified as in-distribution with high confidence. In other words, our goal is to ensure that “if the box is detected, it should be faithfully an in-distribution object rather than OOD”. Although generating the bounding box for OOD data is not the focus of this paper, we do notice that VOS can improve the number of boxes detected for OOD data $+ 2 5 \%$ on BDD trained model compared to the vanilla Faster-RCNN).
446
+
447
+ The number of OOD objects ignored by RPN can largely depend on the confidence score threshold and the NMS threshold. Hence, we found it more meaningful to compare relatively with the vanilla Faster-RCNN under the same default thresholds. Using BDD100K as the in-distribution dataset and the ResNet as the backbone, VOS can improve the number of detected OOD boxes by $2 5 \%$ (compared to vanilla object detector). VOS also improves the number of rejected OOD samples by $63 \%$ .
md/dev/UVtVRcurOYv/UVtVRcurOYv.md ADDED
@@ -0,0 +1,208 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # KGREFINER: KNOWLEDGE GRAPH REFINEMENT FOR IMPROVING ACCURACY OF TRANSLATIONAL LINK PREDICTION METHODS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The Link Prediction is the task of predicting missing relations between entities of the knowledge graph. Recent work in link prediction has attempted to provide a model for increasing link prediction accuracy by using more layers in neural network architecture. In this paper, we propose a novel method of refining the knowledge graph so that link prediction operation can be performed more accurately using relatively fast translational models. Translational link prediction models, such as TransE, TransH, TransD, have less complexity than deep learning approaches. Our method uses the hierarchy of relationships and entities in the knowledge graph to add the entity information as auxiliary nodes to the graph and connect them to the nodes which contain this information in their hierarchy. Our experiments show that our method can significantly increase the performance of translational link prediction methods in $\mathrm { H @ 1 0 }$ , MR, MRR.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Knowledge graphs represent a set of interconnected descriptions of entities, including objects, events, or concepts. These graphs are structures by which knowledge is stored in triples. These triples include the three parts head, relation, and tail. The relation determines the type of relationship between head and tail. These graphs are becoming a popular approach to display and model different information in the world. Additionally, knowledge graphs have several applications, for example, question answering systems (Bordes et al., 2014a;b), recommendation systems (Zhang et al., 2016), search engines (Xiong et al., 2017), relationship extraction (Mintz et al., 2009), etc.
12
+
13
+ Despite many efforts to build knowledge graphs, they are not complete yet. For example, in the Freebase (Bollacker et al., 2008), over $70 \%$ of people do not have their place of birth in the graph. This incompleteness of knowledge graphs has motivated researchers to add information to the graph and complete it.
14
+
15
+ One of the developing fields in completing the knowledge graph is knowledge graph embedding (KGE). The task of KGE is to embed entities and relationships in a small continuous vector space. One application of these embedding is to predict missing links in the knowledge graph.
16
+
17
+ Translational link prediction models use the sum of the head and relation vectors to predict the tail. These models started with TransE (Bordes et al., 2013), and after that, TransH (Wang et al., 2014), TransR (Lin et al., 2015), TransD (Ji et al., 2015), RotatE (Sun et al., 2019), etc., tried to improve it in the following years. The advantages of translational methods over deep learning techniques are that they are robust, and their score function is considerably faster. Therefore, in this work, we tried to improve these translational methods.
18
+
19
+ There is a lot of information in knowledge graphs. The hierarchy of entities and relationships is part of it. Paris, for example, its hierarchy is “entity physical entit $\prime \to \mathrm { o b j e c t } \to \mathrm { l o c a t i o n } \to \mathrm { r e g i o n } \to$ area center seat capital national capital”. This hierarchy is not given enough attention in link prediction methods, and we intend to use this information in this paper.
20
+
21
+ SACN (Shang et al., 2019) added some nodes and relationships to the graph to use the graph structure information but did not justify adding these nodes and edges, so it is not generalizable for other graphs. In addition, SACN added this information only to FB15K237 and did not provide a method for WN18RR. In this paper, we added a much smaller number of relationships and fewer nodes to the graph training section by interpreting them. HRS (Zhang et al., 2018) used relation clusters and sub-relations to use this information. Nevertheless, like SACN, this can not be generalized well.
22
+
23
+ The (Moon et al., 2017) considered that if two entities are embedded closely in the embedding space, they are similar and assigned entities’ classes based on closeness. Still, we assumed that if two entities use the same relation in the graph or have common elements in their hierarchies, they are related.
24
+
25
+ When link prediction models learned the relation between Paris and France, previous link prediction methods did not notice that Paris is a city and France is a country. To use this information, we added auxiliary nodes to the graph that included the classes of entities and connected them to related entities. For example, we added an extra node for countries to the knowledge graph and connected it to all the knowledge graph countries. Our contributions are as follows:
26
+
27
+ • We presented a method for refining the knowledge graph, which is independent of the structure of the link prediction model and adds triples to the knowledge graph. These triples increase the accuracy of link prediction with the same time and space complexity of translational models.
28
+ • We evaluated our proposed method on two FB15K237 and WN18RR datasets with successful translational models. The results showed that accuracy in link prediction was significantly increased on $\mathrm { H @ 1 0 }$ , MRR, and MR.
29
+
30
+ # 2 RELATED WORK
31
+
32
+ Knowledge graph embedding is an active and developing field to embed the entities and relations of the knowledge graph. These embeddings are used in link prediction, question answering systems, relation extraction, etc. Knowledge graph embedding starts with TransE (Bordes et al., 2013), which is the first translational link prediction method. It interprets relation as a transition from head entity to tail in the graph. Some drawbacks of the TransE model are its inability to model N-1, 1-N, and NN relationships. In the following years, some other translational approaches, such as TransH (Wang et al., 2014), TransD (Ji et al., 2015), and TransR (Lin et al., 2015), were inspired by the initial idea of TransE (Bordes et al., 2013) and tried to improve it. These translational models have much more speed against deep learning models such as ConvE (Dettmers et al., 2018), ConvKB (Nguyen et al., 2018), SACN (Shang et al., 2019), and HAKE (Zhang et al., 2020), but their accuracy is slightly lower than these models. Therefore, we proposed a method to increase the accuracy of these translational models.
33
+
34
+ Knowledge graph refinement is a field of correcting or improving the knowledge graph. BioKG (Zhao et al., 2020), which worked on medical graphs, has tried to provide a method for removing the wrong information in these graphs. Other works in the refinement of the knowledge graphs try to add information. SACN (Shang et al., 2019) has also added attributes to the knowledge graph, like our work. SACN proposed FB15k237 Attr; this method for constructing this dataset has three major issues. First, it only worked for FB15k237, but our proposed method can be applied on WN18RR as well. Second, it has brought the number of FB15k237 relations from 237 to 484; therefore, it has more time complexity than ours. However, we only proposed two new relations for FB15k237 and only one relation for WN18RR. Third, these new relations and entities are not interpretable in SACN; It does not provide a reason for adding these attributes. So it can not be generalized on other graphs.
35
+
36
+ HRS (Zhang et al., 2018) tried to use sub-relation and relation-cluster to make better predictions. It used the hierarchy of relations as a sub-relationship, and it created a relation cluster to use these as two additional parts of the transition in the translational models. Because links in Wordnet do not have information about entities, HRS sub-relation and relation-cluster on Wordnet are meaningless.
37
+
38
+ # 3 BACKGROUND
39
+
40
+ Suppose E as the collection of all entities of knowledge graph and R set of all its relationships. The $( e _ { s } , r , e _ { o } )$ is called a triple. The $e _ { s } \sim \mathrm { E }$ is the head, and $e _ { o } \sim E$ is the tail of a triple. Finally, $r \sim E$ represents the relation between $e _ { s }$ and $e _ { o }$ .
41
+
42
+ # 3.1 LINK PREDICTION
43
+
44
+ Link prediction is the task of predicting the missing link of a knowledge graph by inferring from existing facts on it. The score function of link prediction methods is $\psi ( e _ { o } , r , e _ { s } )$ , which evaluates triple’s accuracy. Our goal in teaching a model that has the highest estimation for the missing triplets of the graph and the lowest prediction for false triples.
45
+
46
+ # 3.2 TRANSLATIONAL LINK PREDICTION MODELS
47
+
48
+ Translational link prediction methods consider the relation as a transition from head to tail. For example (Paris, Capital of, France), the relation “Capital of” is a transition from Paris to France. TransE (Bordes et al., 2013) is the first translational link prediction model. In TransE, embeddings for correct triples are learned as $e _ { s } + r \sim e _ { o }$ . It means that the sum of the head’s embedding and relation’s embedding must be close to the tail; primarily, the distance measure is the L2 norm. Here are some translational link predictions:
49
+
50
+ TransE: For factual triple $( e _ { s } , r , e _ { o } )$ , adding embeddings of head and relation should be closed to the tail embedding, and on the other hand, for corrupted ones $( e _ { s } , r , e _ { o } \prime )$ , $e _ { s } + r$ should have a distance with $e _ { o } \prime .$ . The score function of TransE is as follow:
51
+
52
+ $$
53
+ \psi ( e _ { o } , r , e _ { s } ) = - | | h + r - t | | _ { 2 } ^ { 2 }
54
+ $$
55
+
56
+ TransH (Wang et al., 2014): To improve modelling of N-1, 1-N and N-N, TransH defined a hyperplane for each relations, and translation property should be established on that hyperplane.
57
+
58
+ $$
59
+ \begin{array} { c } { h _ { \perp } = w _ { r } ^ { \perp } h w _ { r } \mathrm { ~ , ~ } t _ { \perp } = w _ { r } ^ { \perp } t w _ { r } } \\ { \psi ( e _ { o } , r , e _ { s } ) = - | | h _ { \perp } + r - t _ { \perp } | | _ { 2 } ^ { 2 } } \end{array}
60
+ $$
61
+
62
+ TransD (Ji et al., 2015) : It creates a dynamic matrix for all entity-relation pairs and maps the head and tail into M1 and M2, respectively. The transition from head to tail is as follow:
63
+
64
+ $$
65
+ \begin{array} { c } { { M _ { r } ^ { 1 } = w _ { r } w _ { h } ^ { \perp } + I \ , \ M _ { r } ^ { 2 } = w _ { r } w _ { t } ^ { \perp } + I } } \\ { { \qquad h _ { \perp } = M _ { r } ^ { 1 } h \ , \ t _ { \perp } = M _ { r } ^ { 2 } t } } \\ { { \qquad \psi ( e _ { o } , r , e _ { s } ) = - \vert \vert h _ { \perp } + r - t _ { \perp } \vert \vert _ { 2 } ^ { 2 } } } \end{array}
66
+ $$
67
+
68
+ TransR (Lin et al., 2015) : It considers that entities may have multiple aspects, and various relations focus on different aspects of entities. It projects entities into relation space by projection matrix M.
69
+
70
+ $$
71
+ \begin{array} { c } { { h _ { \perp } = M _ { r } h , h _ { \perp } = M _ { r } t } } \\ { { \psi ( e _ { o } , r , e _ { s } ) = - | | h _ { \perp } + r - t _ { \perp } | | _ { 2 } ^ { 2 } } } \end{array}
72
+ $$
73
+
74
+ RotatE (Sun et al., 2019) : RotatE deals with relation as a rotation to complex space. This rotation brings the source entity to the target entity in the complex space. The relation applies to the head entity by Hadamard product. Then it uses the L1 norm to measure the distance from the tail entity in the score function.
75
+
76
+ $$
77
+ \psi ( e _ { o } , r , e _ { s } ) = - | | h _ { \circ } r - t _ { \bot } | | ^ { 2 }
78
+ $$
79
+
80
+ # 3.3 KNOWLEDGE GRAPH REFINEMENT
81
+
82
+ The knowledge graph refinement follows two main objectives: (A) adding information to the knowledge graph, which is a subcategory of the knowledge graph completion. (B) Detecting incorrect information and remove those triplets from the knowledge graph to increase the correctness of the knowledge graph.
83
+
84
+ # 4 KGREFINER
85
+
86
+ In this work, we propose a method to add information to the graph, which refines the knowledge graph and increases link prediction accuracy. In FB15k237, we do this refinement by using relation
87
+
88
+ ![](images/5a5aec13f61bdc6919501e8f8029724a857e6eca34a090edc44a8ee0319d64b1.jpg)
89
+ Figure 1: Simple illustration of changes in embedding space. The right side graph shows the effect of adding auxiliary nodes to the graph, which translational models bring all countries together and cities together in vector space.
90
+
91
+ hierarchies, and in WN18RR, we use hierarchies of entities. We add this information to the graph as a new node; these nodes are auxiliary nodes. We introduce several new relations to connect these new nodes to graph nodes, and we add these triples to the graph.
92
+
93
+ Translational link prediction methods such as TransE (Bordes et al., 2013), TransH (Wang et al., 2014), TransD (Ji et al., 2015), etc., create transition property in their embeddings. For example, in TransE, embeddings are made as follow:
94
+
95
+ $$
96
+ e _ { s } + r \approx e _ { o }
97
+ $$
98
+
99
+ This means in embedding space; the tail entity should be close to the sum of head and relation. For example, let’s consider these triples:
100
+
101
+ $$
102
+ \begin{array} { c } { P a r i s + c a p i t a l o f \approx F r a n c e } \\ { T e h r a n + c a p i t a l o f \approx F r a n } \end{array}
103
+ $$
104
+
105
+ Link prediction model is not aware of both tails entities are country. If we add new node as “country” to the graph and connect it to all graph’s countries with a new relation “RelatedTo” then these triples are added to graph:
106
+
107
+ $$
108
+ \begin{array} { r } { F r a n c e + R e l a t e d T o \approx c o u n t r y } \\ { I r a n + R e l a t e d T o \approx c o u n t r y } \end{array}
109
+ $$
110
+
111
+ Equations 4 and 5, which are similar, bring closer the embeddings of France and Iran, which are semantically identical. Figure 1 gives an illustration of what changes KGrefiner brings for the embedding space. This closeness in evaluating Equation 2 causes the model to search between countries when asked where France’s capital is.
112
+
113
+ # 4.1 REFINEMENT OF FB15K237
114
+
115
+ In FB15k237, graph relations contain information about entities. For example, the “entity physical entit $\prime \mathrm { o b j e c t } \mathrm { l o c a t i o n } \mathrm { r e g i o n } \mathrm { a r e a } \mathrm { c e n t e r } \mathrm { s e a t } \mathrm { c a p i t a l } $ national capital” is a relationship between countries and cities, and nodes on one side of relationships can be considered similar. Higher levels usually have more general information about objects in the hierarchy, and lower levels have more specific, so we extracted the last three levels of hierarchies from each relation in this graph to use this information. Then, for each sub-relation, we counted the number of repetitions in the graph training section. We removed those components with less than 100 repetitions in the graph to reduce the number of these sub-relations, and the number 100 is arbitrary. Finally, 285 sub-relations remained, which we added to the set of entities in this graph (as new nodes). We call these auxiliary nodes relation-nodes. We defined two new relations, “RelatedTo” and “HasAttribute”, to connect these relation-nodes to the graph. For each triple, if the entity is the triple’s head, we linked it with relation-node by “RelatedTo”, and if it is the tail of the triple, we use “HasAttribute” to establish these connections. For example, to refine relation between Paris and France, (Paris,“entity physical˙entity $ \mathrm { o b j e c t } \mathrm { l o c a t i o n } $ region a $\mathrm { \Delta \ r e a c e n t e r s e a t - }$ capital national˙capital”,France), “capital” has repetition over 100, so the following triples were added to the graph:
116
+
117
+ $$
118
+ F r a n c e + H a s A t t r i b u t e \approx c a p i t a l
119
+ $$
120
+
121
+ # 4.2 REFINEMENT OF WN18RR
122
+
123
+ To refine this graph, we use the hierarchy of entities. In Freebase, we used relationships, but relationships do not give us information about entities in Wordnet. France, for example, has a hierarchy of “existence place region region administrative region country France”. This hierarchy gives us good information about France. Except for the last level, we extract the other last three levels of entities. Among these levels, we hold those with more than an arbitrary number of 50 repetitions among entities to reduce these levels. As a result, 207 levels remained. We add these levels as new nodes to the graph training section and connect them to the entities with these levels in their hierarchy with a new type of connection. In this graph, we define a new relation and name it “HasAttribute”. For example, France and Iran have a “country” in their hierarchical structure. Then, the following triples were added to the training section of the graph:
124
+
125
+ # 5 EXPREMENT
126
+
127
+ # 5.1 DATASETS
128
+
129
+ We evaluated our work on popular benchmarks: FB15K237 and WN18RR; these datasets are respectively refined from real knowledge graphs: WordNet (Miller, 1995) and Freebase (Bollacker et al., 2008). In addition, we built two other datasets with KGRefiner: FB15K237-Refined and WN18RRRefined, respectively, from FB15K237 and WN18RR. The details of the datasets are shown in Table 1.
130
+
131
+ # 5.2 BASELINES
132
+
133
+ To demonstrate the effectiveness of our models, we compare results with the original translational models TransE (Bordes et al., 2013), TransH (Wang et al., 2014), TransD (Ji et al., 2015), and the last translational model, RotatE (Sun et al., 2019).
134
+
135
+ # 5.3 EXPERIMENTAL SETTINGS
136
+
137
+ We used implementation of baselines by OpenKE (Han et al., 2018). We used an embedding dimension of 200 for all models. Also, we removed self adversarial negative sampling from TransE and RotatE to have a fair comparison. We tried $\{ 2 0 0 , 5 0 0 , 1 0 0 0 , 2 0 0 0 \}$ epochs, and we picked the best epoch according to MRR on the validation set. Other hyperparameters of the models are those mentioned in OpenKE. Hyperparameters for FB15K237 and FB15K237-Refined and also WN18RR and WN18RR-Refined are the same.
138
+
139
+ # 5.4 EXPERIMENTAL RESULTS
140
+
141
+ Table 2 and 3 compares the experimental results of our KGRefiner plus translational models and with previously published results. Results in bold font are the best results in the group, and the underlined results denote the best results in the column. KGRefiner with TransH obtains the highest $\mathrm { H @ 1 0 }$ and MRR on FB15k237, and also KGRefiner with RotatE reached the best MR and $\mathrm { H @ 1 0 }$ in WN18RR.
142
+
143
+ Table 1: Statistics of the experimental datasets. The refined version represents that graph has some auxiliary nodes.
144
+
145
+ <table><tr><td>Dataset</td><td>FB15k237</td><td>FB15k237-Refined</td><td>WN18RR</td><td>WN18RR-Refined</td></tr><tr><td>Entities</td><td>14541</td><td>14826</td><td>40943</td><td>41150</td></tr><tr><td>Relations</td><td>237</td><td>239</td><td>11</td><td>12</td></tr><tr><td>Train Edges</td><td>272115</td><td>550998</td><td>86835</td><td>230135</td></tr><tr><td>Val. Edges</td><td>17535</td><td>17535</td><td>3034</td><td>3034</td></tr><tr><td>Test Edges</td><td>20466</td><td>20466</td><td>31134</td><td>31134</td></tr></table>
146
+
147
+ <table><tr><td>Baseline</td><td>H@10</td><td>MR</td><td>MRR</td></tr><tr><td>TransE TransE+KGRefiner</td><td>45.6 47</td><td>347 203</td><td>29.4 29.1</td></tr><tr><td>TransD TransD +KGRefiner</td><td>45.3 43.7</td><td>256 227</td><td>28.6 24</td></tr><tr><td>RotatE RotatE+KGRefiner</td><td>47.4 43.9</td><td>185 226</td><td>29.7 27.9</td></tr><tr><td>TransH TransH+ KGRefiner</td><td>36.6 48.9</td><td>311 221</td><td>21.1 30.2</td></tr></table>
148
+
149
+ Table 2: Link prediction results on FB15K237 and its refined version. Results of TransE is taken from (Nguyen et al., 2018), TransH and TransD from (Zhang et al., 2018), but for RotatE we used (Han et al., 2018) to produce scores.
150
+ Table 3: Link prediction results on WN18RR and its refined version. Results of TransE is taken from (Nguyen et al., 2018), TransH and TransD from (Zhang et al., 2018), for RotatE we used (Han et al., 2018) to produce scores. For other results, we used (Han et al., 2018) to produce them.
151
+
152
+ <table><tr><td>Baseline</td><td>H@10</td><td>MR</td><td>MRR</td></tr><tr><td>TransE TransE+KGRefiner</td><td>50.1 53.7</td><td>3384 1125</td><td>22.6 22.2</td></tr><tr><td>TransH TransH+KGRefiner</td><td>42.4 51.4</td><td>5875 1534</td><td>18.6 20.8</td></tr><tr><td>TransD TransD+KGRefiner</td><td>42.8 52.3</td><td>5482 1348</td><td>18.5 21.4</td></tr><tr><td>RotatE RotatE+KGRefiner</td><td>54.7 57.0</td><td>4274 683</td><td>47.3 44.8</td></tr></table>
153
+
154
+ Table 4: Comparison between translational technique and deep learning methods in training time. $[ \oplus ]$ : These models are implemented by OpenKE (Han et al., 2018) and $[ \ominus ]$ are produced by their original implementations.
155
+
156
+ <table><tr><td rowspan=1 colspan=1>Model</td><td rowspan=1 colspan=1>Training Timefor single epoch</td></tr><tr><td rowspan=1 colspan=1>TransE (Bordes et al., 2013)[]</td><td rowspan=1 colspan=1>2.8 s</td></tr><tr><td rowspan=1 colspan=1>TransH (Wang et al., 2014) []</td><td rowspan=1 colspan=1>5.2 s</td></tr><tr><td rowspan=1 colspan=1>TransD (Ji et al.,2015) ]</td><td rowspan=1 colspan=1>5.2 s</td></tr><tr><td rowspan=1 colspan=1>RotatE (Sun et al.,2019)[]</td><td rowspan=1 colspan=1>5s</td></tr><tr><td rowspan=1 colspan=1>ConvE(Dettmers et al., 2018) []</td><td rowspan=1 colspan=1>279 s</td></tr><tr><td rowspan=1 colspan=1>ConvKB(Nguyen et al., 2018) [Θ]</td><td rowspan=1 colspan=1>40 s</td></tr></table>
157
+
158
+ # 5.5 SPEED OF MODELS
159
+
160
+ The training time of translational models is much less than deep learning approaches such as ConvE, SACN, ConvKB, etc. The complexity in scoring function and neural network layers in their architecture reduces training speed in deep learning methods. Table 4 compares the time that each model
161
+
162
+ needs to be trained for one epoch on FB15k237. We ran models on Nvidia K80. For fair comparison embedding dimension for all models is 200.
163
+
164
+ # 6 CONCLUSION
165
+
166
+ In this paper, we propose KGRefiner, a novel knowledge graph refinement method that alleviates the limitations of translational models by capturing additional information in knowledge graph hierarchies. We used hierarchy components as new nodes, and by connecting these nodes to proper entities in the knowledge graph, we have a more informative graph. Our experimental results show that our KGRefiner outperforms other state-of-the-art translational models on two benchmark datasets WN18RR and FB15k237. Furthermore, it is the first augmentation method that works with both Wordnet and Freebase, while old methods only perform only on one dataset. In future works, we will expand our work on datasets that can be formulated on the triple structure. For example, recommender system datasets can be formed on graph schema, and KGRefiner can be applied.
167
+
168
+ # REFERENCES
169
+
170
+ Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. Freebase: A collaboratively created graph database for structuring human knowledge. In Proceedings of the 2008 ACM SIGMOD International Conference on Management of Data, SIGMOD ’08, pp. 1247–1250, New York, NY, USA, 2008. ACM. ISBN 978-1-60558-102-6. doi: 10.1145/1376616.1376746. URL http://doi.acm.org/10.1145/1376616.1376746.
171
+
172
+ Antoine Bordes, Nicolas Usunier, Alberto Garcia-Duran, Jason Weston, and Oksana Yakhnenko. Translating embeddings for modeling multi-relational data. In Advances in Neural Information Processing Systems, pp. 2787–2795. 2013. URL http://papers.nips.cc/paper/ 5071-translating-embeddings-for-modeling-multi-relational-data. pdf.
173
+
174
+ Antoine Bordes, Sumit Chopra, and Jason Weston. Question answering with subgraph embeddings. In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing, pp. 615–620, 2014a. doi: 10.3115/v1/D14-1067. URL http://aclweb.org/anthology/ D14-1067.
175
+
176
+ Antoine Bordes, Jason Weston, and Nicolas Usunier. Open question answering with weakly supervised embedding models. In Machine Learning and Knowledge Discovery in Databases, pp. 165–180, Berlin, Heidelberg, 2014b.
177
+
178
+ Tim Dettmers, Minervini Pasquale, Stenetorp Pontus, and Sebastian Riedel. Convolutional 2d knowledge graph embeddings. In Proceedings of the 32th AAAI Conference on Artificial Intelligence, pp. 1811–1818, February 2018. URL https://arxiv.org/abs/1707.01476.
179
+
180
+ Xu Han, Shulin Cao, Lv Xin, Yankai Lin, Zhiyuan Liu, Maosong Sun, and Juanzi Li. Openke: An open toolkit for knowledge embedding. In Proceedings of EMNLP, 2018.
181
+
182
+ Guoliang Ji, Shizhu He, Liheng Xu, Kang Liu, and Jun Zhao. Knowledge graph embedding via dynamic mapping matrix. In Proceedings of the 53rd annual meeting of the association for computational linguistics and the 7th international joint conference on natural language processing (volume 1: Long papers), pp. 687–696, 2015.
183
+
184
+ Yankai Lin, Zhiyuan Liu, Maosong Sun, Yang Liu, and Xuan Zhu. Learning entity and relation embeddings for knowledge graph completion. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 29, 2015.
185
+
186
+ George A. Miller. Wordnet: A lexical database for english. Commun. ACM, 38(11):39–41, November 1995. ISSN 0001-0782. doi: 10.1145/219717.219748. URL http://doi.acm.org/ 10.1145/219717.219748.
187
+
188
+ Mike Mintz, Steven Bills, Rion Snow, and Dan Jurafsky. Distant supervision for relation extraction without labeled data. In Proceedings of the 47th Annual Meeting of the ACL, pp. 1003–1011, 2009.
189
+
190
+ Changsung Moon, Paul Jones, and Nagiza F Samatova. Learning entity type embeddings for knowledge graph completion. In Proceedings of the 2017 ACM on conference on information and knowledge management, pp. 2215–2218, 2017.
191
+
192
+ Dai Quoc Nguyen, Tu Dinh Nguyen, Dat Quoc Nguyen, and Dinh Phung. A novel embedding model for knowledge base completion based on convolutional neural network. In Proceedings of North American Chapter of the Association for Computational Linguistics, pp. 327–333, 2018. doi: 10.18653/v1/N18-2053. URL http://aclweb.org/anthology/N18-2053.
193
+
194
+ Chao Shang, Yun Tang, Jing Huang, Jinbo Bi, Xiaodong He, and Bowen Zhou. End-to-end structureaware convolutional networks for knowledge base completion. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 3060–3067, 2019.
195
+
196
+ Zhiqing Sun, Zhi-Hong Deng, Jian-Yun Nie, and Jian Tang. Rotate: Knowledge graph embedding by relational rotation in complex space. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $=$ HkgEQnRqYQ.
197
+
198
+ Zhen Wang, Jianwen Zhang, Jianlin Feng, and Zheng Chen. Knowledge graph embedding by translating on hyperplanes. In Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence, AAAI’14, pp. 1112–1119. AAAI Press, 2014. URL http://dl.acm.org/ citation.cfm?id=2893873.2894046.
199
+
200
+ Chenyan Xiong, Russell Power, and Jamie Callan. Explicit semantic ranking for academic search via knowledge graph embedding. In Proceedings of the 26th international conference on world wide web, pp. 1271–1279, 2017.
201
+
202
+ Fuzheng Zhang, Nicholas Jing Yuan, Defu Lian, Xing Xie, and Wei-Ying Ma. Collaborative knowledge base embedding for recommender systems. In Proceedings of the 22nd International Conference on Knowledge Discovery and Data Mining, KDD ’16, pp. 353–362, New York, NY, USA, 2016. ISBN 978-1-4503-4232-2. doi: 10.1145/2939672.2939673. URL http://doi.acm.org/10.1145/2939672.2939673.
203
+
204
+ Zhanqiu Zhang, Jianyu Cai, Yongdong Zhang, and Jie Wang. Learning hierarchy-aware knowledge graph embeddings for link prediction. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 3065–3072, 2020.
205
+
206
+ Zhao Zhang, Fuzhen Zhuang, Meng Qu, Fen Lin, and Qing He. Knowledge graph embedding with hierarchical relation structure. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 3198–3207, 2018.
207
+
208
+ Sendong Zhao, Bing Qin, Ting Liu, and Fei Wang. Biomedical knowledge graph refinement with embedding and logic rules. arXiv preprint arXiv:2012.01031, 2020.
md/dev/VppWsjXgBY6/VppWsjXgBY6.md ADDED
@@ -0,0 +1,374 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TL;DR: TWIN LEARNING FOR DIMENSIONALITY REDUCTION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ ![](images/7273545d114d99d52df49e70437f9ead1234f72f7dbc87d2f5162f627f63edc2.jpg)
6
+ Figure 1: Overview of the proposed TLDR, a dimensionality reduction method. Given a set of feature vectors in a generic input space, we use nearest neighbors to define a set of feature pairs whose proximity we want to preserve. We then learn a dimensionality-reduction function (the encoder) by encouraging neighbors in the input space to have similar representations. We learn it jointly with an auxiliary projector that produces high dimensional representations, where we compute the Barlow Twins (Zbontar et al., 2021) loss over the $d ^ { \prime } \times d ^ { \prime }$ cross-correlation matrix averaged over the batch.
7
+
8
+ # ABSTRACT
9
+
10
+ Dimensionality reduction methods are unsupervised approaches which learn lowdimensional spaces where some properties of the initial space, typically the notion of “neighborhood”, are preserved. They are a crucial component of diverse tasks like visualization, compression, indexing, and retrieval. Aiming for a totally different goal, self-supervised visual representation learning has been shown to produce transferable representation functions by learning models that encode invariance to artificially created distortions, e.g. a set of hand-crafted image transformations. Unlike manifold learning methods that usually require propagation on large $k$ -NN graphs or complicated optimization solvers, self-supervised learning approaches rely on simpler and more scalable frameworks for learning.
11
+
12
+ In this paper, we unify these two families of approaches from the angle of manifold learning and propose TLDR, a dimensionality reduction method for generic input spaces that is porting the simple self-supervised learning framework of Zbontar et al. (2021) to a setting where it is hard or impossible to define an appropriate set of distortions by hand. We propose to use nearest neighbors to build pairs from a training set and a redundancy reduction loss borrowed from the self-supervised literature to learn an encoder that produces representations invariant across such pairs. TLDR is a method that is simple, easy to implement and train, and of broad applicability; it consists of an offline nearest neighbor computation step that can be highly approximated, and a straightforward learning process that does not require mining negative samples to contrast, eigendecompositions, or cumbersome optimization solvers. Aiming for scalability, the Achilles’ heel of manifold learning, we focus on improving linear dimensionality reduction, a technique that is still an integral part of many large-scale systems. By simply replacing PCA with TLDR, we are able to increase the performance of GeM-AP (Revaud et al., 2019), a stateof-the-art landmark recognition method by $4 \%$ mAP for 128 dimensions, and to retain its performance with $1 6 \times$ fewer dimensions.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Dimensionality reduction refers to a set of unsupervised approaches which aim at learning lowdimensional spaces where properties of an initial higher-dimensional input space, e.g. proximity or “neighborhood”, are preserved. It is a crucial component for very diverse tasks, ranging from visualization and compression, to indexing and retrieval; most web-scale retrieval systems, still use dimensionality reduction in practice. Assuming that data in the input space lie on a lower-dimensional “manifold”, dimensionality reduction is also referred to as manifold learning.
17
+
18
+ Recently, and aiming for a different goal, self-supervised representation learning has been shown to produce representations that are highly transferable to a wide number of downstream tasks via encoding invariance to image distortions like data augmentations (Chen et al., 2020a; He et al., 2020; Caron et al., 2020; Zbontar et al., 2021; Grill et al., 2020). Central to the success of such methods is the scalable and easy-to-optimize learning framework that such methods adopt, often based on loss functions with or without constrasting pairs. Seeing how manifold learning methods lack scalability and usually require propagation on large $k$ -NN graphs or complicated optimization solvers, one cannot help but wonder: Can we borrow from the highly successful learning frameworks of self-supervised representation learning to design dimensionality reduction approaches?
19
+
20
+ In this paper, we unify these two families of approaches from the angle of manifold learning and propose Twin Learning for Dimensionality Reduction or TLDR, a generic dimensionality-reduction technique where the only prior is that data lies on a reliable manifold we want to preserve. It is based on the intuition that comparing a data point and its nearest neighbors is a good “distortion” to learn from, and hence a good way of approximating the local manifold geometry. Similar to other manifold learning methods (Roweis & Saul, 2000; Van der Maaten & Hinton, 2008; Belkin & Niyogi, 2003; Donoho & Grimes, 2003; Hadsell et al., 2006) we use Euclidean nearest neighbors as a way of defining distortions of the input that the dimensionality reduction function should be invariant to. However, unlike other manifold learning methods, TLDR does not require eigendecompositions, negatives to contrast, or cumbersome optimization solvers; it simply consists of an offline nearest neighbor computation step that can be highly approximated without loss in performance and a straightforward stochastic gradient descent learning process. This leads to a highly scalable method that can learn linear and non-linear encoders for dimensionality reduction while trivially handling out-of-sample generalization. We show an overview of the proposed method in Figure 1.
21
+
22
+ We are interested in explicitly targeting applications like image and document search where training labels are non-existent and dimensionality reduction is an important part of the state-of-the-art pipelines. Aiming at large-scale search applications, we focus on improving linear dimensionality reduction with a compact encoder, an integral part of the first-stage of most retrieval systems, and an area where PCA (Pearson, 1901) is still the default method used in practice (Revaud et al., 2019; Tolias et al., 2020). We present a large set of ablations and experimental results on two common benchmarks for image retrieval (Radenovic et al. ´ , 2018a), as well as on the natural language processing task of argument retrieval. We show that one can achieve significant gains without altering the encoding and search complexity: for example we can improve landmark image retrieval on ROxford5K (Radenovic´ et al., 2018a) by almost 4 mAP points for 128 dimensions, a commonly used dimensionality (Tolias et al., 2020), when replacing PCA with TLDR in a state-of-the-art method (Revaud et al., 2019).
23
+
24
+ Contributions. We introduce TLDR, a dimensionality reduction method that achieves neighborhood embedding learning with the simplicity and effectiveness of recent self-supervised visual representation learning losses. Aiming for scalability, we focus on large-scale image and document retrieval where dimensionality reduction is still an integral component. We show that replacing PCA (Pearson, 1901) with a linear TLDR encoder can greatly improve the performance of state-of-the-art methods without any additional computational complexity. We thoroughly ablate parameters and show that our design choices allow TLDR to be robust to a large range of hyper-parameters and is applicable to a diverse set of tasks and input spaces. We intend to make the code for TLDR publicly available.
25
+
26
+ # 2 TWIN LEARNING FOR DIMENSIONALITY REDUCTION
27
+
28
+ Starting from a set of unlabeled and high-dimensional features, our goal is to learn a lowerdimensional space which preserves the local geometry of the larger input space. Assuming that we have no prior knowledge other than the reliability of the local geometry of the input space, we use nearest neighbors to define a set of feature pairs whose proximity we want to preserve. We then learn the parameters of a dimensionality-reduction function (the encoder) using a loss that encourages neighbors in the input space to have similar representations, while also minimizing the redundancy between the components of these vectors. Similar to other works (Chen et al., 2020b;a; Zbontar et al., 2021) we append a projector to the encoder that produces a representation in a very high dimensional space, where the Barlow Twins (Zbontar et al., 2021) loss is computed. At the end of the learning process, the projector is discarded. All aforementioned components are detailed next. We call our method Twin Learning for Dimensionality Reduction or TLDR, in homage to the Barlow Twins loss. An overview is provided in Figure 1.
29
+
30
+ Preserving local neighborhoods. Recent self-supervised learning methods define positive pairs via hand-crafted distortions that exploit prior information from the input space. In absence of any such prior knowledge, defining local distortions can only be achieved via assumptions on the input manifold. Assuming a locally linear manifold, for example, would allow using the Euclidean distance as a local measure of on-manifold distortion and using nearest neighbors over the training set would be a good approximation for local neighborhoods. Therefore, we construct pairs of neighboring training vectors, and learn invariance to the distortion from one such vector to another. Practically, we define the local neighborhood of each training sample as its $k$ nearest neighbors. Although defining local neighborhood in such a uniform way over the whole manifold might seem naive, we experimentally show that not only it is sufficient, but also that our algorithm is robust across a wide range of $k$ values (see Section 3.1).
31
+
32
+ Using nearest neighbors is of course not the only way of defining neighborhoods. In fact, we show alternative results with a simplified variant of TLDR (denoted as $\mathrm { T L D R } _ { \mathcal { G } }$ ) where we construct pairs by simply adding Gaussian noise to an input vector. This is a baseline resembling denoising autoencoders, although in our case we are using a) an asymmetric encoder-decoder architecture and b) the Barlow twins loss instead of a reconstruction loss.
33
+
34
+ Notation. Our goal is to learn an encoder $f _ { \theta } : \mathbb { R } ^ { D } \mathbb { R } ^ { d }$ that takes as input a vector $x \in \mathbb { R } ^ { D }$ and outputs a corresponding reduced vector $z = f _ { \theta } ( x ) \in \mathbb { R } ^ { d }$ , with $d < < D$ . Without loss of generality, we define the encoder to be a neural network with learnable parameters $\theta$ . Let $\mathcal { X }$ be a (training) set of datapoints in $\mathbb { R } ^ { D }$ , the $D$ -dimensional input space. Let $\boldsymbol { \dot { x } } \in \mathbb { R } ^ { D }$ be a vector from $\mathcal { X }$ . $\mathcal { N } _ { k } ( x )$ is composed of the $k$ nearest neighbors of $x$ . For a vector $y \in \mathcal { X }$ from the training set: $\begin{array} { r } { y \in { \mathcal { N } } _ { k } ( x ) \Leftrightarrow y \in \arg _ { k } \operatorname* { m i n } _ { y \in \mathcal { X } } d ( x , y ) } \end{array}$ , where $d ( \cdot , \cdot )$ denotes the Euclidean distance. Although the definition above can be trivially extended to non-Euclidean distances and adaptive neighborhoods (e.g. defined by a radius), without loss of generality we present our method and results with pairs from $k$ Euclidean neighbors. We define neighbor pairs as pairs $( x , y ) \in \mathcal { X } \times \mathcal { X }$ where $y \in \mathcal { N } _ { k } \overline { { ( x ) } }$ .
35
+
36
+ Learning à la Barlow Twins. Although contrastive losses were proven highly successful for visual representation learning, explicitly minimizing the redundancy of the output dimension is highly desirable for dimensionality reduction: having a highly informative output space is more important than a highly discriminative one. We therefore choose to learn the parameters of our encoder by minimizing the Barlow Twins loss function (Zbontar et al., 2021), that suits perfectly. Similar to (Zbontar et al., 2021), we append a projector $g _ { \phi }$ to the encoder $f _ { \theta }$ , allowing to calculate the loss in a (third) representation space which is not the one that will be used for subsequent tasks. That extended space can possibly be much larger. We detail the encoder and the projector later. Let $\hat { z } = g _ { \phi } ( f _ { \theta } ( x ) )$ be the output vector of the projector, $\hat { z } \in \mathbb { R } ^ { d ^ { \prime } }$ . Given a pair of neighbors $( x ^ { A } , x ^ { B } )$ and the corresponding vectors $\hat { z } ^ { A } , \hat { z } ^ { B }$ after the projector, the loss function $\mathcal { L } _ { B T }$ is given by:
37
+
38
+ $$
39
+ \mathcal { L } _ { B T } = \sum _ { i } ( 1 - \mathcal { C } _ { i i } ) ^ { 2 } + \lambda \sum _ { i } \sum _ { i \neq j } \mathcal { C } _ { i j } ^ { 2 } , \mathrm { ~ w h e r e ~ } \mathcal { C } _ { i j } = \frac { \sum _ { b } \hat { z } _ { b , i } ^ { A } \hat { z } _ { b , j } ^ { B } } { \sqrt { \sum _ { b } ( \hat { z } _ { b , i } ^ { A } ) ^ { 2 } } \sqrt { \sum _ { b } ( \hat { z } _ { b , j } ^ { B } ) ^ { 2 } } } ,
40
+ $$
41
+
42
+ where $b$ indexes the positive pairs in a batch, $i$ and $j$ are two dimensions from $\mathbb { R } ^ { d ^ { \prime } }$ (i.e. $0 \leq i , j \leq d ^ { \prime } )$ and $\lambda$ is a hyper-parameter. $\mathcal { C }$ is the $d ^ { \prime } \times d ^ { \prime }$ cross-correlation matrix computed and averaged over all positive pairs $( \hat { z } ^ { \bar { A } } , \hat { z } ^ { B } )$ from the current batch. The loss is composed of two terms. The first term encourages the diagonal elements to be equal to 1. This makes the learned representations invariant to applied distortions, $i . e$ . the datapoints moving along the input manifold in the neighborhood of a training vector are encouraged to share similar representations in the output space. The second term is pushing off-diagonal elements towards 0, reducing the redundancy between output dimensions, a highly desirable property for dimensionality reduction.
43
+
44
+ The redundancy reduction term can be viewed as a soft-whitening constraint on the representations and, shown in Zbontar et al. (2021), it works better than performing “hard” whitening on the representations (Ermolov et al., 2021). Finally, it is worth noting that understanding the dynamics of learning without contrasting pairs is far from trivial and beyond the scope of this paper; we refer the reader to the recent work by Tian et al. (2021) that studies this learning paradigm in depth and discusses why trivial solutions are avoided when learning without negatives as in Eq. (1).
45
+
46
+ The encoder $f _ { \theta }$ . We consider a number of different architectures for the encoder:
47
+
48
+ linear: The most straight-forward choice for encoder $f _ { \theta }$ is a linear function parametrized by a $D \times d$ weight matrix $W$ and bias term $b$ , i.e. $f _ { \theta } ( x ) = W x + b$ . Beyond computational benefits, and given that we are mostly interested in medium-sized output spaces where $d \in \{ 8 , \ldots , 5 1 2 \}$ , we argue that, given a meaningful enough input space, a linear encoder could suffice in preserving neighborhoods of the input. factorized linear: Exploiting the fact that batch normalization (BN) (Ioffe & Szegedy, 2015) is linear during inference,1 we formulate $f _ { \theta }$ as a multi-layer linear model, where $f _ { \theta }$ is a sequence of $l$ layers, each composed of a linear layer followed by a BN layer. This model introduces non-linear dynamics which can potentially help during training but the sequence of layers can still be replaced with a single linear layer after training for efficiently encoding new features. MLP: $f _ { \theta }$ can be a multi-layer perceptron with batch normalization (BN) (Ioffe & Szegedy, 2015) and rectified linear units (reLUs) as non-linearities, i.e. $f _ { \theta }$ would be a sequence of $l$ linear-BN-reLU triplets, each with $H ^ { i }$ hidden units $( i = 1 , . . , l )$ , followed by a linear projection.
49
+
50
+ Our main goal is to develop a scalable alternative to PCA for dimensionality reduction, so we are mostly interested in linear and factorized linear encoders. It is worth already mentioning that, as we will show in our experimental validation, gains from introducing an MLP in the encoder are minimal and would not justify the added computational cost in practice.
51
+
52
+ The projector $g _ { \phi }$ . As also recently noted in Tian et al. (2021), a crucial part of learning with noncontrastive pairs is the projector. This module is present in a number of contrastive self-supervised learning methods (Chen et al., 2020a; Grill et al., 2020; Zbontar et al., 2021; Tian et al., 2021). It is usually implemented as an MLP inserted between the transferable representations and the loss function. Unlike other methods, however, where the projector takes the representations to an even lower dimensional space for the contrastive loss to operate on (i.e. for SimCLR (Chen et al., 2020a) and BYOL (Grill et al., 2020), $d ^ { \prime } \ll d ,$ ), for the Barlow Twins objective, operating in large output dimensions is crucial.
53
+
54
+ In Section 3, we study the impact of the dimension $d ^ { \prime }$ and experiment with a wide range of values. We empirically verify the findings of Zbontar et al. (2021) that calculating the de-correlation loss in higher dimensions $( d ^ { \prime } \gg d )$ is highly beneficial. In this case, and as shown in Figure 1, the transferable representation is now the bottleneck layer of this non-symmetrical hour-glass model. Although Eq. (1) is applied after the projector and only indirectly decorrelates the output representation components, having more dimensions to decorrelate leads to a representation that is more informative: the bottleneck effect created by the projector’s output being in a much larger dimensionality implicitly enables the network to learn an encoder that also has more decorrelated outputs.
55
+
56
+ # 3 EXPERIMENTAL VALIDATION
57
+
58
+ In this section, we present a set of experiments validating the proposed TLDR both on visual and textual features. We selected one input representation space and one task for each modality: for the visual domain, we focus on the task of landmark image retrieval (Section 3.1) and use 2048-dimensional global image features from an off-the-shelf ResNet50 pre-trained for image retrieval2 (Revaud et al., 2019). For the textual domain, we focus on the task of argument retrieval (Section 3.2). We use 768-dimensional features from an off-the-shelf Bert-Siamese model called
59
+
60
+ ANCE3 (Xiong et al., 2021) trained for document retrieval, following the dataset definitions from Thakur et al. (2021). Details on tasks and datasets used are summarized in Table A in the Appendix.
61
+
62
+ Implementation details. We do not explicitly normalize representations during learning TLDR; yet, we follow the common protocol and L2-normalize the features before retrieval for both tasks. Results reported for PCA use whitened PCA; we tested multiple whitening power values and kept the ones that performed best. Further implementation details are reported in the Appendix. It is noteworthy that we used the exact same hyper-parameters for the learning rate, weight decay, scaling, and $\lambda$ suggested in Zbontar et al. (2021), despite having very different tasks and encoder architectures.
63
+
64
+ Further ablations, results on FashionMNIST and 2D visualizations. Due to space constraints, additional results and interesting ablations can be found in the Appendix. In particular, we explore the effect of the training set size, the batch size and report results on another NLP task: duplicate query retrieval. Moreover, and although beyond the scope of what TLDR is designed for, in Appendix E we present results on FashionMNIST when using TLDR on raw pixel data and for 2D visualization. We show that for cases where the input pixels are forming an informative space, TLDR can achieve top performance for $d \geq 8$ .
65
+
66
+ # 3.1 RESULTS ON LANDMARK IMAGE RETRIEVAL
67
+
68
+ We first focus on landmark image retrieval. For large-scale experiments on this task, it is common practice to apply dimensionality reduction to global normalized image representations using PCA with whitening (Jégou & Chum, 2012; Tolias et al., 2016; Revaud et al., 2019). We start from GeM-AP (Revaud et al., 2019) and simply replace the standard PCA step with our proposed TLDR.
69
+
70
+ Experimental protocol. We start from 2048-dimensional features obtained from the pre-trained ResNet-50 of (Revaud et al., 2019), which uses Generalized-Mean pooling (Radenovic et al. ´ , 2018b) and has been specifically trained for landmark retrieval using the AP loss (GeM-AP). To learn the dimensionality reduction function, we use a dataset composed of 1.5 million landmark images (Weyand et al., 2020). We learn different output spaces whose dimensions range from 32 to 512. Finally, we evaluate these spaces on two standard image retrieval benchmarks (Radenovic et al. ´ , 2018a), the revisited Oxford and Paris datasets (ROxford5K and RParis6K). Each dataset comes with two test sets of increasing difficulty, the “Medium” and “Hard”. Following these datasets’ protocol, we apply the learned dimensionality reduction function to encode both the gallery images and the set of query images whose 2048-dim features have been extracted beforehand with the model of Revaud et al. (2019). We then evaluate landmark image retrieval on ROxford5K and RParis6K and report mean average precision (mAP), the standard metric reported for these datasets. For brevity, we report the “Mean” mAP metric, i.e. the average of the mAP of the “Medium” and “Hard” test sets; we include the individual plots for “Medium” and “Hard” in the Appendix for completeness.
71
+
72
+ Compared approaches. We report results for several flavors of our approach. TLDR uses a linear projector, $T L D R _ { 1 }$ uses a factorized linear one, and $T L D R _ { 1 } ^ { \star }$ an MLP encoder with 1 hidden layer. As an alternative, we also report $T L D R _ { \mathcal { G } }$ , which uses Gaussian noise to create synthetic neighbour pairs. All variants use an MLP with 2 hidden layers and 8192 dimensions as a projector.
73
+
74
+ We compare with a number of un- and self-supervised methods (see also Table B in the Appendix for a summary). First, and foremost, we compare to reducing the dimension with PCA with whitening, which is still standard practice for these datasets (Revaud et al., 2019; Radenovic et al. ´ , 2018b; Tolias et al., 2020). We also report results for our approach but trained with the Mean Square Error reconstruction loss instead of the Barlow Twins’ (as we discuss in Section 4, PCA can be rewritten as learning a linear encoder and projector with a reconstruction loss), and refer to this method as MSE. In this case, the projector’s output is reduced to 2048 dimensions in order to match the input’s dimensionality. Following a number of approaches that use nearest neighbors as (self-)supervision for contrastive learning (Hadsell et al., 2006), the Contrastive approach uses a contrastive loss on top of the projector’s output. This draws inspiration from Hadsell et al. (2006), and is a variant where we replace the Barlow Twins loss, with the loss from Hadsell et al. (2006). It is worth noting that we omit results from a more faithful reimplementation of Hadsell et al. (2006), i.e. using a max-margin loss directly applied on the lower dimensional space and without a projector, as they were very low. Note that none of the manifold learning method we tested was able to neither scale, nor outperform PCA in output dimensions $d \geq 8$ ; we present comparisons for smaller $d$ in Section 3.3. Finally, we report retrieval results obtained on the initial features from Revaud et al. (2019) $( G e M – A P )$ , i.e. without dimensionality reduction. For all flavours of TLDR, we fix the number of nearest neighbors to $k = 3$ although, and as we show in Figure 4, TLDR performs well for a wide range of number of neighbors.
75
+
76
+ ![](images/4680f0aa3cb567903b401f7f38f1d846ff21127b8d4243f7d9e1f7a78eb1d2d8.jpg)
77
+ Figure 2: Image retrieval experiments. Mean average precision (mAP) on ROxford5K (left) and RParis6K (right) as a function of the output dimensions $d$ . We report TLDR with different encoders: linear (TLDR), factorized linear with 1 hidden layer $\mathrm { ( T L D R _ { 1 } ) }$ ), and a MLP with 1 hidden layer $( \mathrm { T L D R } _ { 1 } ^ { \star } )$ ), the projector remains the same (MLP with 2 hidden layers). We compare with PCA with whitening, two baselines based on TLDR, but which respectively train with a reconstruction (MSE) and a contrastive (Contrastive) loss, and also with $T L D R _ { \mathcal { G } }$ , a variant of TLDR which uses Gaussian noise to synthesize pairs. The original GeM-AP performance is also reported.
78
+
79
+ Results. Figure 2 reports mean average precision (mAP) results for ROxford5K and RParis6K; as the output dimensions $d$ varies. We report the average of the Medium and Hard protocols for brevity, while results per protocol are presented in Appendix C.1. We make a number of observations. First and most importantly, we observe that both linear flavors of our approach outperform PCA by a significant margin. For instance, TLDR improves ROxford5K retrieval by almost 4 mAP points for 128 dimensions over the PCA baseline. The MLP flavor is very competitive for very small dimensions (up to 128) but degrades for larger ones. Even for the former, it is not worth the extra-computational cost. An important observation is that we are able to retain the performance of the input representation (GeM-AP) while using only 1/16th of its dimensionality. Using a different loss (MSE and Contrastive) instead of the Barlow Twins’ in TLDR degrades the results. These approaches are comparable to or worse than PCA. Finally, replacing true neighbors by synthetic ones, as in $\mathrm { T L D R } _ { \mathcal { G } }$ , performs worse.
80
+
81
+ # 3.2 RESULTS ON FIRST STAGE DOCUMENT RETRIEVAL
82
+
83
+ For document retrieval, the process is generally divided into two stages: the first one selects a small set of candidates while the second one re-ranks them. Because it works on a smaller set, this second stage can afford costly strategies, but the first stage has to scale. The typical way to do this is to reduce the dimension of the representations used in the first retrieval stage, often in a supervised fashion (Khattab & Zaharia, 2020; Gao et al., 2021). Following our initial motivation, we investigate the use of unsupervised dimensionality reduction for document retrieval scenarios where a supervised approach is not possible, e.g. when no such training data is available.
84
+
85
+ Experimental protocol. We start from 768-dimensional features extracted from a model trained for Question Answering (QA), i.e. ANCE (Xiong et al., 2021). We use Webis-Touché-2020 (Bondarenko et al., 2020; Wachsmuth et al., 2017) a conversational argument dataset composed of 380k documents to learn the dimensionality reduction function.
86
+
87
+ Compared approaches. We report results for three flavors of our approach. TLDR uses a linear encoder while $T L D R _ { 1 }$ and $T L D R _ { 2 }$ use a factorized linear one with respectively one hidden layer and two hidden layers. We compare with PCA, which was the best performing competitor from Section 3.1. We also report retrieval results obtained with the 768-dimensional initial features.
88
+
89
+ ![](images/4acf4919eb3e362c53b8623af75435d7a34fccdff381f02c6815b75c30aa0d55.jpg)
90
+ Figure 3: Argument retrieval results on ArguAna for different values of output dimensions $d$ . On the left we vary the amount of factorized layers, with fixed $k = 3$ , on the right we fix the amount of factorized layers to 2 and test $k = [ 3 , 1 0 , 1 0 0 ]$ . Factorized linear is fixed to 512 hidden dimensions.
91
+
92
+ ![](images/9da644575b5b7edd0714dfb2b1acce5f8a5ddb7f3af85e375e552a3751cc3ac6.jpg)
93
+ Figure 4: Impact of TLDR hyper-parameters with a linear encoder and $d = 1 2 8$ . Dashed (solid) lines are for RParis6K-Mean (ROxford5K-Mean). (Left) Impact of the auxiliary dimension $d ^ { \prime }$ and the number of hidden layers in the projector. (Right) Impact of the number of neighbors $k$ . We see how the algorithm is robust to the number of neighbors used.
94
+
95
+ Results. Figure 3 reports retrieval results on ArguAna, for different output dimensions $d$ . We observe that the linear version of TLDR outperforms PCA for almost all values of $d$ . The linear-factorized ones outperforms PCA in all scenarios. We see that the gain brought by TLDR over PCA increases as $d$ decreases. Note that we achieve results equivalent to the initial ANCE representation using only $4 \%$ of the original dimensions; PCA, needs twice as many dimensions to achieve similar performance.
96
+
97
+ # 3.3 ANALYSIS AND IMPACT OF HYPER-PARAMETERS
98
+
99
+ Impact of hyper-parameters. Figure 4 studies the role of some of our parameters. On the left size of Figure 4, we vary the architecture of the projector $g _ { \phi }$ , an important module of TLDR. We see that having hidden layers generally helps. As also noted in Zbontar et al. (2021), having a high auxiliary dimension $d ^ { \prime }$ for computing the loss is very important and highly impacts performance. On the right side of Figure 4 we show the surprisingly consistent performance of TLDR across a wide range of numbers of neighbors $k$ . We observe the same stability across several batch sizes (see also Figure E).
100
+
101
+ Comparisons to manifold learning methods on smaller output dimensions. In Figure 5a we present results for TLDR when the output dimensionality is $d ^ { \prime } \leq 6 4$ ; in this regime, a few more manifold learning methods can be run, eg UMAP, Locally Linear Embedding (LLE) (Roweis & Saul, 2000), Local Tangent Space Alignment (LTSA) (Zhang & Zha, 2004), and UMAP (McInnes et al., 2018). Unfortunately, even at smaller output dimensions we had to subsample the dataset to run some of the methods, due to their scalability issues. Specifically, we are forced to use only $5 \%$ of the training set $\mathord { \sim } 7 5 \mathrm { K }$ images) for learning LLE and LTSA, and $50 \%$ ( $\sim 7 5 0 \mathrm { K }$ images) for UMAP.
102
+
103
+ How sensitive is TLDR to approximate nearest neighbors? To verify that our system is robust to an approximate computation of nearest neighbors, we test its performance using product quantization (Ge et al., 2013) while varying the quantization budget (i.e. the amount of bytes used for each image during the nearest neighbor search). Compression is done using optimized product quantization (OPQ) (Ge et al., 2013) via the FAISS library (Johnson et al., 2017) and results are reported in Figure 5b. We see that TLDR is quite robust to quantization during the nearest neighbor search and that even when the quantization is pretty strong (1/64 the default size or merely 16 Bytes per vector) TLDR still retains its high performance.
104
+
105
+ ![](images/b2088b3a0cf07a2fdb104d51bab5805db31654edf25f95cf4b20c05b70c2a26a.jpg)
106
+ Figure 5: Left: Comparisons to manifold learning methods for small output dimensions $d \leq 1 2 8$ . Mean average precision (mAP) on ROxford5K (Radenovic et al. ´ , 2018a) averaged over the Medium and Hard test sets as a function of the output dimensions $d$ . Right: The effect of nearest neighbor approximation for $d = 1 2 8$ . We plot mAP as a function of the embedding compression rate used during nearest neighbor computation. Note that the baseline (compression rate $= 0$ ) is using the 2048-dimensional (8192 bytes) GeM-AP representations during nearest neighbor computation.
107
+
108
+ # 4 DISCUSSION AND RELATED WORK
109
+
110
+ The basic idea behind TLDR is embarrassingly simple and links to a large number of related methods, from PCA to manifold learning and neighborhood embedding. In this section we discuss a few such relations; more are discussed in Appendix F due to lack of space.
111
+
112
+ Linear dimensionality reduction. We refer the reader to Cunningham & Ghahramani (2015) for an extensive review of linear dimensionality reduction. It is beyond the scope of this paper to exhaustively discuss many such related works, we will therefore focus on PCA (Pearson, 1901) which is the de facto standard linear dimensionality method, in particular for large-scale retrieval.
113
+
114
+ One can derive the learning objective of PCA (Pearson, 1901) by setting $f _ { \theta } ( x ) \ = \ W ^ { T } x$ and $g ( x ) = W x$ in the model of Figure 1, i.e. use a linear encoder and projector with $\dot { W } \in \mathbb { R } ^ { D \times d }$ , and optimize $W$ via minimizing the Frobernius norm of the matrix of reconstruction errors over the whole training set, subject to orthogonality constraints:
115
+
116
+ $$
117
+ \boldsymbol { W } ^ { * } = \arg \operatorname* { m i n } _ { \boldsymbol { W } } | | \boldsymbol { x } - \boldsymbol { g } ( f _ { \boldsymbol { \theta } } ( \boldsymbol { x } ) ) | | _ { F } , \quad \mathrm { s . t . } \quad \boldsymbol { W } ^ { T } \boldsymbol { W } = I _ { d } .
118
+ $$
119
+
120
+ This equation has a closed form solution that can be obtained via the eigendecomposition of the data covariance matrix and then keeping the largest $d$ eigenvectors.
121
+
122
+ Unlike PCA, TLDR does not constrain the projector to be a linear model, nor the loss to be a reconstruction loss. In fact, the redundancy reduction term in the Barlow Twins loss encourages the whitening of the batch representations as a soft constraint (Zbontar et al., 2021), in a way analogous to the orthogonality constraint of Eq.(2). We see from Figure 4 that part of the performance gains of TLDR over PCA is precisely due to this asymmetry in the architecture, i.e. when the projector is an MLP with hidden layers. Looking at MSE results in Figures 2, i.e. a version of TLDR with a reconstruction loss, we also see that the Barlow Twins loss and the flexibility of computing it in an arbitrarily high $d ^ { \prime }$ -dimensional space further contributes to this gain. One can therefore interpret TLDR as a more generic way of optimizing a linear encoder, i.e. using an arbitrary decoder and approximating the constraint of Eq.(2) in a soft way, further incorporating a weak notion of whitening.
123
+
124
+ Manifold learning and neighborhood embedding methods. Manifold learning methods define objective functions that try to preserve the local structure of the input manifold, usually expressed via a $k$ -NN graph. Non-linear unsupervised dimensionality-reduction methods usually require the $k$ -NN graph of the input data, while most further require eigenvalue decompositions (Roweis & Saul, 2000; Donoho & Grimes, 2003; Zhang & Zha, 2004) and shortest-path (Tenenbaum et al., 2000)) or computation of the graph Laplacian (Belkin & Niyogi, 2003). Others involve more complex optimization (McInnes et al., 2018; Agrawal et al., 2021). Moreover, many manifold learning methods were created to solely operate on the data they were learned on. Although “out-of-sample” extensions for many of such methods have been proposed (Bengio et al., 2004), methods like Spectral Embeddings, pyMDE (Agrawal et al., 2021) or the very popular $t$ -SNE (Van der Maaten & Hinton, 2008) can only be used for the data they were trained on. Finally, UMAP (McInnes et al., 2018) was recently proposed as not only a competitor of $t$ -SNE on 2-dimensional outputs, but as a general purpose dimension reduction technique. Yet, all our experiments with UMAP, even after exhaustive hyperparameter tuning, resulted in very low performance for $d \geq 8$ for all the tasks we evaluated in the main paper and the Appendix.
125
+
126
+ Nearest neighbors as “supervision” for contrastive learning. The seminal method DrLIM (Hadsell et al., 2006) uses a contrastive loss over neighborhood pairs for representation learning. Experimenting only on simple datasets like MNIST, it learns a CNN backbone and the dimensionality reduction function in a single stage, using a max-margin loss. TLDR resembles DrLIM (Hadsell et al., 2006) with respect to the encoder input and the way pairs are constructed; a crucial difference, however, is the loss function and the space in which it is computed: DrLIM uses a contrastive loss which is computed directly on the lower dimensional space. Despite our best effort to make this approach work as described, performance was very low without a projector. Using the contrastive loss from Hadsell et al. (2006), together with the projector we use for TLDR, we were able to get more meaningful results (reported as Contrastive in our experiments), although still underperforming the Barlow Twins loss. This difference may be due to two reasons: first, and as discussed above, Barlow Twins encourages the whitening of the representations which makes it more suitable for this task. Second, and like many other pair-wise losses, the contrastive loss further requires sampling hard/meaningful negatives (Wu et al., 2017; Radenovic et al. ´ , 2018b).
127
+
128
+ TLDR out of its comfort zone. Although TLDR can be seen as a way of generalizing recent self-supervised visual representation learning methods to cases where handcrafted transformations of the data are challenging or impossible to define, we want to emphasize that it is not suited for self-supervised representation learning from pixels; augmentation invariance is a much more suited prior in that regard, while it is also practically imposible to define meaningful neighboring pairs from the input pixel space. Additionally, although visualization is a common manifold learning application, TLDR is neither designed not recommended for 2D outputs; there are other methods like Van der Maaten & Hinton (2008); McInnes et al. (2018); Agrawal et al. (2021) that specialize for such tasks.
129
+
130
+ What is TLDR suitable for? TLDR excels for dimensionality reduction to mid-size outputs, e.g. when $d$ is from 32 to 256 dimensions. This is very useful in practice for retrieval and a set of output dimensions where the vast majority of manifold learning methods cannot scale. At the same time, TLDR enables the community to utilize a powerful learning framework initially tailored for visual representation learning (Zbontar et al., 2021) in different domains like natural language.
131
+
132
+ # 5 CONCLUSIONS
133
+
134
+ In this paper we introduce TLDR, a dimensionality-reduction method that combines neighborhood embedding learning with the simplicity and effectiveness of recent self-supervised learning losses. By simply replacing PCA with TLDR one can significantly increase the state-of-the-art landmark retrieval performance of GeM-AP (Revaud et al., 2019) and boost argument retrieval performance without additional computational cost. TLDR further offers a number of desirable properties: i) Scalability: learned via stochastic gradient descent, TLDR can easily be parallelized across GPUs and machines, while for even the largest datasets, approximate nearest neighbor methods can be used to create input pairs in sub-linear complexity (Ge et al., 2013; Kalantidis & Avrithis, 2014), ii) Simplicity: The Barlow Twins (Zbontar et al., 2021) objective is robust and easy to optimize, and does not have trivial solutions, iii) Out-of-sample generalization, and iv) Linear encoding complexity: TLDR is highly effective with a linear encoder, offering a direct replacement of PCA without extra encoding cost.
135
+
136
+ # REPRODUCIBILITY STATEMENT
137
+
138
+ We report all the hyperparameters we used and all implementation details needed to reproduce our experiments in Section 3, and Appendices C and D. We report the urls for the publicly available pre-trained models we used to extract the input features. All the datasets we use are publicly available to download. Finally, we also intend to make easy-to-use code for TLDR publicly available.
139
+
140
+ # REFERENCES
141
+
142
+ Akshay Agrawal, Alnur Ali, and Stephen Boyd. Minimum-distortion embedding. arXiv preprint arXiv:2103.02559, 2021.
143
+ Ehsan Amid and Manfred K Warmuth. Trimap: Large-scale dimensionality reduction using triplets. arXiv preprint arXiv:1910.00204, 2019.
144
+ Artem Babenko, Anton Slesarev, Alexandr Chigorin, and Victor Lempitsky. Neural codes for image retrieval. In Proc. ECCV, 2014.
145
+ Mikhail Belkin and Partha Niyogi. Laplacian eigenmaps for dimensionality reduction and data representation. Neural computation, 15(6):1373–1396, 2003.
146
+ Yoshua Bengio, Jean-François Paiement, Pascal Vincent, Olivier Delalleau, Nicolas Le Roux, and Marie Ouimet. Out-of-sample extensions for lle, isomap, mds, eigenmaps, and spectral clustering. Proc. NeurIPS, 16: 177–184, 2004.
147
+ Alexander Bondarenko, Maik Fröbe, Meriem Beloucif, Lukas Gienapp, Yamen Ajjour, Alexander Panchenko, Chris Biemann, Benno Stein, Henning Wachsmuth, Martin Potthast, et al. Overview of touché 2020: Argument retrieval. In Proc. CLEF, pp. 384–395. Springer, 2020.
148
+ 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.
149
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In Proc. ICML, pp. 1597–1607, 2020a.
150
+ Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b.
151
+ John P Cunningham and Zoubin Ghahramani. Linear dimensionality reduction: Survey, insights, and generalizations. JMLR, 16(1):2859–2900, 2015.
152
+ David L Donoho and Carrie Grimes. Hessian eigenmaps: Locally linear embedding techniques for highdimensional data. Proc. PNAS, 100(10):5591–5596, 2003.
153
+ Aleksandr Ermolov, Aliaksandr Siarohin, Enver Sangineto, and Nicu Sebe. Whitening for self-supervised representation learning. In Proc. ICML. PMLR, 2021.
154
+ Zhiyuan Fang, Jianfeng Wang, Lijuan Wang, Lei Zhang, Yezhou Yang, and Zicheng Liu. {SEED}: Selfsupervised distillation for visual representation. In Proc. ICLR, 2021.
155
+ Luyu Gao, Zhuyun Dai, and Jamie Callan. Coil: Revisit exact lexical match in information retrieval with contextualized inverted list. arXiv preprint arXiv:2104.07186, to appear in NAACL21, 2021.
156
+ Tiezheng Ge, Kaiming He, Qifa Ke, and Jian Sun. Optimized product quantization. PAMI, 36(4):744–755, 2013.
157
+ Albert Gordo, Jon Almazán, Jerome Revaud, and Diane Larlus. Deep image retrieval: Learning global representations for image search. In Proc. ECCV, pp. 241–257. Springer, 2016.
158
+ 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. In Proc. NeurIPS, 2020.
159
+ Aditya Grover and Jure Leskovec. node2vec: Scalable feature learning for networks. In Proc. KDD, pp. 855–864, 2016.
160
+ Raia Hadsell, Sumit Chopra, and Yann LeCun. Dimensionality reduction by learning an invariant mapping. In Proc. CVPR, volume 2, 2006.
161
+ Kaiming He, Haoqi Fan, Yuxin Wu, Saining Xie, and Ross Girshick. Momentum contrast for unsupervised visual representation learning. In Proc. CVPR, pp. 9729–9738, 2020.
162
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
163
+ Doris Hoogeveen, Karin Verspoor, and Timothy Baldwin. Cqadupstack: Gold or silver. In Proc.SIGIR, volume 16, 2016.
164
+ Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In Proc. ICML, 2015.
165
+ Ahmet Iscen, Giorgos Tolias, Yannis Avrithis, Teddy Furon, and Ondrej Chum. Efficient diffusion on region manifolds: Recovering small objects with compact cnn representations. In Proc. CVPR, pp. 2077–2086, 2017.
166
+ Ahmet Iscen, Yannis Avrithis, Giorgos Tolias, Teddy Furon, and Ondˇrej Chum. Fast spectral ranking for similarity search. In Proc. CVPR, pp. 7632–7641, 2018a.
167
+ Ahmet Iscen, Giorgos Tolias, Yannis Avrithis, and Ondˇrej Chum. Mining on manifolds: Metric learning without labels. In Proc. CVPR, pp. 7642–7651, 2018b.
168
+ Hervé Jégou and Ondrej Chum. Negative evidences and co-occurrences in image retrieval: the benefit of PCA and whitening. In Proc. ECCV, pp. 774–787. Springer, 2012.
169
+ Jeff Johnson, Matthijs Douze, and Hervé Jégou. Billion-scale similarity search with gpus. arXiv preprint arXiv:1702.08734, 2017.
170
+ Yannis Kalantidis and Yannis Avrithis. Locally optimized product quantization for approximate nearest neighbor search. In Proc. CVPR, pp. 2321–2328, 2014.
171
+ Omar Khattab and Matei Zaharia. Colbert: Efficient and effective passage search via contextualized late interaction over bert. In Proc.SIGIR, 2020.
172
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. arXiv preprint arXiv:1609.02907, 2016.
173
+ Sheng-Chieh Lin, Jheng-Hong Yang, and Jimmy Lin. Distilling dense representations for ranking using tightly-coupled teachers. arXiv preprint arXiv:2010.11386, 2020.
174
+ Chundi Liu, Guangwei Yu, Maksims Volkovs, Cheng Chang, Himanshu Rai, Junwei Ma, and Satya Krishna Gorti. Guided similarity separation for image retrieval. In Proc. NeurIPS, 2019.
175
+ Leland McInnes, John Healy, and James Melville. Umap: Uniform manifold approximation and projection for dimension reduction. arXiv preprint arXiv:1802.03426, 2018.
176
+ Tri Nguyen, Mir Rosenberg, Xia Song, Jianfeng Gao, Saurabh Tiwary, Rangan Majumder, and Li Deng. Ms marco: A human generated machine reading comprehension dataset. In CoCo@ NeurIPS, 2016a.
177
+ Tri Nguyen, Mir Rosenberg, Xia Song, Jianfeng Gao, Saurabh Tiwary, Rangan Majumder, and Li Deng. Ms marco: A human generated machine reading comprehension dataset. In CoCo@NeurIPS, 2016b.
178
+ Wonpyo Park, Dongju Kim, Yan Lu, and Minsu Cho. Relational knowledge distillation. In Proc. CVPR, pp. 3967–3976, 2019.
179
+ Karl Pearson. LIII. On lines and planes of closest fit to systems of points in space. The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science, 2(11):559–572, 1901.
180
+ Bryan Perozzi, Rami Al-Rfou, and Steven Skiena. Deepwalk: Online learning of social representations. In Proc. KDD, pp. 701–710, 2014.
181
+ Filip Radenovic, Ahmet Iscen, Giorgos Tolias, Yannis Avrithis, and Ond ´ ˇrej Chum. Revisiting Oxford and Paris: Large-scale image retrieval benchmarking. In Proc. CVPR, pp. 5706–5715, 2018a.
182
+ Filip Radenovic, Giorgos Tolias, and Ond ´ ˇrej Chum. Fine-tuning CNN image retrieval with no human annotation. PAMI, 41(7):1655–1668, 2018b.
183
+ J. Revaud, J. Almazan, R.S. Rezende, and C.R. de Souza. Learning with average precision: Training image retrieval with a listwise loss. In Proc. ICCV, 2019.
184
+
185
+ Sam T Roweis and Lawrence K Saul. Nonlinear dimensionality reduction by locally linear embedding. science, 290(5500):2323–2326, 2000.
186
+
187
+ Karen Simonyan, Andrea Vedaldi, and Andrew Zisserman. Learning local feature descriptors using convex optimisation. PAMI, 36(8):1573–1585, 2014.
188
+
189
+ Jian Tang, Meng Qu, Mingzhe Wang, Ming Zhang, Jun Yan, and Qiaozhu Mei. Line: Large-scale information network embedding. In Proceedings of the 24th international conference on world wide web, pp. 1067–1077, 2015.
190
+
191
+ Joshua B Tenenbaum, Vin De Silva, and John C Langford. A global geometric framework for nonlinear dimensionality reduction. science, 290(5500):2319–2323, 2000.
192
+
193
+ Nandan Thakur, Nils Reimers, Andreas Rücklé, Abhishek Srivastava, and Iryna Gurevych. BEIR: a heterogenous benchmark for zero-shot evaluation of information retrieval models. arXiv preprint arXiv:2104.08663, 2021.
194
+
195
+ Yonglong Tian, Dilip Krishnan, and Phillip Isola. Contrastive representation distillation. arXiv preprint arXiv:1910.10699, 2019.
196
+
197
+ Yuandong Tian, Xinlei Chen, and Surya Ganguli. Understanding self-supervised learning dynamics without contrastive pairs. In Proc. ICML, 2021.
198
+
199
+ Giorgos Tolias, Ronan Sicre, and Hervé Jégou. Particular object retrieval with integral max-pooling of CNN activations. In Proc. ICLR, 2016.
200
+
201
+ Giorgos Tolias, Tomas Jenicek, and Ondˇrej Chum. Learning and aggregating deep local descriptors for instancelevel recognition. In Proc. ECCV, pp. 460–477. Springer, 2020.
202
+
203
+ Laurens Van der Maaten and Geoffrey Hinton. Visualizing data using t-SNE. JMLR, 9(11), 2008.
204
+
205
+ Henning Wachsmuth, Martin Potthast, Khalid Al Khatib, Yamen Ajjour, Jana Puschmann, Jiani Qu, Jonas Dorsch, Viorel Morari, Janek Bevendorff, and Benno Stein. Building an argument search engine for the web. In Proceedings of the 4th Workshop on Argument Mining, pp. 49–59, 2017.
206
+
207
+ Henning Wachsmuth, Shahbaz Syed, and Benno Stein. Retrieval of the best counterargument without prior topic knowledge. In Proc. ACL, pp. 241–251, 2018.
208
+
209
+ T. Weyand, A. Araujo, B. Cao, and J. Sim. Google Landmarks Dataset v2 - A Large-Scale Benchmark for Instance-Level Recognition and Retrieval. In Proc. CVPR, 2020.
210
+
211
+ C-Y Wu, Manmatha R., Smola A.J., and Krahenbuhl P. Sampling matters in deep embedding learning. In Proc. ICCV, 2017.
212
+
213
+ Lee Xiong, Chenyan Xiong, Ye Li, Kwok-Fung Tang, Jialin Liu, Paul N. Bennett, Junaid Ahmed, and Arnold Overwijk. Approximate nearest neighbor negative contrastive learning for dense text retrieval. In Proc. ICLR, 2021.
214
+
215
+ Yuning You, Tianlong Chen, Zhangyang Wang, and Yang Shen. When does self-supervision help graph convolutional networks? In Proc. ICML, pp. 10871–10880, 2020.
216
+
217
+ 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.
218
+
219
+ Zhenyue Zhang and Hongyuan Zha. Principal manifolds and nonlinear dimensionality reduction via tangent space alignment. SIAM journal on scientific computing, 26(1):313–338, 2004.
220
+
221
+ # Appendix
222
+
223
+ # Table of Contents
224
+
225
+ A Appendix Summary 13
226
+ B Tables of tasks and compared approaches 14
227
+ Additional experiments: Landmark image retrieval 14
228
+ C.1 Results on Medium and Hard protocols separately 14
229
+ C.2 Results with “Oracle” nearest neighbors . 14
230
+ C.3 ResNet-101 features 14
231
+ C.4 Varying the size of the training set 14
232
+ C.5 Batch size ablation . 15
233
+ D Additional experiments: Document retrieval 15
234
+ D.1 Tasks and dataset 16
235
+ D.2 Experimental results 18
236
+ E FashionMNIST: Learning from raw pixel data and visualization 19
237
+ F Further discussions and related works 20
238
+ F.1 Limitations of our work 22
239
+
240
+ # A APPENDIX SUMMARY
241
+
242
+ In this appendix we present a number of additional details, results and Figures that we could not fit in the main text due to lack of space. In summary:
243
+
244
+ • We present tables with the tasks and datasets we explore in the main paper (Table A), as well as with a summary of all compared methods (Table B).
245
+ • We report additional experiments for the landmark retrieval task in Appendix C. Specifically, we present results for the med/hard splits separately (Appendix C.1), an experiment with oracle neighbors (Appendix C.2), an experiment with features from a larger ResNet-101 backbone (Appendix C.3).
246
+ • We present ablations when varying the training set size (Appendix C.4) and the batch size (Appendix C.5).
247
+ • We report additional experiments for the document retrieval in Appendix D. Specifically, we extend our evaluation protocol and report result on a new task: duplicate query retrieval. We further investigate not only dimensionality reduction for the same task, but also the case of dimensionality reduction transfer.
248
+ • Although TLDR is not suited for such applications, as a proof of concept we present results on the FashionMNIST dataset in Appendix E, i.e. when learning from raw pixel data. We also present some results when using TLDR for visualization, i.e. when the output dimension is $d = 2$ in Figure K.
249
+ • We extend Section 4 with further discussion on related topics and more related works in Appendix F. We conclude with a brief discussion on limitations of TLDR in Appendix F.1
250
+
251
+ Table A: Datasets and tasks of the main paper.
252
+
253
+ <table><tr><td>Task (Metric)</td><td>Input feature space</td><td>Dimensionality reduction dataset</td><td>Test dataset</td></tr><tr><td>Landmark Retrieval (mAP)</td><td>ResNet50 features D= 2048 trained on Landmarks-clean (40k) (Babenko et al., 2014; Gordo et al., 2016)</td><td>Google Landmarks (Weyand et al.,2020) (1.5M)</td><td>ROxford5K (5k) RParis6K (6k) (Radenovic et al., 2018a)</td></tr><tr><td>Argument Retrieval (Recall@ 100)</td><td>BERT Features D= 768 trained on MSMarco (8.8M) (Nguyen et al., 2016a)</td><td>Webis-Touché 2020 (380k) (Bondarenko et al., 2020)</td><td>ArguAna (3k) (Wachsmuth et al.,2018)</td></tr></table>
254
+
255
+ <table><tr><td>Method</td><td>(Self-) supervision</td><td>Encoder</td><td>Projector</td><td>Loss</td><td>Notes</td></tr><tr><td>PCA (Pearson,1901)</td><td>unsupervised</td><td>linear</td><td>linear</td><td>Reconstruction MSE + orthogonality</td><td>Used for dimensionality reduction in SoTA methods like DELF, GeM, GeM-AP and HOW</td></tr><tr><td>DrLim Contrastive</td><td>neighbor-supervised neighbor-supervised</td><td>MLP linear</td><td>None MLP</td><td>Contrastive Contrastive</td><td>(Hadsell et al.,2006)(very low performance) Hadsell et al. (2006) with projector</td></tr><tr><td>MSE TLDRg</td><td>unsupervised</td><td>linear linear</td><td>MLP MLP</td><td>Reconstruction MSE Barlow Twins</td><td>TLDR with MSE loss</td></tr><tr><td></td><td>denoising</td><td></td><td></td><td></td><td>TLDR with noise as distortion</td></tr><tr><td>TLDR</td><td>neighbor-supervised</td><td>linear</td><td>MLP</td><td>Barlow Twins</td><td></td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>TLDR1,2</td><td>neighbor-supervised</td><td>fact. linear</td><td>MLP</td><td></td><td></td></tr><tr><td>TLDR12</td><td>neighbor-supervised</td><td>MLP</td><td>MLP</td><td>Barlow Twins Barlow Twins</td><td></td></tr></table>
256
+
257
+ Table B: Compared Methods. For unsupervised methods the objective is based on reconstruction, neighbor-supervised methods utilize nearest neighbors as pseudo-labels to learn, denoising learns to ignore added Gaussian noise.
258
+
259
+ B TABLES OF TASKS AND COMPARED APPROACHES
260
+
261
+ C ADDITIONAL EXPERIMENTS: LANDMARK IMAGE RETRIEVAL
262
+
263
+ C.1 RESULTS ON MEDIUM AND HARD PROTOCOLS SEPARATELY
264
+
265
+ In Figure A we report the mAP metric for the Medium and Hard splits of the Revisited Oxford and Paris datasets (Radenovic et al. ´ , 2018a) separately.
266
+
267
+ # C.2 RESULTS WITH “ORACLE” NEAREST NEIGHBORS
268
+
269
+ In Figure B we present results using an oracle version of TLDR, i.e. a version that uses labels to only keep as pairs neighbors that come from the same landmark in the training set. As we see, TLDR practically matches the oracle’s performance.
270
+
271
+ # C.3 RESNET-101 FEATURES
272
+
273
+ We also experimented with features obtained from a larger pre-trained ResNet-101 model from Revaud et al. (2019)4. We see in Figure C that TLDR retains a significant gain over PCA and in fact surpasses the highest state-of-the-art numbers based on global features as reported in Tolias et al. (2020) for ROxford5K.
274
+
275
+ # C.4 VARYING THE SIZE OF THE TRAINING SET
276
+
277
+ In Figure D we show the impact of the size of the training set on TLDR’s performance by randomly selecting subsets of images of increasing size from the Google Landmarks training set (Weyand et al., 2020). As we see, PCA outperforms TLDR for a reduced number of images, however, it does not benefit from adding more data, keeping the same performance across all training set sizes. In contrast, TLDR does benefit from adding more data; all plots suggest that a larger training set could potentially boost the performance even further, increasing the gap with respect to PCA.
278
+
279
+ ![](images/88ed6886acb051026cc2d7a96427d94d411f104f8a9a11107d8b4ec40d220bc9.jpg)
280
+ Figure A: Image retrieval experiments. Mean average precision (mAP) on ROxford5K (top) and RParis6K (bottom), for the Medium (left) and Hard (right) test sets, as a function of the output dimensions $d$ . We report TLDR with different encoders: linear (TLDR), factorized linear with 1 hidden layer $\mathrm { ( T L D R _ { 1 } ) }$ ), and a MLP with 1 hidden layer $\mathrm { ( T L D R _ { 1 } ^ { \star } }$ ), the projector remains the same (MLP with 2 hidden layers). We compare with two baselines based on TLDR, but which respectively train with a reconstruction (MSE) and a contrastive (Contrastive) loss. Our main baselines are PCA with whitening, and the original 2048-dimentional features (GeM-AP Revaud et al. (2019)), i.e. before projection.
281
+
282
+ # C.5 BATCH SIZE ABLATION
283
+
284
+ Finally, in Figure E, we show results of TLDR varying the size of the training mini-batch. Surprisingly, we observe it is stable across a wide range of values, allowing training TLDR under limited memory resources.
285
+
286
+ # D ADDITIONAL EXPERIMENTS: DOCUMENT RETRIEVAL
287
+
288
+ In Section 3 of the main paper we studied first stage document retrieval under the task of argument retrieval, where both dimensionality reduction and evaluation are performed on datasets designed for the same task. In this section, we extend this evaluation protocol introducing a new task: duplicate query retrieval and now investigate not only dimensionality reduction for the same task, but also the case of dimensionality reduction transfer.
289
+
290
+ In the following paragraphs we first introduce the five datasets we use for first stage document retrieval, and then we discuss the additional experiments involving duplicate query datasets.
291
+
292
+ ![](images/5f9c6aa1a26b68bd3f91cdb588525d715b1a63749114e609254c1f16a2bf7ceb.jpg)
293
+ Figure B: Neighbor-supervised with oracle. Mean average precision (mAP) on ROxford5K (Radenovic et al. ´ , 2018a) for the Medium (left) and Hard (right) test sets, as a function of the output dimensions $d$ . We compare TLDR with an oracle version that uses labels to select training pairs. We include as baselines both PCA and ICA with whitening, and the original 2048-dimentional features (GeM-AP [32]), i.e. before projection.
294
+
295
+ ![](images/fa0d14932ef8bca344dbb00b374285f43a9ba546331282e93da22d3fcfac2ae9.jpg)
296
+ Figure C: ResNet-101 features. Mean average precision (mAP) on ROxford5K (Radenovic et al. ´ , 2018a) for different values of output dimensions $d$ , using features obtained from the pre-trained ResNet-101 of Revaud et al. (2019).
297
+
298
+ # D.1 TASKS AND DATASET
299
+
300
+ A summary of dataset statistics is available in Table C and examples for each dataset are available in Table D.
301
+
302
+ MSMarco passages (Nguyen et al., 2016b): question and answer dataset based on Bing queries. Very sparse anotation with a high number of false negatives. Queries (Q) and Documents (D) are from different different domains due to size and content. Retrieval is asymmetric, because if you input a D as Q, the answer will not be D. Used only for pretraining as it has a set of training pairs for contrastive learning, while our aim is to perform self-supervision only. For this goal, we have chosen the other four datasets, that do not have a readily available set of training pairs (or triplets) for training, and thus self-supervision or unsupervised learning is required.
303
+
304
+ ArguAna (Wachsmuth et al., 2018): Counter-argument retrieval dataset. Queries and documents belong to the same domain, with some queries being a part of the corpus, which makes it not suitable for training on this dataset. Queries and documents come from the same domain in both size and content, however associated query-document pairs have inverse context (Q defends a point, D is a rebuttal of Q), so input Q should not retrieve Q, if it is on the database. Retrieval is asymmetric as a query should not retrieve itself.
305
+
306
+ ![](images/063771c68306b5e800290e662997b3c6a61c2fa4fc36f91cb9b0355e203e68c9.jpg)
307
+ Figure D: TLDR benefits from larger training sets. Impact of the size of the training set on performance. TLDR uses a linear encoder and $d = 1 2 8$ .
308
+
309
+ ![](images/02c83e88f0fd4db0f14b3511442fcdfcde43e29cb587237a521555c63d70b359.jpg)
310
+ Figure E: The surprising stability of TLDR across batch sizes. Impact of the size of the training mini-batch on performance. TLDR uses a linear encoder and $d = 1 2 8$ .
311
+
312
+ Webis-Touché 2020 (Bondarenko et al., 2020; Wachsmuth et al., 2017): Argument retrieval dataset. Queries and documents are from different domains due to size and content, with queries being questions and documents being support arguments for the question. Retrieval is asymmetric as a query should not retrieve itself.
313
+
314
+ CQADupStack (Hoogeveen et al., 2016): Duplicate question retrieval from StackExchange subforums, composed of 12 different subforums. Corpuses are concatenated during training and mean result over all corpuses is used for testing (i.e. every corpus has equal weight even if the number of queries is different). Queries are titles of recent submissions, while documents are concatenation of titles and descriptions of existing ones. Queries and documents are from different domains due to size and content, with the query domain being a part of the document one (Queries are contained in the documents). Retrieval is symmetric as a query should return itself.
315
+
316
+ Quora: Duplicate question retrieval from the Quora platform. Queries are titles of recent submissions, while documents are titles of existing ones. Queries and documents are from the same domain concerning size and content. Retrieval is symmetric as a query should return itself.
317
+
318
+ Table C: Summary of tasks and datasets for the first stage document retrieval experiments presented in the Appendix.
319
+
320
+ <table><tr><td>Dataset</td><td># Documents</td><td># Queries</td><td>Avg positives per query丨Avg query lengthAvg document length丨Retrieval type</td><td></td><td></td><td></td></tr><tr><td colspan="7">Question answering (pretraining only)</td></tr><tr><td>MSMarco</td><td>8.8M</td><td>6980</td><td>1.1</td><td>6</td><td>56</td><td>Asymmetric</td></tr><tr><td colspan="7">Argument retrieval</td></tr><tr><td>ArguANA</td><td>8674</td><td>1406</td><td>1</td><td>193</td><td>167</td><td>Asymmetric</td></tr><tr><td>Webis-Touché 2020</td><td>380k</td><td>49</td><td>49.2</td><td>7</td><td>292</td><td>Asymmetric</td></tr><tr><td colspan="7">Duplicate question retrieval</td></tr><tr><td>Quora</td><td>523k</td><td>5000</td><td>1.6</td><td>10</td><td>11</td><td>Symmetric</td></tr><tr><td>CQADupStack</td><td>457k</td><td>13145</td><td>1.4</td><td>9</td><td>129</td><td>Symmetric</td></tr></table>
321
+
322
+ Table D: Examples of queries and documents from all the document retrieval datasets we use. Table extracted from Thakur et al. (2021); Note the difference of length between query and document in some datasets.
323
+
324
+ <table><tr><td rowspan=1 colspan=1>Dataset</td><td rowspan=1 colspan=1>Query</td><td rowspan=1 colspan=1>Relevant-Document</td></tr><tr><td rowspan=1 colspan=1>MSMARCO</td><td rowspan=1 colspan=1>what fruit is native to australia</td><td rowspan=1 colspan=1>&lt;Paragraph&gt; Passiflora herbertiana. A rare passion fruit native to Australia.Fruits are green-skinned, white fleshed, with an unknown edible rating.Some sources list the fruit as edible,sweet and tasty, while others list the fruits as being biter and inedible.assiflora herbertiana.Arare passion fruit native to Australia...</td></tr><tr><td rowspan=1 colspan=1>ArguAna</td><td rowspan=1 colspan=1>Sexist advertising is subjective so would be too difficult to codify.Effective advertising appeals to the social,cultural,and personalvalues of consumers. Through the connection of values to prod-ucts, services and ideas, advertising is able to accomplish itsgoal of adoption...</td><td rowspan=1 colspan=1>&lt;Title&gt; media modern culture television gender house would ban sexist advertising &lt;Paragraph&gt;Although there is a claim that sexist advertising is to difficult to codify,such codes have and arebeing developed to guide the advertising industry. These standards speak to advertising whichdemeans the status of women, objectifies them,and plays upon stereotypes about women whichharm women and society in general. Earlier the Council of Europe was mentioned, Denmark,Norway and Australia as specific examples of codes or standards for evaluating sexist advertisingwhich have been developed.</td></tr><tr><td rowspan=1 colspan=1>Touche-2020</td><td rowspan=1 colspan=1>Should the government allow illegal immigrants to become citi-zens?</td><td rowspan=1 colspan=1>&lt;Title&gt; America should support blanket amnesty for illegal immigrants.&lt;Paragraph&gt; Undocu-mented workers do not receive full Social Security benefits because they are not United Statescitizens &quot; nor should they be until they seek citizenship legally. Illgal immigrants are legallyobligated to pay taxes...</td></tr><tr><td rowspan=1 colspan=1>CQADupStack</td><td rowspan=1 colspan=1>Command to display first few and last few lines of a file</td><td rowspan=1 colspan=1>&lt;Title&gt; Combing head and tail in a single call via pipe&lt;Paragraph&gt;Ona regular basis,Iampiping the output of some program to either ‘head&#x27; or ‘tail. Now, suppose that I want to seethe first AND last 1O lines of piped output, such that Icould do something like ./lotsofoutput |headtail...</td></tr><tr><td rowspan=1 colspan=1>Quora</td><td rowspan=1 colspan=1>How long does it take to methamphetamine out of your blood?</td><td rowspan=1 colspan=1>&lt;Paragraph&gt; How long does it take the body to get rid of methamphetamine?</td></tr></table>
325
+
326
+ # D.2 EXPERIMENTAL RESULTS
327
+
328
+ We now test different combinations of the previously introduced datasets as dimensionality reduction and test datasets. The setup for all experiments is the same as the experiments in the main paper. In order to summarize our results (9 combinations of train/test datasets), we consider $d = 6 4$ (second highest we investigate) as the comparison mark between PCA and TLDR. If TLDR outperforms PCA for all $d \leq 6 4$ , we consider that it performed better than PCA, and otherwise we consider that PCA performed better than TLDR. Note that in all cases the lower the dimension the better TLDR performed against PCA. We also report which version of TLDR performed better, $L > 0$ means that factorized linear is better than linear and $L = 0$ the opposite. We present a summary of the experimental results in Table E, and provide depictions of some experiments in Figures F through I. From the results presented on the table, we derive two conclusions about TLDR:
329
+
330
+ 1. Differences in retrieval from pretraining to dimensionality reduction impacts results : Looking into evaluation on argument retrieval, TLDR outperforms PCA. On the other hand, looking into evaluations on duplicate query retrieval, PCA is always able to outperform TLDR for $d \geq 6 4$ . We infer that this must be derived from the difference in retrieval condition, as in all tests with asymmetric retrieval TLDR is able to outperform PCA. Note that symmetric retrieval and same domain for document and queries differs from the original pretraining task, and we posit that PCA is more robust to this type of change (which does not happen in our image retrieval experiments). Although we have this initial suspicion validated with 4 datasets a proper conclusion would need more dataset-pairs for experimentation, which we leave for future work.
331
+
332
+ 2. Choosing linear or factorized linear depends on the statistics of the dataset: Analyzing the results we are able to detect that the choice of which version of TLDR one should use depends on the length of queries and documents of the original dataset. If both lengths are equal, factorized linear is better (ArguANA and Quora), if not then linear is the better
333
+
334
+ <table><tr><td rowspan=3 colspan=3></td><td rowspan=1 colspan=2>Test dataset</td><td rowspan=1 colspan=2></td></tr><tr><td rowspan=1 colspan=1>Argu</td><td rowspan=1 colspan=1>Argument retrieval</td><td rowspan=1 colspan=1>Dupli</td><td rowspan=1 colspan=1>catequery</td></tr><tr><td rowspan=1 colspan=1>ArguAna</td><td rowspan=1 colspan=1>Webis-Touche2020</td><td rowspan=1 colspan=1>Quora</td><td rowspan=1 colspan=1>CQADupStack</td></tr><tr><td rowspan=2 colspan=1>Dimensionality reduction</td><td rowspan=1 colspan=1>Argument Retrieval</td><td rowspan=1 colspan=1>Webis-Touché2020</td><td rowspan=1 colspan=1>TLDR (L&gt;0)</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>PCA (L&gt;0)</td><td rowspan=1 colspan=1>PCA(L=0)</td></tr><tr><td rowspan=1 colspan=1>Duplicate Question</td><td rowspan=1 colspan=1>QuoraCQADupStack</td><td rowspan=1 colspan=1>TLDR (L&gt;0)TLDR (L&gt;0)</td><td rowspan=1 colspan=1>TLDR (L=0)TLDR (L=0)</td><td rowspan=1 colspan=1>PCA (L&gt;0)</td><td rowspan=1 colspan=1>PCA (L=0)</td></tr></table>
335
+
336
+ Table E: Summary of the results on document retrieval. $\scriptstyle ( \mathrm { L } = 0 )$ ) and $( \mathrm { L } { > } 0 )$ indicate which version of TLDR had better perfomance (linear and factorized linear respectively). Note that arguana is not suitable for training (not represented) and that we are not interested in using the same dataset for dimensionality reduction and test (thus the empty cells).
337
+
338
+ choice (Webis-Touché 2020 and CQADupStack). Even if by using ANCE representations we should not need to deal with these differences (we only tackle embeddings of fixed size), the statistics of the resulting embedding is different enough that it is detected by the batch normalization layer that is added for factorized linear.
339
+
340
+ ![](images/a895eefea2e6429398e0713afe6f39e4d13816cbc47b6b13ec74b85fb20ab036.jpg)
341
+ Figure F: Argument retrieval results on the ArguAna dataset using Webis-Touché 2020 for dimensionality reduction for different values of output dimensions $d$ . On the left we present Recall $@ 1 0 0$ and on the right we present $\mathrm { N D C G } @ 1 0$ .
342
+
343
+ ![](images/55e43d8bf18828514ae3033798a2388196967305b2f6b21ecd5b65f9b9cae9fd.jpg)
344
+ Figure G: Argument retrieval results on the Webis-Touché 2020 dataset using Quora for dimensionality reduction for different values of output dimensions $d$ . On the left we present Recall $@ 1 0 0$ and on the right we present ${ \mathrm { N D C G } } \ @ 1 0$ .
345
+
346
+ ![](images/e6a31c291ef43adc0c9bc6a05330e628bb18eb629000904bdbe11fb3d2e77549.jpg)
347
+ Figure H: Duplicate question retrieval results on the CQADupstack dataset using Quora for dimensionality reduction for different values of output dimensions $d$ . On the left we present Recall $@ 1 0 0$ and on the right we present $\mathrm { N D C G } @ 1 0$ .
348
+
349
+ ![](images/737ffa7cefd1c84f734f578b631460a7fc9bac497947430cc3ef9b71c51419a4.jpg)
350
+ Figure I: Duplicate question retrieval results on the Quora dataset using Webis-Touché 2020 for dimensionality reduction for different values of output dimensions $d$ . On the left we present Recall $@ 1 0 0$ and on the right we present $\mathrm { N D C G } @ 1 0$ .
351
+
352
+ Learning from raw pixel data. In Figure J we present results when learning directly from raw pixel data. We use the predefined splits and, following related work (McInnes et al., 2018), we measure and report accuracy after $k$ -NN classifiers. We see that TLDR retains its gains over any other manifold learning method we tested. We have to note however that these results have to be taken with a pinch of salt, as a) the input pixel space is relatively simple compared to higher resolution natural images and b) to achieve such results we use the prior knowledge that we only have 10 classes and set high values for hyper-parameter $k$ , i.e. $k = 1 0 0$ for all methods compared.
353
+
354
+ 2D visualizations. Let us first clarify that TLDR was not created with 2D outputs in mind; in fact, there are other excellent choices for visualization like $t$ -SNE, UMAP (McInnes et al., 2018), TriMAP (Amid & Warmuth, 2019) or the recent Minimum-Distortion Embedding (MDE) (Agrawal et al., 2021) that we would use instead. In Figure K we show 2d visualizations when reducing the $6 0 \mathrm { k }$ training set of FashionMNIST to $d = 2$ dimensions. We present results for TLDR, $t$ -SNE (Van der Maaten & Hinton, 2008), UMAP (McInnes et al., 2018) and PyMDE (Agrawal et al., 2021). It is interesting how TLDR seems to be optimized for linear separability even for 2-dimensional outputs. For visualizations, we used the pyMDE library5 provided by the authors of (Agrawal et al., 2021).
355
+
356
+ # F FURTHER DISCUSSIONS AND RELATED WORKS
357
+
358
+ Graph diffusion for harder $k$ -NN pairs. Iscen et al. (2018b) improve the method presented in Hadsell et al. (2006) by mining harder positives and negative pairs for the contrastive loss via diffusion over the $k$ -NN graph. Similar to Hadsell et al. (2006), they are interested in learning (fine-tuning) the whole network and not just the dimensionality-reduction layer. Although it would be interesting to incorporate such ideas in TLDR, we consider it complementary and beyond the scope of this paper. Methods used for learning descriptor matching are also related; e.g. (Simonyan et al., 2014) formulates dimensionality reduction as a convex optimisation problem. Although the redundancy reduction objective can be formulated in many ways, e.g. via stochastic proximal gradient methods like Regularised Dual Averaging in (Simonyan et al., 2014), we believe that the simplicity, immediacy and clarity in which the Barlow Twins objective optimizes the output space is a strong advantage of TLDR.
359
+
360
+ ![](images/02fdc03963f143fa35523244069e1880913613e895228271f000c1616d665ad4.jpg)
361
+ Figure J: Results on the FashionMNIST dataset as a function of the output dimensions $d$ . We compare TLDR with PCA, PCA with whitening, UMAP and Isomap and report accuracy after $k ^ { \prime }$ -NN classifiers (with $k ^ { \prime } = 1 0 0 \rangle$ ) following (McInnes et al., 2018). For TLDR and UMAP we set the number of neighbors $k = 1 0 0$ . The performance of UMAP was very low for $d ^ { \prime } > 3 2$ .
362
+
363
+ Graph diffusion for query expansion. For the task of retrieval, assuming access to the search (test) database, methods like (Iscen et al., 2017; 2018a; Liu et al., 2019) utilize manifold learning on the the $k$ -NN graph of the database to facilitate query expansion. We note that while these methods have shown great empirical performance on the same image retrieval datasets as we experiment on, we do not directly compare to them as their methodology and goals greatly differs from ours. We aim at being invariant to the target dataset (thus not performing learning on them), differently from the aforementioned methods they need access to the target dataset for learning, and to its $k$ -NN graph during testing. TLDR is complementary to such graph diffusion techniques for query expansion.
364
+
365
+ Relation to knowledge distillation. Knowledge distillation (KD) (Hinton et al., 2015) aims at transferring knowledge from a pre-trained teacher network to a student one, often for neural network compression. One way to perform KD is relational KD (RKD) (Park et al., 2019; Tian et al., 2019; Lin et al., 2020), which transfers knowledge using relations between samples such as distance and angles. TLDR can be seen as a method for RKD. It enforces the student network (encoder) to reproduce a relational property (neighborhood) found on the teacher (the input space). However, there are some main differences to traditional distillation methods: i) the application: self-supervised retrieval instead of supervised classification (Hinton et al., 2015), contrastive (Tian et al., 2019; Lin et al., 2020) or self-supervision for classification (Fang et al., 2021), ii) the definition of the relations: abstract (neighbors), instead of measurable ones (distance, angle), which avoids normalization problems due to the dimensionality difference between teacher and student, and iii) the link between teacher and student: in our case, the student becomes a part of the teacher network at the end, instead of being a separate network.
366
+
367
+ Relation to node embedding. Node embedding methods aim at generating representations to graph nodes that are representative of the sample and its relations on the graph. In that sense, TLDR could be seen as learning embeddings for nodes on a graph. Compared to the traditional methods in this space, such as LINE (Tang et al., 2015), Node2Vec (Grover & Leskovec, 2016), DeepWalk (Perozzi et al., 2014), TLDR has three clear differences: i) does not rely on the edge strength; ii) regularization of the space based on the decorrelation of dimensions instead of L2-norm or orthogonality; and iii) only the 1-hop neighborhood information is used. More recent node embedding solutions are based on deep learning architectures that incorporate diffusion properties in the architecture like GCNs (Kipf & Welling, 2016; You et al., 2020), while TLDR achieves a similar effect via the Barlow Twins loss.
368
+
369
+ ![](images/9af100a69acac10eab39311a2bbf4973838e6303e2d7b67b6042986d30580f4a.jpg)
370
+ Figure K: 2D visualizations of the training set of FashionMNIST. From top to bottom and left to right: $t { \cdot }$ -SNE, MDE, UMAP and TLDR.
371
+
372
+ # F.1 LIMITATIONS OF OUR WORK
373
+
374
+ In the context of document retrieval we also tested TLDR on another task: duplicate question retrieval. In duplicate question retrieval TLDR was only able to outperform PCA for the lower dimension values $( \mathrm { d } { = } 8 , 1 6 , 3 2 )$ ). We posit that TLDR does not achieve significant gains for the rest of the dimensions because duplicate task differs too much from the original pretraining task (QA on MSMarco dataset) in that the duplicate retrieval is symmetric (the documents retrieved by a query should also appear when we use the document as query), while pretraining and argument retrieval is assymetric. In order to verify this, we performed ablations with different pairs of (dimensionality reduction,target dataset) and confirm that if the target dataset is a duplicate retrieval task TLDR is not able to outperform the compared method, but if we use duplicate retrieval only for dimensionality reduction and test on argument retrieval TLDR is able to outperform the compared methods. For full discussion and results cf . Section D.
md/dev/WSIHedvwmru/WSIHedvwmru.md ADDED
@@ -0,0 +1,445 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GSCA: GLOBAL SPATIAL CORRELATION ATTENTION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Convolution and self-attention, with their characteristics complementing each other, are two powerful techniques in vision tasks. The ability of self-attention to capture long-range dependencies compensates for the lack of convolution in understanding global feature information. However, the quadratic computational complexity of self-attention impedes their direct combination. This paper proposes global spatial correlation attention (GSCA), a self-attention approximation with linear computational complexity and no additional parameters. The aim is to adjust the attention distribution in the global space by utilizing the input feature maps’ statistical relationships. We compress the key matrix into a vector, evaluate the pairwise affinity of each pixel with the key vector in terms of the cross-correlation coefficient, and apply the attention weights to the inputs using the Hadamard product. A multi-head attention form is further built to enhance the module’s ability to capture the feature subspace. Based on the above lightweight operations, the proposed method can simply and effectively improve the aggregation capability of convolution for global information. We extensively evaluate our GSCA module on image classification, object detection, and instance segmentation tasks. Parameter-free GSCA is lighter than state-of-the-arts while achieving very competitive performance. It is combined with channel attentions, further outperforming the original methods. The experiments also demonstrate the generalizability and robustness of GSCA. The source code is available at GSCA.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In recent years, convolution (Krizhevsky et al., 2012) and self-attention (Vaswani et al., 2017) have significantly progressed in computer vision. Convolution implements the aggregation function in the local receptive field according to the weight of the convolution filter shared in the whole feature map. By virtue of sliding window operation and translation invariance property (Goodfellow et al., 2016), convolution equips with efficient sampling and high parameter utilization (Simoncelli & Olshausen, 2001). These allow convolution to be competent for almost all tasks in the field of computer vision for years. Inductive biases are built into the structure of convolutional neural networks in the form of two weight constraints: locality and weight sharing (D’Ascoli et al., 2021). Inductive biases make convolution capable of robust local modeling but weaken its ability to capture global information.
12
+
13
+ Self-attention aggregates a larger range of overall contextual information of the feature map, which remedies the bottleneck of convolution in global awareness. Specifically, it calculates aggregation weights by measuring the affinity between dense pixel pairs. Then the weights are leveraged to adaptively refine the feature map for enhancing vanilla representation. It enables self-attention to capture long-range dependencies, thereby learning rich hierarchical information of feature association in the global space (Liu et al., 2021c). Due to these, self-attention has achieved similar or even higher performance than convolution (Kolesnikov et al., 2021; Wang et al., 2021). Although self-attention equips several merits, its quadratic computational complexity for image size leads to a huge computational overhead, especially for higher-resolution inputs. Thus, some variants try to approximate self-attention at a lower computational cost (Geng et al., 2021; Qin et al., 2022).
14
+
15
+ Considering the advantages of convolution and self-attention and the complementarity between them naturally motivates researchers to combine both. One method replaces spatial convolutional layers of the traditional convolutional neural network with self-attention to build a new network structure, e.g., SAN (Zhao et al., 2020), BoTNet (Srinivas et al., 2021), and ACMix (Pan et al., 2022). For another thing, the attention mechanism can be regarded as an enhanced module of convolution has been confirmed by earlier SENet (Hu et al., 2018) and CBAM (Woo et al., 2018), etc. Therefore, some researchers use self-attention as a spatial attention module inserted in networks to enhance the ability of convolution to understand the global scene, such as GCNet (Cao et al., 2019) and CCNet (Huang et al., 2019). The above works prove the validity and feasibility of the combination of convolution and self-attention. In summary, the existing works can be broadly classified into two types. One uses self-attention instead of the original convolutional network blocks to reduce the model size while enhancing the network performance. However, this approach drastically changes the structure of the original network. The other enhances the convolution by adding sub-network modules, but this introduces additional parameters and increases the model size. This paper aims to design a parameter-free self-attention module to realize the combination of convolution and selfattention while maintaining the original network structure.
16
+
17
+ ![](images/a8f3e9ea61ffe674747f84d166ac4dfcc0a4fbcd7b972fba1755ed3018643a40.jpg)
18
+ Figure 1: Illustration of global spatial correlation attention. The key vector $k$ is obtained from the input $X$ by global average pooling (GAP), and the matrices $V$ and $Q$ are equal to $X$ . Each position in $Q$ is cross-correlated with vector $k$ to derive the correlation matrix $C _ { Q k }$ . The matrix $C _ { Q k }$ normalized by a Sigmoid function is subtracted from 1 to reverse the attention to obtain the weight matrix $A$ . $A$ is expanded to the size of $V$ , and the Hadamard product of both is the final output.
19
+
20
+ With the above motivation, we propose a self-attention with linear complexity called global spatial correlation attention (GSCA). We construct a novel, simple but effective lightweight self-attention module, which aims to use the data laws of the input feature map itself for weight adjustment in the global space. GSCA is illustrated in Figure 1. First, we use global average pooling (GAP) to get the key vector $k$ , which contains the spatial compression information of the feature map. The matrices $Q$ (query) and $V$ (value) are identity maps of $X$ . Next, the cross-correlation coefficient matrix $C _ { Q k }$ is derived by calculating the correlation between each pixel of query $Q$ and key $k$ . Then the weight matrix $A$ is obtained by subtracting the normalized $C _ { Q k }$ from 1. At last, $A$ is expanded to the size of $V$ , and the Hadamard product of both is the final output. Inspired by self-attention, we build multi-head GSCA to enhance the expression of feature subspaces in section 3.2. GSCA causes global pixels to interact, which enhances convolution’s ability to capture global information. More importantly, GSCA is parameter-free and does not increase the original model size. To purely validate the effectiveness of GSCA and avoid performance improvements due to changes in network architecture, we do not replace network blocks. Instead, GSCA serves as a simple attention module like SENet (Hu et al., 2018) to enhance convolution. In a word, the main contribution of this paper can be summarized as follows:
21
+
22
+ • We propose a novel self-attention without adding additional parameters, called global spatial correlation attention (GSCA), with $O ( N )$ complexity. We use the cross-correlation coefficient to evaluate the similarity between pixel pairs and apply it to the construction of the attention mechanism.
23
+
24
+ • Multi-head GSCA is built to enhance the expression of feature subspace. Multi-head GSCA can be used as a spatial attention module, plug-and-play, to enhance the ability of convolution to capture global features.
25
+
26
+ • Extensive experiments on ImageNet-1k and MS COCO have proved that GSCA has lower complexity than state-of-the-arts and has achieved very competitive performance. GSCA also improves the original performance of channel attentions in various vision tasks. Relevant experiments also prove that GSCA has strong generalization and robustness.
27
+
28
+ # 2 RELATED WORKS
29
+
30
+ Lightweight Self Attention. The ability of self-attention to model global features is effective in various vision tasks. NonLocal (Wang et al., 2018) constructs spatial feature maps using a self-attention form and verifies the accuracy and validity. However, the quadratic complexity of self-attention will bring a large computational overhead, so some variants try to lighten it. AANet (Bello et al., 2019) proposes a two-dimensional relative self-attention mechanism by encoding positions. $A ^ { 2 }$ -Net (Chen et al., 2018) gathers and distributes features through bilinear pooling and matrix multiplication to capture long-range feature interdependencies. Researchers find that NonLocal has almost the same global modeling context for different query locations. A simplified network based on a query independent formulation is created, which is called GCNet (Cao et al., 2019). CCNet (Huang et al., 2019) obtains global information and reduces complexity by cyclically performing row and column attention. EANet (Guo et al., 2021) proposes External Attention, which constructs learnable, lightweight, and shared key and value vectors through linear layers. DANet (Fu et al., 2019) performs well in semantic segmentation tasks by adding position and channel self-attention at the end of the backbone. Similarly, the modified self-attention PSA (Liu et al., 2021a) is successfully applied to 2D human pose estimation and semantic segmentation tasks. SimA (Koohpayegani & Pirsiavash, 2022) proposes a simple self-attention that replaces softmax with $\ell _ { 1 }$ -norm. Some methods adopt sparse matrices to lightweight self-attention (Kitaev et al., 2020; Zaheer et al., 2020).
31
+
32
+ Attention Mechanism Modules. Attention mechanism modules have been proven to be a potential means to enhance convolution. SENet (Hu et al., 2018) proposes an effective channel attention mechanism module, which inspires a series of subsequent works. In ECANet (Wang et al., 2020), 1D convolution is used to determine the interaction between channels, reducing the parameters and improving efficiency compared with SENet. FcaNet (Qin et al., 2021) analyzes GAP in the frequency domain and proves that GAP is a special form of discrete cosine transform (DCT). FcaNet achieves extremely outstanding performance as channel attention. NAM (Liu et al., 2021b) based on normalization theory, which suppresses less salient weights and applies weight sparsity penalty to the attention module. SGE (Li et al., 2019a) divides the feature map into semantic groups and adjusts the importance by generating an attention factor for each spatial position. CBAM (Woo et al., 2018), BAM (Park et al., 2018), and scSE (Roy et al., 2018) use 2D convolution kernels to adjust spatial weights and combine them with channel attention. SKNet (Li et al., 2019b) proposes a branch attention with automatic selection of convolution kernel size. Similar split attention mechanisms include ResNeSt (Zhang et al., 2022) and EPSANet (Zhang et al., 2021). In this paper, our method is used as a spatial attention module to enhance the expression of convolution.
33
+
34
+ Application of Cross-correlation Coefficient. The cross-correlation coefficient is a powerful analytical tool in signal processing (Zhai et al., 2020), neurophysiology (Rodu et al., 2018), and other fields (Chatterjee et al., 2018). In vision fields, researchers utilize the cross-correlation coefficient to evaluate the similarity of pictures before and after transformation for solving deformable image registration tasks (Balakrishnan et al., 2019). The cross-correlation coefficient uses the statistical relationship between the two variables to measure the correlation. Recently, some works have used statistical information for the design of attention modules. SRM (Lee et al., 2019) combines mean and standard deviation pooling to enhance the capability of feature fusion of modules and performs well in style transfer results. As a variant of SENet, GSoPNet (Gao et al., 2019) uses the covariance matrix in the squeeze module to enhance its ability to model higher-order statistical information.
35
+
36
+ # 3 METHOD
37
+
38
+ In this section, we first briefly review original self-attention. Then we elaborate on the details of general and multi-head GSCA. Finally, the effect of GSCA is visualized.
39
+
40
+ # 3.1 SELF ATTENTION AND GSCA
41
+
42
+ We first review the original self-attention (see Figure 2). Given an input $X \in \mathbb { R } ^ { N \times C }$ , where $N =$ $H \times W$ and $C$ are the number of pixels and channels, respectively. Self-attention linearly projects $X$ to generate a query matrix $Q$ , a key matrix $K$ , and a value matrix $V$ . The weight matrix $A$ is formulated as:
43
+
44
+ $$
45
+ \boldsymbol { A } = \operatorname { S o f t m a x } \left( \boldsymbol { Q } \boldsymbol { K } ^ { T } \right) ,
46
+ $$
47
+
48
+ $$
49
+ X _ { o u t } = A V .
50
+ $$
51
+
52
+ ![](images/8793c7484c86a95d5a78569878a94a5420b41e310920f3f341ce1589f1b0d1b9.jpg)
53
+ Figure 2: Illustration of the principles of GSCA and self-attention. The number of pixels is $N$ , and the channel dimension is $C$ . GSCA allows $O ( N )$ computational complexity with $C \ll N$ .
54
+
55
+ $a _ { i j }$ is a term of $A$ , which denotes the cosine similarity between the $i$ -th and $j$ -th positions in the feature map. $A \in \mathbb { R } ^ { N \times N }$ indicates the affinities between all pixel pairs in the spatial dimension. According to Eq. (2), $X _ { o u t }$ is obtained by applying $A$ to $V$ . Self-attention allows the network to find and focus on important regions in the global space, but its quadratic complexity $O ( N ^ { 2 } )$ about image size is an obvious shortcoming, which leads to a huge computational overhead.
56
+
57
+ Next, we present the details of global spatial correlation attention (GSCA). GSCA differs from the original self-attention in terms of query, key and value generation, similarity matching, and the way weights act. Given an input $X \in \dot { \mathbb { R } } ^ { H \times W \times \mathbf { \dot { C } } }$ , it can be reshaped as $X \in \mathbb { R } ^ { \mathbf { \bar { N } } \times C }$ as a sequence. We choose a 3D format to illustrate our method visually. We implement GAP to obtain the key vector $k$ , i.e., $\begin{array} { r } { k = \frac { 1 } { W H } \sum _ { i = 1 , j = 1 } ^ { W , H } X _ { i j } } \end{array}$ and $k \in \mathbb { R } ^ { C }$ . The matrices $Q$ and $V$ are generated using identical mappings, i.e., $Q = V = X$ . Unlike the cosine similarity used in self-attention, GSCA uses the cross-correlation coefficient to evaluate the similarity between each location in query $Q$ and key $k$ . The correlation matrix $C _ { Q k }$ is calculated from the following equation.
58
+
59
+ $$
60
+ C _ { Q k } = \frac { \sum _ { i = 1 } ^ { C } \left[ Q _ { : , : , i } - \bar { Q } \right] \left[ k _ { i } - \bar { k } \right] } { \sqrt { \sum _ { i = 1 } ^ { C } \left[ Q _ { : , : , i } - \bar { Q } \right] ^ { 2 } \left[ k _ { i } - \bar { k } \right] ^ { 2 } } } ,
61
+ $$
62
+
63
+ where $\bar { Q }$ is the mean value of query $Q$ in the channel dimension. $\bar { k }$ is the mean of vector $k$ . The matrix $\dot { \boldsymbol { C } } _ { Q k } \in \mathbb { R } ^ { H \times W \times 1 }$ , and $C _ { Q k } ( i , j )$ denotes the cross-correlation coefficient, i.e., similarity, between pixels in row $i$ and column $j$ of $Q$ and $k$ . We consider that the key $k$ obtained by GAP obscures the feature representation of the object of interest. Thus, to highlight the positions in $V$ that represent unique features, we utilize the reverse correlation calculation to gain attention. Generally speaking, positions more correlated with $k$ are given lower weights. Conversely, positions less relevant to $k$ are given more attention. As in Eq. (4), the weight matrix $A$ is obtained by subtracting the normalized $C _ { Q k }$ from 1.
64
+
65
+ $$
66
+ A = \left( 1 - \sigma \left( C _ { Q k } \right) \right) ^ { \alpha } ,
67
+ $$
68
+
69
+ where $\sigma ( \cdot )$ is a Sigmoid function, the exponent $\alpha$ is used to enlarge numerical differences to enhance feature expression. Inspired by SENet and CBAM, etc., GSCA uses Sigmoid to normalize $C _ { Q k }$ . GSCA tends to highlight a region rather than a single position in the spatial dimension. Softmax is unsuitable for GSCA due to its near one-shot output (Chen et al., 2020). In contrast, Sigmoid does not inhibit the expression of other sites when it emphasizes a single position, which is more in line with the mechanism of GSCA. As in Eq. (5), $A \in \dot { \mathbb { R } } ^ { W \times H \times 1 }$ is expanded along the channel to the size of $V \in \mathbb { R } ^ { W \times H \times C }$ , and the final output $X _ { o u t }$ is obtained by making a Hadamard product of $A$ and $V$ .
70
+
71
+ $$
72
+ X _ { o u t } = \exp \mathrm { a n d } ( A ) \circ V .
73
+ $$
74
+
75
+ Eq. (6) shows the generic form of GSCA. As analyzed in Figure 2, GSCA has a linear complexity $O ( N )$ to the number of pixels. Furthermore, GSCA has no learnable operations, such as linear projection, and no extra parameters are added.
76
+
77
+ $$
78
+ \operatorname { G S C A } \left( Q , k , V \right) = \operatorname { e x p a n d } \left[ \left( 1 - \sigma \left( C _ { Q k } \right) \right) ^ { \alpha } \right] \circ V .
79
+ $$
80
+
81
+ Figure 2 indicates that, although the details of GSCA differ from self-attention, the principles of both are similar in nature. Their process is divided into two steps. First, generating spatial attention weights by similarity comparison. Second, the weights are applied to the value $V$ to adjust the distribution of the feature maps. Self-attention generates weights based on the cosine similarity between all pixel pairs. GSCA gets weights by the correlation between each pixel and the key $k$ . Self-attention acts $A$ on $V$ (by $X$ linear projection) by matrix multiplication. The output of GSCA is a Hadamard product of $A$ and $V$ $\boldsymbol { V } = \boldsymbol { X }$ ). Both establish interrelationships among all pixels of the feature map and give different levels of attention to each region in the global spatial context.
82
+
83
+ # 3.2 MULTI-HEAD GSCA
84
+
85
+ In Transformer (Kolesnikov et al., 2021), self-attention is calculated in different sub channels in the feature map rather than in the whole channel, which is called multi-head attention. Multi-head attention allows the network to conduct self-attention at different positions of the channel simultaneously to improve the ability of self-attention to capture different feature subspaces. Inspired by this, we also built a multi-head GSCA in this subsection in a similar way.
86
+
87
+ $$
88
+ Q = \left[ Q ^ { 1 } , \dots , Q ^ { h } \right] , k = \left[ k ^ { 1 } , \dots , k ^ { h } \right] , V = \left[ V ^ { 1 } , \dots , V ^ { h } \right] .
89
+ $$
90
+
91
+ $$
92
+ \mathrm { M u l t i H e a d } \left( \boldsymbol { Q } , \boldsymbol { k } , \boldsymbol { V } \right) = \mathrm { C o n c a t } \left( \mathrm { h e a d } _ { 1 } , \dots , \mathrm { h e a d } _ { h } \right) ,
93
+ $$
94
+
95
+ $$
96
+ \mathrm { h e a d } _ { i } = \mathrm { G S C A } \left( Q ^ { i } , k ^ { i } , V ^ { i } \right) .
97
+ $$
98
+
99
+ As in Eq. (7), $Q , k , V$ are equally divided in the channel dimension, respectively, and $h$ is the number of heads, where $k ^ { i } \in \overline { { \mathbb { R } ^ { C / h } } }$ and $Q ^ { i } , V ^ { i } \in \mathbb { R } ^ { H \times W \times C / h }$ . According to Eq. (8), all headi are sequentially concatenated along the channel to obtain the final output. In this paper, we fixed the number of channels per head to respond flexibly to different feature map sizes. Single-head size ablation studies are reported in section 4.2, which validates the effectiveness of the multi-head operation.
100
+
101
+ # 3.3 VISUALIZATION
102
+
103
+ ![](images/5599e394a455fcbcaf362b85ae8ef606106249e182bfc1ea2081fc6b3b494694.jpg)
104
+ Figure 3: Sample visualization on ImageNet-1k val split generated by GradCAM.
105
+
106
+ As in Figure 3, we visualize the images in the ImageNet-1k (Russakovsky et al., 2015) validation set using GradCAM (Selvaraju et al., 2017) in order to show the effect of GSCA intuitively. We take ResNet50 as the baseline network and create heat maps before the classification layer. Figure 3 clearly shows that the heat maps of GSCA cover a larger target area. It indicates that GSCA can motivate the model to focus on more feature details of the recognized objects, to better utilize the information in the target object regions and to aggregate features from them, which is beneficial for image classification (Woo et al., 2018). The above results demonstrate qualitatively that GSCA enhances the baseline network’s ability to capture global spatial features.
107
+
108
+ # 4 EXPERIMENTS
109
+
110
+ In this section, we first state the details of our experiments. Second, we show ablation studies about GSCA. Third, we evaluate GSCA on image classification, object detection, and instance segmentation tasks. At last, we analyze the robustness of GSCA by zero-shot tests.
111
+
112
+ # 4.1 EXPERIMENTAL SETUP
113
+
114
+ To evaluate the performance of GSCA on image classification tasks, we compare GSCA with other methods on Imagenet-1k, taking ResNet (He et al., 2016) families as the backbones. We also apply
115
+
116
+ GSCA to MobileNetV2 (Sandler et al., 2018), ShuffleNetV2 (Ma et al., 2018) and ResNeXt (Xie et al., 2017) to verify its generalization. For object detection and instance segmentation tasks, we evaluate GSCA on MS COCO using Faster R-CNN (Ren et al., 2015), Mask R-CNN (He et al., 2017) and RetinaNet (Lin et al., 2017b) with pre-trained ResNet-50 and ResNet-101 as the backbones and Feature Pyramid Network (FPN) (Lin et al., 2017a) as the neck. We implement all detectors by using MMDetection toolkit (Chen et al., 2019) and employ the default setting. For fair comparisons, the models trained by all methods adopt the same settings, including the number of training epochs, batch size, optimizer, learning rate schedule, weight decay, momentum, and data augmentation strategies. Experiment details are described in Appendix A.1.
117
+
118
+ # 4.2 ABLATION STUDY
119
+
120
+ Table 1: Ablation experiments on Mini-ImageNet with baseline ResNet-50. Reverse indicates whether $\sigma \left( C _ { Q k } \right)$ is subtracted from 1 in Eq. (4). Position represents the different positions in the ResNet block where GSCA is inserted. Specifically, #1 is after the $3 { \times } 3$ convolution, $\# 2$ is after BN layer of the $3 { \times } 3$ convolution, and $\# 3$ is before the shortcut connection (position of SENet).
121
+
122
+ <table><tr><td>GSCA</td><td>Reverse</td><td>Position #1</td><td>Position #2</td><td>Position #3</td><td>Top-1</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>80.55</td></tr><tr><td>&lt;&lt;&lt;√</td><td>√</td><td>√</td><td></td><td></td><td>81.18</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td>80.12</td></tr><tr><td></td><td>:</td><td></td><td></td><td></td><td>81.59</td></tr><tr><td></td><td></td><td></td><td></td><td>√</td><td>81.17</td></tr></table>
123
+
124
+ Analysis of reverse and position. For experimental efficiency, the reverse operation and the position of GSCA are explored on Mini-ImageNet (Ravi & Larochelle, 2017) with baseline ResNet-50. Mini-ImageNet is a subset of ImageNet-1k, with 100 classes and 60,000 images, of which the training and validation sets are 50,000 and 10,000 images, respectively. Appendix A.1.2 describes the experimental details. As in Table 1, GSCA with the reverse operation all improve the performance of the baseline, and position $\# 2$ is optimal. The position $\# 2$ without reverse is weaker than the baseline, which verifies the plausibility of Eq. (4). The comparison of positions $\# 1$ and $\# 2$ illustrates that the data distribution after BN layers is more beneficial to GSCA. The results of $\# 2$ and #3 indicate that the positions of down-sampling or extracting local features are more applicable to GSCA to capture spatial information. It is not limited to the $3 { \times } 3$ convolution in ResNet, but also includes the group convolution in ResNeXt (Xie et al., 2017) block and the depthwise separable (DW) convolution in MobileNetV2 (Sandler et al., 2018) and ShuffleNetV2 (Ma et al., 2018) block. Hence in this paper, we insert GCSA after BN layers of all these convolutions to enhance their representations.
125
+
126
+ Next, we further conduct ablation studies for multi-head attention and exponent $\alpha$ on ImageNet-1k with baseline ResNet50.
127
+
128
+ Analysis of the per head channels $n$ . We perform ablation experiments on the number of channels per head $n$ to respond flexibly to different backbone architectures. An attempt is made to explore the effect of $n$ on GSCA experimentally. For ResNet, since the minimum number of channels in its block is 64, we set $n = 1 6 , 3 2 , 6 4$ respectively for our experiments. Table 2(a) shows the impact of $n$ with
129
+
130
+ Table 2: Ablation experiments for $n$ and $\alpha$ on ImageNet-1k (Top-1 at baseline is 77.28).
131
+
132
+ <table><tr><td>n</td><td>Top-1</td><td>α</td><td>Top-1</td></tr><tr><td>No</td><td>77.75</td><td>1.0</td><td>78.03</td></tr><tr><td>16</td><td>77.97</td><td>1.5</td><td>77.86</td></tr><tr><td>32</td><td>77.92</td><td>2.0</td><td>78.08</td></tr><tr><td>64</td><td>78.03</td><td>2.5</td><td>77.79</td></tr><tr><td colspan="2">(a)</td><td colspan="2">(b)</td></tr></table>
133
+
134
+ Top-1 as the evaluation, and the first row of the table indicates that no multi-head attention is used. Obviously, the multi-head attention enhances the performance of GSCA, while the value of $n$ has almost no influence on the accuracy. We finally set $n = 6 4$ in the multi-head GSCA, corresponding to the number of heads $h = 1 , 2 , 4 , 8$ for four stages in ResNet, respectively.
135
+
136
+ Analysis of the exponent $\alpha$ . As mentioned in section 3.1, the exponent $\alpha$ is used to increase the numerical differences of the weights. Table 2(b) shows the effect of $\alpha$ . Clearly, the fractional $\alpha$ is unfriendly, whereas performance on
137
+
138
+ Table 3: The impact of $\alpha$ on object detection task.
139
+
140
+ <table><tr><td>α</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>1.0</td><td>38.8</td><td>60.2</td><td>42.0</td><td>22.7</td><td>42.5</td><td>49.8</td></tr><tr><td>2.0</td><td>39.0</td><td>60.3</td><td>42.2</td><td>23.5</td><td>42.6</td><td>49.7</td></tr></table>
141
+
142
+ the classification task is slightly facilitated at $\alpha = 2$ . Considering the small difference in accuracy
143
+
144
+ Table 4: Comparison of different attention methods on ImageNet-1k. All results are reproduced and trained with the same training setting except AANet and $A ^ { \frac { \ d S } { \ d ^ { 2 } } }$ -Net, which have no official code.
145
+
146
+ <table><tr><td>Method</td><td>Backbone</td><td>Parameters</td><td>+ Param.</td><td>FLOPs</td><td>Inference</td><td>Top-1</td><td>Top-5</td></tr><tr><td>ResNet (He et al.,2016)</td><td rowspan="10">ResNet-50</td><td>25.56M</td><td>0</td><td>4.11G</td><td>1879</td><td>77.28</td><td>93.53</td></tr><tr><td>SENet (Hu et al.,2018)</td><td>28.07M</td><td>2.51M</td><td>4.12G</td><td>1510</td><td>77.86</td><td>93.87</td></tr><tr><td>CBAM(Woo et al., 2018)</td><td>28.07M</td><td>2.51M</td><td>4.12G</td><td>1286</td><td>78.24</td><td>93.81</td></tr><tr><td>A²-Net (Chen et al., 2018)</td><td>33.00M</td><td>7.44M</td><td>6.50G</td><td>-</td><td>77.00</td><td>93.50</td></tr><tr><td>GSoPNetl (Gao et al.,2019)</td><td>28.29M</td><td>2.73M</td><td>6.39G</td><td>1359</td><td>79.01</td><td>94.35</td></tr><tr><td>AANet (Bello et al.,2019)</td><td>25.80M</td><td>0.24M</td><td>4.15G</td><td>1</td><td>77.70</td><td>93.80</td></tr><tr><td>ECANet (Wang et al.,2020)</td><td>25.56M</td><td>80</td><td>4.12G</td><td>1769</td><td>77.99</td><td>93.85</td></tr><tr><td>FcaNet (Qin et al.,2021)</td><td>28.07M</td><td>2.51M</td><td>4.12G</td><td>1453</td><td>78.57</td><td>94.10</td></tr><tr><td>GSCA</td><td>25.56M</td><td>0</td><td>4.11G</td><td>1644</td><td>78.08</td><td>93.95</td></tr><tr><td>GSCA-SENet</td><td>28.07M 25.56M</td><td>2.51M</td><td>4.12G</td><td>1410</td><td>78.31</td><td>94.15</td></tr><tr><td rowspan="2">GSCA-ECANet GSCA-FcaNet</td><td>28.07M</td><td>80 2.51M</td><td>4.12G 4.12G</td><td>1442 1256</td><td>78.25 78.69</td><td>94.00 94.29</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="7">ResNet (He et al., 2016) SENet (Hu et al.,2018) AANet (Bello et al.,2019) ECANet (Wang et al.,2020) FcaNet (Qin et al.,2021)</td><td rowspan="7"></td><td>44.55M 49.29M</td><td>0 4.74M</td><td>7.83G 7.85G</td><td>1129 960</td><td>78.72 79.19</td><td>94.30 94.50</td></tr><tr><td>45.40M</td><td>0.85M</td><td>8.05G</td><td>-</td><td>78.70</td><td>94.40</td></tr><tr><td>44.55M</td><td>165</td><td>7.84G</td><td>1003</td><td>79.09</td><td>94.38</td></tr><tr><td>ResNet-101 49.29M</td><td>4.74M</td><td>7.85G</td><td>933</td><td>79.63</td><td>94.63</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td> 44.55M</td><td>0</td><td>7.83G</td><td>968</td><td>79.42</td><td>94.64</td></tr><tr><td>49.29M</td><td>4.74M</td><td>7.85G</td><td>896</td><td>79.60</td><td>94.69</td></tr><tr><td>GSCA-ECANet GSCA-FcaNet</td><td>44.55M 49.29M</td><td>165 4.74M</td><td>7.84G 7.85G</td><td>934 808</td><td>79.49</td><td></td><td>94.45</td></tr><tr><td rowspan="7">ResNet (He et al., 2016) SENet (Hu et al., 2018)</td><td rowspan="6"></td><td>60.19M</td><td></td><td></td><td></td><td>79.65</td><td></td><td>94.66</td></tr><tr><td>66.77M</td><td>0</td><td>11.56G</td><td>805</td><td>79.39</td><td></td><td>94.74</td></tr><tr><td></td><td>6.58M</td><td>11.58G</td><td></td><td>758</td><td>79.84</td><td>94.82</td></tr><tr><td>AANet (Bello et al.,2019) ResNet-152 ECANet (Wang et al., 2020)</td><td>61.60M 60.19M</td><td>1.41M 250</td><td>11.90G</td><td>1</td><td>79.10</td><td>94.60</td></tr><tr><td></td><td></td><td></td><td>11.57G</td><td>785</td><td>79.86</td><td>94.80</td></tr><tr><td></td><td>66.77M</td><td>6.58M</td><td>11.58G</td><td>713</td><td>80.02</td><td>94.89</td></tr><tr><td></td><td>60.19M</td><td>0</td><td>11.56G</td><td>764</td><td>79.99</td><td>94.87</td></tr></table>
147
+
148
+ at $\alpha = 1$ and $\alpha = 2$ , we further compared their results on the object detection task based on Faster R-CNN (Ren et al., 2015). As shown in Table 3, $\alpha = 2$ has a 0.2 higher AP on the downstream task. We believe that the numerical enhancement of spatial attention has a greater impact on the downstream localization task compared to the classification task. Considering these considerations, we select $\alpha = 2$ as the default setting for GSCA.
149
+
150
+ # 4.3 IMAGE CLASSIFICATION ON IMAGENET-1K
151
+
152
+ Performance comparison with other methods. Table 4 shows the comparison of our GSCA with the state-of-the-art methods using ResNet-50 (He et al., 2016), ResNet-101, and ResNet152 backbones on ImageNet-1k, including SENet (Hu et al., 2018), CBAM (Woo et al., 2018), $A ^ { 2 }$ -Net (Chen et al., 2018), GSoP-Net1 (Gao et al., 2019), AANet (Bello et al., 2019), ECANet (Wang et al., 2020), and FcaNet (Qin et al., 2021). The evaluation metrics include both efficiency (i.e., network parameters, added parameters, floating point operations per second (FLOPs), and inference speed) and effectiveness (i.e., Top-1/Top-5 accuracy). Generally speaking, all attention modules can improve the baseline models with a clear margin. Our parameter-free GSCA-50 has achieved performance close to or even higher than most modules with parameters. CBAM, GSoP-Net1, and FcaNet are better than GSCA, but all add more than $2 . 5 \mathbf { M }$ extra parameters. GSoP-Net1’s GLOPs are even 1.5 times higher than GSCA. Moreover, GSCA does not add any parameters to the existing model, which is a great advantage over other modules. GSCA-101 surpasses all competitors except FcaNet-101, but FcaNet-101 increases the size of the baseline model by more than 4.5M. GSCA-152 is almost identical to FcaNet-152 (top-1 accuracy differed by only $0 . 0 3 \%$ ). Two obvious conclusions exist from the above analysis. First, the larger the baseline network, the more parameters are added by other modules. Take SENet and FcaNet for example, adding 2.5M, 4.7M and, 6.5M parameters from ResNet50 to ResNet152, respectively. In contrast, GSCA is parameter-free and has no such shortcomings. Second, the enhancement effect of GSCA becomes stronger as the network deepens. Perhaps GSCA is better suited for large networks. The principle of GSCA is to adjust the weights according to the data pattern of the original feature map itself, so a deeper network will gain more prior knowledge to facilitate the performance of GSCA. GSCA can be considered a spatial attention module. We try to combine GSCA with channel attention, including SENet, ECANet, and FcaNet on ResNet50 and 101. GSCA has only a weak boost to FcaNet. We consider that FcaNet creates a certain degree of incompatibility with the role of GSCA when performing 2D DCT. For SENet and ECANet, GSCA significantly improves their behavior. GSCA-SENet50 outperforms CBAM with fewer parameters, which confirms that GSCA can optimize the network in the spatial dimension.
153
+
154
+ Table 5: Object detection results of different methods on COCO val 2017.
155
+
156
+ <table><tr><td>Method</td><td>Detector</td><td>Parameters</td><td>FLOPs</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>ResNet-50</td><td rowspan="6">Faster-RCNN</td><td>41.53M</td><td>207.07</td><td>36.4</td><td>58.2</td><td>39.2</td><td>21.8</td><td>40.0</td><td>46.2</td></tr><tr><td>SENet-50</td><td>44.02M</td><td>207.18</td><td>37.7</td><td>60.1</td><td>40.9</td><td>22.9</td><td>41.9</td><td>48.2</td></tr><tr><td>ECANet-50</td><td>41.53M</td><td>207.18</td><td>38.0</td><td>60.6</td><td>40.9</td><td>23.4</td><td>42.1</td><td>48.0</td></tr><tr><td>FcaNet-50</td><td>44.02M</td><td>207.18</td><td>39.0</td><td>61.1</td><td>42.3</td><td>23.7</td><td>42.8</td><td>49.6</td></tr><tr><td>GSCA</td><td>41.53M</td><td>207.07</td><td>39.0</td><td>60.3</td><td>42.2</td><td>23.5</td><td>42.6</td><td>49.7</td></tr><tr><td>GSCA-SENet50</td><td>44.02M</td><td>207.18</td><td>39.5</td><td>61.2</td><td>42.9</td><td>23.7</td><td>43.5</td><td>50.6</td></tr><tr><td>GSCA-ECANet50</td><td></td><td>41.53M</td><td>207.18</td><td>39.3</td><td>61.2</td><td>42.6</td><td>23.3</td><td>43.3</td><td>49.9</td></tr><tr><td>GSCA-FcaNet50</td><td></td><td>44.02M</td><td>207.18</td><td>39.4</td><td>61.0</td><td>42.6</td><td>24.4</td><td>43.1</td><td>50.2</td></tr><tr><td>ResNet-101 SENet-101</td><td rowspan="6"></td><td>60.52M</td><td>283.14</td><td>38.7</td><td>60.6</td><td>41.9</td><td>22.7</td><td>43.2</td><td>50.4</td></tr><tr><td></td><td>65.24M</td><td>283.33</td><td>39.6</td><td>62.0</td><td>43.1</td><td>23.7</td><td>44.0</td><td>51.4</td></tr><tr><td>ECANet-101</td><td>60.52M</td><td>283.32</td><td>40.3</td><td>62.9</td><td>44.0</td><td>24.5</td><td>44.7</td><td>51.3</td></tr><tr><td>FcaNet-101 Faster-RCNN</td><td>65.24M</td><td>283.33</td><td>41.2</td><td>63.3</td><td>44.6</td><td>23.8</td><td>45.2</td><td>53.1</td></tr><tr><td>GSCA</td><td>60.52M</td><td>283.14</td><td>41.2</td><td>62.5</td><td>45.0</td><td>25.0</td><td>45.3</td><td>53.2</td></tr><tr><td>GSCA-SENet101</td><td>65.24M</td><td>283.33</td><td>41.3</td><td>62.8</td><td>45.2</td><td>24.7</td><td>45.4</td><td>53.5</td></tr><tr><td>GSCA-ECANet101</td><td>60.52M</td><td>283.32</td><td>41.6</td><td>62.7</td><td>45.3</td><td>25.0</td><td></td><td>46.3</td><td>53.3</td></tr><tr><td>GSCA-FcaNet101</td><td>65.24M</td><td>283.33</td><td></td><td>41.5</td><td>62.8</td><td>45.2</td><td>24.6</td><td>46.0</td><td>53.6</td></tr><tr><td>ResNet-50 SENet-50</td><td></td><td>44.17M 260.14</td><td></td><td>37.2</td><td>58.9</td><td>40.3</td><td>22.2</td><td>40.7</td><td>48.0</td></tr><tr><td rowspan="9">ResNet-50+1NL ECANet-50</td><td>Mask-RCNN</td><td>46.66M</td><td>260.25</td><td>38.7</td><td>60.9</td><td>42.1</td><td>23.4</td><td>42.7</td><td>50.0</td></tr><tr><td></td><td>52.57M</td><td>268.54</td><td>39.0</td><td>61.1</td><td>41.9</td><td>1</td><td>1</td><td>=</td></tr><tr><td></td><td>260.25</td><td>39.0</td><td>61.3</td><td></td><td>42.1</td><td>24.2</td><td>42.8</td><td>49.9</td></tr><tr><td>FcaNet-50</td><td>44.17M 46.66M</td><td>260.25</td><td>40.3</td><td>62.0</td><td>44.1</td><td>25.2</td><td>43.9</td><td>52.0</td></tr><tr><td>GSCA</td><td>44.17M</td><td>260.14</td><td>39.5</td><td>60.5</td><td>43.1</td><td>23.0</td><td>42.9</td><td></td></tr><tr><td>GSCA-SENet50</td><td>46.66M</td><td>260.25</td><td>40.5</td><td>61.6</td><td>44.2</td><td>24.3</td><td>44.2</td><td>50.8</td></tr><tr><td>GSCA-ECANet50</td><td>44.17M</td><td></td><td></td><td></td><td></td><td>23.8</td><td></td><td>51.9</td></tr><tr><td>GSCA-FcaNet50</td><td>46.66M</td><td>260.25 260.25</td><td>40.0 40.4</td><td>61.5 61.7</td><td>43.6 44.0</td><td>24.5</td><td>44.0 43.7</td><td>51.2</td></tr><tr><td>ResNet-50</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>52.0</td></tr><tr><td>SENet-50</td><td></td><td>37.74M 40.23M</td><td>239.32</td><td>35.6</td><td>55.5</td><td>38.2</td><td>20.0</td><td>39.6</td><td>46.8</td></tr><tr><td>ECANet-50</td><td>RetinaNet</td><td></td><td>239.43</td><td>37.1</td><td>57.2</td><td>39.9</td><td>21.2</td><td>40.7</td><td>50.0</td></tr><tr><td></td><td></td><td>37.74M</td><td>239.43</td><td>37.3</td><td>57.7</td><td>39.6</td><td>21.9</td><td>41.3</td><td>48.9</td></tr><tr><td>GSCA</td><td></td><td>37.74M</td><td>239.32</td><td>37.5</td><td>56.9 58.0</td><td>39.9 41.2</td><td>21.5 22.5</td><td>41.1 42.2</td><td>49.3 50.4</td></tr><tr><td>GSCA-SENet50 GSCA-ECANet50</td><td></td><td>40.23M 37.74M</td><td>239.43 239.43</td><td>38.6 38.2</td><td>57.8</td><td>40.6</td><td>22.6</td><td>42.0</td><td>50.1</td></tr></table>
157
+
158
+ Application on other backbones. To verify the generalization of GSCA on other backbone structures, we apply GSCA to ResNeXt (Xie et al., 2017), MobileNetV2 (Sandler et al., 2018) and ShuffleNetV2 (Ma et al., 2018). See the appendix A.2 for the implementation and setting of different backbones by GSCA. Table 6 shows the results. Without any additional parameters, it is surprising that GSCA still steadily improves the performance of the baselines in the face of
159
+
160
+ Table 6: Performance comparisons of GSCA application on different backbone architectures.
161
+
162
+ <table><tr><td>Method</td><td>Parameters</td><td>Top-1</td><td>Top-5</td></tr><tr><td>ResNeXt-50</td><td>25.03M</td><td>78.35</td><td>94.11</td></tr><tr><td>+GSCA</td><td>25.03M</td><td>78.89</td><td>94.47</td></tr><tr><td>MobileNetV2</td><td>3.50M</td><td>67.09</td><td>87.92</td></tr><tr><td>+GCSA</td><td>3.50M</td><td>67.89</td><td>88.40</td></tr><tr><td>ShuffleNetV2</td><td>2.28M</td><td>65.45</td><td>86.54</td></tr><tr><td>+GSCA</td><td>2.28M</td><td>65.87</td><td>86.72</td></tr></table>
163
+
164
+ lightweight networks like MobileNetV2 and ShuffleNetV2. At a deeper level, the results of ResNeXt, MobileNetV2 and ShuffleNetV2 demonstrate the adaptability of GSCA to group convolution, deepwise separable convolution, and channel shuffling operations, respectively. The generalizability of GSCA to different backbone architectures is further proved.
165
+
166
+ # 4.4 OBJECT DETECTION ON MS COCO
167
+
168
+ We evaluate our GSCA on object detection task using Faster R-CNN (Ren et al., 2015), Mask RCNN (He et al., 2017) and RetinaNet (Lin et al., 2017b) as detectors and ResNet with FPN as the backbone. SENet, CBAM, NL (Wang et al., 2018) and ECANet are used for comparison. GSCA’s performance on object detection task is exciting. As shown in Table 5, GSCA achieves almost the most advanced performance. Specifically, on the two-stage detector Faster R-CNN, GSCA achieves the same performance as the SOTA method FcaNet without extra parameters. On Mask R-CNN detector, except FcaNet, GSCA exceeds other modules with parameters, including NL, which is also a form of self-attention. GSCA works best on the single-stage detector RetinaNet. We also complete experiments combining GSCA with channel attentions. FcaNet is weakly augmented for reasons consistent with those described in section 4.3. SENet and ECANet are greatly enhanced. Specifically, SENet and ECANet are boosted by $1 . 5 – 1 . 8 \%$ and $0 . 9 \mathrm { - } 1 . 3 \%$ of AP, respectively.
169
+
170
+ # 4.5 INSTANCE SEGMENTATION ON MS COCO
171
+
172
+ For instance segmentation task, we take Mask R-CNN as the detector for evaluation and the results are shown in Table 7. Similar to the object detection task results, GSCA outperforms most methods, including NL, which is also a self-attention module. GSCA is slightly inferior to FcaNet, but GSCA is more lightweight. Regarding the combination with channel attentions, FCANet has a weak performance improvement due to the previously men
173
+
174
+ Table 7: Instance segmentation results of different methods using Mask R-CNN on COCO val 2017.
175
+
176
+ <table><tr><td>Method</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>ResNet-50</td><td>34.1</td><td>55.5</td><td>36.2</td><td>16.1</td><td>36.7</td><td>50.0</td></tr><tr><td>SENet-50</td><td>35.4</td><td>57.4</td><td>37.8</td><td>17.1</td><td>38.6</td><td>51.8</td></tr><tr><td>ResNet-50+1NL</td><td>35.5</td><td>58.0</td><td>37.4</td><td>-</td><td>-</td><td>-</td></tr><tr><td>ECANet-50</td><td>35.6</td><td>58.1</td><td>37.7</td><td>17.6</td><td>39.0</td><td>51.8</td></tr><tr><td>FcaNet-50</td><td>36.2</td><td>58.6</td><td>38.1</td><td>-</td><td>-</td><td>-</td></tr><tr><td>GSCA</td><td>35.8</td><td>57.5</td><td>38.3</td><td>16.8</td><td>38.7</td><td>51.3</td></tr><tr><td>GSCA-SENet50</td><td>36.4</td><td>58.5</td><td>38.4</td><td>17.8</td><td>39.5</td><td>52.1</td></tr><tr><td>GSCA-ECANet50</td><td>36.3</td><td>58.4</td><td>38.7</td><td>17.8</td><td>39.8</td><td>51.5</td></tr><tr><td>GSCA-FcaNet50</td><td>36.3</td><td>58.5</td><td>38.4</td><td>18.2</td><td>39.1</td><td>52.9</td></tr></table>
177
+
178
+ tioned compatibility issues. In addition, SENet and ECANet receive AP increases of 1.0 and 0.7, respectively.
179
+
180
+ # 4.6 ROBUSTNESS EXPERIMENT
181
+
182
+ Table 8: Robustness of trained networks to rotation and flipping of images at test time. Numbers in the parentheses show the relative performance drop compared to testing on original images with no manipulation (lower is better).
183
+
184
+ <table><tr><td rowspan="2">Method</td><td colspan="2">ResNet-50</td><td colspan="2">GSCA-50</td></tr><tr><td>Top-1</td><td>Top-5</td><td>Top-1</td><td>Top-5</td></tr><tr><td>no rotation</td><td>77.28</td><td>93.53</td><td>78.08</td><td>93.95</td></tr><tr><td>clockwise 90°</td><td>52.27 (25.01)</td><td>74.91(18.62)</td><td>54.79 (23.29)</td><td>77.13(16.82)</td></tr><tr><td>clockwise 180°</td><td>52.86 (24.42)</td><td>77.31(16.22)</td><td>55.10 (22.98)</td><td>79.18(14.77)</td></tr><tr><td>clockwise 270°</td><td>52.36 (24.92)</td><td>75.28(18.25)</td><td>54.89 (23.19)</td><td>77.12(16.83)</td></tr><tr><td>upside-down</td><td>52.68 (24.60)</td><td>77.12(16.41)</td><td>54.99 (23.09)</td><td>79.12(14.83)</td></tr></table>
185
+
186
+ We conduct zero-shot tests to explore the role of GSCA on the robustness of the baseline network. In this subsection, we rotate or flip images of the ImageNet val set in one of four ways: clockwise $9 0 ^ { \circ }$ , clockwise $1 8 0 ^ { \circ }$ , clockwise $2 7 0 ^ { \circ }$ , and upside down flip about the horizontal axis. As a reminder, the above transformations are not used in the training process. As in Table 8, all model performance deteriorated in the zero-shot tests. Nevertheless, in terms of accuracy, GSCA still outperforms ResNet by a net $2 . 2 4 { - } 2 . 5 3 \%$ and $1 . 8 4 - 2 . 2 2 \%$ on top-1 and top-5 accuracy, respectively. Furthermore, the GSCA is less vulnerable than the baseline network when suffering from image transformation. The data in parentheses indicate a lower drop in GSCA, specifically, $1 . 4 4 - 1 . 7 3 \%$ and $1 . 4 2 \mathrm { - } 1 . 8 0 \%$ net lower than ResNet on top-1 and top-5 accuracy, respectively. In a word, the ability of GSCA to capture global information has advantages over baseline networks in terms of both accuracy and robustness for disturbed images.
187
+
188
+ # 5 CONCLUSION
189
+
190
+ In this paper, we propose a parameter-free self-attention with linear computational complexity called global spatial correlation attention (GSCA). It compresses the key matrix into a vector and evaluates the pairwise affinities of each pixel with the key vector in terms of the cross-correlation coefficient. The aim is to adjust the attention distribution in the global space by utilizing the input feature maps’ statistical relationships. GSCA can serve as a spatial attention module that enhances the ability of convolution to capture global spatial information. The designed GSCA is simple, yet it has proven to have a strong performance without any projection operation, which is used to generate query, key, and value in self-attention. Therefore, we boldly predict that GSCA has great potential for the design of lightweight network architectures. In the future, we consider adding more nonlinearity to GSCA and borrowing from Transformer architecture to design a lightweight network applied to edge devices.
191
+
192
+ # REFERENCES
193
+
194
+ Guha Balakrishnan, Amy Zhao, Mert R. Sabuncu, John Guttag, and Adrian V. Dalca. Voxelmorph: A learning framework for deformable medical image registration. IEEE Transactions on Medical Imaging, 38(8):1788–1800, 2019.
195
+
196
+ 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 (ICCV), October 2019.
197
+
198
+ Yue Cao, Jiarui Xu, Stephen Lin, Fangyun Wei, and Han Hu. Gcnet: Non-local networks meet squeeze-excitation networks and beyond. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops (ICCVW), pp. 0–0, 2019.
199
+
200
+ Shiladitya Chatterjee, Sean C Chapman, Barry M Lunt, and Matthew R Linford. Using crosscorrelation with pattern recognition entropy to obtain reduced total ion current chromatograms from raw liquid chromatography-mass spectrometry data. Bulletin of the Chemical Society of Japan, 91(12):1775–1780, 2018.
201
+
202
+ Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, et al. Mmdetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019.
203
+
204
+ Yinpeng Chen, Xiyang Dai, Mengchen Liu, Dongdong Chen, Lu Yuan, and Zicheng Liu. Dynamic convolution: Attention over convolution kernels. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
205
+
206
+ Yunpeng Chen, Yannis Kalantidis, Jianshu Li, Shuicheng Yan, and Jiashi Feng. $\mathrm { A ^ { 2 } }$ -nets: Double attention networks. In Advances in Neural Information Processing Systems (NIPS), volume 31, 2018.
207
+
208
+ Stephane 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 (ICML), pp. 2286–2296, 2021.
209
+
210
+ Jun Fu, Jing Liu, Haijie Tian, Yong Li, Yongjun Bao, Zhiwei Fang, and Hanqing Lu. Dual attention network for scene segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3146–3154, 2019.
211
+
212
+ Zilin Gao, Jiangtao Xie, Qilong Wang, and Peihua Li. Global second-order pooling convolutional networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3024–3033, 2019.
213
+
214
+ Zhengyang Geng, Meng-Hao Guo, Hongxu Chen, Xia Li, Ke Wei, and Zhouchen Lin. Is attention better than matrix decomposition? In International Conference on Learning Representations (ICLR), 2021.
215
+
216
+ Ian Goodfellow, Yoshua Bengio, Aaron Courville, and Yoshua Bengio. Deep learning, volume 1. MIT Press, 2016.
217
+
218
+ Priya Goyal, Piotr Dollar, Ross Girshick, Pieter Noordhuis, Lukasz Wesolowski, Aapo Kyrola, An- ´ drew Tulloch, Yangqing Jia, and Kaiming He. Accurate, large minibatch sgd: Training imagenet in 1 hour. arXiv preprint arXiv:1706.02677, 2017.
219
+
220
+ Meng-Hao Guo, Zheng-Ning Liu, Tai-Jiang Mu, and Shi-Min Hu. Beyond self-attention: External attention using two linear layers for visual tasks. arXiv preprint arXiv:2105.02358, 2021.
221
+
222
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, 2016.
223
+
224
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 2961–2969, 2017.
225
+
226
+ Jie Hu, Li Shen, and Gang Sun. Squeeze-and-excitation networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7132–7141, 2018.
227
+
228
+ 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 (ICCV), October 2019.
229
+
230
+ Nikita Kitaev, Łukasz Kaiser, and Anselm Levskaya. Reformer: The efficient transformer. In International Conference on Learning Representations (ICLR), 2020.
231
+
232
+ Alexander Kolesnikov, Alexey Dosovitskiy, Dirk Weissenborn, Georg Heigold, Jakob Uszkoreit, Lucas Beyer, Matthias Minderer, Mostafa Dehghani, Neil Houlsby, Sylvain Gelly, Thomas Unterthiner, and Xiaohua Zhai. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations (ICLR), 2021.
233
+
234
+ Soroush Abbasi Koohpayegani and Hamed Pirsiavash. Sima: Simple softmax-free attention for vision transformers. arXiv preprint arXiv:2206.08898, 2022.
235
+
236
+ Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in Neural Information Processing Systems (NIPS), 2012.
237
+
238
+ HyunJae Lee, Hyo-Eun Kim, and Hyeonseob Nam. Srm: A style-based recalibration module for convolutional neural networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 1854–1862, 2019.
239
+
240
+ Xiang Li, Xiaolin Hu, and Jian Yang. Spatial group-wise enhance: Improving semantic feature learning in convolutional networks. arXiv preprint arXiv:1905.09646, 2019a.
241
+
242
+ Xiang Li, Wenhai Wang, Xiaolin Hu, and Jian Yang. Selective kernel networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2019b.
243
+
244
+ Tsung-Yi Lin, Piotr Dollar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. Feature pyramid networks for object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), July 2017a.
245
+
246
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense ´ object detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 2980–2988, 2017b.
247
+
248
+ Huajun Liu, Fuqiang Liu, Xinyi Fan, and Dong Huang. Polarized self-attention: towards highquality pixel-wise regression. arXiv preprint arXiv:2107.00782, 2021a.
249
+
250
+ Yichao Liu, Zongru Shao, Yueyang Teng, and Nico Hoffmann. NAM: Normalization-based attention module. In NeurIPS 2021 Workshop on ImageNet: Past, Present, and Future, 2021b.
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, October 2021c.
253
+
254
+ Ningning Ma, Xiangyu Zhang, Hai-Tao Zheng, and Jian Sun. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In Proceedings of the European Cnference on Computer Vision (ECCV), pp. 116–131, 2018.
255
+
256
+ Xuran Pan, Chunjiang Ge, Rui Lu, Shiji Song, Guanfu Chen, Zeyi Huang, and Gao Huang. On the integration of self-attention and convolution. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 815–825, June 2022.
257
+
258
+ Jongchan Park, Sanghyun Woo, Joon-Young Lee, and In So Kweon. Bam: Bottleneck attention module. In The British Machine Vision Conference (BMVC), 2018.
259
+
260
+ Zequn Qin, Pengyi Zhang, Fei Wu, and Xi Li. Fcanet: Frequency channel attention networks. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 783– 792, 2021.
261
+
262
+ Zhen Qin, Weixuan Sun, Hui Deng, Dongxu Li, Yunshen Wei, Baohong Lv, Junjie Yan, Lingpeng Kong, and Yiran Zhong. cosformer: Rethinking softmax in attention. In International Conference on Learning Representations (ICLR), 2022.
263
+
264
+ Sachin Ravi and Hugo Larochelle. Optimization as a model for few-shot learning. In International Conference on Learning Representations (ICLR), 2017.
265
+
266
+ 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 (NIPS), volume 28, 2015.
267
+
268
+ Jordan Rodu, Natalie Klein, Scott L Brincat, Earl K Miller, and Robert E Kass. Detecting multivariate cross-correlation between brain regions. Journal of neurophysiology, 120(4):1962–1972, 2018.
269
+
270
+ Abhijit Guha Roy, Nassir Navab, and Christian Wachinger. Concurrent spatial and channel ‘squeeze & excitation’in fully convolutional networks. In International conference on medical image computing and computer-assisted intervention, pp. 421–429. Springer, 2018.
271
+
272
+ 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.
273
+
274
+ Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4510–4520, 2018.
275
+
276
+ Ramprasaath R. Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), Oct 2017.
277
+
278
+ Eero P Simoncelli and Bruno A Olshausen. Natural image statistics and neural representation. Annual review of neuroscience, 24(1):1193–1216, 2001.
279
+
280
+ Aravind Srinivas, Tsung-Yi Lin, Niki Parmar, Jonathon Shlens, Pieter Abbeel, and Ashish Vaswani. Bottleneck transformers for visual recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 16519–16529, June 2021.
281
+
282
+ 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 (NIPS), volume 30, 2017.
283
+
284
+ Qilong Wang, Banggu Wu, Pengfei Zhu, Peihua Li, Wangmeng Zuo, and Qinghua Hu. Eca-net: Efficient channel attention for deep convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
285
+
286
+ 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, October 2021.
287
+
288
+ Xiaolong Wang, Ross Girshick, Abhinav Gupta, and Kaiming He. Non-local neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 7794–7803, 2018.
289
+
290
+ Sanghyun Woo, Jongchan Park, Joon-Young Lee, and In So Kweon. Cbam: Convolutional block attention module. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 3–19, 2018.
291
+
292
+ Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans-´ formations for deep neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1492–1500, 2017.
293
+
294
+ Manzil Zaheer, Guru Guruganesh, Kumar 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. In Advances in Neural Information Processing Systems (NIPS), volume 33, pp. 17283–17297, 2020.
295
+
296
+ Yuwen Zhai, Jianhua Yang, Shuai Zhang, and Houguang Liu. Linear frequency modulated signal induced aperiodic resonance. Physica Scripta, (6):065213, 2020.
297
+
298
+ Hang Zhang, Chongruo Wu, Zhongyue Zhang, Yi Zhu, Haibin Lin, Zhi Zhang, Yue Sun, Tong He, Jonas Mueller, R Manmatha, et al. Resnest: Split-attention networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2736–2746, 2022.
299
+
300
+ Hu Zhang, Keke Zu, Jian Lu, Yuru Zou, and Deyu Meng. Epsanet: An efficient pyramid squeeze attention block on convolutional neural network. arXiv preprint arXiv:2105.14447, 2021.
301
+
302
+ Hengshuang Zhao, Jiaya Jia, and Vladlen Koltun. Exploring self-attention for image recognition. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), June 2020.
303
+
304
+ # A APPENDIX
305
+
306
+ # A.1 IMPLEMENTATION DETAILS
307
+
308
+ # A.1.1 IMAGENET-1K
309
+
310
+ Recall that we compare GSCA with other methods on ImageNet-1k taking ResNet (He et al., 2016) families as the backbones. We also apply GSCA to MobileNetV2 (Sandler et al., 2018), ShuffleNetV2 (Ma et al., 2018) and ResNeXt (Xie et al., 2017) to verify its generalization. For all backbone networks, we employ exactly the same data augmentation and hyperparameter settings as in (He et al., 2016) and Hu et al. (2018). Specifically, the input images are randomly cropped to $2 2 4 \times 2 2 4$ with random horizontal flipping. We use an SGD optimizer with a momentum of 0.9 and a weight decay of 1e-4. The initial learning rate is set to 0.1 for a batch size of 256 (using 4 GPUs with 64 images per GPU) with the linear scaling rule (Goyal et al., 2017) and a linear warm-up of 5 epochs. All models are trained within 100 epochs with cosine learning rate decay and label smoothing following FcaNet (Qin et al., 2021). We use the Nvidia APEX mixed precision training toolkit for training efficiency. For the testing on the validation set, the shorter side of an input image is first resized to 256, and a center crop of $2 2 4 \times 2 2 4$ is used for evaluation.
311
+
312
+ # A.1.2 MINI-IMAGENET
313
+
314
+ For Mini-ImageNet dataset (Ravi & Larochelle, 2017), we only use it for the ablation studies of GSCA in section 4.2. The experimental details are similar but slightly different from ImageNet-1k. Precisely, the input images are randomly cropped to $2 2 4 \times 2 2 4$ with random horizontal flipping. We use an SGD optimizer with a momentum of 0.9 and a weight decay of 1e-4. The initial learning rate is set to 0.1 for a batch size of 100 (using 2 GPUs with 100 images per GPU) with a linear warm-up of 5 epochs. All models are trained within 100 epochs with cosine learning rate decay. Due to the small dataset, we do not use the Nvidia APEX mixed precision training toolkit on Mini-ImageNet. For the testing on the validation set, the shorter side of an input image is first resized to 256, and a center crop of $2 2 4 \times 2 2 4$ is used for evaluation.
315
+
316
+ # A.1.3 MS COCO
317
+
318
+ Recall that we use MMDetection toolkit (Chen et al., 2019) for experiments on MS COCO dataset with the pre-trained ResNet-50 and ResNet-101 as the backbones for the detector. We select the mainstream Faster R-CNN (Ren et al., 2015) and Mask R-CNN (He et al., 2017) detectors with Feature Pyramid Networks (FPNs) (Lin et al., 2017a) as the necks to build the basic object detection and instance segmentation systems. For fair comparisons, we do not insert GSCA into the convolution layers in the FPN neck and adopt the same experimental settings. Specifically, the shorter side of the input image is resized to 800. The SGD optimizer has a weight decay of 1e-4, a momentum of 0.9, and a batch size of 8 (4 GPUs with two images per GPU) within 12 epochs. The learning rate is initialized to 0.01 and is decreased by the factor of 10 at the 8th and 11th epochs, respectively. In validation, we report the standard Average Precision (AP) under IOU thresholds ranging from 0.5 to 0.95 in increments of 0.05. We also retain AP scores for small, medium and large objects.
319
+
320
+ # A.2 GSCA SETTINGS ON OTHER BACKBONES
321
+
322
+ ResNeXt We illustrate with ResNeXt-50 $3 2 { \times } 4 \mathrm { d } )$ ) as an example. As mentioned in section 4.2, we insert GSCA after the BN layer of the group convolution in all blocks of ResNeXt. For the head count of GSCA, since the ResNeXt and ResNet structures are similar, the experience of ResNet can be directly applied to ResNeXt. The output channel of grouped convolution in ResNeXt is double that of ResNet. We still fix 64 channels per head, and for four stages of ResNeXt, the head numbers are 2, 4, 8, and 16 respectively.
323
+
324
+ MobileNetV2 For illustration purposes, Table 9 shows the structure table of MobileNetV2, with GSCA head count added in its last column. We only insert GSCA after the BN layer of the depthwise separable (DW) convolution in the bottleneck. The output of Mobilenetv2’s DW convolution is not an integer multiple of 64. Thus we make the number of channels per head of GSCA approximately equal to 64. Specifically, for each bottleneck, we set $h$ to 1, 1, 2, 3, 4, 8, 15 respectively.
325
+
326
+ ShuffleNetV2 The setting of GSCA in the ShuffleNetV2 is similar to that of MobileNetV2. We still only insert GSCA after the BN layer of the DW convolution in the block. Notably, We do not use GSCA for the DW convolution in the shortcut branch. For the three stages of ShuffleNetV2, we set the number of GSCA head to 2, 4, 8 respectively.
327
+
328
+ Table 9: MobileNetV2 : Each line describes a sequence of 1 or more identical (module stride) layers, repeated $n$ times. All layers in the same sequence have the same number $c$ of output channels. The first layer of each sequence has a stride $s$ and all others use stride 1. All spatial convolutions use $3 \times$ 3 kernels. The expansion factor $t$ is always applied to the input size. $h$ is the head count of GSCA.
329
+
330
+ <table><tr><td>Input</td><td>Operator</td><td>t</td><td>C</td><td>n</td><td>S</td><td>h</td></tr><tr><td>2242×3</td><td>conv2d</td><td>-</td><td>32</td><td>1</td><td>2</td><td>1</td></tr><tr><td>112²×32</td><td>bottleneck</td><td>1</td><td>16</td><td>1</td><td>1</td><td>1</td></tr><tr><td>112²×16</td><td>bottleneck</td><td>6</td><td>24</td><td>2</td><td>2</td><td>1</td></tr><tr><td>56²×24</td><td>bottleneck</td><td>6</td><td>32</td><td>3</td><td>2</td><td>2</td></tr><tr><td>282×32</td><td>bottleneck</td><td>6</td><td>64</td><td>4</td><td>2</td><td>3</td></tr><tr><td>14²×64</td><td>bottleneck</td><td>6</td><td>96</td><td>3</td><td></td><td>4</td></tr><tr><td>14²x96</td><td>bottleneck</td><td>6</td><td>160</td><td>3</td><td>2</td><td>8</td></tr><tr><td>7²x160</td><td>bottleneck</td><td>6</td><td>320</td><td>1</td><td>1</td><td>15</td></tr><tr><td>72×320</td><td>conv2d 1×1</td><td>-</td><td>1280</td><td>1</td><td>1</td><td>=</td></tr><tr><td>7²×1280</td><td>avgpool 7×7</td><td>=</td><td>-</td><td>1</td><td></td><td></td></tr><tr><td>1x1x1280</td><td>conv2d 1x1</td><td>1</td><td>k</td><td>1</td><td></td><td></td></tr></table>
331
+
332
+ # A.3 CODE OF GSCA
333
+
334
+ GSCA module is extremely simple to implement. As in Figure 4, we give a reference implementation of GSCA in PyTorch. Multi-head GSCA simply adds one dimension to the input and adjusts the dimension index of the calculation.
335
+
336
+ ![](images/6a77adb13a457a8add39a0bf150d3da5086ec532b9a8f0e71c731094d8d2c093.jpg)
337
+ Figure 4: PyTorch code of the proposed GSCA module
338
+
339
+ A.4 DISCUSSION OF THE CROSS-CORRELATION COEFFICIENT AND THE COSINE-SIMILARITY
340
+
341
+ In this subsection we review and discuss the cross-correlation coefficient and the cosine-similarity.
342
+ Given two sets of vectors $\boldsymbol { x } \in \mathbb { R } ^ { N }$ and $\boldsymbol { y } \in \mathbb { R } ^ { N }$ .
343
+
344
+ Cross-correlation coefficient The population cross-correlation coefficient $\rho _ { x , y }$ is defined as the quotient of the covariance and standard deviation between the two variables.
345
+
346
+ $$
347
+ \rho _ { x , y } = { \frac { \operatorname { c o v } ( x , y ) } { \sigma _ { x } \sigma _ { y } } } = { \frac { E [ ( x - \mu _ { x } ) ( y - \mu _ { y } ) ] } { \sigma _ { x } \sigma _ { y } } } ,
348
+ $$
349
+
350
+ where $\operatorname { c o v } ( x , y )$ is the covariance of $x$ and $y$ , and $\sigma _ { x } , \sigma _ { y }$ are the standard deviations of $x$ and $y$ , respectively. Estimating the covariance and standard deviation of the samples, the sample crosscorrelation coefficient $C _ { x , y }$ is obtained as:
351
+
352
+ $$
353
+ C _ { x , y } = { \frac { \sum _ { i = 1 } ^ { n } \left( x _ { i } - { \bar { x } } \right) \left( y - { \bar { y } } \right) } { { \sqrt { \sum _ { i = 1 } ^ { n } \left( x _ { i } - { \bar { x } } \right) ^ { 2 } \sum _ { i = 1 } ^ { n } \left( y - { \bar { y } } \right) ^ { 2 } } } } }
354
+ $$
355
+
356
+ where $\begin{array} { r } { \bar { x } = \frac { 1 } { n } \sum _ { i = 1 } ^ { n } x _ { i } } \end{array}$ , $\textstyle { \bar { y } } = { \frac { 1 } { n } } \sum _ { i = 1 } ^ { n } y _ { i }$ . In this paper, we use the above equation to evaluate the pairwise affinity between pixels.
357
+
358
+ Cosine-similarity According to Euclid’s dot product formula
359
+
360
+ $$
361
+ x \cdot y = \left\| x \right\| \left\| y \right\| \cos \theta ,
362
+ $$
363
+
364
+ the cosine-similarity $C o s _ { x , y }$ between the two vectors is obtained
365
+
366
+ $$
367
+ C o s _ { x , y } = \cos \theta = { \frac { x \cdot y } { \left\| x \right\| \left\| y \right\| } } = { \frac { \sum _ { i = 1 } ^ { n } x _ { i } y _ { i } } { { \sqrt { \sum _ { i = 1 } ^ { n } x _ { i } { } ^ { 2 } \sum _ { i = 1 } ^ { n } y _ { i } { } ^ { 2 } } } } } .
368
+ $$
369
+
370
+ Comparing Eq. (10) and Eq. (12) to obtain Eq. (13), it shows that the cross-correlation coefficient is the cosine-similarity after the data centering process. Therefore, the cross-correlation coefficient is less sensitive to fluctuations in the data than the cosine-similarity.
371
+
372
+ $$
373
+ C _ { x , y } = { \frac { \sum _ { i = 1 } ^ { n } \left( x _ { i } - { \bar { x } } \right) \left( y - { \bar { y } } \right) } { { \sqrt { \sum _ { i = 1 } ^ { n } \left( x _ { i } - { \bar { x } } \right) ^ { 2 } \sum _ { i = 1 } ^ { n } \left( y - { \bar { y } } \right) ^ { 2 } } } } } = { \frac { ( x - { \bar { x } } ) \cdot ( y - { \bar { y } } ) } { \left\| x - { \bar { x } } \right\| \left\| y - { \bar { y } } \right\| } } = C o s _ { x - { \bar { x } } , y - { \bar { y } } }
374
+ $$
375
+
376
+ Since $\| x \| \| y \|$ in Eq. (12) would complicate the computation, $\textstyle { \frac { x \cdot y } { \sqrt { d } } }$ is used as an alternative in selfattention mechanism to evaluate the similarity between paired vectors, where $d$ points to the vectors’ dimensions. Eq. (11) shows that for larger values of $d$ , the larger dot product’s magnitude will affect the similarity representation and push the softmax function to the regions with extremely small gradients (Vaswani et al., 2017). To counteract this effect, self-attention scale the dot product by $\scriptstyle { \frac { 1 } { \sqrt { d } } }$ . The dot product in self-attention is implemented by highly optimized matrix multiplication code to achieve high parallelism. In contrast, in GSCA architecture, each position in $Q$ is only required to match the similarity with a single $k$ vector, which has high parallelism. Therefore, the cross-correlation coefficient with low sensitivity to data is allowed to be applied as an indicator of pairwise affinity.
377
+
378
+ Table 10: Comparison experiments of different evaluation methods with ResNet50 as baseline.
379
+
380
+ <table><tr><td>Method</td><td>ImageNet-1k (Top-1)</td><td>Mini-ImageNet (Top-1)</td></tr><tr><td>Baseline</td><td>77.28</td><td>80.55</td></tr><tr><td>Dot product cosine-similarity</td><td>75.69</td><td>80.32</td></tr><tr><td>Cross-correlation coefficient</td><td>78.08</td><td>81.59</td></tr></table>
381
+
382
+ In addition, we experimentally verified the superiority of the cross-correlation coefficient over the dot product cosine-similarity in GSCA architecture. We experiment on ImageNet-1k and MiniImageNet datasets by replacing the cross-correlation coefficient with dot product. Table 10 demonstrates that dot product similarity does not work well in GSCA. It shows that using the dot product to calculate the similarity to assess the affinity between $Q$ and vector $k$ is insufficient. The crosscorrelation coefficient is a better choice.
383
+
384
+ # A.5 ANALYSIS OF COMPUTATIONAL COMPLEXITY
385
+
386
+ This subsection provides a brief analysis of the computational complexity of self-attention and GSCA with the input $X \in \mathbb { R } ^ { H \times W \times C }$ .
387
+
388
+ Computational complexity of self-attention Section 3.1 mentions that self-attention generates query $Q$ , key $K$ , and value $V$ through three linear projection layers, respectively. The computational complexity of generating $Q , K$ , and $V$ is
389
+
390
+ $$
391
+ O _ { Q K V } = O \left( 3 H W C ^ { 2 } \right) .
392
+ $$
393
+
394
+ Secondly, the self-attention obtains the weight $A$ and acts $A$ on $V$ by matrix multiplication. The computational complexity of these two processes is
395
+
396
+ $$
397
+ O _ { \mathrm { A t t n } } = O \left( 2 ( H W ) ^ { 2 } C \right) .
398
+ $$
399
+
400
+ Finally, the aggregated feature also needs to pass through a linear projection layer generally with the complexity of
401
+
402
+ $$
403
+ O _ { \mathrm { P r o j } } = O \left( H W C ^ { 2 } \right) .
404
+ $$
405
+
406
+ Thus, the overall computational complexity of self-attention is
407
+
408
+ $$
409
+ O _ { \mathrm { S e l f - a t t e n t i o n } } = O _ { Q K V } + O _ { \mathrm { A t t n } } + O _ { \mathrm { P r o j } } = O \left( 4 H W C ^ { 2 } + 2 { ( H W ) } ^ { 2 } C \right) .
410
+ $$
411
+
412
+ Computational complexity of GSCA Unlike self-attention, query $Q$ and value $V$ of GSCA are obtained utilizing an identical mapping of $X$ , i.e., $O _ { Q } = O _ { V } = 0$ . The computational complexity of $k$ vector obtained by GAP is
413
+
414
+ $$
415
+ O _ { k } = O \left( H W C \right) .
416
+ $$
417
+
418
+ We estimate the correlation coefficient matrix Eq. (3) to obtain the computational complexity of generating the weight $A$
419
+
420
+ $$
421
+ O _ { \mathrm { C r o s s } } = O \left( H W \left( C + C ^ { 2 } \right) \right) .
422
+ $$
423
+
424
+ The computational complexity of acting $A$ on $V$ via the Hadamard product is
425
+
426
+ $$
427
+ O _ { \mathrm { A c t } } = O \left( H W C \right) .
428
+ $$
429
+
430
+ Thus, the overall computational complexity of GSCA is
431
+
432
+ $$
433
+ O _ { \mathrm { G S C A } } = O _ { k } + O _ { \mathrm { C r o s s } } + O _ { \mathrm { A c t } } = O \left( 3 H W C + H W C ^ { 2 } \right) .
434
+ $$
435
+
436
+ Compared with self-attention, GSCA has linear complexity for the number of pixels.
437
+
438
+ # A.6 EXPLANATION OF REVERSE OPERATION
439
+
440
+ ![](images/4c6919c42c772cb555636ee7dbcb8e8839503f01caff4908252f2e443b994eba.jpg)
441
+ Figure 5: ResNet-50 visualization of GSCA module at layer2.3. (a)-(c) with reverse and (d)-(f) without reverse. (a)(d), (b)(e), and (c)(f), each group represents the input, the attention weight, and the output of GSCA, respectively.
442
+
443
+ As described in section 3.1, the key matrix $K$ of self-attention is obtained by linear projection, while GSCA gets the key vector $k$ by the feature map’s global average pooling (GAP). It causes GSCA to work differently than the intuition that comes from self-attention. Specifically, GAP is challenging to capture the complex information in the feature maps and misses most of the detailed features (Qin et al., 2021). In contrast to the general features in the global scope represented by GAP, we believe that spatial attention should enhance special features, such as texture details. Intuitively, enhancing special detail features is helpful for visual recognition tasks. Therefore, we use the reverse operation to enhance the specificity features rather than features similar to the $k$ vector generated by GAP.
444
+
445
+ To intuitively discuss the necessity of the reverse operation in the system, the feature map of GSCA module is visualized in Figure 5. Figures 5 (a) and (d) show the inputs of GSCA module in layer 2.3. Both are generally similar, and with the network optimized iteratively, the feature maps have the same attention to the target and the background. Figures 5 (b) and (e) show the attention weights obtained from the cross-correlation calculation in GSCA, which have opposite results. The reverse operation drives GSCA to focus almost on the object itself, while GSCA without reverse focuses almost exclusively on the background region. It proves that the reverse operation directly affects the region of attention of GSCA. Naturally, in Figures 5(c) and (f), the final outputs show that the GSCA without reverse tends to focus on the background. The reversed GSCA drives the network to focus on the object, which is more beneficial for visual tasks.
md/dev/XDJwuEYHhme/XDJwuEYHhme.md ADDED
The diff for this file is too large to render. See raw diff
 
md/dev/YPpSngE-ZU/YPpSngE-ZU.md ADDED
@@ -0,0 +1,351 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MACE: Higher Order Equivariant Message Passing Neural Networks for Fast and Accurate Force Fields
2
+
3
+ # Ilyes Batatia
4
+
5
+ Dávid Péter Kovács Engineering Laboratory, University of Cambridge Cambridge, CB2 1PZ UK
6
+
7
+ Engineering Laboratory,
8
+ University of Cambridge
9
+ Cambridge, CB2 1PZ UK
10
+ Department of Chemistry,
11
+ ENS Paris-Saclay, Université Paris-Saclay
12
+ 91190 Gif-sur-Yvette, France
13
+ ilyes.batatia@ens-paris-saclay.fr
14
+
15
+ Gregor N. C. Simm Engineering Laboratory, University of Cambridge Cambridge, CB2 1PZ UK
16
+
17
+ Christoph Ortner Department of Mathematics University of British Columbia Vancouver, BC, Canada V6T 1Z2
18
+
19
+ Gábor Csányi Engineering Laboratory, University of Cambridge Cambridge, CB2 1PZ UK
20
+
21
+ # Abstract
22
+
23
+ Creating fast and accurate force fields is a long-standing challenge in computational chemistry and materials science. Recently, several equivariant message passing neural networks (MPNNs) have been shown to outperform models built using other approaches in terms of accuracy. However, most MPNNs suffer from high computational cost and poor scalability. We propose that these limitations arise because MPNNs only pass two-body messages leading to a direct relationship between the number of layers and the expressivity of the network. In this work, we introduce MACE, a new equivariant MPNN model that uses higher body order messages. In particular, we show that using four-body messages reduces the required number of message passing iterations to just two, resulting in a fast and highly parallelizable model, reaching or exceeding state-of-the-art accuracy on the rMD17, 3BPA, and AcAc benchmark tasks. We also demonstrate that using higher order messages leads to an improved steepness of the learning curves.
24
+
25
+ # 1 Introduction
26
+
27
+ The earliest approaches for creating force fields (interatomic potentials) using machine learning techniques were using local atom-centered symmetric descriptors and feed-forward neural networks [6], Gaussian Process regression[2] or linear regression [44, 47]. The first attempts to use graph neural networks to model the potential energy of atomistic systems had only limited success. The DTNN [42], SchNet [41], HIP-NN [35], PhysNet [48], or DimeNet [20, 29] approaches could only come close to but not improve upon the atomic descriptor-based methods in terms of computational efficiency and accuracy on public benchmarks. Furthermore, most MPNN interatomic potentials use 2-body invariant messages, making them non-universal approximators [38].
28
+
29
+ The MACE architecture presented here allows for the efficient computation of equivariant messages with high body order. As a result of the increased body order of the messages, only two message passing iterations are necessary to achieve high accuracy - unlike the typical five or six iterations of MPNNs, making it scalable and parallelizable. Finally, our implementation has remarkable computational efficiency, reaching state-of-the-art results on the 3BPA benchmark after 30 mins of training on NVIDIA A100 GPUs.
30
+
31
+ We summarise our main contributions as follows:
32
+
33
+ • We introduce MACE, a novel architecture combining equivariant message passing with efficient many-body messages. The MACE models achieve state-of-the-art performance on challenging benchmark tests. They also display greater generalization capabilities over other approaches on extrapolation benchmarks.
34
+ • We demonstrate that many-body messages change the power of the empirical power-law of the learning curves. Furthermore, we show experimentally that the addition of equivariant messages only shifts the learning curves but does not change the power law when higher order messages are used.
35
+ • We show that MACE does not only outperform previous approaches in terms of accuracy but also does so while being significantly faster to train and evaluate than the previous most accurate models.
36
+
37
+ # 2 Background
38
+
39
+ # 2.1 MPNN Interatomic Potentials
40
+
41
+ MPNNs [22, 9] are a type of graph neural network (GNN, [40, 4, 27, 51]) that parametrises a mapping from a labeled graph to a target space, either a graph or a vector space. When applied to parameterise properties of atomistic structures (materials or molecules), the graph is embedded in 3-dimensional (3D) Euclidean space, where each node represents an atom, and edges connect nodes if the corresponding atoms are within a given distance of each other. We represent the state of each node $i$ in layer $t$ of the MPNN by a tuple
42
+
43
+ $$
44
+ \sigma _ { i } ^ { ( t ) } = ( { r } _ { i } , z _ { i } , { h } _ { i } ^ { ( t ) } ) ,
45
+ $$
46
+
47
+ where $\boldsymbol { r } _ { i } \in \mathbb { R } ^ { 3 }$ is the position of atom $i$ , $z _ { i }$ the chemical element, and ${ h } _ { i } ^ { ( t ) }$ are its learnable features. A forward pass of the network consists of multiple message construction, update, and readout steps. During message construction, a message $m _ { i } ^ { ( t ) }$ is created for each node by pooling over its neighbors:
48
+
49
+ $$
50
+ { \pmb m } _ { i } ^ { ( t ) } = \bigoplus _ { j \in \mathcal { N } ( i ) } { \cal M } _ { t } ( { \pmb \sigma } _ { i } ^ { ( t ) } , { \pmb \sigma } _ { j } ^ { ( t ) } ) ,
51
+ $$
52
+
53
+ where $M _ { t }$ is a learnable message function and $\bigoplus _ { j \in { \mathcal { N } } ( i ) }$ is a learnable, permutation invariant pooling operation over the neighbors of atom $i$ (e.g., a sum). In the update step, the message $m _ { i } ^ { ( t ) }$ is transformed into new features
54
+
55
+ $$
56
+ h _ { i } ^ { ( t + 1 ) } = U _ { t } ( \sigma _ { i } ^ { ( t ) } , m _ { i } ^ { ( t ) } ) ,
57
+ $$
58
+
59
+ where $U _ { t }$ is a learnable update function. After $T$ message construction and update steps, the learnable readout functions $\mathcal { R } _ { t }$ map the node states $\sigma _ { i } ^ { ( t ) }$ to the target, in this case the site energy of atom $i$ ,
60
+
61
+ $$
62
+ E _ { i } = \sum _ { t = 1 } ^ { T } \mathcal { R } _ { t } ( \sigma _ { i } ^ { ( t ) } ) .
63
+ $$
64
+
65
+ # 2.2 Equivariant Graph Neural Networks
66
+
67
+ In equivariant GNNs, internal features ${ h } _ { i } ^ { ( t ) }$ transform in a specified way under some group action [1, 12, 32, 46, 49]. When modelling the potential energy of an atomic structure, the group of interest is
68
+
69
+ $\mathrm { O ( 3 ) }$ , specifying rotations and reflections of the particles.1 We call a GNN O(3) equivariant if it has internal features that transform under the rotation $Q \in { \bf O } ( 3 )$ as
70
+
71
+ $$
72
+ \pmb { h } _ { i } ^ { ( t ) } ( \pmb { Q } \cdot ( \pmb { r } _ { 1 } , . . . , \pmb { r } _ { N } ) ) = D ( \pmb { Q } ) \pmb { h } _ { i } ^ { ( t ) } ( \pmb { r } _ { 1 } , . . . , \pmb { r } _ { N } ) ,
73
+ $$
74
+
75
+ where $Q \cdot ( r _ { 1 } , . . . , r _ { N } )$ denotes the action of the rotation on the set of atomic positions and $D ( Q )$ is a matrix representing the rotation $Q$ , acting on message ${ h } _ { i } ^ { ( t ) }$ . In general, elements of the feature vector can be labeled according to the irreducible representation they transform with. We will write $h _ { i , k L M } ^ { ( t ) }$ to indicate a collection of features on atom $i$ , indexed by $k$ , that transform according to
76
+
77
+ $$
78
+ h _ { i , k L M } ^ { ( t ) } ( Q \cdot ( { \pmb { r } } _ { 1 } , \ldots , { \pmb { r } } _ { N } ) ) = \sum _ { M ^ { \prime } } D _ { M ^ { \prime } M } ^ { L } ( Q ) h _ { i , k L M ^ { \prime } } ^ { ( t ) } ( { \pmb { r } } _ { 1 } , \ldots , { \pmb { r } } _ { N } ) ,
79
+ $$
80
+
81
+ where $D ^ { L } ( Q ) \in \mathbb { R } ^ { ( 2 L + 1 ) \times ( 2 L + 1 ) }$ is a Wigner D-matrix of order $L$ . A feature labelled with $L = 0$ describes an invariant scalar. Features labeled with $L > 0$ , describe equivariant features, formally corresponding to equivariant vectors, matrices or higher order tensors. The features of invariant models, such as SchNet[41] and DimeNet[29], transform according to $D ( Q ) = \mathbb { 1 }$ , the identity matrix. Models such as NequIP [5], equivariant transformer [45], PaiNN [43], or SEGNNs [8], in addition to invariant scalars, employ equivariant internal features that transform like vectors or tensors.
82
+
83
+ # 3 Related Work
84
+
85
+ ACE - Higher Order Local Descriptors In the last few years, there have been two significant breakthroughs in machine learning force fields. First, the Atomic Cluster Expansion (ACE) [16] provided a systematic framework for constructing high body order complete polynomial basis functions (features) at a constant cost per basis function, independent of body order [17]. It has also been shown that ACE includes many previously developed atomic environment representations as special cases, including Atom Centred Symmetry Functions [6], the Smooth Overlap of Atomic Positions (SOAP) descriptor [2], Moment Tensor Potential basis functions [44], and the hyperspherical bispectrum descriptor [2] used by the SNAP model [47]. These local models are limited by their cutoff distance and their relatively rigid architecture compared to the overparametrised MPNNs, leading to somewhat lower accuracy, in particular, for molecular force fields.
86
+
87
+ Equivariant MPNNs The second breakthrough was using equivariant internal features in MPNNs. These equivariant MPNNs, such as Cormorant [1], Tensor Field Networks [46], EGNN [39], PaiNN [43], Equivariant Transformers [45], SEGNN [8], NewtonNet [23], and NequIP [5] were able to achieve higher performance than previous local descriptor-based models. However, they suffer from two significant limitations: first, the most accurate models used $L = 3$ spherical tensors as messages and 4 to 6 message passing iterations [5], which resulted in a relatively high computational cost. Second, using this many iterations significantly increased the receptive field of the network, making them difficult to parallelise across multiple GPUs [36].
88
+
89
+ Higher Order Message Passing Most MPNNs use a message passing scheme based on two-body messages, meaning they simultaneously depend on the states of two atoms. It has been recognised that it can be beneficial to include angles into the features, effectively creating 3-body invariant messages [29]. This idea has also been exploited in other invariant MPNNs, in particular, by SphereNet [34] and GemNet [30]. Even though these models improved the accuracy compared to the 2-body message passing, they were limited by the computational cost associated with explicitly summing over all triplets or quadruplets to compute the higher order features.
90
+
91
+ Multi-ACE Framework Recently, multi-ACE has been proposed as a unifying framework of $E ( 3 )$ -equivariant atom-centered interatomic potentials, extending the ACE framework to include methods built on equivariant MPNNs [3]. A similar unifying theories were also put forward by [37] and [7]. The idea is to parameterise the message $m _ { i } ^ { ( t ) }$ in terms of invariant or equivariant ACE models. This framework sets out a design space in which each model can be characterised in terms of: (1) the number of layers, (2) the body order of the messages, (3) the equivariance (or invariance) of the messages, and (4) the number of features in each layer. The framework highlights the relationship between the overall body order of the models and message passing, also previously discussed in Kondor [31]. Most previously published models achieved high accuracy by either using 4 to 6 layers [5, 43] or increasing the local body order with a single layer [33, 36]. With our model, we fall in between these two extremes by combining high body order with message passing.
92
+
93
+ # 4 The MACE Architecture
94
+
95
+ Our MACE model follows the general framework of MPNNs outlined in Section 2. Our key innovation is a new message construction mechanism. We expand the messages $m _ { i } ^ { ( t ) }$ in a hierarchical body order expansion,
96
+
97
+ $$
98
+ m _ { i } ^ { ( t ) } = \sum _ { j } u _ { 1 } \left( \sigma _ { i } ^ { ( t ) } ; \sigma _ { j } ^ { ( t ) } \right) + \sum _ { j _ { 1 } , j _ { 2 } } u _ { 2 } \left( \sigma _ { i } ^ { ( t ) } ; \sigma _ { j _ { 1 } } ^ { ( t ) } , \sigma _ { j _ { 2 } } ^ { ( t ) } \right) + \cdots + \sum _ { j _ { 1 } , \ldots , j _ { \nu } } u _ { \nu } \left( \sigma _ { i } ^ { ( t ) } ; \sigma _ { j _ { 1 } } ^ { ( t ) } , \ldots , \sigma _ { j _ { \nu } } ^ { ( t ) } \right) ,
99
+ $$
100
+
101
+ where the $\textbf { \em u }$ functions are learnable, the sums run over the neighbors of $i$ , and $\nu$ is a hyper-parameter corresponding to the maximum correlation order, the body order minus 1, of the message function with respect to the states. Even though we refer to the message as $( \nu + 1 )$ -body with respect to the states, the overall body order with respect to the positions can be larger depending on the body order of the states themselves. Crucially, by writing $\sum _ { j _ { 1 } , \dots , j _ { \nu } } ^ { - }$ , which includes self-interaction (e.g., $j _ { 1 } = j _ { 2 }$ ), we will later obtain a tensor product structure with a computationally efficient parameterisation, that allows us to circumvent the seemingly exponential scaling of the computational cost with the correlation order $\nu$ . This contrasts with previous models, such as DimeNet [28, 29], that compute 3-body features via the more standard many-body expansion $\sum _ { j _ { 1 } < \cdots < j _ { \nu } }$ . Below, we describe the MACE architecture in detail. To better understand the architecture, we report in A.4 a table of the introduced tensors along with their shapes.
102
+
103
+ $R _ { k l _ { 1 } l _ { 2 } l _ { 3 } } ^ { ( t ) }$ e Construction At each it, a set of spherical harmonics $Y _ { l _ { 1 } } ^ { m _ { 1 } }$ n, we first embed the edges using a learnable radial basis, and a learnable embedding of the previous node features h(t) $h _ { j , \tilde { k } l _ { 2 } m _ { 2 } } ^ { ( t ) }$ using weights W (t)˜ . The $A _ { i } ^ { ( t ) }$ -features are obtained by pooling over the neighbours $\mathcal { N } ( i )$ to obtain permutation invariant 2-body features whilst, crucially, retaining full directional information, and thus, full information about the atomic environment:
104
+
105
+ $$
106
+ A _ { i , k l _ { 3 } m _ { 3 } } ^ { ( t ) } = \sum _ { l _ { 1 } m _ { 1 } , l _ { 2 } m _ { 2 } } C _ { l _ { 1 } m _ { 1 } , l _ { 2 } m _ { 2 } } ^ { l _ { 3 } m _ { 3 } } \sum _ { j \in \mathcal { N } ( i ) } R _ { k l _ { 1 } l _ { 2 } l _ { 3 } } ^ { ( t ) } ( r _ { j i } ) Y _ { l _ { 1 } } ^ { m _ { 1 } } ( \hat { r } _ { j i } ) \sum _ { \tilde { k } } W _ { k \tilde { k } l _ { 2 } } ^ { ( t ) } h _ { j , \tilde { k } l _ { 2 } m _ { 2 } } ^ { ( t ) } ,
107
+ $$
108
+
109
+ where $C _ { l _ { 1 } m _ { 1 } , l _ { 2 } m _ { 2 } } ^ { l _ { 3 } m _ { 3 } }$ 2 are the standard Clebsch-Gordan coefficients ensuring that A(t)i,kl3 maintain the equivariance, is obtained b $r _ { j i }$ is the (scalar) interatomic distance, and eeding a set of radial features that embed $\hat { \pmb { r } } _ { j i }$ is the correspone radial distance g unit vector.using Bessel $\underset { \circ } { R } _ { k l _ { 1 } l _ { 2 } l _ { 3 } } ^ { ( t ) }$ $r _ { j i }$ functions multiplied by a smooth polynomial cutoff (cf. Ref. [29]) to a multi-layer perceptron (MLP). See Section A.5 for details. In the first layer, the node features ${ h } _ { j } ^ { ( t ) }$ correspond to the (invariant) chemical element $z _ { j }$ . Therefore, (8) can be further simplified:
110
+
111
+ $$
112
+ A _ { i , k l _ { 1 } m _ { 1 } } ^ { ( 1 ) } = \sum _ { j \in \mathcal { N } ( i ) } R _ { k l _ { 1 } } ^ { ( 1 ) } ( r _ { j i } ) Y _ { l _ { 1 } } ^ { m _ { 1 } } ( \hat { \pmb { r } } _ { j i } ) W _ { k z _ { j } } ^ { ( 1 ) } .
113
+ $$
114
+
115
+ This simplified operation is much cheaper, making the computational cost of the first layer low.
116
+
117
+ The key operation of MACE is the efficient construction of higher order features from the $A _ { i } ^ { ( t ) }$ - features. This is achieved by first forming tensor products of the features, and then symmetrising:
118
+
119
+ $$
120
+ \pmb { B } _ { i , \eta _ { \nu } k L M } ^ { ( t ) } = \sum _ { l m } \mathcal { C } _ { \eta _ { \nu } , l m } ^ { L M } \prod _ { \xi = 1 } ^ { \nu } \sum _ { \tilde { k } } w _ { k \tilde { k } l _ { \xi } } ^ { ( t ) } A _ { i , \tilde { k } l _ { \xi } m _ { \xi } } ^ { ( t ) } , l m = ( l _ { 1 } m _ { 1 } , \dots , l _ { \nu } m _ { \nu } )
121
+ $$
122
+
123
+ where the coupling coefficients $\mathcal { C } _ { \eta _ { \nu } } ^ { L M }$ corresponding to the generalised Clebsch-Gordan coefficients (details in A.3) ensuring that B(t)i,η νkLM are L-equivariant, the weights w(k $w _ { k \tilde { k } l _ { \xi } } ^ { ( t ) }$ are mixing the channels $( k )$ of h t $A _ { i } ^ { ( t ) }$ , and 10) ca $\nu$ is a given correlation order. be evaluated efficiently (see A $\mathcal { C } _ { \eta _ { \nu } , l m } ^ { L M }$ is very sparse and can be pre-x A.3.3). The additional index mputedsimply $\eta _ { \nu }$ enumerates all possible couplings of $l _ { 1 } , \ldots , l _ { \nu }$ features that yield the selected equivariance specified by the $L$ index. The $B _ { i } ^ { ( t ) }$ -features are constructed up to some maximum $\nu$ . This variable in (10) is the order of the tensor product, and hence, can be identified as the order of the many-body expansion terms in (7). The computationally expensive multi-dimensional sums over all triplets, quadruplets, etc., are thus circumvented and absorbed into (9) and (8).
124
+
125
+ $m _ { i } ^ { ( t ) }$
126
+
127
+ $$
128
+ m _ { i , k L M } ^ { ( t ) } = \sum _ { \nu } \sum _ { \eta _ { \nu } } W _ { z _ { i } k L , \eta _ { \nu } } ^ { ( t ) } B _ { i , \eta _ { \nu } k L M } ^ { ( t ) } ,
129
+ $$
130
+
131
+ where W (t)z kL is a learnable weight matrix that depends on the chemical element $z _ { i }$ of the receiving atom and messcombination of etry feat $L$ . Thus, we implicitly construct each term es of the corresponding body order. $\textbf { \em u }$ in (7) by a linear $B _ { i , \eta _ { \nu } k L M } ^ { ( t ) }$
132
+
133
+ Under mild conditions on the two-body bases A(t)i , the higher order features B(t)i,η $B _ { i , \eta _ { \nu } k L M } ^ { ( t ) }$ νkLM can be interpreted as a complete basis of many-body interactions [17], which can be computed at a cost comparable to pairwise interactions. Because of this, the expansion (11) is systematic. It can in principle be converged to represent any smooth $( \nu + 1 )$ -body equivariant mapping in the limit of infinitely many features (proof in [17]).
134
+
135
+ Update In MACE, the update is a linear function of the message and the residual connection [25]:
136
+
137
+ $$
138
+ h _ { i , k L M } ^ { ( t + 1 ) } = U _ { t } ^ { k L } ( \sigma _ { i } ^ { ( t ) } , { m } _ { i } ^ { ( t ) } ) = \sum _ { \tilde { k } } W _ { k L , \tilde { k } } ^ { ( t ) } m _ { i , \tilde { k } L M } + \sum _ { \tilde { k } } W _ { z _ { i } k L , \tilde { k } } ^ { ( t ) } h _ { i , \tilde { k } L M } ^ { ( t ) } .
139
+ $$
140
+
141
+ Readout In the readout phase, the invariant part of the node features is mapped to a hierarchical decomposition of site energies via readout functions:
142
+
143
+ $$
144
+ \begin{array} { r } { \boldsymbol { E _ { i } } = \boldsymbol { E _ { i } ^ { ( 0 ) } } + \boldsymbol { E _ { i } ^ { ( 1 ) } } + \ldots + \boldsymbol { E _ { i } ^ { ( T ) } } , \qquad \mathrm { w h e r e } \qquad } \\ { \boldsymbol { E _ { i } ^ { ( t ) } } = \mathcal { R } _ { t } \left( \boldsymbol { h _ { i } ^ { ( t ) } } \right) = \left\{ \begin{array} { l l } { \sum _ { \tilde { k } } W _ { \mathrm { r e a d o u t } , \tilde { k } } ^ { ( t ) } h _ { i , \tilde { k } 0 0 } ^ { ( t ) } } & { \mathrm { i f } t < T } \\ { \qquad \operatorname { M L P } _ { \mathrm { r e a d o u t } } ^ { ( t ) } \left( \left\{ h _ { i , k 0 0 } ^ { ( t ) } \right\} _ { k } \right) } & { \mathrm { i f } t = T } \end{array} \right. } \end{array}
145
+ $$
146
+
147
+ The readout only depends on the invariant features $h _ { i , k 0 0 } ^ { ( t ) }$ to ensure that the site energy contributions $E _ { i } ^ { ( t ) }$ are invariant as well. To maintain body ordering, we use linear readout functions for all layers except the last, where we use a one-layer MLP.
148
+
149
+ # 5 Results
150
+
151
+ # 5.1 Effect of Higher Order Messages
152
+
153
+ Number of Layers In this section, we investigate the effect of using higher order messages. Many MPNN architectures [41, 48] exclusively pass two-body invariant messages resulting in an incomplete representation of the local environment [38]. Equivariant message-passing schemes [5, 43, 8] lift the degeneracy of most structures by containing directional information in the messages. MPNNs that only employ two-body messages at each layer can increase the body order either by stacking layers [31] which simultaneously increases the model’s receptive field or by using non-linear activation functions, generate only a subset of all possible higher order features. By constructing higher order messages using the MACE architecture, we disentangle the increase in body order from the increase of the receptive field.
154
+
155
+ In Figure 1, we show the accuracy of MACE, NequIP, and BOTNet [3] on the 3BPA benchmark [33] as a function of the number of message passing layers. Approaches employing 2-body message passing require up to five iterations for their accuracy to converge. By constructing many body messages, the number of required layers to converge in accuracy reduces to just two. In all subsequent experiments, we use two-layer MACE models.
156
+
157
+ Furthermore, we compare BOTNet, which does not use any non-linearities in the update step to NequIP, which does. Otherwise, the two models are very similar. We observe that the increase in body order through non-linearities within the update provides only marginal improvement, highlighting the difference between an increase in body order through non-linearities (NequIP) and higher order symmetric messages (MACE). Consequently, higher order message passing allows one to reduce the number of layers, thereby increasing speed and ease of parallelization over multiple GPUs. We note that MACE does not improve after two layers as the diameter of the 3BPA molecule is about $9 \mathring { \mathrm { A } }$ and radial cutoff in each layer is $5 \textup { \AA }$ .
158
+
159
+ ![](images/32e035f5e8d757a448412d015607f2e4777b03db5b47506bd442a3b45a5d5fb0.jpg)
160
+ Figure 1: Energy and force errors of BOTNet, NequIP, and MACE $\left( L = 2 \right.$ ) on the 3BPA dataset at different temperatures as a function of the number of layers.
161
+
162
+ Learning Curves We study how higher order message passing affects the learning curves. A recent study of the NequIP model [5] showed that the inclusion of equivariant features results in enhanced data efficiency, increasing the slope of the log-log plot of predictive error as a function of the dataset size. They showed that adding equivariance not only shifts the learning curves, but also changes the powers in the empirical power law of the learning curves, which is usually constant for a given dataset [26].
163
+
164
+ On the left panel of Figure 2, we replicate the experiments of [5] by training a series of invariant MACE models with increasing correlation order $\nu$ on the aspirin molecule from the rMD17 dataset. We observe that adding higher order messages changes the steepness of the learning curves, even without equivariant messages. The model with correlation order $\nu = 1$ corresponds to a two-layer 2-body invariant model, similar to SchNet. This model is the least accurate due to the incomplete nature of 2-body invariant representations of the local environment [38]. The invariant messages with $\nu = 2$ are akin to those in DimeNet, which explicitly puts angular information into the messages. We see that including higher order information significantly improves the model’s accuracy. Finally, by going beyond any current message passing potential by setting $\nu = 3$ , we achieve similar performance to a highly-accurate 2-body, equivariant MPNN while only using higher order invariant messages.
165
+
166
+ On the middle panel of Figure 2, we keep the correlation order fixed at $\nu = 3$ and gradually increase the symmetry order $L$ of the messages. While the slope remains nearly unchanged, the curves are shifted. In the right panel of Figure 2, we keep the correlation order fixed at $\nu = 1$ and gradually increase the symmetry order $L$ of the messages. We see only a marginal slope change when adding equivariant features, which could be attributable to the relatively low expressiveness of a two-layer MACE restricted to correlation order $\nu = 1$ . These results suggest two routes to improve invariant 2-body MPNN models: creating higher correlation order messages or incorporating equivariant messages. By exploiting both of these options, the MACE model achieves state-of-the-art accuracy.
167
+
168
+ # 5.2 Scaling and Computational Cost
169
+
170
+ Chemical Elements A significant limitation of existing atomic environment representations is that their size grows with the number of chemical elements $S$ and correlation order $\nu$ as $S ^ { \nu }$ . Data-driven compression schemes have been proposed [50] to solve this issue, and MPNNs incorporate similar embeddings of the chemical elements into a fixed-size vector space. MACE uses a continuous species embedding and when constructing the higher order features in (10), it does not include the species dimension $k$ in the tensor product resulting in $\mathcal { O } ( 1 )$ scaling of the model with the number of chemical elements $S$ .
171
+
172
+ ![](images/5cfe770ab17926ef3929980c906315d8d38acc8eb27da71bc3d45a837193e681.jpg)
173
+ Figure 2: Learning curve of force errors (MAE in $\mathrm { e V } / \mathrm { \mathring A } )$ for aspirin from the rMD17 dataset for different models. Left: Two layers of invariant $ { \boldsymbol { L } } = 0$ ) MACE with increasing body order $\nu \in \{ 1 , 2 , 3 \}$ . Center: Two layers of MACE with $\nu = 3$ and increasing equivariance $\bar { L } \in \{ \mathrm { { 0 } , 1 , 2 } \}$ . Right: Two layers of MACE with $\nu = 1$ and increasing equivariance $\bar { L \in \{ 0 , 1 , 2 \} }$ . In each case the slope (s) is indicated.
174
+
175
+ Receptive Field A severe limitation of many previously published MPNNs was their large receptive field, making it difficult to parallelize the evaluation across multiple GPUs. In traditional MPNNs, the total receptive field of each node, which grows with each message passing iteration, can be up to $3 0 \textup { \AA }$ . This scaling results in the number of neighbours being in the thousands in a condensed phase simulation, preventing any efficient parallelization [36]. By decoupling the increase in correlation order of the messages from the number of message passing iterations, MACE only requires two layers resulting in a much smaller receptive field. With a local radial cutoff of 4 to $5 \textup { \AA }$ , the overall receptive field remains small, making the model more parallelisable.
176
+
177
+ Computational Cost The computational bottleneck of equivariant MPNNs is the equivariant tensor product (8). This tensor product is evaluated on edges. In MACE, we only evaluate this expensive tensor product once, within the second layer, and build up correlations through the tensor product of (10). Importantly, this operation is carried out on nodes. Typically the number of nodes is orders of magnitudes smaller than the number of edges resulting in a computational advantage. In addition, we developed a loop tensor contraction algorithm for the efficient implementation of (10) and (11) detailed in Section A.3.
178
+
179
+ We report evaluation times for BOTNet, NequIP, and multiple versions of MACE in Table 2. We observe that the invariant MACE $L = 0$ ) is close to 10 times faster than BOTNet and NequIP while achieving similar accuracy at high temperatures. MACE with $L = 1$ and $L = 2$ is 5 and 4 times faster than BOTNet and NequIP, respectively, while outperforming them at every temperature. We acknowledge that accurate speed comparisons between codes are hard to obtain, and further investigations need to be carried out. It is also essential to consider training times. In order to do a fair comparison, all the timings were realised using the mace code that implements all the above models. Models that are significantly faster to train are better suited for applications of active learning, which is typically how databases for materials science applications are built [13–15]. The MACE model reported in Table 2 takes approximately 30 mins to reach the accuracy of a converged BOTNet model, taking more than a day to be trained on the 3BPA dataset using NVIDIA A100 GPUs.
180
+
181
+ # 5.3 Benchmark Results 2
182
+
183
+ # 5.3.1 rMD17: Molecular Dynamics Trajectory
184
+
185
+ The revised MD17 (rMD17) dataset contains train test splits randomly selected from a long molecular dynamics trajectory of ten small organic molecules [11]. For each molecule, the splits consist of 1000 training and test configurations. Table 1 shows that MACE achieves excellent accuracy, improving the state of the art for some molecules, particularly those with the highest errors. As several methods achieve similar accuracy on the standard task of predicting energies and forces based on the whole training set, we also trained MACE and NequIP, another accurate model, on just 50 configurations to increase the difficulty of the benchmark. In this case, we found that MACE outperformed NequIP for most molecules.
186
+
187
+ Table 1: Mean absolute errors on the rMD17 dataset [11]. Energy (E, meV) and force (F, meV/Å) errors of different models trained on 950 configurations and validated on 50. The models on the right of the first vertical line, DimeNet and NewtonNet, were trained on the original MD17 dataset [10]. The models on the right of the second (double) vertical line were trained on just 50 configurations.
188
+
189
+ <table><tr><td>MACEAllegro [36]BOTNet [3]NequIP [5]</td><td></td><td></td><td></td><td></td><td>GemNet (T/Q) [30]ACE [33]</td><td></td><td></td><td>FCHL [18]GAP [2]ANI [19]</td><td></td><td></td><td></td><td></td><td></td><td>PaiNN [43]| DimeNet [29]NewtonNet [24] || ACE [33]NequIP [5]MACE</td><td></td></tr><tr><td></td><td></td><td>粥</td><td></td><td></td><td></td><td>Ntrain = 1000</td><td></td><td></td><td></td><td></td><td></td><td></td><td>II</td><td>Ntan = 50</td><td></td></tr><tr><td>Aspirin</td><td>2</td><td></td><td>2</td><td>2</td><td>95</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>2</td><td></td></tr><tr><td></td><td>1</td><td></td><td></td><td></td><td></td><td>9</td><td>209</td><td>1</td><td>166</td><td></td><td>28</td><td>1</td><td></td><td>15</td><td>1</td></tr><tr><td>Azobenzene</td><td>1</td><td></td><td></td><td></td><td></td><td>6</td><td></td><td>2</td><td>15</td><td></td><td>:</td><td>5</td><td>28</td><td>200</td><td>品</td></tr><tr><td></td><td>3</td><td></td><td>33</td><td>2</td><td></td><td></td><td>1</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td></td><td>1 0</td><td></td><td>0.03</td><td></td><td></td><td></td><td></td><td></td><td></td><td>·</td><td></td><td>·</td><td></td><td></td><td></td></tr><tr><td>Benzene</td><td></td><td></td><td>0.3</td><td>00</td><td>0.5</td><td></td><td>0</td><td></td><td>10</td><td>-</td><td>3</td><td>:</td><td>2</td><td>2</td><td>2</td></tr><tr><td></td><td></td><td></td><td>3</td><td>2</td><td>3.6</td><td>5</td><td>68</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Ethanol</td><td>F</td><td>2</td><td></td><td></td><td></td><td></td><td></td><td>3</td><td>1</td><td>20</td><td>28</td><td>3</td><td>8</td><td>480</td><td>3</td></tr><tr><td></td><td>EF</td><td>48</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>123</td><td></td></tr><tr><td>Malonaldehyde</td><td></td><td></td><td>8</td><td>8</td><td>66</td><td>品</td><td>13</td><td>4</td><td>4</td><td>38</td><td>16</td><td>4</td><td>18</td><td></td><td>电</td></tr><tr><td></td><td>0.5</td><td></td><td>0.2</td><td>1</td><td>-</td><td>0.9</td><td>品</td><td>3.8</td><td></td><td></td><td>5.3</td><td>3</td><td>8</td><td>2</td><td></td></tr><tr><td>Naphthalene</td><td>F 1.6</td><td></td><td>1.8</td><td></td><td>1.9</td><td>5.1</td><td></td><td>16.5</td><td>2</td><td>3</td><td>9.3</td><td></td><td></td><td></td><td>2</td></tr><tr><td></td><td></td><td></td><td></td><td></td><td></td><td>1</td><td>12</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Paracetamol</td><td>1</td><td>1</td><td>5</td><td></td><td></td><td></td><td></td><td>28</td><td>30</td><td></td><td>:</td><td>1</td><td>1</td><td>13</td><td>品</td></tr><tr><td></td><td></td><td>0.9</td><td>0.8</td><td>0.7</td><td></td><td></td><td></td><td>26</td><td>29</td><td>4.9</td><td>5.8</td><td>3</td><td>8.9</td><td>8.0</td><td>6.5</td></tr><tr><td>Salicylic acid</td><td>EF</td><td>3.1</td><td>4.3</td><td>4.0</td><td>53</td><td>18</td><td>8</td><td></td><td></td><td>9.1</td><td>16.2</td><td></td><td>41.7</td><td>35.0</td><td>28.4</td></tr><tr><td></td><td></td><td></td><td></td><td>1</td><td>22</td><td>8</td><td>1</td><td>1</td><td></td><td></td><td>4</td><td>3</td><td></td><td></td><td></td></tr><tr><td>Toluene</td><td>1</td><td>1</td><td></td><td></td><td></td><td></td><td></td><td></td><td>23</td><td>4</td><td></td><td></td><td>2</td><td></td><td>三</td></tr><tr><td></td><td>F</td><td>2</td><td>3</td><td></td><td></td><td></td><td></td><td>1</td><td>214</td><td>6</td><td>15</td><td></td><td></td><td>7</td><td>2</td></tr><tr><td>Uracil</td><td></td><td></td><td></td><td></td><td></td><td></td><td>2</td><td></td><td></td><td></td><td></td><td>4</td><td>62</td><td></td><td></td></tr><tr><td></td><td></td><td></td><td></td><td>3</td><td>38</td><td>8</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
190
+
191
+ # 5.3.2 3BPA: Extrapolation to Out-of-domain Data
192
+
193
+ The 3BPA dataset introduced in [33] tests a model’s extrapolation capabilities. Its training set contains 500 geometries sampled from $3 0 0 \mathrm { K }$ molecular dynamics simulation of the large and flexible drug-like molecule 3-(benzyloxy)pyridin-2-amine. The three test sets contain geometries sampled at $3 0 0 \mathrm { K }$ , $6 0 0 \mathrm { K }$ , and $1 2 0 0 \mathrm { K }$ to assess in- and out-of-domain accuracy. A fourth test set consists of optimized geometries, where two of the molecule’s dihedral angles are fixed, and a third is varied between 0 and 360 degrees resulting in so-called dihedral slices through regions of the PES far away from the training data.
194
+
195
+ The root-mean-squared errors (RMSE) on energies and forces for several models are shown in Table 2. It can be seen that MACE outperforms the other models on all tasks. In particular, when extrapolating to $1 2 0 0 \mathrm { K }$ data, MACE with $L = 2$ outperforms NequIP and Allegro models by about $3 0 \%$ . Further, MACE with $L = 2$ outperforms the next best model, BOTNet, by $4 0 \%$ on energies for the dihedral slices. Finally, the MACE model with invariant messages $L = 0$ ) often nearly matches or exceeds the performance of competitive equivariant models.
196
+
197
+ Table 2: Root-mean-square errors on the 3BPA dataset. Energy $\mathrm { ( E , m e V ) }$ and force $( \mathrm { F } , \mathrm { m e V } / \mathring { \mathrm { A } } )$ ) errors of models trained and tested on configurations collected at $3 0 0 ~ \mathrm { K }$ of the flexible drug-like molecule 3-(benzyloxy)pyridin-2-amine (3BPA). Standard deviations are computed over three runs and shown in brackets if available. In order to facilitate measuring the efficiency of architectures we implemented the NequIP and BOTNet architectures in the same code that we used for MACE and which is published together with this paper. For the precise specification of our NequIP implementation see the Appendix A.5.2. All PyTorch timings were realised on an NVIDIA A100 GPU custom implementations.
198
+
199
+ <table><tr><td></td><td>Allegro (L=3)</td><td></td><td>NequIP (L=3)</td><td>NequIP (L=3)</td><td>BOTNet (L=3)</td><td>MACE (L=0)</td><td>MACE (L=1)</td><td>MACE(L=2)</td></tr><tr><td>Code</td><td></td><td>allegro [36]</td><td>nequip [5]</td><td>mace</td><td>mace</td><td>mace</td><td>mace</td><td>mace</td></tr><tr><td rowspan="2">300K</td><td>F</td><td>3.84 (0.08)</td><td>3.3 (0.1)</td><td>3.1 (0.1)</td><td>3.1 (0.13)</td><td>4.5 (0.25)</td><td>3.4 (0.2)</td><td>3.0 (0.2)</td></tr><tr><td></td><td>12.98 (0.17)</td><td>10.8 (0.2)</td><td>11.3 (0.2)</td><td>11.0 (0.14)</td><td>14.6 (0.5)</td><td>10.3 (0.3)</td><td>8.8 (0.3)</td></tr><tr><td rowspan="2">600 K</td><td>F</td><td>12.07 (0.45)</td><td>11.2 (0.1)</td><td>11.3 (0.31)</td><td>11.5 (0.6)</td><td>13.7 (0.16)</td><td>9.9 (0.8)</td><td>9.7 (0.5)</td></tr><tr><td></td><td>29.17(0.22)</td><td>26.4 (0.1)</td><td>27.3 (0.3)</td><td>26.7 (0.29)</td><td>33.3 (1.35)</td><td>24.6 (1.1)</td><td>21.8 (0.6)</td></tr><tr><td rowspan="2">1200K</td><td>E</td><td>42.57 (1.46)</td><td>38.5 (1.6)</td><td>40.8 (1.3)</td><td>39.1 (1.1)</td><td>37.1 (0.8)</td><td>31.7 (0.5)</td><td>29.8 (1.0)</td></tr><tr><td>F</td><td>82.96 (1.77)</td><td>76.2 (1.1)</td><td>86.4 (1.5)</td><td>81.1 (1.5)</td><td>81.6 (3.89)</td><td>67.8 (1.8)</td><td>62.0 (0.7)</td></tr><tr><td rowspan="2">Dihedral Slices</td><td>F</td><td>-</td><td>-</td><td>23.2</td><td>16.3 (1.5)</td><td>12.3 (0.8)</td><td>11.5 (0.6)</td><td>7.8 (0.6)</td></tr><tr><td></td><td>-</td><td>-</td><td>23.1</td><td>20.0 (1.2)</td><td>26.1 (2.8)</td><td>19.3 (0.6)</td><td>16.5 (1.7)</td></tr><tr><td>Time latency[ms]</td><td></td><td>-</td><td>-</td><td>103.5</td><td>101.2</td><td>10.5</td><td>17.5</td><td>24.3</td></tr></table>
200
+
201
+ MACE shows excellent results while also featuring low computational cost compared to many other models. The $L = 0$ model, which approaches previous models in terms of accuracy, outpaces them by nearly a factor of 10, whereas the $L = 2$ model achieves state-of-the-art accuracy and is around four times faster than other equivariant MPNN models. In the table, we characterise the evaluation speed of the models by reporting the “latency” which is defined as the time it takes to compute forces on a structure, which is typically independent of the number of atoms until GPU threads are filled (typically 10,000 atoms for these models on an Nvidia A100 80GB GPU).
202
+
203
+ In Figure 3, we compare the BOTNet, NequIP, and MACE $L = 2$ ) by inspecting their energy profile for three dihedral slices. Overall, it can be seen that all models produce smooth energy profiles and that, in general, MACE comes closest to the ground truth. The fact that MACE outperforms the other methods in the middle panel, which contains geometries furthest from the training dataset [3], suggests superior extrapolation capabilities.
204
+
205
+ ![](images/bb1447c1ca57dff1bf207dcf9d01a905155d291e4c41304a76b56f74f69043c7.jpg)
206
+ Figure 3: Energy predictions on three cuts through the potential energy surface of the 3- (benzyloxy)pyridin-2-amine (3BPA) molecule by BOTNet, NequIP, and MACE $( L = 2$ ). The ground-truth energy (DFT) is shown in black. For each cut, the curves have been shifted vertically so that the lowest ground-truth energy is zero.
207
+
208
+ # 5.3.3 AcAc: Flexibility and Reactivity
209
+
210
+ A similar benchmark dataset assessing a model’s extrapolation capabilities to higher temperatures, bond breaking, and bond torsions of the acetylacetone molecule was proposed in [3]. In Table 3, we show that MACE achieves state-of-the-art results on this dataset as well. For details, see Appendix 5.3.3.
211
+
212
+ Table 3: Root-mean-square errors on the acetylacetone dataset. Energy $\mathrm { ( E , m e V ) }$ and force (F, $\mathrm { m e V } / { \mathring { \mathrm { A } } } )$ errors of models trained on configurations of the acetylacetone molecule sampled at $3 0 0 \mathrm { K }$ and tested on configurations sampled at $3 0 0 \mathrm { K }$ and $6 0 0 \mathrm { K }$ . Standard deviations are computed over three runs.
213
+
214
+ <table><tr><td></td><td></td><td>BOTNet</td><td>NequIP</td><td>MACE</td></tr><tr><td rowspan="2">300K</td><td>E</td><td>0.89 (0.0)</td><td>0.81 (0.04)</td><td>0.9 (0.03)</td></tr><tr><td>F</td><td>6.3 (0.0)</td><td>5.90 (0.38)</td><td>5.1 (0.10)</td></tr><tr><td rowspan="2">600K</td><td>E</td><td>6.2 (1.1)</td><td>6.04 (1.26)</td><td>4.6 (0.3)</td></tr><tr><td>F</td><td>29.8 (1.0)</td><td>27.8 (3.29)</td><td>22.4 (0.9)</td></tr><tr><td>N°Parameters</td><td></td><td>2,756,416</td><td>3,190,488</td><td>2,803,984</td></tr></table>
215
+
216
+ # 6 Discussions
217
+
218
+ With MACE, we extend traditional (equivariant) MPNNs from 2-body to many-body message passing in a computationally efficient manner. Our experiments show that the approach reduces the required number of message passing, leading to efficient and parallelizable models. Furthermore, we have demonstrated the high accuracy and good extrapolation capabilities of MACE, reaching state-of-theart accuracy on the rMD17, 3BPA, and AcAc benchmarks. Future development should concentrate on testing MACE on larger systems, including condensed phases and solids.
219
+
220
+ # 7 Reproducibility Statements
221
+
222
+ We have included error bars via different seeds and various ablation studies wherever necessary and appropriate. We have stated all hyper-parameters and data description in the Appendix A.5. Source code is available at https://github.com/ACEsuit/mace.
223
+
224
+ # 8 Ethical Statements
225
+
226
+ The societal impact of MACE is challenging to predict. However, better force fields have a positive impact on society by speeding up drug discovery and through helping to understand, control, and design new materials. However, machine learning force fields rely on generating ab initio training data leading to heavy computation and large energy consumption. Machine learned force fields do alleviate the costs of doing molecular modelling significantly when compared with using solely ab initio methods.
227
+
228
+ # Acknowledgments and Disclosure of Funding
229
+
230
+ # 9 Acknowledgement
231
+
232
+ The authors acknowledge useful discussions with Simon Batzner, Albert Musaelian and William Baldwin. This work was performed using resources provided by the Cambridge Service for Data Driven Discovery (CSD3) operated by the University of Cambridge Research Computing Service (www.csd3.cam.ac.uk), provided by Dell EMC and Intel using Tier-2 funding from the Engineering and Physical Sciences Research Council (capital grant EP/T022159/1), and DiRAC funding from the Science and Technology Facilities Council (www.dirac.ac.uk). DPK acknowledges support from AstraZeneca and the Engineering and Physical Sciences Research Council. CO is supported by Leverhulme Research Project Grant RPG-2017-191 and by the Natural Sciences and Engineering Research Council of Canada (NSERC) [funding reference number IDGR019381].
233
+
234
+ # References
235
+
236
+ [1] Brandon Anderson, Truong Son Hy, and Risi Kondor. Cormorant: Covariant molecular neural networks. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alché-Buc, E. Fox, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/paper/2019/ file/03573b32b2746e6e8ca98b9123f2249b-Paper.pdf.
237
+ [2] Albert P Bartók, Mike C Payne, Risi Kondor, and Gábor Csányi. Gaussian approximation potentials: the accuracy of quantum mechanics, without the electrons. Phys. Rev. Lett., 104(13): 136403, April 2010.
238
+ [3] Ilyes Batatia, Simon Batzner, Dávid Péter Kovács, Albert Musaelian, Gregor N. C. Simm, Ralf Drautz, Christoph Ortner, Boris Kozinsky, and Gábor Csányi. The design space of E(3)- equivariant atom-centered interatomic potentials, 2022. URL https://arxiv.org/abs/ 2205.06643.
239
+ [4] Peter W. Battaglia, Jessica B. Hamrick, Victor Bapst, Alvaro Sanchez-Gonzalez, Vinícius Flores Zambaldi, Mateusz Malinowski, Andrea Tacchetti, David Raposo, Adam Santoro, Ryan Faulkner, Çaglar Gülçehre, H. Francis Song, Andrew J. Ballard, Justin Gilmer, George E. Dahl, Ashish Vaswani, Kelsey R. Allen, Charles Nash, Victoria Langston, Chris Dyer, Nicolas Heess, Daan Wierstra, Pushmeet Kohli, Matthew M. Botvinick, Oriol Vinyals, Yujia Li, and Razvan Pascanu. Relational inductive biases, deep learning, and graph networks. CoRR, abs/1806.01261, 2018. URL http://arxiv.org/abs/1806.01261.
240
+
241
+ [5] Simon Batzner, Albert Musaelian, Lixin Sun, Mario Geiger, Jonathan P. Mailoa, Mordechai Kornbluth, Nicola Molinari, Tess E. Smidt, and Boris Kozinsky. E(3)-equivariant graph neural networks for data-efficient and accurate interatomic potentials. Nature Communications, 13(1): 2453, 2022.
242
+
243
+ [6] Jörg Behler and Michele Parrinello. Generalized neural-network representation of highdimensional potential-energy surfaces. Phys. Rev. Lett., 98:146401, Apr 2007. doi: 10.1103/ PhysRevLett.98.146401. URL https://link.aps.org/doi/10.1103/PhysRevLett.98. 146401.
244
+
245
+ [7] Anton Bochkarev, Yury Lysogorskiy, Christoph Ortner, Gábor Csányi, and Ralf Drautz. Multilayer atomic cluster expansion for semi-local interactions, 2022. URL https://arxiv.org/ abs/2205.08177.
246
+
247
+ [8] Johannes Brandstetter, Rob Hesselink, Elise van der Pol, Erik J Bekkers, and Max Welling. Geometric and physical quantities improve e(3) equivariant message passing, 2021. URL https://arxiv.org/abs/2110.02905.
248
+
249
+ [9] Michael M. Bronstein, Joan Bruna, Taco Cohen, and Petar Velickovi ˇ c. Geometric deep learning: ´ Grids, groups, graphs, geodesics, and gauges, 2021. URL https://arxiv.org/abs/2104. 13478.
250
+
251
+ [10] Stefan Chmiela, Alexandre Tkatchenko, Huziel E Sauceda, Igor Poltavsky, Kristof T Schütt, and Klaus-Robert Müller. Machine learning of accurate energy-conserving molecular force fields. Science advances, 3(5):e1603015, 2017.
252
+
253
+ [11] Anders S. Christensen and O. Anatole von Lilienfeld. On the role of gradients for machine learning of molecular energies and forces. Machine Learning: Science and Technology, 1, 2020. ISSN 23318422. doi: 10.1088/2632-2153/abba6f.
254
+
255
+ [12] Taco S. Cohen and Max Welling. Group equivariant convolutional networks, 2016. URL https://arxiv.org/abs/1602.07576.
256
+
257
+ [13] Volker L Deringer, Chris J Pickard, and Gábor Csányi. Data-driven learning of total and local energies in elemental boron. Physical review letters, 120(15):156001, 2018.
258
+
259
+ [14] Volker L Deringer, Miguel A Caro, and Gábor Csányi. A general-purpose machine-learning force field for bulk and nanostructured phosphorus. Nature communications, 11(1):1–11, 2020.
260
+
261
+ [15] Volker L Deringer, Albert P Bartók, Noam Bernstein, David M Wilkins, Michele Ceriotti, and Gábor Csányi. Gaussian process regression for materials and molecules. Chemical Reviews, 121(16):10073–10141, 2021.
262
+
263
+ [16] Ralf Drautz. Atomic cluster expansion for accurate and transferable interatomic potentials. Phys. Rev. B Condens. Matter, 99(1):014104, January 2019.
264
+
265
+ [17] Genevieve Dusson, Markus Bachmayr, Gabor Csanyi, Ralf Drautz, Simon Etter, Cas van der Oord, and Christoph Ortner. Atomic cluster expansion: Completeness, efficiency and stability. Journal of Computational Physics, page 110946, 2022.
266
+
267
+ [18] Felix A. Faber, Anders S. Christensen, Bing Huang, and O. Anatole von Lilienfeld. Alchemical and structural distribution based representation for universal quantum machine learning. The Journal of Chemical Physics, 148(24):241717, 2018. doi: 10.1063/1.5020710. URL https: //doi.org/10.1063/1.5020710.
268
+
269
+ [19] Xiang Gao, Farhad Ramezanghorbani, Olexandr Isayev, Justin S. Smith, and Adrian E. Roitberg. Torchani: A free and open source pytorch-based deep learning implementation of the ani neural network potentials. Journal of Chemical Information and Modeling, 60(7):3408–3415, 2020. doi: 10.1021/acs.jcim.0c00451. URL https://doi.org/10.1021/acs.jcim.0c00451. PMID: 32568524.
270
+
271
+ [20] Johannes Gasteiger, Shankari Giri, Johannes T. Margraf, and Stephan Günnemann. Fast and uncertainty-aware directional message passing for non-equilibrium molecules, 2020. URL https://arxiv.org/abs/2011.14115.
272
+
273
+ [21] Mario Geiger and Tess Smidt. e3nn: Euclidean neural networks, 2022. URL https://arxiv. org/abs/2207.09453.
274
+ [22] Justin Gilmer, Samuel S. Schoenholz, Patrick F. Riley, Oriol Vinyals, and George E. Dahl. Neural message passing for quantum chemistry, 2017. URL https://arxiv.org/abs/1704.01212.
275
+ [23] Mojtaba Haghighatlari, Jie Li, Xingyi Guan, Oufan Zhang, Akshaya Das, Christopher J. Stein, Farnaz Heidar-Zadeh, Meili Liu, Martin Head-Gordon, Luke Bertels, Hongxia Hao, Itai Leven, and Teresa Head-Gordon. Newtonnet: A newtonian message passing network for deep learning of interatomic potentials and forces, 2021. URL https://arxiv.org/abs/2108.02913.
276
+ [24] Mojtaba Haghighatlari, Jie Li, Xingyi Guan, Oufan Zhang, Akshaya Das, Christopher J. Stein, Farnaz Heidar-Zadeh, Meili Liu, Martin Head-Gordon, Luke Bertels, Hongxia Hao, Itai Leven, and Teresa Head-Gordon. Newtonnet: A newtonian message passing network for deep learning of interatomic potentials and forces, 2021.
277
+ [25] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition, 2015.
278
+ [26] Joel Hestness, Sharan Narang, Newsha Ardalani, Gregory Diamos, Heewoo Jun, Hassan Kianinejad, Md. Mostofa Ali Patwary, Yang Yang, and Yanqi Zhou. Deep learning scaling is predictable, empirically, 2017. URL https://arxiv.org/abs/1712.00409.
279
+ [27] Thomas N. Kipf and Max Welling. Semi-supervised classification with graph convolutional networks, 2016. URL https://arxiv.org/abs/1609.02907.
280
+ [28] Johannes Klicpera, Shankari Giri, Johannes T. Margraf, and Stephan Günnemann. Fast and uncertainty-aware directional message passing for non-equilibrium molecules. CoRR, abs/2011.14115, 2020. URL https://arxiv.org/abs/2011.14115.
281
+ [29] Johannes Klicpera, Janek Groß, and Stephan Günnemann. Directional message passing for molecular graphs, 2020.
282
+ [30] Johannes Klicpera, Florian Becker, and Stephan Günnemann. Gemnet: Universal directional graph neural networks for molecules. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021. URL https: //openreview.net/forum?id=HS_sOaxS9K-.
283
+ [31] Risi Kondor. N-body networks: a covariant hierarchical neural network architecture for learning atomic potentials. arXiv preprint arXiv:1803.01588, 2018.
284
+ [32] Risi Kondor and Shubhendu Trivedi. On the generalization of equivariance and convolution in neural networks to the action of compact groups, 2018. URL https://arxiv.org/abs/ 1802.03690.
285
+ [33] Dávid Péter Kovács, Cas van der Oord, Jiri Kucera, Alice E. A. Allen, Daniel J. Cole, Christoph Ortner, and Gábor Csányi. Linear atomic cluster expansion force fields for organic molecules: Beyond rmse. Journal of Chemical Theory and Computation, 17(12):7696–7711, 2021. doi: 10.1021/acs.jctc.1c00647. URL https://doi.org/10.1021/acs.jctc.1c00647. PMID: 34735161.
286
+ [34] Yi Liu, Limei Wang, Meng Liu, Xuan Zhang, Bora Oztekin, and Shuiwang Ji. Spherical message passing for 3d graph networks, 2021. URL https://arxiv.org/abs/2102.05013.
287
+ [35] Nicholas Lubbers, Justin S Smith, and Kipton Barros. Hierarchical modeling of molecular energies using a deep neural network. The Journal of chemical physics, 148(24):241715, 2018.
288
+ [36] Albert Musaelian, Simon Batzner, Anders Johansson, Lixin Sun, Cameron J. Owen, Mordechai Kornbluth, and Boris Kozinsky. Learning local equivariant representations for large-scale atomistic dynamics, 2022. URL https://arxiv.org/abs/2204.05249.
289
+ [37] Jigyasa Nigam, Sergey Pozdnyakov, Guillaume Fraux, and Michele Ceriotti. Unified theory of atom-centered representations and message-passing machine-learning schemes. The Journal of Chemical Physics, 0(ja):null, 0. doi: 10.1063/5.0087042. URL https://doi.org/10.1063/ 5.0087042.
290
+
291
+ [38] Sergey N Pozdnyakov and Michele Ceriotti. Incompleteness of graph convolutional neural networks for points clouds in three dimensions. arXiv preprint arXiv:2201.07136, 2022.
292
+
293
+ [39] Victor Garcia Satorras, Emiel Hoogeboom, and Max Welling. E(n) equivariant graph neural networks, 2021. URL https://arxiv.org/abs/2102.09844.
294
+
295
+ [40] Franco Scarselli, Marco Gori, Ah Chung Tsoi, Markus Hagenbuchner, and Gabriele Monfardini. The graph neural network model. IEEE Transactions on Neural Networks, 20(1):61–80, 2009. doi: 10.1109/TNN.2008.2005605.
296
+
297
+ [41] Kristof Schütt, Pieter-Jan Kindermans, Huziel Enoc Sauceda Felix, Stefan Chmiela, Alexandre Tkatchenko, and Klaus-Robert Müller. Schnet: A continuous-filter convolutional neural network for modeling quantum interactions. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017. URL https://proceedings.neurips. cc/paper/2017/file/303ed4c69846ab36c2904d3ba8573050-Paper.pdf.
298
+
299
+ [42] Kristof T Schütt, Farhad Arbabzadah, Stefan Chmiela, Klaus R Müller, and Alexandre Tkatchenko. Quantum-chemical insights from deep tensor neural networks. Nature communications, 8(1):1–8, 2017.
300
+
301
+ [43] Kristof T. Schütt, Oliver T. Unke, and Michael Gastegger. Equivariant message passing for the prediction of tensorial properties and molecular spectra. CoRR, abs/2102.03150, 2021. URL https://arxiv.org/abs/2102.03150.
302
+
303
+ [44] Alexander V. Shapeev. Moment tensor potentials: A class of systematically improvable interatomic potentials. Multiscale Modeling Simulation, 14(3):1153–1173, 2016. doi: 10.1137/15M1054183. URL https://doi.org/10.1137/15M1054183.
304
+
305
+ [45] Philipp Thölke and Gianni De Fabritiis. Equivariant transformers for neural network based molecular potentials. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=zNHzqZ9wrRB.
306
+
307
+ [46] Nathaniel Thomas, Tess Smidt, Steven M. Kearnes, Lusann Yang, Li Li, Kai Kohlhoff, and Patrick Riley. Tensor field networks: Rotation- and translation-equivariant neural networks for 3d point clouds. CoRR, abs/1802.08219, 2018. URL http://arxiv.org/abs/1802.08219.
308
+
309
+ [47] A.P. Thompson, L.P. Swiler, C.R. Trott, S.M. Foiles, and G.J. Tucker. Spectral neighbor analysis method for automated generation of quantum-accurate interatomic potentials. Journal of Computational Physics, 285:316–330, 2015. ISSN 0021-9991. doi: https: //doi.org/10.1016/j.jcp.2014.12.018. URL https://www.sciencedirect.com/science/ article/pii/S0021999114008353.
310
+
311
+ [48] Oliver T Unke and Markus Meuwly. Physnet: A neural network for predicting energies, forces, dipole moments, and partial charges. Journal of chemical theory and computation, 15(6): 3678–3693, 2019.
312
+
313
+ [49] Maurice Weiler, Mario Geiger, Max Welling, Wouter Boomsma, and Taco Cohen. 3d steerable cnns: Learning rotationally equivariant features in volumetric data. In NeurIPS, pages 10402–10413, 2018. URL http://papers.nips.cc/paper/ 8239-3d-steerable-cnns-learning-rotationally-equivariant-features-in-volumetric-data.
314
+
315
+ [50] Michael J Willatt, Félix Musil, and Michele Ceriotti. Feature optimization for atomistic machine learning yields a data-driven construction of the periodic table of the elements. Physical Chemistry Chemical Physics, 20(47):29661–29668, 2018.
316
+
317
+ [51] 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, 2018. URL https://arxiv.org/abs/1812.08434.
318
+
319
+ # Checklist
320
+
321
+ 1. For all authors...
322
+
323
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
324
+ (b) Did you describe the limitations of your work? [Yes]
325
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes]
326
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
327
+
328
+ 2. If you are including theoretical results...
329
+
330
+ (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]
331
+
332
+ 3. If you ran experiments...
333
+
334
+ (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]
335
+ (b) Did you specify all the training details (e.g., data splits, hyper-parameters, how they were chosen)? [Yes]
336
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
337
+ (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]
338
+
339
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
340
+
341
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
342
+ (b) Did you mention the license of the assets? [N/A]
343
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
344
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
345
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
346
+
347
+ 5. If you used crowdsourcing or conducted research with human subjects...
348
+
349
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
350
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
351
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/arg1dQSS6Mh/arg1dQSS6Mh.md ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ATTRIBUTE ALIGNMENT AND ENHANCEMENT FOR GENERALIZED ZERO-SHOT LEARNING
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Generalized zero-shot learning (GZSL) aims to recognize both seen and unseen classes, which challenges the generalization ability of a model. In this paper, we propose a novel approach to fully utilize attributes information, referred to as attribute alignment and enhancement (A3E) network. It contains two modules. First, attribute localization (AL) module utilizes the supervision of class attribute vectors to guide visual localization for attributes through the implicit localization capability within the feature extractor, and the visual features corresponding to the attributes (attribute-visual features) are obtained. Second, enhanced attribute scoring (EAS) module employs the supervision of the attribute word vectors (attribute semantics) to project input attribute visual features to attribute semantic space using Graph Attention Network (GAT). Based on the constructed attribute relation graph (ARG), EAS module generates enhanced representation of attributes. Experiments on standard datasets demonstrate that the enhanced attribute representation greatly improves the classification performance, which helps A3E to achieve state-of-the-art performances in both ZSL and GZSL tasks.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Zero-shot learning aims to recognize unseen classes that have not been appeared during training phase, a common solution resort to auxiliary information to bridge the gap between seen and unseen domains to achieve knowledge transfer from the seen to the unseen. Semantics are the most frequently used auxiliary information for ZSL, either by class descriptions, word vectors (Mikolov et al., 2013) or attributes (Farhadi et al., 2009). A general paradigm (Xie et al., 2019; Zhu et al., 2019; Huynh & Elhamifar, 2020b; Min et al., 2020; Xie et al., 2020; Ge et al., 2021; Liu et al., 2021b; Chen et al., 2021b; 2022) is to learn a mapping that projects visual features of seen samples into an embed-ding space to align with semantic attributes. With the assumption that seen and unseen domains share the same attribute space, the learned knowledge from seen classes is easily transferred to the unseen ones. And then, the subsequent classi-fication is accomplished by measuring compatibility scores between the projected features and the attribute prototypes. Recent works on embeddings turn to local features of image parts, i.e. part-based embedding meth-ods (Elhoseiny et al., 2017), to learn discriminative features easy for classification. Comparatively, gener-ative methods (Xian et al., 2019b; Huynh & Elhamifar, 2020a; Ma & Hu, 2020; Han et al., 2021; Chen et al., 2021a;c; Chou et al., 2021) utilize semantic information of unseen classes to synthesize unseen visual features by a generative model, such as generative adversarial network (GAN) (Goodfellow et al., 2020) or variational autoencoder (VAE) (Kingma & Welling, 2013), so that convert zero-shot classification to the traditional supervised model learning that could be trainable with generated samples. However, the features inferred from semantic information mostly are high-level visual representation, which are often non-discriminative to class recognition (Huynh & Elhamifar, 2020b; Xian et al., 2019b; Huynh & Elhamifar, 2020a).
12
+
13
+ Recently, generalized zero-shot learning (GZSL) for its rigorous and realistic nature has received increasing attention in this field, where seen classes and unseen classes constitute the testing space. Embedding methods are inherently inferior in GZSL since the model training merely relies on samples of seen classes, and thus inevitably biases towards the seen ones. Moreover, the visual-semantic alignment in embedding models is just operated in seen domain, and the visual di-vergence between seen and unseen domains may strengthen the bias, namely domain shift ( $\mathrm { F u }$ et al., 2014). Different methods have been explored to improve the model performance in GZSL. Some studies try to mitigate the bias by introducing constraints on losses to calibrate output pre-diction probability, which usually require unseen semantics as side infor-mation (Huynh & Elhamifar, 2020b; Xie et al., 2020). The Parts Relation Rea-soning is used in RGEN (Xie et al., 2020) to capture appearance relationships among image parts, which is believed to be a complementary cue for improving the performance. GCNZ (Velickovi ˇ c et al., 2018) utilizes class relationships to infer classifier parame- ´ ters directly from knowledge graph. Relation learning is no novelty to ZSL, however, the semantic relationship between attributes is rarely explored in previous works. Huynh & Elhamifar (2020b) have informed us by introduc-ing word vectors of attribute that there is a wealth of semantic information in attributes beyond the commonly used class attribute vectors. There are also rich semantic relationships between attributes, which can be transferred to visual domain to help mitigate visualsemantic gap. Once the relations between attributes are modeled, it is possible to enhance the fi-nal prediction of classes by the interplay of attributes. Existing methods tried to capture the semantic relations in the at-tributes, such as using the entanglement of CNN and GCN based on knowledge graph about attrib-utes (Hu et al., 2022). However, despite the fact that nodes in graph are explic-itly defined as attributes, those methods lack a mechanism to accurately align nodes to the corresponding attributes. To the best of our knowledge, the fusion of relation learning and attention mechanism has not been studied in ZSL.
14
+
15
+ ![](images/b00a5d11c0c9f40b1dfa49fff812cc467d8778948d4c15c8feb819dabea8846e.jpg)
16
+ Figure 1: Attribute Localization.
17
+
18
+ Accordingly, we propose an attribute alignment and enhancement (A3E) network for GZSL, which incorporates attribute alignment (AA) pipeline and attribute enhancement (AE) module. AA pipeline consists of attribute localization (AL) module and attribute scoring (AS) module, this novel approach of attribute alignment allows model to subtly catch visual features corresponding to attributes (namely attribute-visual features, AVFs) by fully utilization of attribute knowledge (both class attribute vectors and attribute word vectors). Compared to previous part-based methods that require complex accessories such as attention module and part detector, A3E simplifies its AA pipeline to a single convolutional layer with a single linear transformation, and still delivers competitive results. Most importantly, the resulted AVFs serve as the carriers for attributes which support the subsequent attribute enhancement process. In order to model the relations of attributes, AE module first constructs an attribute-relation graph (ARG), where relation-ships of attributes are quantified as graph edges, then, facilitated by graph neural networks, embeds the input AVFs into attribute semantics space. The enhanced attribute features are obtained through the outputs of graph nodes. Figure 1 demonstrates the basic process of AE module. Experiments in three standard ZSL datasets show that A3E reaches the state-of-the-art results in both ZSL and GZSL without extra information from unseen classes or auxiliary constraints on output probabilities, verifying the advantages of our proposed method.
19
+
20
+ Our contributions can be summarized as:
21
+
22
+ • A novel attribute enhancement (AE) module is created to explicitly model the relationship between attributes, and the enhanced attribute representation is generated with attribute-relations modeled inside.
23
+
24
+ • To align graph nodes with attributes, an efficient attribute alignment (AA) pipeline is designed to generate visual fea-tures corresponding to attributes, namely attribute-visual features (AVFs).
25
+
26
+ • We propose an attribute alignment and enhancement (A3E) network that based on the AA pipeline and AE module, an innovative combination of attention mechanism and semantic-relation learning.
27
+
28
+ Extensive experiments on three bench-marks show that our design can significantly improve results in both ZSL and GZSL tasks.
29
+
30
+ # 2 RELATED WORK
31
+
32
+ There are two main paradigms for ZSL/GZSL: generative methods (Xian et al., 2019b; Huynh & Elhamifar, 2020a; Ma & Hu, 2020; Han et al., 2021; Chen et al., 2021a;c; Chou et al., 2021) and embedding methods (Xie et al., 2019; Zhu et al., 2019; Huynh & Elhamifar, 2020b; Min et al., 2020; Xie et al., 2020; Ge et al., 2021; Liu et al., 2021b; Chen et al., 2021b; 2022). Generative methods covert ZSL problem into traditional supervised learning using visual features synthesized by generative models for unseen classes (Liu et al., 2021a). However, generative models such as GAN or VAE are often difficult to generate high-quality synthetic samples for unseen classes to train classifiers (Pourpanah et al., 2022). On the other hand, embedding methods learn a mapping that aligns visual features with semantic prototypes, therefore achieve knowledge transfer from seen to unseen classes via their sharable semantics. According to the mapping space, embedding methods can be divided into three categories: visual space embedding (Zhang et al., 2017), semantic space embedding (Zhu et al., 2019; Huynh & Elhamifar, 2020b; Xie et al., 2020; Liu et al., 2021b) and common space embedding (Min et al., 2020), with their respective pros and cons.
33
+
34
+ As its name suggests, semantic space embedding projects visual features into semantic space. Recent studies further suggest that global visual features are detrimental to classification (Xie et al., 2019; Zhu et al., 2019; Huynh & Elhamifar, 2020b; Xie et al., 2020). Instead of using noisy global features, part-based embedding methods try to improve classification performance by locating discriminative parts in image. Elhoseiny et al. (2017) deployed a visual part detector to link text descriptions with corresponding image regions, which would be fed into the part-based visual classifiers. SGMA (Zhu et al., 2019) employed a multi-attention module and DAZLE (Huynh & Elhamifar, 2020b) constructed a hierarchical linear structure, all in order to focus the model on discriminative regions in image. Whereas, the model with part detector attention module would become complex, so that make it difficult to train and optimize. SELAR (Yang et al., 2021) proposed to localize part features by the implicit localization ability within feature extractor, where the complex attention module is replaced with a single convolution layer. Most of the above models use class attribute vectors as semantic information. However, since the attribute space spanned by class attribute vectors is inevitably suffered from hubness problem (Zhang et al., 2017), the choice of embedding space is still an issue that is worth to explore in subsequent study.
35
+
36
+ With the increasing attention paid to ZSL, various techniques from other fields were also incorporated into ZSL models, such as knowledge distillation (Chen et al., 2022), meta-learning (Verma et al., 2020) and graph learning (Xie et al., 2020; Wang et al., 2018). Graph Neural Networks (GNNs) (Kipf & Welling, 2017; Velickovi ˇ c et al., 2018) were proposed to model non-Euclidean ´ data, especially for those with graph structure. Velickovi ˇ c et al. (2018) firstly introduced Graph Con- ´ volutional Networks (GCN) (Kipf & Welling, 2017) to explicitly model relations between classes in ZSL by knowledge graph. And RGEN (Xie et al., 2020) employed GCN to represent the relations among local image regions. Whereas, none of them have explored the semantic relations that implied within attributes.
37
+
38
+ Inspired by the advantages and deficiencies of previous works, our proposed A3E employs a dual embedding strategy to fully utilize the rich semantics beneath attributes, and incorporates GAT (Velickovi ˇ c et al., 2018) to dynamically model the semantic relations between attributes. ´
39
+
40
+ # 3 ATTRIBUTE ALIGNMENT AND ENHANCEMENT
41
+
42
+ In this section, we will specify how and why the A3E network is proposed. Here we follow the pipeline that A3E processes the samples, and present the whole structure and details of our model.
43
+
44
+ # 3.1 ATTRIBUTE LOCALIZATION
45
+
46
+ In order to explore those rich semantics and relations between attributes, we need to obtain the visual representations for attributes first. Instead of generating discriminative regions using various of attention modules, Yang et al. (2021) innovated to utilize the implicit attribute localization ability
47
+
48
+ within feature extractor (CNNs) to get part location, here we refer to it as attribute localization (AL). AL greatly reduces the complexity of the model by replacing the complicated attention module with a single $1 \times 1$ convolution:
49
+
50
+ $$
51
+ \tilde { \mathbf { a } } = c o n v \left( \mathbf { v } \right)
52
+ $$
53
+
54
+ where, $\mathbf { v } = \varphi \left( \mathbf { x } _ { i } \right)$ is the visual features with $H \times W \times C$ dimensions extracted by the backbone network $\varphi \left( \cdot \right)$ . $\mathbf { x } _ { i }$ is the $i -$ th input image, and conv $( \cdot )$ is the $1 \times 1$ convolution with $1 \times 1 \times C \times A$ parameters. $\mathbf { \tilde { a } } \in \mathbb { R } ^ { H \times W \times A }$ is the output features with attribute localization, referred to as attribute features.
55
+
56
+ Under the supervision of attribute vectors, this simple convolution could gather most important spacial information of attributes. The loss function of AL module is defined as follows:
57
+
58
+ $$
59
+ \mathcal { L } _ { A L } = \mathcal { C E } \left( S o f t M a x \left( \mathbf { A } ^ { S } G M P ( c o n v \left( \mathbf { v } \right) ) ^ { T } \right) , y _ { i } \right)
60
+ $$
61
+
62
+ where $y _ { i }$ is the label of $i -$ th input image, and $G M P \left( \cdot \right)$ is the global maximum pooling function that employs spatial aggregation to the attribute features. $\mathbf { A } ^ { S } \in \mathbb { R } ^ { N ^ { S } \times A }$ is the seen attributes matrix where $N ^ { S }$ is the number of seen classes. $S o f t M a x \left( \cdot \right)$ is SoftMax activation function and $\mathcal { C } \mathcal { E } \left( \cdot \right)$ is the cross entropy loss commonly used in ZSL models.
63
+
64
+ Blue area at the bottom of Figure 2 shows the layout of AL module.
65
+
66
+ # 3.2 ATTRIBUTE SCORING
67
+
68
+ As mentioned in the previous section, attribute space, despite being commonly used in ZSL models, suffers from several problems like hubness problem. We are aware of the rich semantic information beneath attributes. Inspired by Huynh & Elhamifar (2020b), we introduce attribute semantic space to collaborate with attribute space, which forms our attribute scoring (AS) module.
69
+
70
+ With the attribute features from AL module, the visual location of every attribute is encoded in each channel of ˜a. Naturally, we thought of making it into a set of attention masks as a substitute for attention mechanism. The attribute masks are obtained through the sigmoid function that normalizes values of each channel in ˜a into a range from 0 to 1, where the value approaching to 1 stands for high confidence of having attribute-related visual features in the location, while that approaching to 0 is the opposite. Therefore, we can extract visual features for each attribute-related image region using attribute masks by performing the broadcasted Hadamard production between visual features $\mathbf { v } \in \mathbb { R } ^ { H \times W \times C }$ and each channel of normalized ˜a, which produces A masked visual features that correspond to A attributes, namely attribute-visual features (AVFs) $\mathbf { v } ^ { ( a ) } \in \mathbb { R } ^ { H \times W \times C }$ $( a \in [ 1 , A ] )$ .
71
+
72
+ To achieve zero-shot classification, the next step is to map AVFs into attribute semantic space with reference to DAZLE (Huynh & Elhamifar, 2020b). The attribute semantic space is constructed using word vectors of attributes that are usually produced by word vector models like Word2Vec (Mikolov et al., 2013). With these attribute word vectors, we employ AS module to map the above AVFs into attribute sematic space, and then calculate the class score of samples as follows:
73
+
74
+ $$
75
+ \begin{array} { c } { { \hat { \mathbf { e } } _ { a } = \mathbf { W } \left( G A P \left( \mathbf { v } ^ { ( a ) } \right) \right) , a \in \left[ 1 , A \right] } } \\ { { p _ { a } = \mathbf { e } _ { a } \hat { \mathbf { e } } _ { a } ^ { T } , a \in \left[ 1 , A \right] } } \\ { { s ^ { c } = \mathbf { a } ^ { c } \mathbf { p } ^ { T } , c \in \left[ 1 , N ^ { S } \right] } } \end{array}
76
+ $$
77
+
78
+ where $G A P \left( \cdot \right)$ is the global average pooling function that aggregates AVFs into $1 \times C$ dimensions, and $\mathbf { W } \left( \cdot \right)$ is the linear mapping with $1 \times C \times e$ parameters. $\hat { \textbf { e } } \in \mathbb { R } ^ { 1 \times e }$ is the predicted word vector, and $\mathbf { e } \in \mathbb { R } ^ { 1 \times e }$ is the ground truth attribute word vector. $p _ { a }$ is the attribute score for the $a -$ th attribute. $ { \mathbf { p } } \in \mathbb { R } ^ { 1 \times A }$ is the concatenation of $p _ { a } \left( a \in \left[ 1 , { \cal A } \right] \right)$ . $\mathbf { a } ^ { \hat { c } } \in \mathbb { R } ^ { 1 \times A } \left( c \in \left[ 1 , N ^ { S } \right] \right)$ is the class attribute vector of the $c -$ th class which is extracted from the $c -$ th row of attribute matrix $\mathbf { A } ^ { S }$ . And $s ^ { c }$ is the class score of the current sample belonging to the $c -$ th class.
79
+
80
+ Thus, the attribute scoring loss based on cross entropy is designed:
81
+
82
+ $$
83
+ \mathcal { L } _ { A S } = \mathcal { C E } \left( S o f t M a x \left( \mathbf { s } _ { A S } \right) , y _ { i } \right)
84
+ $$
85
+
86
+ where $\mathbf { s } _ { A S } \in \mathbb { R } ^ { N ^ { S } }$ is the concatenation of class score $s ^ { c } \left( c \in \left[ 1 , N ^ { S } \right] \right)$
87
+
88
+ Ultimately, a novel attribute alignment (AA) pipeline is constructed, which consists of AL and AS modules. AA innovates attribute alignment approach through integrating attribute space and attribute semantic space into a unified pipeline of ZSL model. Subsequently, we will model the relations between attributes.
89
+
90
+ # 3.3 ATTRIBUTE ENHANCEMENT
91
+
92
+ Studies on CNNs (or DNNs) have shown that feature extractor built up by convolutional neurons does well in extracting visual patterns from images. However, what they are not good at is to extract non-visual concepts from image samples. Unfortunately, the abstract concepts are common in the attribute sets of many ZSL datasets. For example, Animals with Attributes 2 (AwA2) (Xian et al., 2019a) has 85 expert-defined attributes in total. Roughly half of these attributes can be directly related to visual representations (like “stripes” and “tail”), while more than half of them do not correspond directly to the visual representation (such as “fast” and “smart”). This is even more troublesome for part-based ZSL methods since it is hard to locate a visual region for such non-visual attributes thus confusing the model.
93
+
94
+ To address the issue, we turn to exploiting the implicit semantic relations between attributes. The idea is to dynamically build the associations between visual-related attributes and non-visual attributes by modeling the relations between them. With the assumption that all attributes share the same semantic space, it allows the model to enhance the usability of non-visual attributes using representations of visual-related attributes.
95
+
96
+ In order to model the relations of attributs, we construct an attribute relation graph (ARG) $\mathbf { G } _ { A }$ based on point-wise mutual information (PMI) (Bouma, 2009) according to $\mathrm { H u }$ et al. (2022). Let $\mathbf { G } _ { A }$ has A vertices corresponding to A attributes, the edges between attributes (vertices) are defined based on their normalized PMI values referring to threshold $\delta$ :
97
+
98
+ $$
99
+ { { A } _ { i , j } } = { { A } _ { j , i } } = \left\{ \begin{array} { c } { 1 , P M { { I } _ { n } } \left( x , y \right) > \delta } \\ { 0 , e l s e } \end{array} \right.
100
+ $$
101
+
102
+ where $A _ { i , j }$ is the element in the $i -$ th row and $j -$ th column of A. We use the undirected graph for ARG, so that its adjacency matrix is symmetric, that is $A _ { i , j } = A _ { j , i }$ . See Appendix A for the detailed formula of PMI. The selection of threshold $\delta$ will be discussed in detail in experiments section.
103
+
104
+ So far, ARG discussed above is still a static structure shared by all categories, which cannot be dynamically optimized with different classes and samples. Meanwhile, the PMI-based connections (graph edges) may not always represent the correct relations between attributes. Therefore, instead of using the well-known graph convolutional networks (GCN), we leverage graph attention networks (GAT) (Velickovi ˇ c et al., 2018) to achieve dynamic modeling based on ARG. ´
105
+
106
+ GAT proposed by Velickovi ˇ c et al. can dynamically adjust edge weights with self-attention mech- ´ anism to solve a series of problems in spatial GNNs. According to AA pipeline in the previous subsection, A sets of global AVFs $\bar { \mathbf { v } } ^ { ( a ) }$ $( a \in [ 1 , A ] )$ belonging to the sample $x _ { i }$ are obtained, which will be subsequently used as the input of nodes in $\mathbf { G } _ { A }$ . We use a two-layer GAT network in the paper, i.e. $l \in \{ \bar { 0 } , 1 \}$ . The outputs of GAT are the predicted word vectors $\tilde { \mathbf { e } } _ { a } ^ { \cdot } \in \mathbb { R } ^ { 1 \times e } ( a \in [ 1 , A ] )$ from each node, where $e$ is the dimension of word vector. In the process, GAT not only projects the input global AVFs into attribute semantic space (like the AS module), but also models attribute relations in the output, namely predicted word vectors $\hat { \mathbf { e } } _ { a }$ . With the help of ARG that connected attributes by their semantic relation, GAT can enhance the expression of certain attribute-related features (especially those from non-visual attributes), yielding more discriminative semantic representations. Hence, we name it attribute enhancement (AE) module.
107
+
108
+ As the output of AE module has the same form of predicted word vectors like AS module, an integrated enhanced attribute scoring (EAS) module is naturally formed. We can follow formula (3), (4) and (5) to calculate the class score vector $\mathbf { s } _ { E A S }$ , and the enhanced attribute scoring loss is constructed as:
109
+
110
+ ![](images/d6a040d03d386625ef5f5dcf7df0f44dd3f08c641ea6e76f8b3041053ac29215.jpg)
111
+ Figure 2: Attribute Alignment and Enhancement Network.
112
+
113
+ $$
114
+ \mathcal { L } _ { E A S } = \mathcal { C E } \left( S o f t M a x \left( \mathbf { s } _ { E A S } \right) , y _ { i } \right)
115
+ $$
116
+
117
+ The dropout strategy is often used to improve the generalization of GNN models by randomly “dropping” some nodes (sweeping node features) during training. The method is originally used in GNNs to suppress over-smoothing problem (Li et al., 2018), while we use here to perturb the original data (AVFs) to enhance the generalization of the model. Subsequent experiments will demonstrate the significant impact of the dropout strategy on GZSL performance.
118
+
119
+ # 3.4 GENERALIZED ZERO-SHOT IMAGE CLASSIFICATION
120
+
121
+ Finally, by integrating the attribute localization (AL) module and enhanced attribute scoring (EAS) module, A3E network for GZSL is constructed (see Figure 2).
122
+
123
+ # 3.4.1 OVERALL LOSS
124
+
125
+ The overall loss function of A3E is:
126
+
127
+ $$
128
+ \mathcal { L } _ { A 3 E } = \lambda \mathcal { L } _ { A L } + \left( 1 - \lambda \right) \mathcal { L } _ { E A S }
129
+ $$
130
+
131
+ where $\lambda$ is the weighting coefficient that balance the two modules.
132
+
133
+ # 3.4.2 INFERENCE
134
+
135
+ In the inference stage, A3E employs a fusion prediction method as follows:
136
+
137
+ $$
138
+ \hat { y } = \arg \operatorname* { m a x } _ { c \in N } \left( \lambda \mathbf { s } _ { A L } + \left( 1 - \lambda \right) \mathbf { s } _ { E A S } + \beta \Delta _ { \left[ c \in N ^ { U } \right] } \right)
139
+ $$
140
+
141
+ where $\hat { y }$ is the predicted label, and $\lambda$ is a coefficient which has identical function with the one in training loss. $\mathbf { s } _ { A L }$ is the output probability of AL module and $\mathbf { s } _ { E A S }$ is the output probability of EAS module. $N = N ^ { S } \cap N ^ { U }$ is the set of all classes labels. $\beta$ is an adjustable bias, and $\Delta _ { [ c \in N ^ { U } ] }$ is an indicator which will take 1 for unseen classes, and -1 for seen classes.
142
+
143
+ To alleviate the inevitable bias caused by domain shift in GZSL, we set a calibration bias refer to (Huynh & Elhamifar, 2020b). However, it is worth notice that unlike (Huynh & Elhamifar,
144
+
145
+ Table 1: Results of conventional ZSL and GZSL classification on AwA2, CUB and SUN datasets. The best and second-best results are marked in bold and underline, respectively. The symbol “-” indicates no results. The symbol “\*” represents models with $4 4 8 \times 4 4 8$ input size.
146
+
147
+ <table><tr><td rowspan="3" colspan="2">Methods</td><td colspan="4">AwA2</td><td colspan="4">CUB</td><td colspan="4">SUN</td></tr><tr><td>ZSL MCA</td><td rowspan="2"></td><td colspan="2">GZSL</td><td>ZSL</td><td></td><td colspan="2">GZSL</td><td>ZSL</td><td></td><td colspan="2">GZSL</td></tr><tr><td>Unseen</td><td>Seen</td><td>H</td><td>MCA</td><td>Unseen</td><td>Seen</td><td>H</td><td>MCA</td><td>Unseen</td><td>Seen</td><td>H</td></tr><tr><td colspan="2">Generative Methods</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>CVPR 2019 f-VAEGAN-D2</td><td></td><td>71.1</td><td>57.6</td><td>70.6</td><td>63.5</td><td>61.0</td><td>48.4</td><td>60.1</td><td>53.6</td><td>64.7</td><td>45.1</td><td>38.0</td><td>41.3</td></tr><tr><td>NeurIPS 2020 Composer</td><td></td><td>71.5</td><td>62.1</td><td>77.3</td><td>68.8</td><td>69.4</td><td>56.4</td><td>63.8</td><td> 59.9</td><td>62.6</td><td>55.1</td><td>22.0</td><td>31.4</td></tr><tr><td>ICCV 2021</td><td>FREE</td><td>-</td><td>60.4</td><td>75.4</td><td>67.1</td><td>:</td><td>55.7</td><td>59.9</td><td> 57.7</td><td>-</td><td>47.4</td><td>37.2</td><td>41.7</td></tr><tr><td colspan="2">EmbeddingMethods</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>NeurIPS 2019</td><td>SGMA</td><td>68.8*</td><td>37.6*</td><td>87.1*</td><td>52.5*</td><td>71*</td><td>36.7*</td><td>71.3*</td><td>48.5*</td><td>:</td><td>-</td><td>:</td><td>-</td></tr><tr><td>CVPR 2020</td><td>DAZLE</td><td>1</td><td>60.3</td><td>75.7</td><td>67.1</td><td>65.9</td><td>56.7</td><td>59.6</td><td>58.1</td><td>-</td><td>52.3</td><td>24.3</td><td>33.2</td></tr><tr><td>ECCV 2020</td><td>RGEN</td><td>73.6</td><td>67.1</td><td>76.5</td><td>71.5</td><td>76.1</td><td>60.0</td><td>73.5</td><td>66.1</td><td>63.8</td><td>44.0</td><td>31.7</td><td>36.8</td></tr><tr><td>AAAI 2021</td><td>SR2E</td><td>:</td><td>58*</td><td>80.7*</td><td>67.5*</td><td>-</td><td>61.6*</td><td>70.6*</td><td>65.8*</td><td>-</td><td>43.1*</td><td>36.8*</td><td>39.7*</td></tr><tr><td>SPL 2021</td><td>SELAR</td><td>:</td><td>52.0</td><td>71.9</td><td>60.3</td><td>:</td><td>62.4</td><td>64.9</td><td>63.6</td><td>:</td><td>40.5</td><td>32.9</td><td>36.3</td></tr><tr><td>NeurIPS 2021</td><td>HSVA</td><td>-</td><td>56.7</td><td>79.8</td><td>66.3</td><td>62.8</td><td>52.7</td><td>58.3</td><td> 55.3</td><td>63.8</td><td>48.6</td><td>39.0</td><td> 43.3</td></tr><tr><td>CVPR 2022</td><td>MSDN</td><td>70.1*</td><td>62*</td><td>74.5*</td><td>67.7*</td><td>76.1*</td><td>68.7*</td><td>67.5*</td><td>68.1*</td><td>65.8*</td><td>52.2*</td><td>34.2*</td><td>41.3*</td></tr><tr><td>ours</td><td>A3E</td><td>74.1</td><td>69.3</td><td>71.2</td><td>70.2</td><td>74.9*</td><td>66.3*</td><td>71.6*</td><td>68.8*</td><td>64.0*</td><td>46.8*</td><td>30.0*</td><td>36.5*</td></tr></table>
148
+
149
+ 2020b), the calibration in our method only includes a bias on the prediction probability, and does not include any additional loss term that usually requires unseen semantics to adjust output predictions.
150
+
151
+ # 4 EXPERIMENTS
152
+
153
+ # 4.1 EXPERIMENTAL SETUP
154
+
155
+ # 4.1.1 DATASETS
156
+
157
+ We evaluate A3E network on three GZSL benchmarks: Animals with Attributes 2 (AwA2) (Xian et al., 2019a), Caltech-UCSD Birds 200-2011 (CUB) (Wah et al., 2011) and SUN attribute database (SUN) (Patterson et al., 2014). AwA2 is a coarse-grained dataset with 37,322 images from 50 animal classes, each of which has 85 attributes. While, CUB is a fine-grained bird dataset containing 11,788 images from 200 bird classes with 312 attributes. SUN is also a fine-grained dataset which includes 14,340 images from 717 scene categories, and each class has a 102-dimension attribute vector.
158
+
159
+ In order to fairly compare with the state-of-the-art ZSL models, we adopt the proposed split (PS) of datasets presented in (Xian, Schiele, and Akata 2017). Evaluation metrics are shown in Appendix B
160
+
161
+ # 4.1.2 IMPLEMENTATION DETAILS
162
+
163
+ All the experiments in the paper are conducted on NVIDIA GeForce RTX 3090 with 24 GB video memory size. Software versions are Python 3.9, PyTorch 1.11.0, NumPy 1.22.3 and CUDA 11.3.
164
+
165
+ For better reproducibility of experiment results, we manually fixed the random seed to 1024 for all tests. Detailed settings would be listed in Appendix C
166
+
167
+ # 4.2 COMPARISON WITH STATE-OF-THE-ARTS
168
+
169
+ We compare our A3E network with several state-of-the-art models in both ZSL setting and GZSL setting. The results are presented in Table 1. On the ZSL side, A3E shows very gratifying results in all three datasets. While it is competitive compared with the state-of-the-art models on CUB and SUN, the most compelling achievement is that A3E outperforms the long-standing record by RGEN (Xie et al., 2020) on AwA2 since 2020. On the GZSL side, A3E reaches the highest harmonic mean $( 6 8 . 8 \% )$ on CUB dataset, which is the current best generalized model on CUB. It also gets a satisfactory performance on AwA2, though is inferior to RGEN. Whereas, harmonic mean of A3E on AwA2 is still improved by at least $2 . 5 \%$ compared with the former state-of-the-art models, which verifies that A3E is a strong competitor so far, compared with most of the models except for RGEN. In general, the results prove that the proposed attribute alignment and enhancement work effectively on AwA2 and CUB, which are beneficial to represent the rich semantic relations between attributes hidden in AwA2 and CUB. The data characteristic of AwA2 and CUB promotes A3E network more generalized. However, the performance on SUN dataset declines sharply. The reason accounted for the phenomenon is that attributes of SUN are more abstract which are hard to capture their correspondent image regions. More importantly, the semantic relations are too sparser compared with the former datasets to affect the performance of attribute enhancement.
170
+
171
+ Table 2: Ablation study under two datasets. The best results are marked in bold.
172
+
173
+ <table><tr><td rowspan="3">Method</td><td colspan="4">AwA2</td><td colspan="4">CUB</td></tr><tr><td>ZSL</td><td></td><td>GZSL</td><td></td><td>ZSL</td><td></td><td>GZSL</td><td></td></tr><tr><td>MCA</td><td>Unseen</td><td>Seen</td><td>H</td><td>MCA</td><td>Unseen</td><td>Seen</td><td>H</td></tr><tr><td>AL+AS(AA pipeline)</td><td>60.4</td><td>52.6</td><td>78.5</td><td>63.0</td><td>57.7</td><td>44.6</td><td>60.5</td><td>51.3</td></tr><tr><td>AL+EAS(A3ENetwork)</td><td>74.1</td><td>69.3</td><td>71.2</td><td>70.2</td><td>74.9</td><td>66.3</td><td>71.6</td><td>68.8</td></tr></table>
174
+
175
+ Among all comparison models, DAZLE, RGEN and MSDN are the most noteworthy as well as our A3E network. They have some similarity in research motivation. DALZE and MSDN adopt attribute scoring mechanisms, as well as A3E. RGEN uses GNN to perform region-based relations on visual features. Whereas, A3E employs AE module to model semantic relations between attributes. From the GZSL results on AwA2 and CUB, A3E successfully surpasses these models by the stable performance which can be expressed as the average of harmonic means: A3E network reaches $6 9 . 5 \%$ in average, while DAZLE, RGEN and MSDN are $6 2 . 6 \%$ , $6 8 . 8 \%$ and $6 7 . 9 \%$ , respectively(see Appendix D). The more surprising fact is that when A3E generalizes well in GZSL settings, it does not resort to any probability tricks commonly used in above models, such as the balance loss used by RGEN and the calibration loss used in DALZE and MSDN models. The modified losses by the probability tricks require the supervision from unseen semantics during training, which are contrary to the original setting of ZSL to some extent. In contrast, A3E only relies on seen samples and generalizes better than those models that require unseen semantics, which further demonstrates the superiority of the propose method.
176
+
177
+ # 4.3 ABLATION STUDY
178
+
179
+ # 4.3.1 EFFECTS OF ATTRIBUTE ENHANCEMENT
180
+
181
+ The proposed A3E network is composed of three interrelated modules, namely, AL, AS and AE modules. Among them, AE module based on GAT is the most innovative and representative component of our work. To further evaluate the efficacy of attribute enhancement in actual task, we conduct ablation studies on AwA2 and CUB datasets, by setting the baseline model with only AL and AS modules, i.e. attribute alignment (AA) pipeline. Table 2 shows the results of ablation study.
182
+
183
+ To fairly compare the baseline model with A3E network, we use the same parameter setting in both. Even so, the ZSL accuracy of A3E has improved by staggering $1 3 . 7 \%$ and $1 7 . 2 \%$ for AwA2 and CUB datasets, respectively. Similarly, drastic performance boost is also present in the GZSL setting, where A3E exceeds the baseline by up to $7 . 2 \%$ and $1 7 . 5 \%$ in harmonic mean metric on AwA2 and CUB, respectively. Thus, with the help of AE module, A3E exceeds the baseline with absolute superiority in all settings, with an even greater advantage in CUB. In effect, the characteristics of attributes such as semantics and relations vary with different datasets. The reason that the performance on CUB has dramatic improvement by AE module is resulted from the stronger semantic relations between attributes of CUB, where attributes are more uniform to describe image contents.
184
+
185
+ # 4.3.2 EFFECTS OF DROPOUT
186
+
187
+ To investigate the effects of dropout in AE module, we conduct experiments with different dropout rates on CUB dataset. The results are concluded in Appendix E.
188
+
189
+ ![](images/9a441089bba5cbdf9cd6f80114e0846909569ec537d2cfc00a4f313c4dd4cd29.jpg)
190
+ Figure 3: Effects of weighting coefficient $\lambda$ on Figure 4: Effects of threshold $\delta$ on AwA2 and AwA2 and CUB datasets. CUB datasets.
191
+
192
+ # 4.4 HYPERPARAMETER ANALYSIS
193
+
194
+ # 4.4.1 EFFECTS OF WEIGHTING COEFFICIENT $\lambda$
195
+
196
+ Figure 3 is the summary of the experimental results on tuning weighting coefficient $\lambda$ between AL and EAS modules. We do not show experiments for $\lambda$ at 0 and 1 since they are no longer considered in our A3E model. In CUB dataset (see Figure 3(b)), both ZSL and GZSL indicators increase with the rise of $\lambda$ . While in AwA2 dataset (see Figure 3(a)), the accuracies of unseen classes in ZSL and GZSL rise with the increase of $\lambda$ . But the accuracy of seen classes in GZSL shows the opposite trend, so as to cause harmonic means of GZSL slowly improving. The increasing of $\lambda$ represents that the model emphasizes more on AL module learning. Results show that despite the simpler structure and fewer parameters of the AL module, its importance in the objective function is no less than that of the EAS module. It is proven by the results that model performance improves as the effort invested in AL module (i.e., value of $\lambda$ ) increases. Specially, attribute localization is more demanding for the fine-grained datasets with more subtle features, such as the CUB dataset. Considering all the indicators, we set $\lambda$ to 0.6 and 0.9 for AwA2 and CUB, respectively.
197
+
198
+ # 4.4.2 EFFECTS OF THRESHOLD $\delta$
199
+
200
+ Threshold $\delta$ controls the generation of ARG. Smaller value of $\delta$ indicates easier connection between nodes in ARG, which means more edges in the graph. When $\delta = 1$ , there is no edge in ARG, so that AE module does not work. Figure 4 shows how different values of $\delta$ affect model performance on the two datasets. As $\delta$ increases in CUB dataset (see Figure 4(b)), all four metrics increase equally until $\delta = 0 . 8$ . In AwA2 dataset (see Figure 4(a)), we can find a general uptrend in the accuracy of unseen classes as $\delta$ increase, and the best accuracy is found at $\delta = 0 . 9$ . With the increase in $\delta$ , the edges representing attribute relationships in ARG should gradually decrease. Obviously, edges created by PMI do not perfectly correspond with the semantic relationships of attributes. We believe that the graphs generated by lower values of $\delta$ have more noisy connections (edges), which leads to the model performance decline. When the structure of ARG is simplified with higher threshold, GAT is more likely to obtain robust information from ARG, thus enhancing the classification performance. To balance the accuracies of seen classes and unseen classes, we set $\delta = 0 . 9$ and $\delta = 0 . 8$ for AwA2 and CUB, respectively.
201
+
202
+ # 5 CONCLUSION
203
+
204
+ In the paper, we propose an attribute alignment and enhancement (A3E) network, which consist of attribute alignment (AA) pipeline and AE module. Therefore, A3E can align each attribute with corresponding image region and enhance their representations by the semantic relations between attributes through GNNs. At last, the experiments on three ZSL datasets have demonstrated the superiority of A3E network on ZSL/GZSL classification.
205
+
206
+ # REFERENCES
207
+
208
+ Gerlof Bouma. Normalized (Pointwise) Mutual Information in Collocation Extraction. pp. 11, 2009.
209
+
210
+ Shiming Chen, Wenjie Wang, Beihao Xia, Qinmu Peng, Xinge You, Feng Zheng, and Ling Shao. FREE: Feature Refinement for Generalized Zero-Shot Learning. In 2021 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 122–131, Montreal, QC, Canada, October 2021a. IEEE. ISBN 978-1-66542-812-5. doi: 10.1109/ICCV48922.2021.00019.
211
+
212
+ Shiming Chen, Guo-Sen Xie, Yang Liu, Qinmu Peng, Baigui Sun, Hao Li, Xinge You, and Ling Shao. HSVA: Hierarchical Semantic-Visual Adaptation for Zero-Shot Learning. pp. 13, 2021b.
213
+
214
+ Shiming Chen, Ziming Hong, Guo-Sen Xie, Wenhan Yang, Qinmu Peng, Kai Wang, Jian Zhao, and Xinge You. MSDN: Mutually Semantic Distillation Network for Zero-Shot Learning, April 2022.
215
+
216
+ Zhi Chen, Yadan Luo, Ruihong Qiu, Sen Wang, Zi Huang, Jingjing Li, and Zheng Zhang. Semantics Disentangling for Generalized Zero-Shot Learning. In 2021 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 8692–8700, Montreal, QC, Canada, October 2021c. IEEE. ISBN 978-1-66542-812-5. doi: 10.1109/ICCV48922.2021.00859.
217
+
218
+ Yu-Ying Chou, Hsuan-Tien Lin, and Tyng-Luh Liu. ADAPTIVE AND GENERATIVE ZEROSHOT LEARNING. pp. 14, 2021.
219
+
220
+ Mohamed Elhoseiny, Yizhe Zhu, Han Zhang, and Ahmed Elgammal. Link the head to the ”beak”: Zero Shot Learning from Noisy Text Description at Part Precision, September 2017.
221
+
222
+ Ali Farhadi, Ian Endres, Derek Hoiem, and David Forsyth. Describing objects by their attributes. In 2009 IEEE Conference on Computer Vision and Pattern Recognition, pp. 1778–1785, Miami, FL, June 2009. IEEE. ISBN 978-1-4244-3992-8. doi: 10.1109/CVPR.2009.5206772.
223
+
224
+ Yanwei Fu, Timothy M. Hospedales, Tao Xiang, Zhenyong Fu, and Shaogang Gong. Transductive Multi-view Embedding for Zero-Shot Recognition and Annotation. In David Fleet, Tomas Pajdla, Bernt Schiele, and Tinne Tuytelaars (eds.), Computer Vision – ECCV 2014, volume 8690, pp. 584–599. Springer International Publishing, Cham, 2014. ISBN 978-3-319-10604-5 978-3-319- 10605-2. doi: 10.1007/978-3-319-10605-2 38.
225
+
226
+ Jiannan Ge, Hongtao Xie, Shaobo Min, and Yongdong Zhang. Semantic-guided Reinforced Region Embedding for Generalized Zero-Shot Learning. Proceedings of the AAAI Conference on Artificial Intelligence, 35(2):1406–1414, May 2021. ISSN 2374-3468, 2159-5399. doi: 10.1609/aaai.v35i2.16230.
227
+
228
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. Communications of the ACM, 63(11):139–144, 2020.
229
+
230
+ Zongyan Han, Zhenyong Fu, Shuo Chen, and Jian Yang. Contrastive Embedding for Generalized Zero-Shot Learning. In 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2371–2381, Nashville, TN, USA, June 2021. IEEE. ISBN 978-1-66544-509-2. doi: 10.1109/CVPR46437.2021.00240.
231
+
232
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 770–778, Las Vegas, NV, USA, June 2016. IEEE. ISBN 978-1-4673-8851-1. doi: 10.1109/ CVPR.2016.90.
233
+
234
+ Yang Hu, Guihua Wen, Adriane Chapman, Pei Yang, Mingnan Luo, Yingxue Xu, Dan Dai, and Wendy Hall. Graph-Based Visual-Semantic Entanglement Network for Zero-Shot Image Recognition. IEEE Transactions on Multimedia, 24:2473–2487, 2022. ISSN 1520-9210, 1941-0077. doi: 10.1109/TMM.2021.3082292.
235
+
236
+ Dat Huynh and Ehsan Elhamifar. Compositional Zero-Shot Learning via Fine-Grained Dense Feature Composition. pp. 12, 2020a.
237
+
238
+ Dat Huynh and Ehsan Elhamifar. Fine-Grained Generalized Zero-Shot Learning via Dense Attribute-Based Attention. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 4482–4492, Seattle, WA, USA, June 2020b. IEEE. ISBN 978-1-72817- 168-5. doi: 10.1109/CVPR42600.2020.00454.
239
+
240
+ Diederik P. Kingma and Jimmy Ba. Adam: A Method for Stochastic Optimization, January 2017.
241
+
242
+ Diederik P Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
243
+
244
+ Thomas N. Kipf and Max Welling. Semi-Supervised Classification with Graph Convolutional Networks, February 2017.
245
+
246
+ Qimai Li, Zhichao Han, and Xiao-Ming Wu. Deeper Insights into Graph Convolutional Networks for Semi-Supervised Learning, January 2018.
247
+
248
+ Lu Liu, Tianyi Zhou, Guodong Long, Jing Jiang, Xuanyi Dong, and Chengqi Zhang. ISOMETRIC PROPAGATION NETWORK FOR GENERALIZED ZERO-SHOT LEARNING. pp. 13, 2021a.
249
+
250
+ Yang Liu, Lei Zhou, Xiao Bai, Yifei Huang, Lin Gu, Jun Zhou, and Tatsuya Harada. Goal-Oriented Gaze Estimation for Zero-Shot Learning, March 2021b.
251
+
252
+ Peirong Ma and Xiao Hu. A Variational Autoencoder with Deep Embedding Model for Generalized Zero-Shot Learning. Proceedings of the AAAI Conference on Artificial Intelligence, 34(07): 11733–11740, April 2020. ISSN 2374-3468, 2159-5399. doi: 10.1609/aaai.v34i07.6844.
253
+
254
+ Tomas Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. Efficient Estimation of Word Representations in Vector Space, September 2013.
255
+
256
+ Shaobo Min, Hantao Yao, Hongtao Xie, Chaoqun Wang, Zheng-Jun Zha, and Yongdong Zhang. Domain-aware Visual Bias Eliminating for Generalized Zero-Shot Learning, April 2020.
257
+
258
+ Genevieve Patterson, Chen Xu, Hang Su, and James Hays. The SUN Attribute Database: Beyond Categories for Deeper Scene Understanding. International Journal of Computer Vision, 108(1-2): 59–81, May 2014. ISSN 0920-5691, 1573-1405. doi: 10.1007/s11263-013-0695-z.
259
+
260
+ Farhad Pourpanah, Moloud Abdar, Yuxuan Luo, Xinlei Zhou, Ran Wang, Chee Peng Lim, Xi-Zhao Wang, and Q. M. Jonathan Wu. A Review of Generalized Zero-Shot Learning Methods. IEEE Transactions on Pattern Analysis and Machine Intelligence, pp. 1–20, 2022. ISSN 0162-8828, 2160-9292, 1939-3539. doi: 10.1109/TPAMI.2022.3191696.
261
+
262
+ Nitish Srivastava, Geoffrey Hinton, Alex Krizhevsky, Ilya Sutskever, and Ruslan Salakhutdinov. Dropout: A Simple Way to Prevent Neural Networks from Overfitting. pp. 30, 2014.
263
+
264
+ Petar Velickovi ˇ c, Guillem Cucurull, Arantxa Casanova, Adriana Romero, Pietro Li ´ o, and Yoshua \` Bengio. Graph Attention Networks, February 2018.
265
+
266
+ Vinay Kumar Verma, Dhanajit Brahma, and Piyush Rai. Meta-Learning for Generalized Zero-Shot Learning. Proceedings of the AAAI Conference on Artificial Intelligence, 34(04):6062–6069, April 2020. ISSN 2374-3468, 2159-5399. doi: 10.1609/aaai.v34i04.6069.
267
+
268
+ Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The CaltechUCSD Birds-200-2011 Dataset. pp. 8, 2011.
269
+
270
+ Xiaolong Wang, Yufei Ye, and Abhinav Gupta. Zero-shot Recognition via Semantic Embeddings and Knowledge Graphs, April 2018.
271
+
272
+ Yongqin Xian, Christoph H. Lampert, Bernt Schiele, and Zeynep Akata. Zero-Shot Learning—A Comprehensive Evaluation of the Good, the Bad and the Ugly. IEEE Transactions on Pattern Analysis and Machine Intelligence, 41(9):2251–2265, September 2019a. ISSN 0162-8828, 2160- 9292, 1939-3539. doi: 10.1109/TPAMI.2018.2857768.
273
+
274
+ Yongqin Xian, Saurabh Sharma, Bernt Schiele, and Zeynep Akata. F-VAEGAN-D2: A Feature Generating Framework for Any-Shot Learning. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 10267–10276, Long Beach, CA, USA, June 2019b. IEEE. ISBN 978-1-72813-293-8. doi: 10.1109/CVPR.2019.01052.
275
+
276
+ Guo-Sen Xie, Li Liu, Xiaobo Jin, Fan Zhu, Zheng Zhang, Jie Qin, Yazhou Yao, and Ling Shao. Attentive Region Embedding Network for Zero-Shot Learning. In 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 9376–9385, Long Beach, CA, USA, June 2019. IEEE. ISBN 978-1-72813-293-8. doi: 10.1109/CVPR.2019.00961.
277
+
278
+ Guo-Sen Xie, Li Liu, Fan Zhu, Fang Zhao, Zheng Zhang, Yazhou Yao, Jie Qin, and Ling Shao. Region Graph Embedding Network for Zero-Shot Learning. In Andrea Vedaldi, Horst Bischof, Thomas Brox, and Jan-Michael Frahm (eds.), Computer Vision – ECCV 2020, volume 12349, pp. 562��580. Springer International Publishing, Cham, 2020. ISBN 978-3-030-58547-1 978-3-030- 58548-8. doi: 10.1007/978-3-030-58548-8 33.
279
+
280
+ Shiqi Yang, Kai Wang, Luis Herranz, and Joost van de Weijer. On Implicit Attribute Localization for Generalized Zero-Shot Learning. IEEE Signal Processing Letters, 28:872–876, 2021. ISSN 1070-9908, 1558-2361. doi: 10.1109/LSP.2021.3073655.
281
+
282
+ Li Zhang, Tao Xiang, and Shaogang Gong. Learning a Deep Embedding Model for Zero-Shot Learning. In 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3010–3019, Honolulu, HI, July 2017. IEEE. ISBN 978-1-5386-0457-1. doi: 10.1109/CVPR. 2017.321.
283
+
284
+ Yizhe Zhu, Jianwen Xie, Zhiqiang Tang, Xi Peng, and Ahmed Elgammal. Semantic-Guided MultiAttention Localization for Zero-Shot Learning. pp. 11, 2019.
285
+
286
+ # A POINT-WISE MUTUAL INFORMATION
287
+
288
+ Point-wise mutual information (PMI) (Bouma, 2009) is proposed measure the relationship of two points (objects), defined as:
289
+
290
+ $$
291
+ P M I \left( x , y \right) = \ln \frac { p \left( x , y \right) } { p \left( x \right) p \left( y \right) }
292
+ $$
293
+
294
+ where $p \left( x , y \right)$ is the joint probability of $x$ and $y$
295
+
296
+ In practice, the normalized PMI is more commonly used as:
297
+
298
+ $$
299
+ P M I _ { n } \left( x , y \right) = \frac { P M I \left( x , y \right) } { - \ln p \left( x , y \right) }
300
+ $$
301
+
302
+ where its values are in the range of [-1,1], which give a good indication of the relevance between $x$ and $y$ . Specifically, 1 means they are co-occurrence, while -1 shows the opposite case. But, 0 indicates they are not relevant at all.
303
+
304
+ # B EVALUATION METRICS
305
+
306
+ We consider both conventional ZSL and GZSL settings in all three datasets. Mean Class Accuracy $( M C A )$ is adopted as the evaluation indicator for ZSL setting, which takes average value of Top-1 accuracies on unseen classes. And harmonic mean $( H )$ is employed to evaluate the performance of GZSL setting, which is the most comprehensive metric to reflect model performance by taking accuracies of seen and unseen classes into consideration. The specific formula is defined as follows:
307
+
308
+ $$
309
+ H = \frac { 2 \times M C A _ { S } \times M C A _ { U } } { M C A _ { S } + M C A _ { U } }
310
+ $$
311
+
312
+ where $M C A _ { S }$ and $M C A _ { U }$ are the $M C A s$ for seen classes and unseen classes, respectively.
313
+
314
+ # C MODEL SETTINGS
315
+
316
+ We use the fixed ResNet101 (He et al., 2016) pretrained on ImageNet as the feature extractor of A3E network, which is commonly used as the backbone network in many models (Huynh & Elhamifar, 2020b; Xie et al., 2020; Ge et al., 2021; Chen et al., 2021b; 2022). The input images of model are reshaped as $2 2 4 \times 2 2 4$ pixels for AwA2 datasets and $4 4 8 \times 4 4 8$ pixels for CUB and SUN datasets since the finer details could significantly improve performance on fine-grained datasets. We use the Word2Vec model trained on Google News to generate attribute word vectors with 300 dimensions.
317
+
318
+ We adopt ADAM optimizer (Kingma & Ba, 2017) in model training and set weigh decay to $1 \times 1 0 ^ { - 5 }$ . We empirically set the hidden layers and attention heads of GAT network in EAS module to $\{ 2 0 0$ , $1 \}$ for AwA2, $\{ 2 0 0 , 4 \}$ for CUB and $\{ 1 0 0 0 , 5 \}$ for SUN, with dropout rate fixed to 0.2. For AwA2 dataset, we set the learning rate to $5 \times 1 0 ^ { - 6 }$ , batch size to 64 and maximum iteration number to 10. Regarding to CUB dataset, the learning rate is set to $7 . 5 \times 1 0 ^ { - 6 }$ . Batch size is set to 8, and maximum iteration number is 30. As to SUN dataset, we set the learning rate to $5 \times 1 0 ^ { - 6 }$ , batch size to 16 and maximum iteration number to 25. The learning rate for $1 \times 1$ convolution in AL module is 10 times greater than the given values in all datasets. The calibration bias $\beta$ is set to 2.0, 0.4 and 0.4 for AwA2, CUB and SUN, respectively.
319
+
320
+ There are two hyperparameters in A3E network: weighting coefficient $\lambda$ and ARG threshold $\delta$ . We set $\lambda$ to 0.6, 0.8 and 0.9 for AwA2, CUB and SUN datasets. While $\delta$ is set to 0.9, 0.8 and 0.1 for these three datasets, respectively. The influence of the hyperparameters is explored in the following experiments.
321
+
322
+ # D AVERAGE HARMONIC MEANS ON AWA2 AND CUB
323
+
324
+ Table 3: Average harmonic means on AwA2 and CUB datasets.
325
+
326
+ <table><tr><td rowspan="2">Method</td><td>AwA2</td><td>CUB</td><td>Average</td></tr><tr><td colspan="3">H</td></tr><tr><td>DAZLE</td><td>67.1</td><td>58.1</td><td>62.6</td></tr><tr><td>RGEN</td><td>71.5</td><td>66.1</td><td>68.8</td></tr><tr><td>MSDN A3E</td><td>67.7 70.2</td><td>68.1 68.8</td><td>67.9 69.5</td></tr></table>
327
+
328
+ # E ABLATION STUDY ON DROPOUT
329
+
330
+ ![](images/d3e7fcb7cf368a89809b4c1bb0996f90c10c255117db32e06ca340cd3ed01262.jpg)
331
+ Figure 5: Effects of dropout rate $d$ on CUB dataset.
332
+
333
+ Dropout is a commonly used strategy to prevent neural networks from overfitting (Srivastava et al., 2014). In our work, we employ dropout on GAT of AE module by randomly dropping some node features during training stage. The dropping process is controlled by dropout rate $d$ that determines the proportion of dropped nodes. As shown in Figure 5, with dropout rate $d$ increasing from 0 to 0.2 (0 means dropout is inactive), almost all indicators are on the rise, except a slight fluctuation for the seen class accuracy on GZSL. The accuracy decreases gradually from 0.3. To sum up, both ZSL accuracy and GZSL harmonic mean reach the best values at 0.2 dropout rate, then begin to decline with the increase of $d$ . The phenomenon can verify functionality of dropout: preventing models from overfitting. Besides, dropout is indispensable to AE module because it improves the generalization ability of model.
334
+
335
+ # F TERM EXPLANATION
336
+
337
+ Attribute semantics: The word vectors of attributes, which is the output of word2vec model by taking the attribute name as the input. The resulted representation codes semantic information of each input attribute, so called the attribute semantics.
338
+
339
+ Class attribute vectors: A set of vectors corresponds to the set of classes. Each vector encodes information about the attributes of the corresponding class, and the presence of attribute is indicated by a continuous or binary value at its corresponding element of the vector.
340
+
341
+ Attribute prototypes is actually the class attribute vectors in the attribute space, that has identical meanings with class attribute vectors.
md/dev/cBu4ElJfneV/cBu4ElJfneV.md ADDED
@@ -0,0 +1,297 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GIRAFFEDET: A HEAVY-NECK PARADIGM FOR OBJECT DETECTION
2
+
3
+ Yiqi Jiang, Zhiyu Tan, Junyan Wang, Xiuyu Sun∗, Ming Lin, Hao Li DAMO Academy, Alibaba Group {yiqi.jyq, zhiyu.tzy, wangjunyan.wjy}@alibaba-inc.com {xiuyu.sxy, ming.l, lihao.lh}@alibaba-inc.com
4
+
5
+ # ABSTRACT
6
+
7
+ In conventional object detection frameworks, a backbone body inherited from image recognition models extracts deep latent features and then a neck module fuses these latent features to capture information at different scales. As the resolution in object detection is much larger than in image recognition, the computational cost of the backbone often dominates the total inference cost. This heavy-backbone design paradigm is mostly due to the historical legacy when transferring image recognition models to object detection rather than an end-to-end optimized design for object detection. In this work, we show that such paradigm indeed leads to sub-optimal object detection models. To this end, we propose a novel heavy-neck paradigm, GiraffeDet, a giraffe-like network for efficient object detection. The GiraffeDet uses an extremely lightweight backbone and a very deep and large neck module which encourages dense information exchange among different spatial scales as well as different levels of latent semantics simultaneously. This design paradigm allows detectors to process the high-level semantic information and lowlevel spatial information at the same priority even in the early stage of the network, making it more effective in detection tasks. Numerical evaluations on multiple popular object detection benchmarks show that GiraffeDet consistently outperforms previous SOTA models across a wide spectrum of resource constraints. The source code is available at https://github.com/jyqi/GiraffeDet.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ In the past few years, remarkable progress in deep learning based object detection methods has been witnessed. Despite object detection networks getting more powerful by different designing on architecture, training strategy and so on, the meta-goal that detecting all objects with large-scale variation has not been changed. For example, the scale of the smallest and largest $10 \%$ of object instances in COCO dataset is 0.024 and 0.472 respectively (Singh & Davis, 2018), which scaling in almost 20 times. This presents an extreme challenge to handle such a large-scale variation by using recent approaches. To this end, we aim to tackle this problem by designing a scale robust approach.
12
+
13
+ To alleviate the problem arising from large-scale variations, an intuitive way is to use multi-scale pyramid strategy for both training and testing. The work of (Singh & Davis, 2018) trains and tests detectors on the same scales of an image pyramid, and selectively back-propagates the gradients of object instances of different sizes as a function of the image scale. Although this approach improves the detection performance of most existing CNN-based methods, it is not very practical, as the image pyramid methods process every scale image, which could be computationally expensive. Moreover, the scale of objects between classification and detection datasets remains another challenge in domain shift when using pre-trained classification backbones.
14
+
15
+ Alternatively, the feature pyramid network is proposed to approximate image pyramids with lower computational costs. Recent methods still rely on superior backbone designing, but insufficient information exchange between high-level features and low-level features. For example, some work enhances the entire feature hierarchy with accurate localization signals in lower layers by bottom-up path augmentation, however this bottom-up path design might lack exchange between high-level semantic information and low-level spatial information. According to the above challenges, two questions in this task are raised as follows:
16
+
17
+ • Is the backbone of the image classification task indispensable in a detection model? • What types of multi-scale representations are effective for detection tasks?
18
+
19
+ These two questions motivate us to design a new framework with two sub-tasks two i.e., efficient feature down-sampling and sufficient multi-scale fusion. First, conventional backbones for scalesensitive features generation are computationally expensive and exist domain-shift problem. An alternative lightweight backbone can solve these problems. Second, it is crucial for a detector to learn sufficient fused information between high-level semantic and low-level spatial features. According to the above motivations, we design a giraffe-like network, named as GiraffeDet, with the following insights: (1) An alternative lightweight backbone can extract multi-scale feature transformation without any additional computation costs. (2) A sufficient cross-scale connection, Queen-Fusion, like the Queen Piece pathway in chess, to deal with different levels and layers of feature fusion. (3) According to the designed lightweight backbone and flexible FPN, we propose a GiraffeDet family for each FLOPs level. Notably, the experimental results suggest that our GiraffeDet family achieves higher accuracy and better efficiency in each FLOPs level.
20
+
21
+ In summary, the key contributions of our work as follows:
22
+
23
+ • To the best of our knowledge, we present the first lightweight alternative backbone and flexible FPN combined as a detector. The proposed GiraffeDet family consists of Lightweight S2D-chain and Generalized-FPN, which demonstrates the state-of-the-art performance. • We design the lightweight space-to-depth chain (S2D-chain) instead of the conventional CNNbased backbone, and controlled experiments demonstrate that FPN is more crucial than conventional backbones in the object detection mode. • In our proposed Generalized-FPN (GFPN), a novel queen-fusion is proposed as our cross-scale connection style that fuses both level features in previous and current layers, and $\log _ { 2 } { \tt n }$ skip-layer link provides more effective information transmission that can scale into deeper networks.
24
+
25
+ Based on the light backbone and heavy neck paradigm, the GiraffeDet family models perform well in a wide range of FLOPs-performance trade-offs. In particular, with the multi-scale testing technique, GiraffeDet-D29 achieves $5 4 . 1 \%$ mAP on the COCO dataset and outperforms other SOTA methods.
26
+
27
+ # 2 RELATED WORK
28
+
29
+ It is crucial for the object detector to recognize and localize objects by learning scale-sensitive features. Traditional solutions for the large-scale variation problem mainly based on improved convolutional neural networks. CNN-based object detectors are mainly categorized by two-stage detectors and one-stage detectors. Two-stage detectors (Ren et al., 2015; Dai et al., 2016; He et al., 2017; Cai & Vasconcelos, 2018; Pang et al., 2019) predict region proposals and then refine them by a subnetwork, and one-stage detectors (Liu et al., 2016; Lin et al., 2017b; Redmon et al., 2016; Redmon & Farhadi, 2017; Tan et al., 2019; Tian et al., 2019; Zhu et al., 2019; Zhang et al., 2020; 2019; Ge et al., 2021) directly detecting bounding-boxes without the proposal generation step. In this work, we mainly conduct experiments based on one-stage detector methods.
30
+
31
+ Recently, the main research line is utilizing pyramid strategy, including image pyramid and feature pyramid. The image pyramid strategy is used for detecting instances by scaling images. For example, SNIPER (Singh et al., 2018) propose a fast multi-scale training method, which samples the foreground regions around ground-truth object and background regions for different scale training. Unlike image pyramid methods, feature pyramid methods Lin et al. (2017a); Liu et al. (2018); Chen et al. (2019a); Tan et al. (2020); Sun et al. (2021) fuse pyramidal representations that cross different scales and different semantic information layers. For instance, PANet (Liu et al., 2018) enhances the feature hierarchies on top of feature pyramid network by additional bottom-up path augmentation. Our work focuses on feature pyramid strategy and proposes a sufficient high-level semantic and low-level spatial information fusion method.
32
+
33
+ Some researchers start working on designing new architectures to solve the large-scale variation problem instead of “backbone-neck-head” architecture in detection tasks. The work of Sun et al. (2019b) proposed the FishNet as an encoder-decoder architecture with skip connections to fuse multi-scale features. SpineNet (Du et al., 2020) designed as a backbone with scale-permuted intermediate features and cross-scale connections that is learned on an object detection task by Neural Architecture Search. Our work is inspired by these methods and proposes a lightweight space-todepth backbone instead of a CNN-based backbone. However, our GiraffeDet still designed as the “backbone-neck-head” architecture. Because this typical architecture is widely used and proved effective in detection tasks.
34
+
35
+ ![](images/4b536d49e5be62c93fe90ee1f8dd0c32e90a6c4f938e69949b0d0d1aea058ad9.jpg)
36
+ Figure 1: Overview of the GiraffeDet which has three parts: 1) Body contains image preprocessing and lightweight S2D-chain;, 2) Heavy neck refines and fuses high-level semantic and low-level spatial features; 3) Head predicts the bounding box and class label of exist objects.
37
+
38
+ # 3 THE GIRAFFEDET
39
+
40
+ Although extensive research has been carried out to investigate efficient object detection, large-scale variation still remains a challenge. To achieve the goal of sufficient multi-scale information exchange efficiently, we proposed the GiraffeDet for efficient object detection, and the “giraffe” consists of lightweight space-to-depth chain, generalized-FPN and prediction networks. The overall framework is shown in Figure 1, which largly follows the one-stage detectors paradigm.
41
+
42
+ # 3.1 LIGHTWEIGHT SPACE-TO-DEPTH CHAIN
43
+
44
+ Most feature pyramid networks apply conventional CNN-based networks as the backbone to extract multi-scale feature maps and even learn information exchange. However, recent backbones became much heavier with the development of CNN, it is computationally expensive to utilize them. Moreover, most recent applied backbones are mainly pre-trained on classification dataset, e.g., ResNet50 pre-trained on ImageNet, and we argue these pre-trained backbones are inappropriate in detection task and remains the domain-shift issue. Alternatively, FPN more emphasis on high-level semantic and low-level spatial information exchange. Therefore, we assume that FPN is more crucial than conventional backbones in the object detection model.
45
+
46
+ Inspired by (Shi et al., 2016; Sajjadi et al., 2018), we propose Space-to-Depth Chain (S2D Chain) as our lightweight backbone, which includes two 3x3 convolution networks and stacked S2D blocks. Concretely, 3x3 convolutions are used for initial down-sampling and introduce more non-linear transformations. Each S2D block consists of a S2D layer and a 1x1 convolution. S2D layer moves spatial dimension information to depth dimension by uniformly sampling and reorganizing features with a fixed gap, so as to down-sample features without additional parameters. Then 1x1 convolutions are used to offer a channel-wise pooling to generate fixed-dimension feature maps. More details are shown in Appendix A.1.
47
+
48
+ ![](images/55654a3e63f40781778e79eaaf350384ded24dab8d7193147cdb5477b314cecb.jpg)
49
+ Figure 2: Illustration of the space-to-depth transformation. The S2D operation moves the activation from the spatial dimension to the channel dimension
50
+
51
+ To verify our assumption, we conduct controlled experiments on different backbone and neck computation ratios in multiple object detection of the same FLOPs in Section 4. The results show that neck is more crucial than conventional backbones in object detection task.
52
+
53
+ ![](images/6e299b3dadae9143bfc868585de20ed1555649f5b94b7dd1e4b00a41079e916e.jpg)
54
+ Figure 3: Feature pyramid network evolution design from level 3 to level 7 (P3 - P7). (a) FPN (Lin et al., 2017a) introduces a top-down pathway to fuse multi-scale features; (b) PANet (Liu et al., 2018) adds an additional bottom-up pathway on top of FPN; (c) BiFPN (Tan et al., 2020) introduces a bidirectional cross-scale pathway; (d) our GFPN contains both queen-fusion style pathway and skip-layer connection. The dashed box refers to the layer in each FPN design.
55
+
56
+ # 3.2 GENERALIZED-FPN
57
+
58
+ In feature pyramid network, multi-scale feature fusion aims to aggregate different resolution features that are extracted from the backbone. Figure 3 shows the evolution of feature pyramid network design. Conventional FPN (Lin et al., 2017a) introduces a top-down pathway to fuse multi-scale features from level 3 to 7. Considering the limitation of one-way information flow, PANet(Liu et al., 2018) adds an extra bottom-up path aggregation network, but with more computational cost. Besides, BiFPN (Tan et al., 2020) removes nodes that only have one input edge, and add extra edge from the original input on the same level. However, we observe that previous methods focus only on feature fusion, but lack the inner block connection. Therefore, we design a novel pathway fusion including skip-layer and cross-scale connections, as shown in Figure 3(d).
59
+
60
+ Skip-layer Connection. Compared to other connection methods, skip connections have short distances among feature layers during back-propagation. In order to reduce gradient vanish in such a heavy “giraffe” neck, we propose two feature link methods: dense-link and $\log _ { 2 } n$ -link in our proposed GFPN, as shown in Figure 4.
61
+
62
+ ![](images/ee7a226b5c26b9f1018f43e0f8acde2fb6dc066b22af5c94d9850269a6133fb6.jpg)
63
+ Figure 4: Two link mode of skip-layer connection: (a) dense-link: the concatenation of all preceding layers (b) $\log _ { 2 } \mathrm { n }$ -link: the concatenation of at most $\mathrm { \ } l o g _ { 2 } l + 1$ layers.
64
+
65
+ • dense-link: Inspired by DenseNet (Huang et al., 2017), for each scale feature $P _ { k } ^ { l }$ in level $k$ , Consequently, the $l ^ { t h }$ layer receives the feature-maps of all preceding layers:
66
+
67
+ $$
68
+ P _ { k } ^ { l } = C o n v ( C o n c a t ( P _ { k } ^ { 0 } , . . . , P _ { k } ^ { l - 1 } ) ) ,
69
+ $$
70
+
71
+ where $C o n c a t ( )$ refers to the concatenation of the feature-maps produced in all preceding layers, and $C o n v ( )$ represents a $3 { \tt X } 3$ convolution.
72
+
73
+ • $l o g _ { 2 } n$ -link: Specifically, in each level $k$ , the ${ { l } ^ { t h } }$ layer receives the feature-maps from at most $\mathrm { \it { l o g } _ { 2 } } \mathrm { \it { l } } + 1$ number of preceding layers, and these input layers are exponentially apart from depth i with base 2, as denoted:
74
+
75
+ $$
76
+ P _ { k } ^ { l } = C o n v ( C o n c a t ( P _ { k } ^ { l - 2 ^ { n } } , . . . , P _ { k } ^ { l - 2 ^ { 1 } } , P _ { k } ^ { l - 2 ^ { 0 } } ) ) ,
77
+ $$
78
+
79
+ where $l - 2 ^ { n } \geq 0$ , Concat() and $C o n v ( )$ also represent concatenation and $3 { \bf x } 3$ convolution respectively. Compare to dense-link at depth $l$ , the time complexity of $\log _ { 2 } n$ -link only cost $O ( l \cdot l o g _ { 2 } l )$ , instead of $\hat { O ( l ^ { 2 } ) }$ . Moreover, $l o g _ { 2 } n$ -link only increase the short distances among layers during backpropagation from 1 to $1 + 1 0 \mathrm { g } _ { 2 } l$ . Hence, $\log _ { 2 } n$ -link can scale to deeper networks.
80
+
81
+ ![](images/31349e5cc3108673e7573e98a590752a8fdc4cf5e17eff98c78a6de15f146219.jpg)
82
+ Figure 5: Illustration of cross-scale connection between PANet and our Queen-fusion in GFPN. S and C represent summation and concatenation fusion style, and $\dot { P } _ { k }$ denotes node in next layer.
83
+
84
+ Cross-scale Connection. Based on our assumption, our designed sufficient information exchange should contains not only skip-layer connection, but also cross-scale connection, to overcome largescale variation. Previous works in connecting features between adjacent layers only consider same level feature (Liu et al., 2018) or previous level feature (Tan et al., 2020). Therefore, we propose a new cross-scale fusion named as Queen-fusion, that considering both same level and neighbor level features as shown in Figure 3(d), like playing the queen piece in chess. As an example shown in Figure 5(b), the concatenation of Queen-fusion in $P _ { 5 }$ consists previous layer $P _ { 4 }$ down-sampling, previous layer $P _ { 6 }$ up-sampling, previous layer $P _ { 5 }$ and current layer $P _ { 4 }$ . In this work, we apply bilinear interpolation and max-pooling as our up-sampling and down-sampling functions respectively.
85
+
86
+ Therefore, in the extreme large-scale variation scenario, it requires that the model has sufficient high-level and low-level information exchange. Based on the mechanism of our skip-layer and cross-scale connections, the proposed generalized-FPN can be expanded as long as possible, just like the “giraffe neck”. With such a “heavy neck” and a lightweight backbone, our GiraffeDet can balance higher accuracy and better efficiency trade-off.
87
+
88
+ # 3.3 GIRAFFEDET FAMILY
89
+
90
+ According to our proposed S2D-chain and Generalized-FPN, we can develop a family of different GiraffeDet scaling models that can overcome a wide range of resource constraints. Previous work scale up its detector in the inefficient way, as changing bigger backbone networks like ResNeXt (Xie et al., 2017), or stacking FPN blocks e.g., NAS-FPN (Ghiasi et al., 2019). Specially, EfficientDet (Tan et al., 2020) start using compound coefficient $\phi$ to jointly scale up all dimensions of backbone. Different from EfficientDet, we only focus on the scaling of GFPN layers instead of the whole framework including lightweight backbone. Specifically, we apply two coefficients $\phi _ { d }$ and $\phi _ { w }$ to flexibly scale GFPN depth and width.
91
+
92
+ Based on our GFPN and eS2D chain, we have developed a GiraffeDet family. Most previous work scale up a baseline detector by changing bigger backbone networks, since their model mainly focus on a single or limited scaling dimensions. As we assume backbone is not critical for object detection task, the GiffeDet family only focus on the scaling of generalized-FPN. Two multipliers are proposed to control the depth (# of layers) and width (# of channels) for GFPN:
93
+
94
+ Table 1: The scaling config for GiraffeDet family $- \quad \phi _ { d }$ is the hyper−parameter that denotes the depth $\#$ of layers) of GFPN. The width (# of channels) of GFPN can be calculated based on $\phi _ { w }$ by Equation 3.
95
+
96
+ $$
97
+ D _ { g f p n } = \phi _ { d } , \ W _ { g f p n } = 2 5 6 * \phi _ { w } ,
98
+ $$
99
+
100
+ Following above setting and equation. 3, we have developed six architectures of GiraffeDet, as shown in Table 1. GiraffeDet-D7,D11,D14,D16 have the same level FLOPs with ResNet-series based model and we compare performance of GiraffeDet family with SOTA models in the next section. Note that the layer of GFPN is different with other FPN design as shown in Figure 3. In our proposed GFPN, each layer represents one depth, while the layer of PANet and BiFPN contains two depth.
101
+
102
+ <table><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>Generalized-FPNd w</td></tr><tr><td rowspan=1 colspan=1>Giraffe-D7</td><td rowspan=1 colspan=1>7 0.7</td></tr><tr><td rowspan=1 colspan=1>Giraffe-D11</td><td rowspan=1 colspan=1>11 0.85</td></tr><tr><td rowspan=1 colspan=1>Giraffe-D14</td><td rowspan=1 colspan=1>14 0.95</td></tr><tr><td rowspan=1 colspan=1>Giraffe-D16</td><td rowspan=1 colspan=1>16 1.0</td></tr><tr><td rowspan=1 colspan=1>Giraffe-D25</td><td rowspan=1 colspan=1>25 1.15</td></tr><tr><td rowspan=1 colspan=1>Giraffe-D29</td><td rowspan=1 colspan=1>29 1.2</td></tr></table>
103
+
104
+ # 4 EXPERIMENTS
105
+
106
+ In this section, we first introduce the implementation details and present our experimental result on the COCO dataset (Lin et al., 2014). Then compare our proposed GiraffeDet family with other state-of-the-art methods, and an in-depth analysis is provided to better understand our framework.
107
+
108
+ # 4.1 DATASET AND IMPLEMENTATION DETAILS
109
+
110
+ COCO dataset. We evaluate GiraffeDet on COCO 2017 detection dataset with 80 object categories. It includes $1 1 5 \mathrm { k }$ images for training (train), $5 \mathrm { k }$ images for validation $( v a l )$ and $2 0 \mathrm { k }$ images with no public ground-truth for testing $( t e s t - d e v )$ . The training of all methods is conducted on the $1 1 5 \mathrm { k }$ training images. We report results on the validation dataset for ablation study and results of the testdev dataset from the evaluation server for state-of-the-art comparison and DCN related comparison.
111
+
112
+ For fair comparison, all results are produced under mmdetection (Chen et al., 2019b) and the standard COCO-style evaluation protocol. GFocalV2 (Li et al., 2021) and ATSS (Zhang et al., 2020) are applied as head and anchor assigner, respectively. Following the the work of (He et al., 2019), all models are trained from scratch to reduce the influence of pre-train backbones on ImageNet. The shorter side of input images is resized to 800 and the maximum size is restricted within 1333. To enhance the stability of scratch training, we adopt multi-scale training for all models, including: $2 \mathbf { x }$ imagenet-pretrained (p-2x) learning schedule (24 epochs, decays at 16 and 22 epochs) only in R2-101-DCN backbone experiments, and $3 \mathbf { x }$ scratch (s-3x) learning schedule (36 epochs, decays at 28 and 33 epochs) in ablation study, and 6x scratch (s-6x) learning schedule (72 epochs, decays at 65 and 71 epochs) in state-of-the-art comparison. More implementation details in Appendix B.
113
+
114
+ # 4.2 QUANTITATIVE EVALUATION ON COCO DATASET
115
+
116
+ We compare GiraffeDet with state-of-the-art approaches in Table. 2. Unless otherwise stated, singlemodel and single-scale setting with no test-time augmentation is applied. We report accuracy for both test-dev (20k images with no public ground-truth) and val with 5k validation images. We group models together if they have similar FLOPs and compare their accuracy in each group. Notably, model performance depends on both network architecture and training settings. We refer most models from their paper. But for a fair comparison, we also reproduce some of RetinaNet (Lin et al., 2017b), FCOS (Tian et al., 2019), HRNet (Sun et al., 2019a), GFLV2 (Li et al., 2021) with 6x training from scratch, which denoted as $^ \dagger$ .
117
+
118
+ Large-scale Variance. According to the performance of Figure 6, we can observe that our proposed GiraffeDet achieves the best performance in each pixel scale range, which indicates that the light backbone and heavy-neck paradigm, as well as our proposed GFPN, can effectively solve a large-scale variance problem. Also, under the skip-layer and crossscale connections, high-level semantic information and low-level spatial information can be sufficiently exchanged. Many object instances are smaller than $1 \%$ of the image area in the COCO dataset, making detectors difficult to detect. Even though extremely small instance are difficult to detect, our method still outperforms $5 . 7 \%$ mAP than RetinaNet in the pixel range 0-32, which outperforms the same mAP in the middle pixel range 80-144. Notably, in the scale of pixel range 192-256, the proposed GiraffeDet outperforms the most than other methods, which proves that our design can learn scale-sensitive features effectively.
119
+
120
+ ![](images/04cfcc9cfa6b7a1079456149cf77f6931b12b5b7d27fc4e21e369fae01c75c80.jpg)
121
+ Figure 6: mAP on all scale of object instances (pixels) in five different models under R50 FLOPs level and 6x scratch training, including HRNet (Sun et al., 2019a), GFocalV2 (Li et al., 2021), RetinaNet (Lin et al., 2017b), FCOS (Tian et al., 2019) and our proposed GiraffeDet.
122
+
123
+ Table 2: GiraffeDet performance on COCO - Results for single-model single-scale. test-dev is the COCO test set and val is the validation set. $\dagger$ means that the results are reproduced by 6x scratch training, others are referred from their paper. We group models together if they have similar FLOPs, and compare their accuracy in each group. $\mathbf { M S } _ { t e s t }$ : multiscale testing, R: ResNet, X: ResNext, and W: low-level features map width in HRNet (# of channels). The head and anchor assigner of GiraffeDet family are GFocalV2 and ATSS.
124
+
125
+ <table><tr><td></td><td>#FLOPs</td><td>#FLOPs</td><td>#FLOPs</td><td colspan="4">test-dev</td><td>val-2017</td></tr><tr><td>Model</td><td>Backbone</td><td>Neck</td><td>total</td><td>APtest</td><td>APs</td><td>APM</td><td>APL</td><td>APval</td></tr><tr><td>Yolov3-darknet53</td><td>139.82</td><td>32.54</td><td>187.73</td><td>33.0</td><td>18.3</td><td>35.4</td><td>41.9</td><td>33.8</td></tr><tr><td>RetinaNet-R50t</td><td>76.15</td><td>16.6</td><td>229.59</td><td>40.4</td><td>23.1</td><td>43.3</td><td>52.2</td><td>40.2</td></tr><tr><td>FCOS-R50t</td><td>76.15</td><td>16.6</td><td>192.39</td><td>42.9</td><td>26.6</td><td>46.5</td><td>53.8</td><td>42.7</td></tr><tr><td>GFLV2-R50 GFLV2-R50t</td><td>76.15</td><td>16.6</td><td>199.96</td><td>44.3</td><td>26.8</td><td>47.7</td><td>54.1</td><td>43.9</td></tr><tr><td>HRNetV2p-W18</td><td>76.15 65.13</td><td>16.6</td><td>199.96 182.06</td><td>44.8</td><td>27.2 23.1</td><td>48.1</td><td>54.4 49.2</td><td>44.5 38.1</td></tr><tr><td>HRNetV2p-W18t</td><td>65.13</td><td>16.34 16.34</td><td>182.06</td><td>38.3 40.6</td><td>25.7</td><td>41.5 43.3</td><td>50.6</td><td>40.2</td></tr><tr><td>GiraffeDet-D7</td><td>3.89</td><td>76.13</td><td>186.71</td><td>45.6</td><td>28.8</td><td>48.7</td><td>55.6</td><td>44.9</td></tr><tr><td>RetinaNet-R101</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>FCOS-R101</td><td>153.74</td><td>16.6 16.6</td><td>302.62 265.38</td><td>39.1</td><td>21.8 24.4</td><td>42.7 44.8</td><td>50.2</td><td>38.9 40.8</td></tr><tr><td>ATSS-R101</td><td>153.74</td><td>16.6</td><td></td><td>41.5</td><td>26.1</td><td></td><td>51.6</td><td>41.5</td></tr><tr><td>PAA-R101</td><td>153.74 153.74</td><td>16.6</td><td>269.94 269.94</td><td>43.6 44.8</td><td>26.5</td><td>47.0 48.8</td><td>53.6 56.3</td><td>43.5</td></tr><tr><td>GFLV2-R101</td><td>153.74</td><td>16.6</td><td>272.99</td><td>46.2</td><td>27.8</td><td>49.9</td><td></td><td>45.9</td></tr><tr><td>HRNetV2p-W32</td><td>155.8</td><td>19.64</td><td>276.03</td><td>40.5</td><td>23.4</td><td>42.6</td><td>57.0 51.0</td><td>40.3</td></tr><tr><td>HRNetV2p-W32t</td><td>155.8</td><td>19.64</td><td>276.03</td><td>44.6</td><td>27.9</td><td>48.0</td><td>56.8</td><td>44.1</td></tr><tr><td>GiraffeDet-D11</td><td>3.89</td><td>166.73</td><td>275.39</td><td>46.9</td><td>29.9</td><td>51.1</td><td>58.4</td><td>46.6</td></tr><tr><td>RetinaNet-R152</td><td>226.84</td><td>16.6</td><td>375.72</td><td></td><td>28.4</td><td></td><td></td><td></td></tr><tr><td>HRNetV2p-W40</td><td>229.57</td><td>21.52</td><td>351.69</td><td>45.1 42.8</td><td>27.0</td><td>48.8 46.4</td><td>58.2 54.5</td><td>- 42.7</td></tr><tr><td>GiraffeDet-D14</td><td>3.89</td><td>251.9</td><td>361.98</td><td>47.7</td><td>30.9</td><td>51.6</td><td>60.3</td><td>47.3</td></tr><tr><td>FSAF-X101-64x4d</td><td>304.68</td><td>16.6</td><td>421.86</td><td>42.9</td><td>26.6</td><td>46.2</td><td></td><td></td></tr><tr><td>libraRCNN-X101-64x4d</td><td>304.68</td><td>16.6</td><td>424.32</td><td>43.0</td><td>25.3</td><td>45.6</td><td>52.7 54.6</td><td>42.4</td></tr><tr><td>FreeAnchor-X101-64x4d</td><td>304.68</td><td>16.6</td><td>458.07</td><td>44.9</td><td>26.5</td><td>48.0</td><td>56.5</td><td>42.7</td></tr><tr><td>FCOS-X101-64x4d</td><td>304.68</td><td>16.6</td><td>420.87</td><td>43.2</td><td>26.5</td><td>46.2</td><td>53.3</td><td>-</td></tr><tr><td>ATSS-X101-64x4d</td><td>304.68</td><td>16.6</td><td>425.43</td><td></td><td>28.5</td><td></td><td></td><td>42.6</td></tr><tr><td>OTA-X101-64x4d</td><td>304.68</td><td>16.6</td><td>453.55</td><td>45.6</td><td></td><td>48.9</td><td>55.6</td><td>-</td></tr><tr><td>GiraffeDet-D16</td><td>3.89</td><td>315.69</td><td>438.59</td><td>47.0 48.7</td><td>29.2 31.7</td><td>50.4 52.4</td><td>57.9 61.3</td><td>-</td></tr><tr><td>GiraffeDet-D25</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>48.3</td></tr><tr><td>GiraffeDet-D29</td><td>3.89 3.89</td><td>681.02 865.44</td><td>785.4 972.97</td><td>50.5 51.3</td><td>32.2</td><td>54.2 54.9</td><td>63.5 64.9</td><td>49.9 51.0</td></tr><tr><td>GiraffeDet-D29+MStest</td><td>3.89</td><td>865.44</td><td>972.97</td><td>54.1</td><td>33.1 35.9</td><td>56.8</td><td>67.2</td><td>53.9</td></tr></table>
126
+
127
+ Comparison with State-of-the-art Methods. Table 2 shows that our GiraffeDet family achieves better performance than previous detectors in each same level of FLOPs, which indicates that our method can detect objects effectively and efficiently. 1) Compared to ResNet-based methods on the low-level FLOPs scale, we found that, even if the overall performance is obviously not increased too much, our method has a significant performance in detecting small and large object cases. It indicates our method performs better in large-scale variation dataset. 2) Compared to ResNextbased methods in high-level FLOPs scale, we find that GiraffeDet has a higher performance than in low-level FLOPs slot, which indicates that a good design of FPN can be more crucial than a heavy backbone. 3) Compared to other methods, the proposed GiraffeDet family also has the SOTA performance that proves our design achieves higher accuracy and better efficiency in each FLOPs level. Besides, the NAS-based method consumes a ton of computational resources to cover the search space in the training process, and therefore we do not consider comparing our method with them. Finally, with the multi-scale test protocol, our GiraffeDet achieve $5 4 . 1 \%$ mAP, especially $\mathsf { A P } _ { S }$ increases $2 . 8 \%$ and $\mathsf { A P } _ { L }$ increases $2 . 3 \%$ much more than $1 . 9 \%$ in $\mathsf { A P } _ { M }$ .
128
+
129
+ # 4.3 ABLATION STUDY
130
+
131
+ The success of our GiraffeDet can be attributed to both framework design and technical improvements in each component. To analyze the effect of each component in GiraffeDet, we construct ablation studies including: 1) Connection analysis in generalized-FPN; 2) Depth & Width in GFPN; 3) Backbone discussion; 4) GirrafeDet with DCN. More ablation study can be seen in Appendix C.
132
+
133
+ Table 3: Ablation study on the Connection analysis. The model of “GFPN w/o skip” neck designed without any skip-layer connection, “GFPN-dense” neck model utilizes dense-link and “GFPNlog2n” neck model utilizes $\log _ { 2 } \mathrm { n } \cdot$ -link.
134
+
135
+ <table><tr><td>Backbone</td><td>Neck</td><td>training</td><td>FLOPs(G)</td><td>APual</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>S2D chain</td><td>stacked FPN</td><td>s-3x</td><td>276.11</td><td>38.8</td><td>54.3</td><td>42.2</td><td>23.1</td><td>41.9</td><td>50.6</td></tr><tr><td>S2D chain</td><td>stacked PANet</td><td>s-3x</td><td>275.32</td><td>40.5</td><td>56.3</td><td>43.9</td><td>24.3</td><td>43.8</td><td>52.1</td></tr><tr><td>S2D chain</td><td>stacked BiFPN</td><td>s-3x</td><td>273.1</td><td>41.0</td><td>57.1</td><td>44.3</td><td>24.0</td><td>43.6</td><td>51.9</td></tr><tr><td>S2D chain</td><td>GFPN w/o skip</td><td>s-3x</td><td>273.51</td><td>41.2</td><td>57.0</td><td>44.3</td><td>25.7</td><td>43.5</td><td>51.9</td></tr><tr><td>S2D chain</td><td>GFPN-dense</td><td>s-3x</td><td>273.43</td><td>41.3</td><td>57.1</td><td>44.4</td><td>26.0</td><td>43.8</td><td>52.2</td></tr><tr><td>S2D chain</td><td>GFPN-log2n</td><td>s-3x</td><td>275.39</td><td>41.8</td><td>58.1</td><td>45.7</td><td>26.4</td><td>44.9</td><td>52.7</td></tr></table>
136
+
137
+ Connection Analysis. There are multiple options for constructing pathways between nodes, which are mainly based on graph theory design and human empirical design. Different connections represent different exchanges of information on feature maps. We construct ablation study models and conduct experiments to investigate the effects of our proposed connections. In addition, we stacked basic FPN, PANet and BiFPN several times for fair comparison on the same FLOPs level and used the same backbone and prediction head. Results are given in Table 3.
138
+
139
+ • Skip-layer Connection. According to the results of GFPN-dense and GFPN-log2n neck of GiraffeDet, we observe that $\log _ { 2 } { \tt n }$ connection has achieved the best performance, and dense connection only performs slightly better than without any skip-layer connection. It indicates that the $\log _ { 2 } { \tt n }$ connection provides more effective information transmission from early nodes to later, while dense connection might provides redundant information transmission. Meanwhile, log2n connection can provides deeper generalized-FPN on the same level of FLOPs. Notably, both generalized-FPN connections obtain higher performance than stacked BiFPN, which can prove that our proposed GiraffeDet can be more efficient.
140
+
141
+ • Cross-scale Connection. From Table 3, we can see that stacked PANet and stacked BiFPN can achieve higher accuracy than their basic structure with bidirectional information flow, which indicates the importance of information exchange in FPN structure. Overall, our GiraffeDet model can achieve better performance, which proves that our Queen-fusion can obtain sufficient high-level and low-level information exchange from previous nodes. Especially, even without skip-layer connection, our generalized-FPN can still outperform other methods.
142
+
143
+ Table 4: Ablation study on Depth & Width analysis. All models apply S2D-chain as their backbone. “GFPN-log2n” denotes the GFPN neck utilizes log2n-link.
144
+
145
+ <table><tr><td>Backbone</td><td>Neck</td><td>depth</td><td>width</td><td>training</td><td>FLOPs(G)</td><td>APual</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>S2D chain</td><td>stacked FPN</td><td>11</td><td>307</td><td>s-3x</td><td>274.67</td><td>38.3</td><td>55.0</td><td>41.2</td><td>22.0</td><td>42.1</td><td>51.5</td></tr><tr><td>S2D chain</td><td>stacked PANet</td><td>11</td><td>308</td><td>s-3x</td><td>274.41</td><td>40.6</td><td>56.9</td><td>44.3</td><td>24.2</td><td>44.1</td><td>52.0</td></tr><tr><td>S2D chain</td><td>stacked BiFPN</td><td>11</td><td>400</td><td>s-3x</td><td>274.51</td><td>40.5</td><td>56.8</td><td>43.9</td><td>24.1</td><td>43.6</td><td>52.0</td></tr><tr><td>S2D chain</td><td>stacked FPN</td><td>19</td><td>221</td><td>s-3x</td><td>276.11</td><td>38.8</td><td>54.3</td><td>42.2</td><td>23.1</td><td>41.9</td><td>50.6</td></tr><tr><td>S2D chain</td><td>stacked PANet</td><td>19</td><td>221</td><td>s-3x</td><td>275.32</td><td>40.5</td><td>56.3</td><td>43.9</td><td>24.3</td><td>43.8</td><td>52.1</td></tr><tr><td>S2D chain</td><td>stacked BiFPN</td><td>29</td><td>221</td><td>s-3x</td><td>273.1</td><td>41.0</td><td>57.1</td><td>44.3</td><td>24.0</td><td>43.6</td><td>51.9</td></tr><tr><td>S2D chain</td><td>GFPN-log2n</td><td>11</td><td>221</td><td>s-3x</td><td>275.39</td><td>41.8</td><td>58.1</td><td>45.7</td><td>26.4</td><td>44.9</td><td>52.7</td></tr></table>
146
+
147
+ Effect of Depth & Width. To further fairly comparison with different “Neck”, we conduct two groups of experiments comparison with stacked basic FPN, PANet and BiFPN on the same FLOPs level, in order to analysis the effectiveness of depth and width (number of channel) in our proposed generalized-FPN. Note that as shown in Figure 3, each layer of our GFPN and FPN contains one depth, while the layer of PANet and BiFPN contains two depth. As shown in Table 4, we observe that our proposed GFPN outperforms both level of depth and width in all kinds of FPN, which also indicates that the $\log _ { 2 } \mathrm { n }$ connection can provide information transmission effectively and the designed Queen-fusion can provide information exchange sufficiently. Moreover, our proposed GFPN can achieve higher performance in a smaller design, as “11” depth and “221” width, which indicates that our design can achieve multi-scale detection efficiently.
148
+
149
+ Backbone Effects. Figure 7 shows the performance of different neck depth and different backbones in the same FLOPs level. The results show that the combination of S2D-chain and GFPN outperforms other backbone models, which can verify our assumption that FPN is more crucial and conventional backbone would not improve performance as depth increasing. In particular, we can observe that performance even decreases with the growth of the backbone model. We consider this might because the domain-shift problem remains higher in a large backbone, and it also proves our assumption.
150
+
151
+ ![](images/06aac5e302076cc4362865eadd25104ea3e4e59ee4ed2fe062c56da7864dbb3a.jpg)
152
+ Figure 7: Ablation study on different backbones: a) S2D-chain with GFPN-D11; b) ResNet-18 with GFPN-D10; c) ResNet-34 with GFPN-D8; d) ResNet 18 with stacked BiFPN; e) ResNet50 with GFPN-D7; f) DarkNet with GFPN-D4; g) ResNet-101 with GFPN-D2.
153
+
154
+ Table 5: val-2017 results of the deformable convolution network applied in GiraffeDet-D11. $^ \ddag$ denotes the GFPN with synchronized batch normalization (Zhang et al., 2018) for multi-GPU training.
155
+
156
+ <table><tr><td>Backbone</td><td>Neck</td><td>training</td><td>DCN|APual</td><td></td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>S2D chain</td><td>GFPN-D11</td><td>s-3x</td><td></td><td>41.8</td><td>58.1</td><td>45.7</td><td>26.4</td><td>44.9</td><td>52.7</td></tr><tr><td>S2D chain</td><td>GFPN-D11#</td><td>s-3x</td><td></td><td>42.9</td><td>59.6</td><td>46.9</td><td>27.1</td><td>46.5</td><td>54.1</td></tr><tr><td>S2D chain</td><td>GFPN-D11</td><td>s-3x</td><td>√</td><td>45.3</td><td>62.4</td><td>49.6</td><td>28.5</td><td>49.3</td><td>56.9</td></tr><tr><td>S2D chain</td><td>GFPN-D11</td><td>s-6x</td><td></td><td>46.6</td><td>64.0</td><td>51.1</td><td>29.6</td><td>50.8</td><td>57.9</td></tr><tr><td>S2D chain</td><td>GFPN-D11 #</td><td>s-6x</td><td>√</td><td>49.3</td><td>66.9</td><td>53.8</td><td>31.6</td><td>53.2</td><td>61.7</td></tr></table>
157
+
158
+ Table 6: val-2017 results of Res2Net-101-DCN (R2-101-DCN) backbone with multiple GFPN necks. GFPNtiny refers to GFPN of depth as 8 and width as 122 (same FLOPs level as FPN).
159
+
160
+ <table><tr><td>Backbone</td><td>Neck</td><td>Head</td><td>training</td><td>APual</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td><td>FPS</td></tr><tr><td>R2-101-DCN</td><td>FPN</td><td>GFLV2</td><td>p-2x</td><td>49.9</td><td>68.2</td><td>54.6</td><td>31.3</td><td>54.0</td><td>65.5</td><td>11.7</td></tr><tr><td>R2-101-DCN</td><td>GFPN-tiny</td><td>GFLV2</td><td>p-2x</td><td>50.2</td><td>68.0</td><td>54.8</td><td>32.4</td><td>54.7</td><td>65.5</td><td>11.2</td></tr><tr><td>R2-101-DCN</td><td>GFPN-D11</td><td>GFLV2</td><td>p-2x</td><td>51.1</td><td>69.3</td><td>55.5</td><td>32.6</td><td>56.0</td><td>65.7</td><td>10.1</td></tr><tr><td>R2-101-DCN</td><td>GFPN-D11</td><td>GFLV2</td><td>s-6x</td><td>52.3</td><td>70.2</td><td>56.7</td><td>33.9</td><td>56.8</td><td>66.9</td><td>10.1</td></tr></table>
161
+
162
+ # Results with DCN
163
+
164
+ We then conduct experiments to analyse deformable convolution network (DCN)(Dai et al., 2017) in our GiraffeDet, which has been widely used for improving detection performance recently. As shown in Table 5, we observe that DCN can significantly improve the performance of our GiraffeDet. Especially, according to Table 2, GiraffeDet-D11 with DCN can achieve a better performance than GiraffeDet-D16. Also under acceptable inference time, we observe that such a shallow GFPN (tiny) with a strong DCN backbone can improve the performance, and the performance has been largely increased with the growth of GFPN depth, as shown in Table 6. Note that as the design of GFPN, Our GiraffeDet is more suitable for scratch training and has significant improvement.
165
+
166
+ # 5 CONCLUSION
167
+
168
+ In this paper, we propose a novel heavy-neck paradigm framework, GiraffeDet, a giraffe-like network, to address the problem of large-scale variation. In particular, GiraffeDet uses a lightweight spatial-to-depth chain as a backbone, and the proposed generalized-FPN as a heavy neck. The spatial-to-depth chain is applied to extract multi-scale image features in a lightweight way, and the generalized-FPN is proposed to learn sufficient high-level semantic information and low-level spatial information exchange. Extensive results manifested that the proposed GiraffeDet family achieves higher accuracy and better efficiency, especially detecting small and large object instances.
169
+
170
+ # REFERENCES
171
+
172
+ Zhaowei Cai and Nuno Vasconcelos. Cascade r-cnn: Delving into high quality object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6154–6162, 2018.
173
+
174
+ Hesen Chen, Ming Lin, Xiuyu Sun, Qian Qi, Hao Li, and Rong Jin. Muffnet: Multi-layer feature federation for mobile deep learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision Workshops, pp. 0–0, 2019a.
175
+
176
+ Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, et al. Mmdetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019b.
177
+
178
+ Jifeng Dai, Yi Li, Kaiming He, and Jian Sun. R-fcn: Object detection via region-based fully convolutional networks. In Advances in neural information processing systems, pp. 379–387, 2016.
179
+
180
+ Jifeng Dai, Haozhi Qi, Yuwen Xiong, Yi Li, Guodong Zhang, Han Hu, and Yichen Wei. Deformable convolutional networks. In Proceedings of the IEEE international conference on computer vision, pp. 764–773, 2017.
181
+
182
+ Xianzhi Du, Tsung-Yi Lin, Pengchong Jin, Golnaz Ghiasi, Mingxing Tan, Yin Cui, Quoc V Le, and Xiaodan Song. Spinenet: Learning scale-permuted backbone for recognition and localization. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 11592–11601, 2020.
183
+
184
+ Zheng Ge, Songtao Liu, Zeming Li, Osamu Yoshie, and Jian Sun. Ota: Optimal transport assignment for object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 303–312, 2021.
185
+
186
+ Golnaz Ghiasi, Tsung-Yi Lin, and Quoc V Le. Nas-fpn: Learning scalable feature pyramid architecture for object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 7036–7045, 2019.
187
+
188
+ Kaiming He, Georgia Gkioxari, Piotr Dollar, and Ross Girshick. Mask r-cnn. In ´ Proceedings of the IEEE international conference on computer vision, pp. 2961–2969, 2017.
189
+
190
+ Kaiming He, Ross Girshick, and Piotr Dollar. Rethinking imagenet pre-training. In ´ Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4918–4927, 2019.
191
+
192
+ 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.
193
+
194
+ Xiang Li, Wenhai Wang, Xiaolin Hu, Jun Li, Jinhui Tang, and Jian Yang. Generalized focal loss v2: Learning reliable localization quality estimation for dense object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11632–11641, 2021.
195
+
196
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ´ European conference on computer vision, pp. 740–755. Springer, 2014.
197
+
198
+ Tsung-Yi Lin, Piotr Dollar, Ross Girshick, Kaiming He, Bharath Hariharan, and Serge Belongie. ´ Feature pyramid networks for object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2117–2125, 2017a.
199
+
200
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense ´ object detection. In Proceedings of the IEEE international conference on computer vision, pp. 2980–2988, 2017b.
201
+
202
+ Shu Liu, Lu Qi, Haifang Qin, Jianping Shi, and Jiaya Jia. Path aggregation network for instance segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 8759–8768, 2018.
203
+
204
+ Wei Liu, Dragomir Anguelov, Dumitru Erhan, Christian Szegedy, Scott Reed, Cheng-Yang Fu, and Alexander C Berg. Ssd: Single shot multibox detector. In European conference on computer vision, pp. 21–37. Springer, 2016.
205
+
206
+ Jiangmiao Pang, Kai Chen, Jianping Shi, Huajun Feng, Wanli Ouyang, and Dahua Lin. Libra r-cnn: Towards balanced learning for object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 821–830, 2019.
207
+
208
+ Joseph Redmon and Ali Farhadi. Yolo9000: better, faster, stronger. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7263–7271, 2017.
209
+
210
+ Joseph Redmon, Santosh Divvala, Ross Girshick, and Ali Farhadi. You only look once: Unified, real-time object detection. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 779–788, 2016.
211
+
212
+ 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.
213
+
214
+ Mehdi SM Sajjadi, Raviteja Vemulapalli, and Matthew Brown. Frame-recurrent video superresolution. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6626–6634, 2018.
215
+
216
+ Wenzhe Shi, Jose Caballero, Ferenc Huszar, Johannes Totz, Andrew P Aitken, Rob Bishop, Daniel ´ Rueckert, and Zehan Wang. Real-time single image and video super-resolution using an efficient sub-pixel convolutional neural network. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1874–1883, 2016.
217
+
218
+ Bharat Singh and Larry S Davis. An analysis of scale invariance in object detection snip. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 3578–3587, 2018.
219
+
220
+ Bharat Singh, Mahyar Najibi, and Larry S Davis. Sniper: Efficient multi-scale training. arXiv preprint arXiv:1805.09300, 2018.
221
+
222
+ Ke Sun, Bin Xiao, Dong Liu, and Jingdong Wang. Deep high-resolution representation learning for human pose estimation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5693–5703, 2019a.
223
+
224
+ Shuyang Sun, Jiangmiao Pang, Jianping Shi, Shuai Yi, and Wanli Ouyang. Fishnet: A versatile backbone for image, region, and pixel level prediction. arXiv preprint arXiv:1901.03495, 2019b.
225
+
226
+ Zhenhong Sun, Ming Lin, Xiuyu Sun, Zhiyu Tan, and Rong Jin. Revisiting efficient object detection backbones from zero-shot neural architecture search. arXiv preprint arXiv:2111.13336, 2021.
227
+
228
+ Mingxing Tan, Ruoming Pang, and Quoc V Le. Efficientdet: Scalable and efficient object detection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 10781–10790, 2020.
229
+
230
+ Zhiyu Tan, Xuecheng Nie, Qi Qian, Nan Li, and Hao Li. Learning to rank proposals for object detection. In ICCV, 2019.
231
+
232
+ Zhi Tian, Chunhua Shen, Hao Chen, and Tong He. Fcos: Fully convolutional one-stage object detection. In Proceedings of the IEEE/CVF international conference on computer vision, pp. 9627–9636, 2019.
233
+
234
+ Saining Xie, Ross Girshick, Piotr Dollar, Zhuowen Tu, and Kaiming He. Aggregated residual trans- ´ formations for deep neural networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 1492–1500, 2017.
235
+
236
+ Hang Zhang, Kristin Dana, Jianping Shi, Zhongyue Zhang, Xiaogang Wang, Ambrish Tyagi, and Amit Agrawal. Context encoding for semantic segmentation. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 7151–7160, 2018.
237
+
238
+ Shifeng Zhang, Cheng Chi, Yongqiang Yao, Zhen Lei, and Stan Z Li. Bridging the gap between anchor-based and anchor-free detection via adaptive training sample selection. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 9759–9768, 2020.
239
+
240
+ Xiaosong Zhang, Fang Wan, Chang Liu, Rongrong Ji, and Qixiang Ye. Freeanchor: Learning to match anchors for visual object detection. arXiv preprint arXiv:1909.02466, 2019.
241
+
242
+ Chenchen Zhu, Yihui He, and Marios Savvides. Feature selective anchor-free module for single-shot object detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 840–849, 2019.
243
+
244
+ # A ARCHITECTURE DETAILS
245
+
246
+ A.1 S2D CHAIN DESIGN
247
+
248
+ ![](images/cb3b454a6012c22b1b40d5207344c2fdf77238d74a71ef3c4257530576a81264.jpg)
249
+ Figure 8: Architecture of Space-to-depth chain. “Conv”: convolutional neural networks, “SiLU”: sigmoid Linear Units activation function, “Space-to-depth”: S2D layer, and “Bx” represents the number of S2D block.
250
+
251
+ Table 7: Structure of Space-To-Depth chain used in our experiments
252
+
253
+ <table><tr><td>Operation Layer</td><td>Number of Filters</td><td>Size of Each Filter</td><td>Stride Value</td><td>Padding Value</td><td>Size of Output Feature</td><td>FLOPs</td></tr><tr><td>Input Image</td><td>1</td><td></td><td></td><td>=</td><td>1280 x 768 x 3</td><td>0</td></tr><tr><td>Convolution Layer</td><td>32</td><td>3x3x3</td><td>2x2</td><td>1x1</td><td>640 x 384 x 32</td><td>0.21G</td></tr><tr><td>SiLU Layer</td><td>1</td><td></td><td>1</td><td>-</td><td>640 x 384 x 32</td><td>0.21G</td></tr><tr><td>Convolution Layer</td><td>64</td><td>3 x3 x 32</td><td>2 x2</td><td>1x1</td><td>320 x 192 x 64</td><td>1.34G</td></tr><tr><td>SiLULayer</td><td>1</td><td>=</td><td>1</td><td>1</td><td>320 x 192 x 64</td><td>1.34G</td></tr><tr><td>Space-to-Depth</td><td>1</td><td></td><td>-</td><td>1</td><td>160 x 96 x 256</td><td>1.34G</td></tr><tr><td>Convolution Layer</td><td>128</td><td>1 x1x 256</td><td>1x1</td><td>0x0</td><td>160 x 96 x 128</td><td>1.85G</td></tr><tr><td>SiLU Layer</td><td>1</td><td>-</td><td>-</td><td>-</td><td>160 x 96 x 128</td><td>1.85G</td></tr><tr><td>Space-to-Depth</td><td>1</td><td>-</td><td>1</td><td>1</td><td>80 x48x512</td><td>1.85G</td></tr><tr><td>Convolution Layer</td><td>256</td><td>1 x1x 512</td><td>1x1</td><td>0x0</td><td>80 x48 x 256</td><td>2.35G</td></tr><tr><td>SiLU Layer</td><td>1</td><td>1</td><td>-</td><td>1</td><td>80 x 48 x 256</td><td>2.35G</td></tr><tr><td>Space-to-Depth</td><td>-</td><td>=</td><td>1</td><td>-</td><td>40 x 24 x 1024</td><td>2.35G</td></tr><tr><td>Convolution Layer</td><td>512</td><td>1 x1 x 1024</td><td>1x1</td><td>0x0</td><td>40 x 24 x 512</td><td>2.85G</td></tr><tr><td>SiLU Layer</td><td>-</td><td>-</td><td>1</td><td>-</td><td>40 x 24 x 512</td><td>2.85G</td></tr><tr><td>Space-to-Depth</td><td>-</td><td></td><td>-</td><td>1</td><td>20 x 12 x 2048</td><td>2.85G</td></tr><tr><td>Convolution Layer</td><td>1024</td><td>1 x 1 x 2048</td><td>1x1</td><td>0x0</td><td>20 x 12 x 1024</td><td>3.36G</td></tr><tr><td>SiLU Layer</td><td>1</td><td>-</td><td>1</td><td>-</td><td>20 x12 x1024</td><td>3.36G</td></tr><tr><td>Space-to-Depth</td><td>-</td><td></td><td>-</td><td>1</td><td>10 x 6x 4096</td><td>3.36G</td></tr><tr><td>Convolution Layer</td><td>2048</td><td>1 x 1 x 4096</td><td>1x1</td><td>0x0</td><td>10 x 6x 2048</td><td>3.86G</td></tr><tr><td>SiLU Layer</td><td>1</td><td>=</td><td>1</td><td>-</td><td>10 x 6x 2048</td><td>3.86G</td></tr></table>
254
+
255
+ ![](images/ca8289cb9ea1fe36192e762e96e13a4ff21ffd4553366f9446be02ab7eff270e.jpg)
256
+ Figure 9: Architecture comparison of stacked BiFPN and our proposed GFPN-D11.
257
+
258
+ # B MORE IMPLEMENTATION DETAILS
259
+
260
+ Table 8: List of hyperparameters used.
261
+
262
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Batch Size per GPU</td><td>2</td></tr><tr><td>Optimizer</td><td>SGD</td></tr><tr><td>Learning Rate</td><td>0.02</td></tr><tr><td>Step Decrease Ratio</td><td>0.1</td></tr><tr><td>Momentum</td><td>0.9</td></tr><tr><td>Weight Decay</td><td>1.0 x 10-4</td></tr><tr><td>Input Image Size</td><td>[1333,800]</td></tr><tr><td>Multi-Scale Range (Ablation Study)</td><td>[0.8, 1.0]</td></tr><tr><td>Multi-Scale Range (SOTA)</td><td>[0.6, 1.2]</td></tr><tr><td>GFPN Input Channels</td><td>[128,256,512,1024,2048]</td></tr><tr><td>GFPN Output Channels</td><td>[256, 256, 256, 256, 256]</td></tr><tr><td>Training Epochs (Ablation Study)</td><td>36 epochs from scratch (decays at 28 and 33 epochs)</td></tr><tr><td>Training Epochs (SOTA)</td><td>72 epochs from scratch (decays at 65 and 71 epochs)</td></tr></table>
263
+
264
+ # C MORE ABLATION STUDIES
265
+
266
+ # C.1 FEATURE FUSION METHODS
267
+
268
+ ![](images/10c4c148f381f53386b5dc4e7aaaff4195bc26b1c410c490a80ffa7fae8aca40.jpg)
269
+ Figure 10: Ablation study on Fusion-style analysis consists three models: 1) “Concatenation” model: GiraffeDet utilizes concatenation fusion style; 2) “Summation” model: GiraffeDet utilizes summation fusion style; 3) “Summation smilar-FLOPs” model: same FLOPs level with “Concatenation” model.
270
+
271
+ Figure 10 shows the performance of using summation-based feature fusion and concatenation-based feature fusion style. We can observe that the concatenation-based fusion style of features can achieve better performance in the same FLOPs level. Although summation-based feature fusion has fewer FLOPs than concatenation-based style, performance is significantly lower. We think it is not worth sacrificing mAP to have fewer FLOPs. Notably, the performance of the “Summation” model is growing slightly after GFLOPs over 300, which indicates the concatenation-based feature fusion style can be more accurate and efficient again.
272
+
273
+ # C.2 INFERENCE TIME
274
+
275
+ ![](images/f2b43e560ade00cd91888c0e426da18772b82bdebcc9fd2f2eddf95d64d62d22.jpg)
276
+ Figure 11: Inference time comparison between “ResNet $^ +$ FPN” model and “S2D-chain $^ +$ GFPN” model on the same FLOPs level. Orange line denotes $\mathrm { ^ { 6 6 } S 2 D }$ -chain $^ +$ GFPN” and purple line denotes “ResNet $^ +$ FPN”.
277
+
278
+ Table 9: Comparison on inference time between “ResNet $^ +$ FPN” model and “S2D-chain $^ +$ GFPN” model on the same FLOPs level.
279
+
280
+ <table><tr><td>Backbone</td><td>Neck</td><td>Head</td><td>training</td><td>FLOPs(G)</td><td>APtest</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td><td>FPS</td></tr><tr><td>ResNet-50</td><td>FPN</td><td>GFLV2</td><td>p-2x</td><td>199.96</td><td>44.3</td><td>62.3</td><td>48.5</td><td>26.8</td><td>47.7</td><td>54.1</td><td>20.5</td></tr><tr><td>S2D chain</td><td>GFPN-d7</td><td>GFLV2</td><td>s-6x</td><td>183.67</td><td>45.6</td><td>62.7</td><td>49.8</td><td>28.8</td><td>48.7</td><td>57.6</td><td>19.9</td></tr><tr><td>ResNet-101</td><td>FPN</td><td>GFLV2</td><td>p-2x</td><td>272.99</td><td>46.2</td><td>64.3</td><td>50.5</td><td>27.8</td><td>49.9</td><td>57.0</td><td>15.1</td></tr><tr><td>S2D chain</td><td>GFPN-d11</td><td>GFLV2</td><td>s-6x</td><td>275.39</td><td>46.9</td><td>64.3</td><td>51.5</td><td>29.9</td><td>51.1</td><td>58.4</td><td>14.0</td></tr></table>
281
+
282
+ We conduct inference time experiments to compare our GiraffeDet with the basic detection model (ResNet-FPN-GFocalV2) at the same FLOPs level. From Table 9, we can observe that our GiraffeDet achieves significant improvements with acceptable inference time. We think the reason might be that most popular GPUs are friendly for ResNet-based backbone inferences and memory I/O is sensitive to the concatenate-based fusion on GFPN that will affect the inference speed. Notably, according to Figure 11, the performance of our GiraffeDet decreases slower than the standard model with FPS growth.
283
+
284
+ # C.3 STANDARD BACKBONE
285
+
286
+ Table 10: val-2017 results of standard backbone with stacked BiFPN and proposed GFPN.
287
+
288
+ <table><tr><td>Backbone</td><td>Neck</td><td>Head</td><td>training</td><td>FLOPs(G)</td><td>APual</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td></tr><tr><td>resnet-18</td><td>stacked BiFPN</td><td>GFLV2</td><td>s-3x</td><td>275.71</td><td>40.8</td><td>57.1</td><td>44.3</td><td>24.0</td><td>43.6</td><td>51.9</td></tr><tr><td>resnet-18</td><td>GFPN-d9</td><td>GFLV2</td><td>s-3x</td><td>277.05</td><td>41.3</td><td>57.7</td><td>45.0</td><td>25.0</td><td>44.2</td><td>52.8</td></tr><tr><td>resnet-18</td><td>GFPN-d11</td><td>GFLV2</td><td>s-3x</td><td>308.64</td><td>42.1</td><td>59.0</td><td>45.8</td><td>25.3</td><td>45.3</td><td>53.5</td></tr><tr><td>resnet-18</td><td>GFPN-d14</td><td>GFLV2</td><td>s-3x</td><td>366.20</td><td>42.9</td><td>59.6</td><td>46.9</td><td>25.8</td><td>46.3</td><td>54.7</td></tr></table>
289
+
290
+ We also conduct experiments on the ResNet-18 backbone. According to Table 10, our proposed GFPN with a standard backbone can increase with the depth of GFPN growth. Our designed GFPN also outperforms BiFPN under the same FLOPs level.
291
+
292
+ # D ADDITIONAL QUALITATIVE RESULTS
293
+
294
+ ![](images/41dc4dbedc83e45a4bc22b99e78bcbe3d810d581707d5a9ca7a655e4ec860ec9.jpg)
295
+ Figure 12: Qualitative Evaluation of different approaches for object detection on COCO dataset.
296
+
297
+ To better illustrate the performance of different approaches, we provide qualitative result in Figure 12. Overall, we can observe that all methods can detect object instances from each image. Furthermore, GiraffeDet can detect more instances than other SOTA methods, especially small object instances, which proves that our designed FPN can be effective in the large-scale variation dataset.
md/dev/cZAi1yWpiXQ/cZAi1yWpiXQ.md ADDED
@@ -0,0 +1,404 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CAUSALADV: ADVERSARIAL ROBUSTNESS THROUGH THE LENS OF CAUSALITY
2
+
3
+ Yonggang Zhang1,2 Mingming Gong3 Tongliang Liu4 Gang Niu5 Xinmei Tian1
4
+ Bo Han2,† Bernhard Scholkopf ¨ 6 Kun Zhang7,8
5
+ 1University of Science and Technology of China 2Hong Kong Baptist University
6
+ 3The University of Melbourne 4The University of Sydney
7
+ 5RIKEN Center for Advanced Intelligence Project 6Max Planck Institute for Intelligent Systems
8
+ 7Carnegie Mellon University 8Mohamed bin Zayed University of Artificial Intelligence
9
+
10
+ # ABSTRACT
11
+
12
+ The adversarial vulnerability of deep neural networks has attracted significant attention in machine learning. As causal reasoning has an instinct for modeling distribution change, it is essential to incorporate causality into analyzing this specific type of distribution change induced by adversarial attacks. However, causal formulations of the intuition of adversarial attacks and the development of robust DNNs are still lacking in the literature. To bridge this gap, we construct a causal graph to model the generation process of adversarial examples and define the adversarial distribution to formalize the intuition of adversarial attacks. From the causal perspective, we study the distinction between the natural and adversarial distribution and conclude that the origin of adversarial vulnerability is the focus of models on spurious correlations. Inspired by the causal understanding, we propose the Causal-inspired Adversarial distribution alignment method, CausalAdv, to eliminate the difference between natural and adversarial distributions by considering spurious correlations. Extensive experiments demonstrate the efficacy of the proposed method. Our work is the first attempt towards using causality to understand and mitigate the adversarial vulnerability.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ The seminal work (Szegedy et al., 2014; Biggio et al., 2013) shows that DNNs are vulnerable to adversarial examples, which consist of malicious perturbations imperceptible to humans yet fooling state-of-the-art models (Krizhevsky et al., 2012; Szegedy et al., 2015; Simonyan & Zisserman, 2015; He et al., 2016). The lack of robustness hinders the applications of DNNs to some safetycritical areas such as automatic driving (Tuncali et al., 2018) and healthcare (Finlayson et al., 2019). Therefore, mitigating the adversarial vulnerability is critical to the further development of DNNs.
17
+
18
+ Human cognitive systems are immune to the distribution change induced by adversarial attacks because humans are more sensitive to causal relations than statistical associations (Gopnik et al., 2004). Using causal language, causal reasoning can identify causal relation and ignore nuisance factors, i.e., not the cause of labels, by intervention (Pearl, 2009; Peters et al., 2017). As adversarial perturbations are usually imperceptible and make no impact on human decisions (Szegedy et al., 2014; Goodfellow et al., 2015), it is reasonable to assume that the difference between natural and adversarial examples comes from nuisance factors. This is because if task-relevant factors of some samples are changed, these samples will make both humans and DNNs change their decisions. From a causal viewpoint (Zhang et al., 2020a), adversarial attacks can be regarded as a specific type of distribution change resulting from the intervention on the natural data distribution. In summary, causal reasoning has the instinct for analyzing the effect of the intervention caused by adversarial attacks, so it is essential to leverage causality to understand and mitigate the adversarial vulnerability.
19
+
20
+ However, there are two significant problems to overcome before using causality to understand and mitigate the adversarial vulnerability. Firstly, constructing a causal graph is arguably the fundamental premise for causal reasoning (Pearl, 2009; Peters et al., 2017), but how to construct causal graphs in the context of adversarial attacks is still lacking in the literature. Secondly, using causal language to formalize the intuition of adversarial attacks is the key to connect causality and adversarial vulnerability, but it also remains to be solved. These two problems are fundamental obstacles, which prevent us from employing causality to contribute to adversarial learning.
21
+
22
+ To address these challenges, we first construct a causal graph to model the perceived data generation process where nuisance factors are considered. The constructed causal graph can entail a specific intervention distribution, i.e., the adversarial distribution. Moreover, the causal graph immediately shows that, given inputs, labels are statistically correlated with nuisance factors, which have no cause-effect to labels. The spurious correlation implies that if DNNs fit the conditional association between labels and nuisance factors, their performance on different conditional associations between labels and nuisance factors will change accordingly. Through investigating the distinction between these two distributions induced by nuisance factors, we conclude that adversarial distributions can be obtained by exploiting conditional associations between labels and nuisance factors, where the conditional association of adversarial distributions is drastically different from that of natural distributions. Namely, the origin of adversarial vulnerability is the focus of DNNs on the spurious correlation between labels and nuisance factors.
23
+
24
+ According to the causal perspective, an adversarial distribution is crafted by exploiting a specific conditional association between labels and nuisance factors, this association is drastically different from that of natural distributions. Intuitively, eliminating the difference in such conditional associations between natural and adversarial distributions can promote the performance of models on adversarial distributions. Thus, we propose the Causal-inspired Adversarial distribution alignment method, CausalAdv, to eliminate the difference between these two distributions. Surprisingly, we find that the proposed method shares the same spirits to existing adversarial training (Goodfellow et al., 2015) variants, i.e., Madry (Madry et al., 2018) and TRADES (Zhang et al., 2019). We validate the efficacy of the proposed method on MNIST, CIFAR10, and CIFAR100 (Krizhevsky et al., 2009) datasets under various adversarial attacks such as FGSM (Goodfellow et al., 2015), PGD (Madry et al., 2018), CW attack (Carlini & Wagner, 2017), and AutoAttack (Croce & Hein, 2020). Extensive experiments demonstrate that CausalAdv can improve the adversarial robustness significantly.
25
+
26
+ Our main contributions are:
27
+
28
+ • We provide a causal perspective to understand and mitigate the adversarial vulnerability, which is the first attempt towards using causality to contribute adversarial learning. • To leverage causality to contribute adversarial learning, we solve two fundamental problems. Specifically, we construct a causal graph to model the adversarial data generation process and define the adversarial distribution to formalize adversarial attacks. • A defense method called causal-inspired adversarial distribution alignment, CausalAdv, is proposed to reduce adversarial vulnerability by eliminating the difference between adversarial distribution and natural distribution. Extensive experiments demonstrate that the proposed method can significantly improve the adversarial robustness.
29
+
30
+ # 2 A CAUSAL VIEW ON ADVERSARIAL DATA GENERATION
31
+
32
+ The ability of humans to perform causal reasoning is arguably an essential factor that makes human learning different from deep learning (Scholkopf et al. ¨ , 2021; Zhang et al., 2020a; Gopnik et al., 2004). The superiority of causal reasoning endows humans with the ability to identify causal relations and ignore nuisance factors that are not relevant to the task. In contrast, DNNs are usually trained to fit the perceived information overlooking the ability to distinguish causal relations and statistical associations. This shortcut solution could lead to overfitting to these nuisance factors, which would further result in the sensitivity of DNNs to such factors. Therefore, we propose incorporating causal reasoning to mitigate the sensitivity of DNNs to these nuisance factors.
33
+
34
+ Before using causal reasoning to analyze adversarial vulnerability, we need to construct a causal graph, as causal graphs are the key for formalizing causal reasoning (Peters et al., 2017). In the context of adversarial learning, we desire the causal graph by which both the natural and the adversarial distributions can be generated. In addition, the graph is required to reflect the impact of nuisance factors on these two distributions, so that we can investigate the difference in nuisance factors between these two distributions. Consequently, we can formally establish the connection between nuisance factors and adversarial vulnerability. Therefore, we propose constructing a causal graph to model the adversarial generation process where the nuisance factors are considered. One approach is to use causal structure learning to infer causal graphs (Pearl, 2009; Peters et al., 2017), but it is challenging to apply this kind of approach to high-dimensional data. Using external knowledge to construct causal graphs is another approach (Zhang et al., 2013; Tang et al., 2020; Scholkopf ¨ et al., 2021). As automatically learning a precise causal graph is out of scope for this work, external human knowledge about the data generation process is employed to construct the causal graph.
35
+
36
+ Specifically, we construct a causal graph $\mathcal { G }$ to formalize the image data generation process using the following knowledge for analyzing adversarial vulnerability. As there might be a number of different causes of natural data $X$ , we propose to divide all the causes into two categories for simplicity. We group content-related causes into one category, called content variable $C$ . The rest causes, i.e., nuisance factors, are grouped into another category, called style variable $S$ , which is content-independent, i.e., $ { S } \perp \perp$ $C$ . This implies that $C \right. X \left. S$ . It is noteworthy that, in this paper, we assume that only the content variable is relevant for the task we care about, i.e., $C Y$ . Perceived data $\tilde { X }$ are usually composed of perturbations $E$ and natural data $X$ . When the perturbation $E$ is designed carefully to fool DNNs, $E$ should be a compound result of $X$ (the object to be perturbed), $Y$ (the reference for the perturbation), and $\pmb \theta$ (the targets affected by the perturbation), e.g., white-box attacks (Goodfellow et al., 2015; Carlini & Wagner, 2017; Moosavi-Dezfooli et al., 2016), which means that $( X , Y , \pmb \theta ) E ^ { 1 }$ . Leverage all this background knowledge, we obtain the causal graph $\mathcal { G }$ formalizing the perturbed data generation process, depicted in Fig. 1.
37
+
38
+ ![](images/1e7f98f43c2575be3a641a5a7bc3d283ac4554e2d841ffdb69cbb16cde30d5cb.jpg)
39
+ Figure 1: Causal graph of the perturbed data generation process. Each node represents a random variable, and gray ones indicate observable variables, where $C , S , X , Y , E , \tilde { X } , \theta$ are content variable, style variable, natural data, label, perturbation, perturbed data and parameters of a neural network, respectively.
40
+
41
+ Based on the causal graph, we can define valid interventions (Pearl, 2009; Scholkopf et al. ¨ , 2021) and the corresponding intervention distributions. Defining valid interventions is equivalent to determining which variables or mechanisms in the causal graph can be intervened. In this work, we consider both hard and soft interventions (Eberhardt & Scheines, 2007; Correa & Bareinboim, 2020) on the perturbation variable $E$ . Specifically, we can use a structural causal model to represent the generating mechanism of $E$ :
42
+
43
+ $$
44
+ E : = \mathcal { M } ( X , Y , \pmb \theta , U _ { E } ) ,
45
+ $$
46
+
47
+ where the exogenous variable $U _ { E }$ stands for other indeterminacies, e.g., random start noise used in PGD attack (Madry et al., 2018).
48
+
49
+ By intervening $E$ in different ways, we can obtain different intervention distributions, which could be either natural or adversarial, over the observed variables. For example, if we do a hard intervention on $E$ , i.e., $d o ( E = { \bf 0 } )$ in the graph, the generated data distribution corresponds to the natural distribution $P \left( X , Y \right)$ . Different perturbations can be obtained by performing soft interventions on $E$ , i.e., modifying $\mathcal { M }$ . In the context of adversarial attacks, adversaries aim to maximize a certain objective function $\ell ( \cdot )$ to mislead a target model $h \left( X ; \pmb { \theta } \right)$ by searching for the worst perturbation for each instance (Goodfellow et al., 2015; Carlini & Wagner, 2017; Dong et al., 2018; Madry et al., 2018), where $\pmb { \theta }$ stands for parameters of the target model. To formalize the intuition of adversarial attacks, we can first search for the adversarial perturbation $E _ { a d v }$ , and then use a function to approximate the mechanism for generating $E _ { a d v }$ . The adversarial perturbation $E _ { a d v }$ can be obtained by maximizing $\ell ( \cdot )$ :
50
+
51
+ $$
52
+ E _ { a d v } = \underset { E ^ { \prime } \in \mathbb { B } } { \arg \operatorname* { m a x } } \ell ( h ( \boldsymbol { X } + \boldsymbol { E ^ { \prime } } ; \pmb { \theta } ) , \boldsymbol { Y } ) .
53
+ $$
54
+
55
+ where $\mathbb { B }$ is a set of valid perturbations, and the adversarial perturbation $E _ { a d v }$ is the result of the mechanism $\mathcal { M } _ { a d v }$ , i.e., $E _ { a d v } : = \mathcal { M } _ { a d v } ( X , Y , \pmb \theta , U _ { E } )$ . The intervention distribution that corresponds to the adversarial mechanism $M _ { a d v }$ is defined as the adversarial distribution $P _ { \theta } ( { \tilde { X } } , Y )$ , where the subscript $\pmb \theta$ indicates that $P _ { \theta } ( { \tilde { X } } , Y )$ is crafted to attack the target model $h \left( X ; \theta \right)$ with parameter $\pmb \theta$ .
56
+
57
+ # 3 METHOD
58
+
59
+ To understand the adversarial vulnerability, we study the difference between the natural and adversarial distributions and conclude that conditional associations between labels and style factors play a crucial role in adversarial vulnerability. Inspired by the conclusion, we propose a method to eliminate the difference in such conditional associations to mitigate adversarial vulnerability.
60
+
61
+ # 3.1 ORIGIN OF ADVERSARIAL VULNERABILITY
62
+
63
+ Inspired by the causal graph, we derive a causal understanding of adversarial vulnerability. According to the causal graph $\mathcal { G }$ depicted in Fig. 1, there is a path, $S \to \underline { { X } } C \to Y$ , from the style variable $S$ to the label $Y$ when $X$ is given 2, which leads to the correlation between labels and style variables. The spurious correlation implies that DNNs can perform well on the training set by fitting the statistical association between $Y$ and $S$ , even though the genuine content information is dropped. Moreover, if the conditional association between $Y$ and $S$ on the (natural) test set is similar to that on the training set, fitting these spurious correlations will also perform well on the test set. This is consistent with the recent work (Ilyas et al., 2019), which shows that training DNNs with incorrectly labeled data, i.e., the genuine content information is not utilized for training, yields good accuracy on the (natural) test set. However, suppose DNNs learn such spurious correlation. In that case, their performance will change with the conditional association between $Y$ and $S$ . Consequently, fitting such spurious correlation gives adversaries a chance to fool DNNs. Therefore, the conditional association between labels and style variables is a key to understand adversarial vulnerability.
64
+
65
+ To identify the origin of adversarial vulnerability from the spurious correlation perspective, we study the distinction between the adversarial distribution and the natural distribution. To look at what makes the adversarial distribution different from the natural distribution, we expand the natural $P ( Y | X )$ and the adversarial distribution $P _ { \theta } ( Y | \tilde { X } )$
66
+
67
+ $$
68
+ P ( \boldsymbol { Y } | \boldsymbol { X } ) = \sum _ { s \in \mathbb { S } } P ( s | \boldsymbol { X } ) P ( \boldsymbol { Y } | \boldsymbol { X } , s ) , P _ { \theta } ( \boldsymbol { Y } | \tilde { \boldsymbol { X } } ) = \sum _ { s \in \mathbb { S } } P _ { \theta } ( s | \tilde { \boldsymbol { X } } ) P _ { \theta } ( \boldsymbol { Y } | \tilde { \boldsymbol { X } } , s ) ,
69
+ $$
70
+
71
+ where we assume the set of valid styles $\mathbb { S }$ is discrete, and $s$ stands for a certain style. We can see that the difference between $P ( { Y \vert { X } } )$ and $P _ { \theta } ( Y | \tilde { X } )$ results from two terms, i.e., $\dot { P } _ { \theta } ( s | \tilde { X } )$ and $P _ { \theta } ( Y | \tilde { X } , s )$ . $P _ { \theta } ( s | \tilde { X } )$ represents the change of style information, e.g., textures (Geirhos et al., 2018), transformations (Chen et al., 2020; Mitrovic et al., 2020; He et al., 2020), and domain shifts (Ganin et al., 2016). It is shown that changing image textures has a significant impact on predictions of DNNs (Geirhos et al., 2018), but such drastic style changes will hardly appear in the context of adversarial attacks as perturbations are required to be imperceptible 3. Although modifying style variables $S$ is not allowed, adversaries can exploit the conditional association between $Y$ and $S$ , i.e., $P _ { \theta } ( Y | \tilde { X } , s )$ , via injecting a specific perturbation to generate adversarial distributions. Specifically, under an appropriate soft intervention, i.e., $\mathcal { M } _ { a d v }$ , the conditional distribution $P _ { \theta } ( Y | \tilde { X } , s )$ can be drastically different from $P ( \boldsymbol { Y } | \boldsymbol { X } , \boldsymbol { s } )$ . Namely, the property of adversarial distribution essentially results from the drastic difference in the statistical association between labels and style variables. Intuitively, if DNNs fit the conditional associations between $Y$ and $S$ , their performance will change with the spurious correlation. Consequently, a drastic difference between the conditional association between $Y$ and $S$ will cause significant performance degradation of DNNs.
72
+
73
+ Hence, the origin of adversarial vulnerability is the excessive focus of DNNs on spurious correlations between labels and style variables. This conclusion provides a causal perspective for the empirical observation, i.e. some features are useful but not robust (Ilyas et al., 2019), so adversarial examples can be viewed as a model phenomenon rather than merely a human phenomenon.
74
+
75
+ # 3.2 THE ADVERSARIAL DISTRIBUTION ALIGNMENT METHOD
76
+
77
+ In light of the causal understanding of the adversarial vulnerability, improving adversarial robustness requires forcing DNNs to fit the causal relations rather than merely the statistical associations. However, only the perceived data can be observed in practice, and the supervised information of content variables is usually unavailable. Therefore, an approach that can avoid reliance on such supervised information is required.
78
+
79
+ To develop such an approach, we revisit the difference between the adversarial and natural distributions. Intuitively, if the difference between the natural and the adversarial distribution is negligible, the adversarial vulnerability of DNNs can be mitigated, as DNNs perform well on the natural distribution (Krizhevsky et al., 2012; He et al., 2016; Zhang et al., 2021). Consequently, a straightforward solution for improving adversarial robustness is to align these two distributions. The aforementioned analysis shows that the property of adversarial distributions to fool DNNs comes from specific conditional associations between labels $Y$ and style variables $S$ , i.e., $P _ { \theta } ( Y | \tilde { X } , s )$ and $P ( \boldsymbol { Y } | \boldsymbol { X } , \boldsymbol { s } )$ . Inspired by the conclusion, we propose an adversarial distribution alignment method to eliminate the difference between the natural and adversarial distributions. Specifically, we regard the natural distribution $P ( \boldsymbol { Y } | \boldsymbol { X } , \boldsymbol { s } )$ as an anchor, then align the adversarial distribution $P _ { \theta } ( Y \vert \tilde { X } , s )$ with the anchor such that the difference between these two distributions is negligible. In addition, the relationship between $Y$ and $X$ should also be the same on both the adversarial and natural distributions. Concretely, we operationalize the intuition of the adversarial distribution alignment by:
80
+
81
+ $$
82
+ \operatorname* { m i n } _ { \theta } \ d \big ( P \left( Y | X \right) , P _ { \theta } \left( Y | \tilde { X } \right) \big ) + \lambda \mathbb { E } _ { s } d \big ( P \left( Y | X , s \right) , P _ { \theta } \left( Y | \tilde { X } , s \right) \big ) .
83
+ $$
84
+
85
+ Here $d ( \cdot )$ is a metric reflecting the divergence between two distributions, and $\lambda > 0$ presents the weighting of the misalignment penalty. In addition, we assume $X$ and $\tilde { X }$ have the same support set because adversarial perturbations are usually bounded. Solving the adversarial distribution alignment objective is equivalent to search a classifier $h ( { \tilde { X } } ; \theta )$ such that the adversarial distribution of the classifier is similar to the natural distribution. Benefiting from the consistency of these two distributions, classifier $h ( { \tilde { X } } ; \theta )$ can perform well on both the natural and adversarial distributions.
86
+
87
+ In practice, the adversarial distribution often cannot be obtained analytically, so we relax the distribution divergence in Eq. 4 to the sum of two divergences, see Appendix A for details. For the divergence between $P ( { Y \vert { X } } )$ and $P _ { \theta } ( Y | \tilde { X } )$ , we have:
88
+
89
+ $$
90
+ \begin{array} { r l } & { \quad K L \left( P _ { \theta } \left( Y \vert \tilde { X } \right) , Q _ { \theta } \left( Y \vert \tilde { X } \right) \right) + \gamma K L \left( P \left( Y \vert X \right) , Q _ { \theta } \left( Y \vert X \right) \right) } \\ & { = \mathbb { E } _ { \left( \tilde { X } , Y \right) \sim P _ { \theta } \left( \tilde { X } , Y \right) } C E \left( h \left( \tilde { X } ; \theta \right) , Y \right) + \gamma \mathbb { E } _ { \left( X , Y \right) \sim P \left( X , Y \right) } C E \left( h \left( X ; \theta \right) , Y \right) } \\ & { \approx \mathbb { E } _ { \left( X , Y \right) \sim P \left( X , Y \right) } C E \left( h \left( X + E _ { a d v } ; \theta \right) , Y \right) + \gamma C E \left( h \left( X ; \theta \right) , Y \right) , } \end{array}
91
+ $$
92
+
93
+ where $K L$ is the Kullback-Leibler divergence, $C E$ is the cross-entropy loss, $Q _ { \theta } ( Y | X )$ is the conditional distribution specified by the classifier $h \left( X ; \pmb { \theta } \right)$ , and $\gamma$ is a tunable hyperparameter. Because adversarial examples are usually generated by adding perturbation to their corresponding natural samples rather than sampled from the adversarial distribution independently, we use $X + E _ { a d v }$ to approximate examples independently sampled from the adversarial distribution, where $X$ is sampled from the natural distribution independently.
94
+
95
+ Similar to Eq. 5, the divergence between $P ( \boldsymbol { Y } | \tilde { X } , s )$ and $P _ { \theta } ( Y | \tilde { X } , s )$ can be approximated by:
96
+
97
+ $$
98
+ \mathbb { E } _ { ( X , Y ) \sim P ( X , Y ) } C E \left( g \left( s \left( X + E _ { a d v } \right) ; W _ { g } \right) , Y \right) + \beta \left( g \left( s \left( X \right) ; W _ { g } \right) , Y \right) ,
99
+ $$
100
+
101
+ where $g \left( s \left( X \right) ; W _ { g } \right)$ is a function used for modeling the statistically conditional association between labels and style variables, $s \left( X \right)$ stands for the integrated representation of $X$ and $s$ , and $\beta$
102
+
103
+ is a tunable hyperparameter. Thus, the overall objective of the proposed adversarial distribution alignment method can be expressed as
104
+
105
+ $$
106
+ \begin{array} { r l } & { \displaystyle \operatorname* { m i n } _ { \theta , W _ { g } } \mathbb { E } ( x , Y ) { \sim } P ( X , Y ) C E \left( h \left( X + E _ { a d v } ; \theta \right) , Y \right) + \gamma C E \left( h \left( X ; \theta \right) , Y \right) } \\ & { \quad \quad \quad + \lambda \left( \mathbb { E } _ { s } C E \left( g \left( s \left( X + E _ { a d v } \right) ; W _ { g } \right) , Y \right) + \beta C E \left( g \left( s \left( X \right) ; W _ { g } \right) , Y \right) \right) . } \end{array}
107
+ $$
108
+
109
+ To make sure that introducing $g$ can benefit learning $h$ , it is necessary to design an approach to connect model $g$ and model $h$ . In this paper, we connect $g$ and $h$ by representation sharing. Interestingly, according to Eq. 4 and Eq. 7, if we omit the spurious correlation between labels and style variables, i.e., $\lambda = 0$ , and set $\gamma = 0$ , Eq. 7 then becomes the objective function introduced by Madry (Madry et al., 2018). This suggests that the proposed adversarial distribution alignment method is consistent with the seminal variant Madry (Madry et al., 2018) of adversarial training.
110
+
111
+ # 3.3 REALIZATION OF ADVERSARIAL DISTRIBUTION ALIGNMENT METHOD
112
+
113
+ According to Eq. 7, realizing the proposed adversarial distribution alignment method requires predicting labels with all style variables, i.e., modeling the statistically conditional association between $Y$ and $S$ . However, there are two major obstacles preventing us from calculating the last term of Eq. 7. Specifically, a) the number of all possible styles $s$ is infinite, so the cost of calculating the expectation in Eq. 7 can grow to infinity; b) the representation of the integrated representation of $X$ and $s$ , i.e., $s \left( X \right)$ , used for predicting labels is unknown.
114
+
115
+ To calculate the expectation in Eq. 7, we have to make some assumptions to approximate the distribution of the style variable, as the true distribution is unknown. Following previous work (Gal & Ghahramani, 2016; Kendall & Gal, 2017), we assume a Gaussian distribution to approximate the unknown distribution. Specifically, the representation $s \left( X \right)$ is estimated by ${ \hat { s } } \left( X \right)$ sampled from a Gaussian distribution, i.e., $\hat { s } \left( X \right) \cdot \bar { \mathcal { N } } \left( \bar { \mu } \left( X \right) , \Sigma \right)$ , where $\mu \left( X \right)$ is employed to model the Gaussian distribution’s mean, and $\Sigma$ is the covariance matrix. Because little prior knowledge about the covariance matrix is observed, we simply regard the covariance matrix $\Sigma$ as an identity matrix, i.e., $\hat { s } \left( X \right) \sim \mathcal { N } \left( \mu \left( X \right) , \sigma ^ { 2 } I \right)$ . Then, the expectation can be approximated by
116
+
117
+ $$
118
+ \mathbb { E } _ { s } C E \left( g \left( s \left( X \right) ; W _ { g } \right) , Y \right) \approx \mathbb { E } _ { \hat { s } \left( X \right) \sim \mathcal { N } \left( \mu \left( X \right) , \sigma ^ { 2 } I \right) } C E \left( g \left( \hat { s } \left( X \right) ; W _ { g } \right) , Y \right) .
119
+ $$
120
+
121
+ Thanks to the Gaussian distribution assumption, we can derive an upper bound of the expectation:
122
+
123
+ $$
124
+ \mathbb { E } _ { \hat { s } ( X ) \sim \mathcal { N } \left( \mu \left( X \right) , \sigma ^ { 2 } I \right) } C E \left( g \left( \hat { s } \left( X \right) ; W _ { g } \right) , Y \right) \leq C E \left( \overline { { g } } \left( \mu \left( X \right) ; W _ { g } \right) , Y \right) ,
125
+ $$
126
+
127
+ where the probability of the $i ^ { t h }$ category of $\overline { { g } } \left( \mu \left( X \right) ; W _ { g } \right)$ is (see Appendix B for details)
128
+
129
+ $$
130
+ P \left( \boldsymbol { Y } = i | \overline { { g } } \left( \mu \left( \boldsymbol { X } \right) ; W _ { g } \right) \right) = \frac { e ^ { W _ { g , i } ^ { \top } \mu \left( \boldsymbol { X } \right) } } { \sum _ { j } e ^ { W _ { g , j } ^ { \top } \mu \left( \boldsymbol { X } \right) + \frac { \sigma ^ { 2 } } { 2 } \left( W _ { g , j } - W _ { g , i } \right) ^ { \top } \left( W _ { g , j } - W _ { g , i } \right) } } .
131
+ $$
132
+
133
+ Here, we simply set $g$ to a linear function, i.e., $W _ { g }$ is a linear mapping. Instead of calculating all styles ${ \hat { s } } \left( X \right)$ , the conclusion of Eq. 9 and Eq. 10 shows that only the mean and variance of ${ \hat { s } } \left( X \right)$ are required to calculate the expectation in Eq. 7.
134
+
135
+ In light of Eq. 9 and Eq. 10, the challenge of learning the representation of $s \left( X \right)$ boils down to estimating the mean of ${ \hat { s } } \left( X \right)$ , i.e., no need to estimate every style representation explicitly. In addition, the variance can be treated as a hyperparameter. To estimate the mean, we draw inspiration from the proposed causal graph. According to the causal graph $\mathcal { G }$ , the content and style variables are statistically independent, i.e., $C \perp \perp S$ . Thus, the estimated content ${ \hat { c } } \left( X \right)$ and style ${ \hat { s } } \left( X \right)$ are desired to be independent, i.e., $\hat { c } \left( X \right) \perp \perp \hat { s } \left( X \right)$ . The underlying intuition is that we aim to model the causal relation between the content variable and the style variable and omit the spurious correlation between $\hat { c } \left( X \right)$ and ${ \hat { s } } \left( X \right)$ , because the spurious correlation is not a causal relation, although $\hat { c } \left( X \right)$ and ${ \hat { s } } \left( X \right)$ are not statistically independent. Following previous work (LeCun et al., 1998; Bengio et al., 2013), we regard DNNs as a combination of representation learning modules and linear classifier modules. Specifically, we apply a linear function to the learned representation for approximating the content which is further used to predicting labels. Specifically, we have ${ \hat { c } } \left( X \right) ~ = ~ { \hat { c } } \left( r \left( X ; W _ { r } \right) ; W _ { c } \right) ~ = ~ W _ { c } r \left( X ; W _ { r } \right)$ . That is, $W _ { c }$ are parameters used for predicting labels. According to the Gaussian distribution assumption, we can obtain the estimated style by the reparameterization trick, i.e., $\hat { s } \left( X \right) = \mu \left( X ; \bar { W _ { s } } \right) + \sigma n$ , where $W _ { s }$ presents parameters for modeling the mean, and $\textbf { \em n }$ is sampled from a normal distribution. For simplicity, we assume that $\mu \left( X ; W _ { s } \right)$ is an affine mapping applied to the learned representation 4, i.e., $\mu \left( X ; W _ { s } \right) = \mu \left( r \left( X ; W _ { r } \right) ; W _ { s } \right) = W _ { s } r \left( X ; W _ { r } \right)$ . Assume that $r \left( X ; W _ { r } \right)$ is a Gaussian distribution with a covariance matrix $M$ . Then, the independence $\hat { c } \left( X \right) \perp \perp \hat { s } \left( X \right)$ holds if we set $W _ { s }$ as an instantiation of the orthogonal complement of $W _ { c }$ , i.e., ker $\left( W _ { c } \right) ^ { \perp } \perp _ { M } \mathrm { k e r } \left( W _ { s } \right) ^ { \perp }$ . Here, we define $\langle a , b \rangle _ { M } = \langle a , M b \rangle$ , and the orthogonality of two subspaces is defined likewise. Therefore, we can simply employ the learned representation $r \left( X ; W _ { r } \right)$ and the parameters used for predicting labels, i.e., $W _ { c }$ , to estimate $\mu \left( X \right)$ , see Appendix C for details.
136
+
137
+ Combining Eq. 7 and Eq. 9, we derive a realization of adversarial distribution alignment method:
138
+
139
+ $$
140
+ \begin{array} { r l } & { \underset { \theta , W _ { g } } { \operatorname* { m i n } } \mathbb { E } _ { ( X , Y ) \sim P ( X , Y ) } C E \left( h \left( X + E _ { a d v } ; \pmb { \theta } \right) , Y \right) + \gamma C E \left( h \left( X ; \pmb { \theta } \right) , Y \right) } \\ & { } \\ & { \quad \quad \quad + \lambda \left( C E \left( \overline { { g } } \left( \mu \left( X + E _ { a d v } \right) ; W _ { g } \right) , Y \right) + \beta C E \left( \overline { { g } } \left( \mu \left( X \right) ; W _ { g } \right) , Y \right) \right) . } \end{array}
141
+ $$
142
+
143
+ Given $X$ , Eq. 11 encourages the statistically conditional association between labels and style variables of the adversarial distribution to be close to that of the natural distribution. The explicit distribution alignment can reduce the difference between the adversarial distribution and the natural distribution. If the conditional association of the adversarial distribution is similar to that of the natural distribution, it should be hard for the adversary to find adversarial examples, which is consistent with recent work (Kilbertus et al., 2018; Scholkopf et al. ¨ , 2021).
144
+
145
+ # 4 EXPERIMENT
146
+
147
+ # 4.1 SETUPS
148
+
149
+ Baseline methods. Our experiments are designed to demonstrate the necessity of considering the spurious correlation between labels $Y$ and style variables $S$ when developing robust models. Eq. 7 shows that if we set the hyperparameter $\gamma = 0$ , and omit the spurious correlation between $Y$ and $S$ , the proposed method is equivalent to the adversarial training variant Madry (Madry et al., 2018). Thus, to demonstrate the necessity of considering the spurious correlation, we set $\gamma = 0$ and $\lambda > 0$ in Eq. 7, named CausalAdv-M, and compare the adversarial robustness of CausalAdv-M with that of Madry. In addition, the model capacity is often insufficient in adversarial training (Madry et al., 2018), so replacing one-hot labels of the first term in Eq. 7 with soft targets, i.e., the model prediction $h ( X ; \pmb \theta )$ , can relieve the problem of insufficient model capacity 5. Considering the insufficient model capacity, we replace $Y$ in the first term of Eq. 7 with the model prediction, and the derived method is called CausalAdv-T. We find that CausalAdv-T becomes the objective introduced in TRADES (Zhang et al., 2019) when we omit the spurious correlation, i.e., $\lambda ~ = ~ 0$ , which shows that the proposed method also shares the same spirits to TRADES. Therefore, to demonstrate the importance of the spurious correlation between $Y$ and $S$ , we compare CausalAdv-M and CausalAdv-T with Madry and TRADES, respectively.
150
+
151
+ Evaluation metrics and training details. To evaluate the robustness for different methods, we compute the test accuracy on natural and adversarial examples with $\ell _ { \infty }$ -norm bounded perturbation generated by: FGSM (Goodfellow et al., 2015), PGD (Madry et al., 2018), and C&W (Carlini & Wagner, 2017) attacks. The robustness is evaluated on both the best checkpoint model suggested by (Rice et al., 2020) and the last checkpoint model used in (Madry et al., 2018), respectively. For MNIST, we use the same CNN architecture as (Carlini & Wagner, 2017; Zhang et al., 2019). For CIFAR10 and CIFAR100, two architectures are employed: ResNet-18 (He et al., 2016) and WRN34-10 (Zagoruyko & Komodakis, 2016). The settings of attacks and hyper-parameters for training are the same as previous works, more details can be found in Appendix D.
152
+
153
+ # 4.2 ROBUSTNESS EVALUATION
154
+
155
+ We evaluate the robustness of Madry, TRADES, and the proposed method on MNIST, CIFAR10, and CIFAR100 against various attacks (Goodfellow et al., 2015; Madry et al., 2018; Carlini & Wagner, 2017), which are widely used in the literature. We report the classification accuracy on MNIST in
156
+
157
+ Table 1: Classification accuracy $( \% )$ ) on MNIST under the white-box threat model with $\epsilon = 0 . 3$ . The best-performance model and the corresponding accuracy are highlighted.
158
+
159
+ <table><tr><td rowspan="2">Method</td><td colspan="4">Best checkpoint</td><td colspan="4">Last checkpoint</td></tr><tr><td>Natural</td><td>FGSM</td><td>PGD-40</td><td>CW-40</td><td>Natural</td><td>FGSM</td><td>PGD-40</td><td>CW-40</td></tr><tr><td>Madry</td><td>99.48</td><td>97.82</td><td>95.75</td><td>95.92</td><td>99.47</td><td>96.52</td><td>94.33</td><td>94.45</td></tr><tr><td>CausalAdv-M</td><td>99.53±0.04</td><td>98.02±0.07</td><td>96.37±0.12</td><td>96.47±0.17</td><td>99.49±0.08</td><td>96.83±0.10</td><td>94.67±0.14</td><td>94.84±0.19</td></tr><tr><td>TRADES</td><td>99.39</td><td>97.22</td><td>96.55</td><td>96.66</td><td>99.36</td><td>96.76</td><td>94.89</td><td>94.91</td></tr><tr><td>CausalAdv-T</td><td>99.49±0.06</td><td>97.82±0.07</td><td>96.72±0.10</td><td>96.78±0.15</td><td>99.49±0.04</td><td>97.32±0.08</td><td>96.63±0.13</td><td>96.69±0.21</td></tr></table>
160
+
161
+ Table 2: Classification accuracy $( \% )$ ) of ResNet-18 on CIFAR-10 under the white-box threat model with $\epsilon = 8 / 2 5 5$ . The best-performance model and the corresponding accuracy are highlighted.
162
+
163
+ <table><tr><td rowspan="2">Method</td><td colspan="4">Best checkpoint</td><td colspan="4">Last checkpoint</td></tr><tr><td>Natural</td><td>FGSM</td><td>PGD-20</td><td>CW-20</td><td>Natural</td><td>FGSM</td><td>PGD-20</td><td>CW-20</td></tr><tr><td>Madry</td><td>83.56</td><td>56.69</td><td>51.92</td><td>51.00</td><td>84.65</td><td>54.37</td><td>46.38</td><td>46.73</td></tr><tr><td>CausalAdv-M</td><td>80.42±0.39</td><td>57.98±0.21</td><td>54.44±0.18</td><td>52.51±0.25</td><td>83.72±0.41</td><td>59.17±0.24</td><td>51.82±0.19</td><td>50.93±0.27</td></tr><tr><td>TRADES</td><td>81.39</td><td>57.25</td><td>53.64</td><td>51.39</td><td>82.91</td><td>57.95</td><td>52.80</td><td>51.27</td></tr><tr><td>CausalAdv-T</td><td>81.22±0.27</td><td>58.97±0.17</td><td>54.55±0.16</td><td>52.95±0.26</td><td>81.62±0.30</td><td>58.90±0.16</td><td>53.64±0.14</td><td>52.70±0.37</td></tr></table>
164
+
165
+ Table 1, where “Natural” denotes the accuracy on natural test images. We denote by PGD-40 the PGD attack with 40 iterations for generating adversarial examples, which also applies to the C&W attack. The results of ResNet-18 on CIFAR10 and CIFAR100 are illustrated in Table 2 and Table 3, respectively. The results of WRN-34-10 are in Appendix E. We can see that the proposed method achieves the best robustness against all three types of attacks, demonstrating that taking into account the spurious correlation can significantly improve the adversarial robustness. To further understand the comparative effects of different terms of the proposed method, we reorganize the robust accuracy of the best checkpoint trained on CIFAR-10 and CIFAR-100 in Appendix F.
166
+
167
+ # 4.3 DISCUSSION
168
+
169
+ Consideration of gradient obfuscation. According to the criterion suggested by (Athalye et al., 2018), we exclude the potential effect of gradient obfuscation by showing the following phenomenons: a) the performance of our method on FSGM attack $( 5 { \bar { 9 } } . 1 7 \% )$ is better than iterative attacks PGD20 $( 5 1 . 8 2 \% )$ and C&W-20 $( 5 0 . 9 3 \% )$ ; b) the performance of our method on black-box PGD-20 $( 8 3 . 6 5 \% )$ and C&W-20 $( 8 3 . 5 7 \% )$ attacks is better than that on white-box attacks $( 5 1 . 8 2 \% )$ ; c) strong attacks cause lower accuracy than weak attacks, i.e., the accuracy on PGD-20 and PGD-100 are $5 1 . 8 2 \%$ and $4 8 . 0 5 \%$ , respectively. In addition, no gradient shattering operator is used in our method. All these results are evaluated on the CIFAR10 dataset using the last checkpoint of ResNet-18. Thus, according to the criterion suggested by (Athalye et al., 2018), the robustness improvement of the proposed method does not result from gradient obfuscation.
170
+
171
+ ![](images/d80997aa85bf7a3f6994282695524b6391f74e853e752ace8e2f3ba9399b5b68.jpg)
172
+ Figure 2: Comparisons of Madry (dotted lines) and CausalAdv-M (solid lines) using ResNet-18 on the CIFAR-10 dataset under PGD-20 attack. Madry-Nat and Madry-Adv represent the accuracy of Madry on the natural and adversarial data, respectively, which also applies to CausalAdv-M. To verify that CausalAdv-M effectively alleviates the robust overfitting rather than delaying the occurrence of robust overfitting, we train these models with 200 epochs which is larger than the basic setting.
173
+
174
+ Consideration of adaptive attack. According to the adaptive attack criterion (Tramer et al., 2020), we augment the original objective function used in the PGD attack with the proposed adversarial distribution alignment loss to implement adaptive attacks, i.e., Eq. 11. Under the adaptive attack, the accuracy is $5 1 . 6 8 \%$ , while under the original PGD-20 attack is $5 1 . 8 2 \%$ , demonstrating that the proposed method is genuinely robust.
175
+
176
+ Consideration of AutoAttack. Following previous work (Pang et al., 2020), we verify the effectiveness of the proposed method on AutoAttack (Croce & Hein, 2020). According to the commonly used setting, see (Pang et al., 2020), we report robust accuracy of WRN-34-10 trained with CIFAR10 dataset on Auto-Attack, Madry: $4 9 . 5 8 \%$ , CausalAdv-M: $5 1 . 5 6 \%$ , TRADES: $5 2 . 4 6 \%$ , CausalAdv
177
+
178
+ Table 3: Classification accuracy $( \% )$ of ResNet-18 on CIFAR-100 under the white-box threat model with $\epsilon = 8 / 2 5 5$ . The best-performance model and the corresponding accuracy are highlighted.
179
+
180
+ <table><tr><td rowspan="2">Method</td><td colspan="4">Best checkpoint</td><td colspan="4">Last checkpoint</td></tr><tr><td>Natural</td><td>FGSM</td><td>PGD-20</td><td>CW-20</td><td>Natural</td><td>FGSM</td><td>PGD-20</td><td>CW-20</td></tr><tr><td>Madry</td><td>55.98</td><td>28.39</td><td>25.15</td><td>24.04</td><td>55.08</td><td>25.35</td><td>21.63</td><td>21.42</td></tr><tr><td>CausalAdv-M</td><td>54.07±0.17</td><td>29.76±0.16</td><td>27.62±0.13</td><td>25.44±0.15</td><td>54.81±0.23</td><td>26.83±0.19</td><td>23.34±0.15</td><td>22.93±0.13</td></tr><tr><td>TRADES</td><td>53.85</td><td>29.04</td><td>27.91</td><td>24.09</td><td>53.54</td><td>29.29</td><td>26.80</td><td>23.79</td></tr><tr><td>CausalAdv-T</td><td>53.17±0.39</td><td>30.66±0.20</td><td>28.57±0.18</td><td>25.74±0.18</td><td>54.79±0.41</td><td>30.81±0.40</td><td>28.51±0.35</td><td>25.32±0.27</td></tr></table>
181
+
182
+ T: $5 4 . 0 9 \%$ , and HE (Pang et al., 2020): $5 3 . 7 4 \%$ , where HE is an adversarial variant achieving state-of-the-art performance. These results show that the proposed method can endow models with robustness comparable to the state-of-the-art performance.
183
+
184
+ Mitigating robust overfitting. The recent work (Rice et al., 2020) first studies the robust overfitting phenomenon. Robust overfitting means that further training will increase the robust training accuracy and test accuracy on natural data after a certain training epoch, but the robust test accuracy will decrease. The robust overfitting phenomenon of Madry (Madry et al., 2018) is depicted in Fig. 2. It can be seen that the robust test accuracy of Madry decreases to about $4 4 \%$ , while the best robust accuracy of Madry is $5 1 . 9 2 \%$ . In contrast, the proposed method drastically reduces the difference between the best robust accuracy $5 4 . 4 4 \%$ and the robust accuracy $5 0 . 9 3 \%$ of the last checkpoint.
185
+
186
+ # 5 RELATED WORK
187
+
188
+ Adversarial attack. Unlike the assumption employed in noisy labels (Han et al., 2020; Liu & Tao, 2015; Xia et al., 2020), adversarial attacks assume that the input determines noise. Since the realization of the adversarial example phenomenon (Biggio et al., 2013; Szegedy et al., 2014), tons of adversarial attacks have been proposed (Moosavi-Dezfooli et al., 2016; Goodfellow et al., 2015; Carlini & Wagner, 2017; Dong et al., 2018; Tu et al., 2019; Madry et al., 2018; Croce & Hein, 2020). Among these attacks, FGSM Goodfellow et al. (2015), PGD attack (Madry et al., 2018), C&W attack (Carlini & Wagner, 2017), and Auto-Attack (Croce & Hein, 2020) are the most commonly used attacks for evaluating robustness.
189
+
190
+ Adversarial defense. The development of adversarial attacks promotes the progress of adversarial defense and detection. Recent work on improving adversarial robustness mainly falls into two categories: certified defense (Raghunathan et al., 2018; Wong & Kolter, 2018; Singla & Feizi, 2020) and empirical defense and detection with two-sample test (Najafi et al., 2019; Carmon et al., 2019; Shafahi et al., 2019; Wong et al., 2019; Pang et al., 2020; Rice et al., 2020; Ma et al., 2018; Gao et al., 2021). Detailed discussions of these exciting works can be found in Appendix G.
191
+
192
+ Causal reasoning. The field of graphical causality, like machine learning, has a long history, see Pearl (2009); Scholkopf et al. ¨ (2021); Peters et al. (2017). One purpose of causal reasoning is to pursue the causal effect of interventions, contributing to achieving the desired objectives. Recent work shows the benefits of introducing causality into machine learning from various aspects (Zhang et al., 2020a; Mitrovic et al., 2020; Teshima et al., 2020; Tang et al., 2020; Sauer & Geiger, 2020; Tang et al., 2021). More details about relevant works can be found in Appendix H.
193
+
194
+ # 6 CONCLUSION
195
+
196
+ In this paper, we provide a novel causality viewpoint for understanding and mitigating adversarial vulnerability. Through constructing the causal graph of the adversarial data generation process and formalizing the intuition of adversarial attacks, we show that the spurious correlation between labels and style variables is important for understanding and mitigating adversarial vulnerability. Inspired by the observation, we propose the adversarial distribution alignment method, which takes the spurious correlation into account for robustness improvement. In addition, we find that the proposed method shares the same spirits to existing adversarial training variants. In future work, we will develop more effective algorithms to leverage or eliminate the spurious correlation between labels and style variables to further improve adversarial robustness. In addition, we will explore the uses of counterfactual statements to explain and mitigate the adversarial vulnerability. In sum, we make a first step towards employing causality to contribute to adversarial learning.
197
+
198
+ # 7 ACKNOWLEDGMENT
199
+
200
+ We thank the area chair and reviewers for their valuable comments. YGZ and BH were supported by the RGC ECS No. 22200720 and NSFC YSF No. 62006202. YGZ and XMT were supported by NSFC No. 61872329. MMG was supported by Australian Research Council Project DE210101624. TLL was supported by Australian Research Council Projects DE-190101473 and DP-220102121. KZ would like to acknowledge the support by the National Institutes of Health (NIH) under Contract R01HL159805, by the NSF-Convergence Accelerator Track-D award #2134901, and by the United States Air Force under Contract No. FA8650-17-C7715.
201
+
202
+ # 8 ETHICS STATEMENT
203
+
204
+ This paper does not raise any ethics concerns. This study does not involve any human subjects, practices to data set releases, potentially harmful insights, methodologies and applications, potential conflicts of interest and sponsorship, discrimination/bias/fairness concerns, privacy and security issues, legal compliance, and research integrity issues.
205
+
206
+ # 9 REPRODUCIBILITY STATEMENT
207
+
208
+ To ensure the reproducibility of experimental results, we open source our code https:// github.com/YonggangZhangUSTC/CausalAdv.git.
209
+
210
+ #
211
+
212
+ REFERENCES
213
+ Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In International Conference on Machine Learning, pp. 274–283. PMLR, 2018.
214
+ Yoshua Bengio, Aaron Courville, and Pascal Vincent. Representation learning: A review and new perspectives. IEEE Transactions on Pattern Analysis and Machine Intelligence, 35(8):1798–1828, 2013.
215
+ Battista Biggio, Igino Corona, Davide Maiorca, Blaine Nelson, Nedim Srndi ˇ c, Pavel Laskov, Gior- ´ gio Giacinto, and Fabio Roli. Evasion attacks against machine learning at test time. In Joint European Conference on Machine Learning and Knowledge Discovery in Databases, pp. 387– 402. Springer, 2013.
216
+ Peter Buhlmann. Invariance, causality and robustness. ¨ Statistical Science, 35(3):404–426, 2020.
217
+ Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 IEEE Symposium on Security and Privacy $( S P )$ , pp. 39–57. IEEE, 2017.
218
+ Yair Carmon, Aditi Raghunathan, Ludwig Schmidt, John C Duchi, and Percy S Liang. Unlabeled data improves adversarial robustness. Advances in Neural Information Processing Systems, 32, 2019.
219
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International Conference on Machine Learning, pp. 1597–1607. PMLR, 2020.
220
+ Juan Correa and Elias Bareinboim. A calculus for stochastic interventions: Causal effect identification and surrogate experiments. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pp. 10093–10100, 2020.
221
+ Francesco Croce and Matthias Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. In International Conference on Machine Learning, pp. 2206– 2216. PMLR, 2020.
222
+ Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In Proceedings of the IEEE conference on Computer Vision and Pattern Recognition, pp. 9185–9193, 2018.
223
+ Frederick Eberhardt and Richard Scheines. Interventions and causal inference. Philosophy of science, 74(5):981–995, 2007.
224
+ Samuel G Finlayson, John D Bowers, Joichi Ito, Jonathan L Zittrain, Andrew L Beam, and Isaac S Kohane. Adversarial attacks on medical machine learning. Science, 363(6433):1287–1289, 2019.
225
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. In International Conference on Machine Learning, pp. 1050–1059. PMLR, 2016.
226
+ 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.
227
+ Ruize Gao, Feng Liu, Jingfeng Zhang, Bo Han, Tongliang Liu, Gang Niu, and Masashi Sugiyama. Maximum mean discrepancy test is aware of adversarial attacks. In International Conference on Machine Learning, pp. 3564–3575. PMLR, 2021.
228
+ 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, 2018.
229
+ Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. In International Conference on Learning Representations, 2015.
230
+ Alison Gopnik, Clark Glymour, David M Sobel, Laura E Schulz, Tamar Kushnir, and David Danks. A theory of causal learning in children: causal maps and bayes nets. Psychological review, 111 (1):3, 2004.
231
+ Bo Han, Gang Niu, Xingrui Yu, Quanming Yao, Miao Xu, Ivor Tsang, and Masashi Sugiyama. Sigua: Forgetting may make learning with noisy labels more robust. In International Conference on Machine Learning, pp. 4006–4016. PMLR, 2020.
232
+ 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.
233
+ 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.
234
+ Christina Heinze-Deml and Nicolai Meinshausen. Conditional variance penalties and domain shift robustness. Machine Learning, 110(2):303–348, 2021.
235
+ Jan Hendrik Metzen, Mummadi Chaithanya Kumar, Thomas Brox, and Volker Fischer. Universal adversarial perturbations against semantic image segmentation. In Proceedings of the IEEE International Conference on Computer Vision, pp. 2755–2764, 2017.
236
+ Geoffrey Hinton, Oriol Vinyals, and Jeff Dean. Distilling the knowledge in a neural network. arXiv preprint arXiv:1503.02531, 2015.
237
+ Andrew Ilyas, Shibani Santurkar, Logan Engstrom, Brandon Tran, and Aleksander Madry. Adversarial examples are not bugs, they are features. Advances in Neural Information Processing Systems, 32, 2019.
238
+ Alex Kendall and Yarin Gal. What uncertainties do we need in bayesian deep learning for computer vision? In Proceedings of the 31st International Conference on Neural Information Processing Systems, pp. 5580–5590, 2017.
239
+ Niki Kilbertus, Giambattista Parascandolo, and Bernhard Scholkopf. Generalization in anti-causal ¨ learning. arXiv preprint arXiv:1812.00524, 2018.
240
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
241
+ 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.
242
+ Yann LeCun, Leon Bottou, Yoshua Bengio, and Patrick Haffner. Gradient-based learning applied to ´ document recognition. Proceedings of the IEEE, 86(11):2278–2324, 1998.
243
+ Tongliang Liu and Dacheng Tao. Classification with noisy labels by importance reweighting. IEEE Transactions on Pattern Analysis and Machine Intelligence, 38(3):447–461, 2015.
244
+ Xingjun Ma, Bo Li, Yisen Wang, Sarah M Erfani, Sudanthi Wijewickrema, Grant Schoenebeck, Dawn Song, Michael E Houle, and James Bailey. Characterizing adversarial subspaces using local intrinsic dimensionality. In International Conference on Learning Representations, 2018.
245
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018.
246
+ Jovana Mitrovic, Brian McWilliams, Jacob C Walker, Lars Holger Buesing, and Charles Blundell. Representation learning via invariant causal mechanisms. In International Conference on Learning Representations, 2020.
247
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, and Pascal Frossard. Deepfool: a simple and accurate method to fool deep neural networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 2574–2582, 2016.
248
+ Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1765–1773, 2017.
249
+ Amir Najafi, Shin-ichi Maeda, Masanori Koyama, and Takeru Miyato. Robustness to adversarial perturbations in learning from incomplete data. Advances in Neural Information Processing Systems, 32, 2019.
250
+ Tianyu Pang, Xiao Yang, Yinpeng Dong, Kun Xu, Jun Zhu, and Hang Su. Boosting adversarial training with hypersphere embedding. Advances in Neural Information Processing Systems, 33: 7779–7792, 2020.
251
+ Nicolas Papernot, Patrick McDaniel, Ian Goodfellow, Somesh Jha, Z Berkay Celik, and Ananthram Swami. Practical black-box attacks against machine learning. In Proceedings of the 2017 ACM on Asia Conference on Computer and Communications Security, pp. 506–519, 2017.
252
+ Judea Pearl. Causality. Cambridge university press, 2009.
253
+ Jonas Peters, Dominik Janzing, and Bernhard Scholkopf. ¨ Elements of causal inference: foundations and learning algorithms. The MIT Press, 2017.
254
+ Aditi Raghunathan, Jacob Steinhardt, and Percy Liang. Certified defenses against adversarial examples. In International Conference on Learning Representations, 2018.
255
+ Nasim Rahaman, Aristide Baratin, Devansh Arpit, Felix Draxler, Min Lin, Fred Hamprecht, Yoshua Bengio, and Aaron Courville. On the spectral bias of neural networks. In International Conference on Machine Learning, pp. 5301–5310. PMLR, 2019.
256
+ Leslie Rice, Eric Wong, and Zico Kolter. Overfitting in adversarially robust deep learning. In International Conference on Machine Learning, pp. 8093–8104. PMLR, 2020.
257
+ Shiori Sagawa, Pang Wei Koh, Tatsunori B Hashimoto, and Percy Liang. Distributionally robust neural networks for group shifts: On the importance of regularization for worst-case generalization. In International Conference on Learning Representations, 2020.
258
+ Axel Sauer and Andreas Geiger. Counterfactual generative networks. In International Conference on Learning Representations, 2020.
259
+ Bernhard Scholkopf, Francesco Locatello, Stefan Bauer, Nan Rosemary Ke, Nal Kalchbrenner, ¨ Anirudh Goyal, and Yoshua Bengio. Toward causal representation learning. Proceedings of the IEEE, 109(5):612–634, 2021.
260
+ Ali Shafahi, Mahyar Najibi, Mohammad Amin Ghiasi, Zheng Xu, John Dickerson, Christoph Studer, Larry S Davis, Gavin Taylor, and Tom Goldstein. Adversarial training for free! Advances in Neural Information Processing Systems, 32, 2019.
261
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. In International Conference on Learning Representations, 2015.
262
+ Sahil Singla and Soheil Feizi. Second-order provable defenses against adversarial attacks. In International Conference on Machine Learning, pp. 8981–8991. PMLR, 2020.
263
+ Christian Szegedy, Wojciech Zaremba, Ilya Sutskever, Joan Bruna, Dumitru Erhan, Ian J. Goodfellow, and Rob Fergus. Intriguing properties of neural networks. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings, 2014.
264
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1–9, 2015.
265
+ Kaihua Tang, Jianqiang Huang, and Hanwang Zhang. Long-tailed classification by keeping the good and removing the bad momentum causal effect. Advances in Neural Information Processing Systems, 33, 2020.
266
+ Kaihua Tang, Mingyuan Tao, and Hanwang Zhang. Adversarial visual robustness by causal intervention. arXiv preprint arXiv:2106.09534, 2021.
267
+ Takeshi Teshima, Issei Sato, and Masashi Sugiyama. Few-shot domain adaptation by causal mechanism transfer. In International Conference on Machine Learning, pp. 9458–9469. PMLR, 2020.
268
+ Florian Tramer, Nicholas Carlini, Wieland Brendel, and Aleksander Madry. On adaptive attacks to adversarial example defenses. Advances in Neural Information Processing Systems, 33, 2020.
269
+ Chun-Chen Tu, Paishun Ting, Pin-Yu Chen, Sijia Liu, Huan Zhang, Jinfeng Yi, Cho-Jui Hsieh, and Shin-Ming Cheng. Autozoom: Autoencoder-based zeroth order optimization method for attacking black-box neural networks. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pp. 742–749, 2019.
270
+ Cumhur Erkan Tuncali, Georgios Fainekos, Hisahiro Ito, and James Kapinski. Simulation-based adversarial test generation for autonomous vehicles with machine learning components. In 2018 IEEE Intelligent Vehicles Symposium (IV), pp. 1555–1562. IEEE, 2018.
271
+ Eric Wong and Zico Kolter. Provable defenses against adversarial examples via the convex outer adversarial polytope. In International Conference on Machine Learning, pp. 5286–5295. PMLR, 2018.
272
+ Eric Wong, Leslie Rice, and J Zico Kolter. Fast is better than free: Revisiting adversarial training. In International Conference on Learning Representations, 2019.
273
+ Xiaobo Xia, Tongliang Liu, Bo Han, Nannan Wang, Mingming Gong, Haifeng Liu, Gang Niu, Dacheng Tao, and Masashi Sugiyama. Part-dependent label noise: Towards instance-dependent label noise. Advances in Neural Information Processing Systems, 33:7597–7610, 2020.
274
+ Cihang Xie, Yuxin Wu, Laurens van der Maaten, Alan L Yuille, and Kaiming He. Feature denoising for improving adversarial robustness. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 501–509, 2019.
275
+ Yuzhe Yang, Guo Zhang, Dina Katabi, and Zhi Xu. Me-net: Towards effective adversarial robustness with matrix estimation. In International Conference on Machine Learning, pp. 7025–7034. PMLR, 2019.
276
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In British Machine Vision Conference 2016. British Machine Vision Association, 2016.
277
+ Cheng Zhang, Kun Zhang, and Yingzhen Li. A causal view on robustness of neural networks. Advances in Neural Information Processing Systems, 33, 2020a.
278
+ Chiyuan Zhang, Samy Bengio, Moritz Hardt, Benjamin Recht, and Oriol Vinyals. Understanding deep learning (still) requires rethinking generalization. Communications of the ACM, 64(3):107– 115, 2021.
279
+ 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.
280
+ Kun Zhang, Bernhard Scholkopf, Krikamol Muandet, and Zhikun Wang. Domain adaptation under ¨ target and conditional shift. In International Conference on Machine Learning, pp. 819–827. PMLR, 2013.
281
+ Yonggang Zhang, Xinmei Tian, Ya Li, Xinchao Wang, and Dacheng Tao. Principal component adversarial example. IEEE Transactions on Image Processing, 29:4804–4815, 2020b.
282
+
283
+ # A DERIVATION OF DISTRIBUTION DIVERGENCE
284
+
285
+ Considering that the adversarial distribution often cannot be obtained analytically, we need to relax the distribution divergence in Eq. 4, i.e., $d \left( P \left( Y | X \right) , P _ { \theta } \left( Y | \tilde { X } \right) \right)$ . Without loss of generality, the metric $d$ in Eq. 4 can be realized as total variation distance (TVD). Thus, according to the definition of TVD, we have
286
+
287
+ $$
288
+ d \big ( P \left( Y | X \right) , P _ { \theta } \left( Y | \tilde { X } \right) \big ) \leq d \big ( P _ { \theta } \left( Y | \tilde { X } \right) , Q _ { \theta } \left( Y | \tilde { X } \right) \big ) + d \left( P \left( Y | X \right) , Q _ { \theta } \left( Y | X \right) \right) ,
289
+ $$
290
+
291
+ where $Q _ { \theta } ( Y | X )$ is the conditional distribution specified by the classifier $h \left( X ; \pmb { \theta } \right)$ . According to the Pinsker inequality, i.e., $\begin{array} { r } { d ( P , Q ) \leq \sqrt { \frac { K L ( P | | Q ) } { 2 } } } \end{array}$ , where $K L$ is the Kullback-Leibler divergence, we have an upper bound of Eq. 12:
292
+
293
+ $$
294
+ l \bigl ( P \left( Y | X \right) , P _ { \theta } \left( Y | \tilde { X } \right) \bigr ) \leq \sqrt { \frac { K L \left( P _ { \theta } \left( Y | \tilde { X } \right) | | Q _ { \theta } \left( Y | \tilde { X } \right) \right) } { 2 } } + \sqrt { \frac { K L \left( P \left( Y | X \right) | | Q _ { \theta } \left( Y | X \right) \right) } { 2 } } .
295
+ $$
296
+
297
+ Now, we can employ the upper bound Eq. 13 as a surrogate loss. In practice, we can replace $\sqrt { \frac { K L ( P | | Q ) } { 2 } }$ with $K L \left( P | | Q \right)$ . The intuition is that the difference between $\sqrt { \frac { K L ( P | | Q ) } { 2 } }$ and $K L \left( P | | Q \right)$ is relatively small when $K L \left( P | | Q \right)$ is not extremely large, so the replacement will not introduce much difference. Thus, we derive Eq. 5: $K L \left( \bar { P } _ { \theta } \left( \bar { Y } | \tilde { X } \right) | | Q _ { \theta } \left( \bar { Y } | \tilde { X } \right) \right) +$ $\gamma K L \left( P \left( Y | X \right) | | Q _ { \theta } \left( Y | X \right) \right)$ , where $\gamma$ is a tunable hyperparameter.
298
+
299
+ Here, we give an intuitive explanation of why optimizing Eq. 5 can make the adversarial distribution similar to the natural distribution. Considering that both the adversarial distribution $P _ { \theta } \left( Y | \tilde { X } \right)$ and the anchor $Q _ { \theta } \left( Y | \tilde { X } \right)$ are parameterized by $\theta$ , so optimizing $\theta$ to minimize $K L \left( P _ { \theta } \left( Y | \tilde { X } \right) | | Q _ { \theta } \left( Y | \tilde { X } \right) \right)$ can force the adversarial distribution be similar to the distribution specified by the classifier $h \left( X ; \theta \right)$ , i.e., $Q _ { \theta } \left( Y | \tilde { X } \right)$ . That is, optimizing $Q _ { \theta } \left( Y | \tilde { X } \right)$ will also change the adversarial distribution $P _ { \theta } \left( Y | \tilde { X } \right)$ . In addition, minimizing the divergence $K L \left( P \left( Y | X \right) | | Q _ { \theta } \left( Y | \tilde { X } \right) \right)$ can endow the classifier with the ability to provide a good prediction performance. Thus, minimizing $K L \left( P _ { \pmb { \theta } } \left( Y | \tilde { X } \right) | | Q _ { \pmb { \theta } } \left( Y | \tilde { X } \right) \right)$ will make the adversarial distribution be similar with the natural distribution.
300
+
301
+ To verify the replacement will not introduce much difference, we evaluate the robustness of CausalAdv-M and CausalAdv-T on the CIFAR-10 dataset with two losses, i.e., Eq. 5 and Eq. 13. The results evaluated on best checkpoints are shown in Table 4.
302
+
303
+ Table 4: Classification accuracy $( \% )$ on CIFAR-10 under the white-box threat model with $\epsilon = 8 / 2 5 5$ Here, “\*” means that Eq. 13 is used for optimization.
304
+
305
+ <table><tr><td></td><td>Natural</td><td>FGSM</td><td>PGD20</td><td>CW20</td></tr><tr><td>Madry</td><td>83.56</td><td>56.69</td><td>51.92</td><td>51.00</td></tr><tr><td>CausalAdv-M</td><td>80.42</td><td>57.98</td><td>54.44</td><td>52.51</td></tr><tr><td>CausalAdv-M*</td><td>80.03</td><td>57.47</td><td>52.98</td><td>52.72</td></tr><tr><td>TRADES</td><td>81.39</td><td>57.25</td><td>53.64</td><td>51.39</td></tr><tr><td>CausalAdv-T</td><td>81.22</td><td>58.97</td><td>54.55</td><td>52.95</td></tr><tr><td>CausalAdv-T*</td><td>79.94</td><td>58.46</td><td>54.12</td><td>52.28</td></tr></table>
306
+
307
+ # B CALCULATION OF THE EXPECTATION ON THE STYLE INFORMATION
308
+
309
+ We provide details of calculating $\mathbb { E } _ { \hat { s } \left( \tilde { X } \right) \sim \mathcal { N } \left( \mu \left( \tilde { X } \right) , \sigma ^ { 2 } I \right) } C E \left( g \left( \hat { s } \left( \tilde { X } \right) ; W _ { g } \right) , Y \right)$ . We assume a normal distribution for the styles, i.e., $\hat { s } \left( \tilde { X } \right) \sim \mathcal { N } \left( \mu \left( \tilde { X } \right) , \sigma ^ { 2 } I \right)$ . According to the definition of the crossentropy loss, for a input pair $( x , y )$ we have:
310
+
311
+ $$
312
+ \begin{array} { r l } & { \frac { 3 } { 2 } \Delta \phi _ { \phi } \varepsilon \partial \phi _ { \phi } ^ { \star } ( x , y ) + \varepsilon \mathcal { F } \mathcal { F } \mathcal { F } \mathcal { F } ( \phi \xi ( x ; x ; \theta ) , \theta ) } \\ & { = 2 e _ { - \phi , x \phi , y } \frac { 1 } { \varepsilon ( x , y ) } e _ { x , y } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } } \\ & { \quad \times \log \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) \sin ( x , y ) + \varepsilon \mathcal { F } ( x , y ) } \frac { 1 } { \varepsilon ( x , y ) } } \\ & { \quad - \log \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) \sin ( x , y ) + \varepsilon \mathcal { F } ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } } \\ & { \quad - \log \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) \sin ( x , y ) + \varepsilon \mathcal { F } ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } } \\ & { \quad - \log \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) + \varepsilon \mathcal { F } ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } } \\ & { \quad - \log \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) + \varepsilon \mathcal { F } ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } , \ \exp _ { ( ( \phi , x ) ) } \ , \ } \\ & { \quad - \log \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } } \\ & { \quad - \log \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } } \\ & { \quad \times \log \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } \frac { \varepsilon ( x , y ) } { \varepsilon ( x , y ) } } \\ & \quad \ \end{array}
313
+ $$
314
+
315
+ where the inequality follows from the Jensen’s inequality: $\mathbb { E } \log ( X ) \le \log \mathbb { E } X$ , the expectation is calculated by leveraging the moment-generating function:
316
+
317
+ $$
318
+ \mathbb { E } e ^ { t X } = e ^ { t \mu + \frac { 1 } { 2 } { \sigma } ^ { 2 } t ^ { 2 } } , X \sim { \mathcal { N } } ( \mu , { \sigma } ^ { 2 } ) .
319
+ $$
320
+
321
+ Note that, we define the function $\overline { { g } } \left( \mu \left( x \right) ; W _ { g } \right)$ for simplicity:
322
+
323
+ $$
324
+ P ( ( Y = y | \overline { { g } } ( \boldsymbol { \mu } ( \boldsymbol { x } ) ; W _ { g } ) ) \triangleq \frac { W _ { g , y } ^ { \top } \mu ( \boldsymbol { x } ) } { \sum _ { j = 1 } e ^ { W _ { g , j } ^ { \top } \mu ( \boldsymbol { x } ) + \frac { \sigma ^ { 2 } } { 2 } ( W _ { g , j } - W _ { g , y } ) \top } ( W _ { g , j } - W _ { g , y } ) } .
325
+ $$
326
+
327
+ Besides seting $g$ to a linear model, non-linear models, e.g., neural networks, can also be employed in practice. To verify the influence introduced by selecting different instantiation of model $g$ , we compare different realizations of mode $g$ , i.e., linear mapping and non-linear neural networks. The following results suggest that our method is relatively robust to the selection of model $g$ . Note that, all these results are evaluated on the best checkpoint models trained on CIFAR-10 dataset.
328
+
329
+ Table 5: Classification accuracy $( \% )$ on CIFAR-10 under the white-box threat model with $\epsilon = 8 / 2 5 5$ . Here, $^ { 6 6 } +$ Linear” means that model $g$ is instantiated with a linear mapping, and $^ { 6 6 } + \mathrm { N o n }$ -linear” means that model $g$ is instantiated with a neural network.
330
+
331
+ <table><tr><td></td><td>Natural</td><td>FGSM</td><td>PGD20</td><td>CW20</td></tr><tr><td>Madry</td><td>83.56</td><td>56.69</td><td>51.92</td><td>51.00</td></tr><tr><td>CausalAdv-M+Linear</td><td>80.68</td><td>57.18</td><td>53.36</td><td>51.41</td></tr><tr><td>CausalAdv-M+Non-linear</td><td>80.42</td><td>57.98</td><td>54.44</td><td>52.51</td></tr><tr><td>TRADES</td><td>81.39</td><td>57.25</td><td>53.64</td><td>51.39</td></tr><tr><td>CausalAdv-T+Linear</td><td>80.31</td><td>58.43</td><td>54.31</td><td>52.25</td></tr><tr><td>CausalAdv-T+Non-linear</td><td>81.22</td><td>58.97</td><td>54.55</td><td>52.95</td></tr></table>
332
+
333
+ # C RELATIONSHIP BETWEEN ORTHOGONALITY AND STATISTICAL INDEPENDENCE
334
+
335
+ We give the proof for the following lemma in Sec. 3.3. Note that, we use $R$ to present the learned representation of $X$ , and replace $X$ with $R$ for simplicity.
336
+
337
+ Lemma 1. $R \in \mathbb { R } ^ { d }$ is the learned representation, where $d$ is the number of dimension of $R$ . Assume that $R$ is a normal distribution with mean m and covariance matrix $M$ . The content used for predicting labels, i.e., logits, is obtained by applying a linear functions to $R$ , i.e., ${ \hat { c } } ( R ) = W _ { c } R _ { }$ , where $W _ { c }$ are parameters used for mapping $R$ to logits. The style is modeled by a normal distribution, i.e., $\hat { s } \left( R \right) = \mu \left( R ; W _ { s } \right) + \bar { \Sigma } \left( Y \right) ^ { \frac { 1 } { 2 } } \bar { n } ,$ , where $W _ { s }$ presents parameters for modeling the mean of styles, and $\textbf { \em n }$ is sampled from a standard normal distribution. Assume that $\mu \left( R ; W _ { s } \right)$ is a linear function, i.e., $\hat { s } \left( R \right) = W _ { s } R + \Sigma \left( Y \right) ^ { \frac { 1 } { 2 } } n$ . Then, setting $W _ { s }$ as an instantiate of the orthogonal complement of $W _ { c }$ leads to statistical independence, i.e., $\hat { c } \left( R \right) \perp \perp \hat { s } \left( R \right)$ . Here, $\perp$ denotes the statistical independence, and we define $\langle a , b \rangle _ { M } = \langle a , M b \rangle$ for a given semi-definite matrix $M$ . The orthogonality $A \perp _ { M } B$ of two subspaces $A$ and $B$ is defined likewise.
338
+
339
+ Proof. Under the assumption in Lemma 1, setting $W _ { s }$ as an instantiate of the orthogonal complement of $W _ { c }$ , we have:
340
+
341
+ $$
342
+ \begin{array} { r l } & { \ker ( W _ { s } ) ^ { \perp } \perp _ { M } \ker ( W _ { c } ) ^ { \perp } \Longleftrightarrow \operatorname { i m } ( W _ { s } ^ { \top } ) \perp _ { M } \operatorname { i m } ( W _ { c } ^ { \top } ) \Longleftrightarrow \langle W _ { s } ^ { \top } { \boldsymbol a } , W _ { c } ^ { \top } b \rangle _ { M } = 0 \forall { \boldsymbol a } , { \boldsymbol b } } \\ & { \Longleftrightarrow \langle W _ { s } ^ { \top } { \boldsymbol a } , M W _ { c } ^ { \top } { \boldsymbol b } \rangle = 0 \forall { \boldsymbol a } , { \boldsymbol b } \Longleftrightarrow W _ { s } M W _ { c } ^ { \top } = 0 \Longleftrightarrow \mathbb { E } _ { R } W _ { s } \left( R - m \right) \left( R - m \right) ^ { \top } W _ { c } ^ { \top } = 0 } \\ & { \Longleftrightarrow \mathbb { E } _ { R , n } W _ { s } \Big ( R + \Sigma ^ { \frac { 1 } { 2 } } n - m \Big ) ( R - m ) ^ { \top } W _ { c } ^ { \top } = 0 \Longleftrightarrow C o v \left( \hat { s } \left( R \right) , \hat { c } \left( R \right) \right) = 0 } \\ & { \Longleftrightarrow \hat { c } ( R ) \perp \hat { s } \left( R \right) } \end{array}
343
+ $$
344
+
345
+ # D MORE DETAILS ABOUT EVALUATION METRICS AND TRAINING DETAILS
346
+
347
+ Evaluation metrics. For MNIST dataset, we set the maximum perturbation bound $\epsilon = 0 . 3$ , perturbation step size $\eta = 0 . 0 1$ , and the number of iterations $K = 4 0$ for PGD and C&W attacks, which keeps the same as (Zhang et al., 2019). Following (Rice et al., 2020), we set perturbation bound $\epsilon = 8 / 2 5 5$ , perturbation step size $\eta = \epsilon / 1 0$ , and the number of iterations $K = 2 0$ for CIFAR-10 dataset.
348
+
349
+ Training details. For MNIST, we use the same CNN architecture as (Carlini & Wagner, 2017; Zhang et al., 2019). Following (Zhang et al., 2019), the network is trained using SGD with 0.9 momentum for 50 epochs with an initial learning rate 0.01, and the batch size is set to 128. Hyperparameters used to craft adversarial examples for training are the same as those used for evaluation. These two networks share the same hyper-parameters: we use SGD with 0.9 momentum, weight decay $2 \times { 1 0 } ^ { - 4 }$ , batch size 128, and an initial learning rate of 0.1. The maximum epoch is 120, and the learning rate is divided by 10 at epoch 60 and 90, respectively. To generate adversarial examples for training, we set the maximal perturbation $\epsilon = 8 / 2 5 5$ , the perturbation step size $\eta = 2 / 2 5 5$ , and the number of iterations $K = 1 0$ , which is the same as (Rice et al., 2020). In all of our experiments $\beta$ is set to 1.0. For CausalAdv-M, $\lambda$ is set to 1.0 and 0.5 for CIFAR-10 and CIFAR-100 datasets, respectively. For CausalAdv-T, $\lambda$ is set to 0.5 and 1.0 for CIFAR-10 and CIFAR-100 datasets, respectively.
350
+
351
+ # E EXPERIMENTS OF WRN-34-10 ON CIFAR-10
352
+
353
+ Table 6: Classification accuracy $( \% )$ of WRN-34-10 on CIFAR-10 under the white-box threat model. The best-performance model and the corresponding accuracy are highlighted.
354
+
355
+ <table><tr><td rowspan="2">Method</td><td colspan="4">Best checkpoint</td><td colspan="4">Last checkpoint</td></tr><tr><td>Natural</td><td>FGSM</td><td>PGD-20</td><td>CW-20</td><td>Natural</td><td>FGSM</td><td>PGD-20</td><td>CW-20</td></tr><tr><td>Madry</td><td>86.63</td><td>59.48</td><td>53.65</td><td>53.58</td><td>86.60</td><td>57.07</td><td>49.23</td><td>49.46</td></tr><tr><td>CausalAdv-M</td><td>85.24</td><td>61.22</td><td>55.17</td><td>55.68</td><td>85.61</td><td>60.08</td><td>51.76</td><td>52.59</td></tr><tr><td>TRADES</td><td>84.32</td><td>60.94</td><td>56.69</td><td>54.87</td><td>84.86</td><td>59.94</td><td>52.04</td><td>52.39</td></tr><tr><td>CausalAdv-T</td><td>84.19</td><td>61.62</td><td>57.36</td><td>55.75</td><td>84.35</td><td>61.57</td><td>55.15</td><td>55.23</td></tr></table>
356
+
357
+ In Table 6, we report the accuracy of WRN-34-10 (Zagoruyko & Komodakis, 2016) of Madry, TRADES, and the proposed method on CIFAR-10 against various attacks, i.e., FGSM, PGD, and
358
+
359
+ C&W attacks, which are widely used in the literature. Here, “Natural” denotes the accuracy of natural test images. We denote by PGD-20 the PGD attack with 20 iterations for generating adversarial examples, which also applies to the C&W attack. We can see that the proposed method achieves the best robustness against all three types of attacks, demonstrating that taking into account the spurious correlation can significantly improve the adversarial robustness. Note that the standard deviations of 5 runs are omitted, because they hardly affect the results.
360
+
361
+ # F ABLATION STUDY
362
+
363
+ Table 7: Robust accuracy $( \% )$ of ResNet-18 on CIFAR-10 and CIFAR-100 under the white-box threat model. For simplicity, we use $t _ { 1 }$ , $t _ { 2 }$ , and $t _ { 3 }$ to represent the first, second, and third terms in Eq. 11, respectively. The best-performance model and the corresponding accuracy are highlighted.
364
+
365
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">t1</td><td rowspan="2">t2</td><td rowspan="2">t3</td><td colspan="3">CIFAR-10</td><td colspan="3">CIFAR-100</td></tr><tr><td>FGSM</td><td>PGD-20</td><td>CW-20</td><td>FGSM</td><td>PGD-20</td><td>CW-20</td></tr><tr><td>Madry</td><td></td><td></td><td></td><td>56.69</td><td>51.92</td><td>51.00</td><td>56.69</td><td>51.92</td><td>51.00</td></tr><tr><td>CausalAdv-M</td><td>专</td><td></td><td>√</td><td>57.98</td><td>54.44</td><td>52.51</td><td>57.98</td><td>54.44</td><td>52.51</td></tr><tr><td>TRADES</td><td>√</td><td>√</td><td></td><td>57.25</td><td>53.64</td><td>51.39</td><td>57.25</td><td>53.64</td><td>51.39</td></tr><tr><td>CausalAdv-T</td><td>√</td><td>√</td><td>√</td><td>58.97</td><td>54.55</td><td>52.95</td><td>58.97</td><td>54.55</td><td>52.95</td></tr></table>
366
+
367
+ We implicitly conducted ablation studies when designing Table 1, Table 2, and Table 3. To further understand the comparative effects of different terms of the proposed method, we reorganize the robust accuracy of the best checkpoint trained on CIFAR-10 and CIFAR-100 in Table 7. Comparing Madry, TRADES, and CausalAdv-M, we find that introducing the second $( t _ { 2 } )$ and the third term $( t _ { 3 } )$ can improve the robustness and that the effect of these two terms is close. Similarly, comparing TRADES and CausalAdv-T, we see that introducing the third term $( t _ { 3 } )$ can further improve the robustness.
368
+
369
+ To further analyze the superiority of our method, we compare CausalAdv-M with Madry to explore which kind of adversarial examples that CausalAdv-M is more robust to. These analyses are based on the spurious perspective, as one main conclusion of our paper is that the origin of adversarial vulnerability is the excessive focus of DNNs on spurious correlations between labels and style variables. Specifically, we calculate the KL-divergence between $K L \left( P \left( Y | h \left( x , s \right) \right) | | P \left( Y | h \left( \dot { x } _ { a d v } , s \right) \right) \right)$ for each input $x$ , and divide samples into several (10 in our experiment) bins according to the KLdivergence. Then, we evaluate the robust accuracy of models trained with CausalAdv-M and Madry in each bin sample, and results are depicted in Fig. 3. We can see that CausalAdv-M is more robust to samples leading to large KL-divergence than Madry. According to these empirical results, we can conclude that the proposed method is more robust to samples causing a significant difference between natural and adversarial distributions.
370
+
371
+ ![](images/4424792f32aef7e203fdb475bf520645b4a1d4e323dfaefad07475f7839938b1.jpg)
372
+ Figure 3: Classification accuracy $( \% )$ on CIFAR-10 under the PGD attack with with $\epsilon = 8 / 2 5 5$ .
373
+
374
+ To further verify that CausalAdv-T can outperform TRADES interms of both the natural and adversairal robustness, we compare the robust accuracy of CausalAdv-T with that of TRADES on CIFAR-10 and CIFAR-100 dataset. The results evaluated on the best checkpoint models are shown in Table 8. We can see that CausalAdv-T can improve both the natural and the adversarial accuracy.
375
+
376
+ Table 8: Robust accuracy $( \% )$ of ResNet-18 on CIFAR-10 and CIFAR-100 under the white-box threat model.
377
+
378
+ <table><tr><td rowspan="2"></td><td colspan="4">CIFAR-10</td><td colspan="4">CIFAR-100</td></tr><tr><td>Natural</td><td>FGSM</td><td>PGD20</td><td>CW20</td><td>Natural</td><td>FGSM</td><td>PGD20</td><td>CW20</td></tr><tr><td>TRADES</td><td>81.39</td><td>57.25</td><td>53.64</td><td>51.39</td><td>53.85</td><td>29.04</td><td>27.91</td><td>24.09</td></tr><tr><td>CausalAdv-T</td><td>81.72</td><td>58.26</td><td>54.06</td><td>51.90</td><td>53.91</td><td>30.19</td><td>28.11</td><td>24.90</td></tr></table>
379
+
380
+ To explore the sensitivity of our method on hyperparameters, we evaluate our methods on CIFAR10 and CIFAR100 datasets. The results are organized in Table 9. Results in Table 9 demonstrate that
381
+
382
+ Table 9: Robust accuracy $( \% )$ of ResNet-18 on CIFAR-10 and CIFAR-100 under the white-box threat model.
383
+
384
+ <table><tr><td rowspan="2"></td><td colspan="4">CIFAR10</td><td colspan="4">CIFAR100</td></tr><tr><td>Natural</td><td>FGSM</td><td>PGD20</td><td>CW20</td><td>Natural</td><td>FGSM</td><td>PGD20</td><td>CW20</td></tr><tr><td>Madry</td><td>83.56</td><td>56.69</td><td>51.92</td><td>51.00</td><td>55.98</td><td>28.39</td><td>25.15</td><td>24.04</td></tr><tr><td>CausalAdv-M入 = 0.2</td><td>82.17</td><td>57.13</td><td>53.28</td><td>51.80</td><td>54.68</td><td>29.85</td><td>27.32</td><td>25.88</td></tr><tr><td>CausalAdv-M入= 0.5</td><td>80.83</td><td>57.28</td><td>53.65</td><td>51.97</td><td>54.07</td><td>29.76</td><td>27.62</td><td>25.44</td></tr><tr><td>CausalAdv-M入= 1.0</td><td>80.42</td><td>57.98</td><td>54.44</td><td>52.51</td><td>52.69</td><td>29.77</td><td>27.80</td><td>26.04</td></tr><tr><td>CausalAdv-M入= 1.5</td><td>80.17</td><td>57.53</td><td>53.24</td><td>51.40</td><td>52.37</td><td>30.74</td><td>28.49</td><td>26.71</td></tr><tr><td>CausalAdv-M入 = 2.0</td><td>80.35</td><td>58.29</td><td>53.16</td><td>52.71</td><td>48.40</td><td>30.07</td><td>28.52</td><td>25.97</td></tr><tr><td>TRADES</td><td>81.39</td><td>57.25</td><td>53.64</td><td>51.39</td><td>53.85</td><td>29.04</td><td>27.91</td><td>24.09</td></tr><tr><td>CausalAdv-T入= 0.2</td><td>81.72</td><td>58.26</td><td>54.06</td><td>51.90</td><td>53.83</td><td>29.76</td><td>28.05</td><td>24.49</td></tr><tr><td>CausalAdv-T入= 0.5</td><td>81.22</td><td>58.97</td><td>54.55</td><td>52.95</td><td>53.91</td><td>30.19</td><td>28.11</td><td>24.90</td></tr><tr><td>CausalAdv-T入= 1.0</td><td>79.65</td><td>58.48</td><td>54.45</td><td>52.89</td><td>53.17</td><td>30.66</td><td>28.57</td><td>25.74</td></tr><tr><td>CausalAdv-T入= 1.5</td><td>78.09</td><td>57.42</td><td>53.66</td><td>51.38</td><td>52.22</td><td>30.49</td><td>28.17</td><td>25.48</td></tr><tr><td>CausalAdv-T入= 2.0</td><td>74.42</td><td>55.29</td><td>52.07</td><td>50.04</td><td>50.40</td><td>30.22</td><td>28.14</td><td>25.49</td></tr></table>
385
+
386
+ both CausalAdv-M and CausalAdv-T are relatively insensitive to the hyperparameters.
387
+
388
+ # G MORE DETAILS ABOUT ADVERSARIAL LEARNING
389
+
390
+ Recent work on improving adversarial robustness mainly falls into two categories: certified defense and empirical methods.
391
+
392
+ Certified defense (Raghunathan et al., 2018; Wong & Kolter, 2018; Singla & Feizi, 2020) aims to endow the model with provably adversarial robustness against norm-bounded perturbations. Although the certified defense strategy is promising, the empirical defense (Goodfellow et al., 2015; Madry et al., 2018; Zhang et al., 2019; Pang et al., 2020; Wong & Kolter, 2018; Xie et al., 2019; Yang et al., 2019), especially the adversarial training method (Goodfellow et al., 2015; Madry et al., 2018; Zhang et al., 2019), is currently the most effective strategy. Empirical defense firstly generates adversarial examples using a certain adversarial attack, then incorporates the generated adversarial examples into the training process. Recently, an empirical detection strategy is to utilize a twosample test to detect adversarial examples (Gao et al., 2021). In the following, we mainly discuss defense strategies, as the detection approach is not the main focus of this paper.
393
+
394
+ Recently, various efforts (Najafi et al., 2019; Carmon et al., 2019; Shafahi et al., 2019; Wong et al., 2019; Pang et al., 2020; Rice et al., 2020) have been devoted to improving adversarial training. One line of work focuses on accelerating the training procedure (Shafahi et al., 2019; Wong et al., 2019). Another line of research (Najafi et al., 2019; Carmon et al., 2019) shows a promising direction that unlabeled training data can significantly mitigate the adversarial vulnerability. Lastly, recent work (Pang et al., 2020; Rice et al., 2020) provides an interesting direction where these methods rethink the adversarial training from a exciting aspect, i.e., rethinking the role of normalization (Pang et al.,
395
+
396
+ 2020) and basic training strategies (Rice et al., 2020). However, all these methods overlook the spurious correlation between labels and the style information.
397
+
398
+ Another related work is (Ilyas et al., 2019), which provides an interesting viewpoint, i.e., adversarial examples can be viewed as a human phenomenon because the model’s reliance on useful but not robust features leads to adversarial vulnerability. Our work gives a new causal perspective of adversarial vulnerability. Specifically, a) (Ilyas et al., 2019) found some features were useful but not robust, while our work explores the phenomenon’s fundamental cause and provides a clear explanation of why some features are useful but not robust: Given $X$ , labels $Y$ are spuriously correlated with the style variables, so fitting the spurious correlation can predict labels. Thus, the style variables can be viewed as ‘features’; b) (Ilyas et al., 2019) claimed that adversarial examples could be viewed as a human phenomenon, while our work shows that adversarial examples can be viewed as a model phenomenon rather than merely a human phenomenon. Specifically, the adversarial vulnerability results from fitting the correlation between labels and style variables and failing to fit the causal relations, i.e., DNNs fail to extract content variables.
399
+
400
+ # H MORE DETAILS ABOUT CAUSAL REASONING
401
+
402
+ The most relevant work is CAMA (Zhang et al., 2020a) that aims to improve the robustness of DNNs on unseen perturbation via explicitly modeling the perturbation from a causal view. The main difference between our method and CAMA is that we focus on the adversarial vulnerability while CAMA aims to improve the robustness of unseen perturbations. In addition, CAMA assumes a hard intervention on a latent variable. It promotes robustness via modeling the perturbation in the latent space. In this paper, we employ a soft intervention and propose to penalize DNNs when the adversarial distribution is different from the natural distribution. A recent work (Buhlmann ¨ , 2020) also aims to connect robust learning and causality, but the main focus of (Buhlmann ¨ , 2020) is on out-of-distribution generalization, which is different from adversarial learning.
403
+
404
+ Another related work is RELIC (Mitrovic et al., 2020), a regularizer used in self-supervised learning that uses the independence of mechanisms (Peters et al., 2017) and encourages DNNs to be invariant to different augmentations of the same instance. The self-supervised learning method (Mitrovic et al., 2020) also constructs a causal graph to model the data generation process, but the focus of RELIC is on the content invariant property, overlooking the importance of style information. One concurrent work (Tang et al., 2021) propose using the instrumental variable to perform causal intervention, based on a strong assumption that the adversarial vulnerability results from the confounding effect. In contrast, merely some general assumptions are required in this paper, e.g., causal model assumption. Although (Sagawa et al., 2020) takes spurious correlations into account, (Sagawa et al., 2020) proposes using prior knowledge to group the training data to avoid the reliance on spurious correlations. Difference from (Sagawa et al., 2020), our method does not rely on prior knowledge. Another related work is CORE (Heinze-Deml & Meinshausen, 2021), a regularizer inspired by a causal graph is proposed to minimizing the variance of prediction and loss condition on label and ID information to mitigate the influence of domain shift. Different from (Heinze-Deml & Meinshausen, 2021), our method is designed to eliminate the difference between the natural and adversarial distributions.
md/dev/eYfIM88MTUE/eYfIM88MTUE.md ADDED
@@ -0,0 +1,293 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Simple Unsupervised Object-Centric Learning for Complex and Naturalistic Videos
2
+
3
+ Gautam Singh∗ Rutgers University singh.gautam@rutgers.edu
4
+
5
+ Yi-Fu Wu Rutgers University yifu.wu@gmail.com
6
+
7
+ Sungjin Ahn KAIST sjn.ahn@gmail.com
8
+
9
+ # Abstract
10
+
11
+ Unsupervised object-centric learning aims to represent the modular, compositional, and causal structure of a scene as a set of object representations and thereby promises to resolve many critical limitations of traditional single-vector representations such as poor systematic generalization. Although there have been many remarkable advances in recent years, one of the most critical problems in this direction has been that previous methods work only with simple and synthetic scenes but not with complex and naturalistic images or videos. In this paper, we propose STEVE, an unsupervised model for object-centric learning in videos. Our proposed model makes a significant advancement by demonstrating its effectiveness on various complex and naturalistic videos unprecedented in this line of research. Interestingly, this is achieved by neither adding complexity to the model architecture nor introducing a new objective or weak supervision. Rather, it is achieved by a surprisingly simple architecture that uses a transformer-based image decoder conditioned on slots and the learning objective is simply to reconstruct the observation. Our experiment results on various complex and naturalistic videos show significant improvements compared to the previous state-of-the-art. https://sites.google.com/view/slot-transformer-for-videos
12
+
13
+ # 1 Introduction
14
+
15
+ The goal of object-centric representation learning is to represent the inherent structure of the physical world such as compositionality and causality as a set of representation vectors (and their relations) each corresponding to a conceptual entity module such as an object (Greff et al., 2020; Schölkopf et al., 2021). Many previous works have demonstrated the potential of this approach as a way of resolving the key limitations of traditional single-vector representations (Greff et al., 2020; Schölkopf et al., 2021; Dittadi et al., 2021; Eslami et al., 2016; Bapst et al., 2019; Mambelli et al., 2022; Ghasemipour et al., 2022). For example, considering object-centric representations as independent mechanisms helps realize systematic and zero-shot generalization for image generation (Singh et al., 2022; Chen et al., 2021). Also, the ability to decompose a visual observation into a set of discrete knowledge modules has shown to be useful for visual reasoning (Zhou et al., 2021; Wu et al., 2021).
16
+
17
+ One of the most critical challenges remaining in object-centric representation learning is to successfully apply it to complex and natural images or videos. Achieving this has primary importance because it opens up a way to utilize the enormous amounts of images and videos available on the internet and thereby unleash the full potential of this method by applying it at scale — the machine learning community has recently observed the power of scale in large-scale language models (Brown et al., 2020; Bommasani et al., 2021).
18
+
19
+ ![](images/f68abd2a6839b81353ccf40218672931e448ad5050cb4409458740048a49c44c.jpg)
20
+ Figure 1: Overview of the proposed model. Left: SLATE auto-encoder combines the representational bottleneck of slots with an auto-regressive transformer decoder and shows unsupervised object discovery in visually complex images. However, the question of whether this framework can deal with complex and naturalistic videos is unexplored. Middle: Conventional object-centric video models such as Slot Attention Video deal with videos by applying slot attention recurrently on the frames and applying a pixel-mixture decoder to reconstruct the frames. However, in the fully unsupervised setting, these lack the ability to handle complex and naturalistic videos. Right: Our model Slot Transformer for Videos provides a simple and minimal architecture leveraging an auto-regressive transformer decoder that can effectively handle complex and naturalistic videos without any supervision.
21
+
22
+ However, despite a significant amount of effort and many remarkable achievements in recent years, we do not yet have an unsupervised object-centric learning method that works well on complex and naturalistic videos. In fact, when considering the high complexity of natural images, the ultimate goal of making the concept of objects emerge without any supervision, i.e., only by observing, indeed remains quite elusive. As such, previous works have been shown to work only on toy or synthetic images/videos or resorted to utilizing some supervision such as optical flow or annotation on the initial frame (Kipf et al., 2021).
23
+
24
+ In this paper, we propose an unsupervised model for object-centric learning in videos, called STEVE (Slot-TransformEr for VidEos). Our proposed model makes a significant advancement by demonstrating its effectiveness for the first time on various complex and naturalistic videos unprecedented in this line of research. Interestingly, this is achieved by neither adding much complexity to the model architecture nor by introducing a new objective or weak supervision. Rather, it is achieved by a surprisingly simple architecture, comparable to or simpler than most of the previous methods that have not worked well on complex videos. Moreover, the learning objective is just to reconstruct. We believe this simplicity is one of the best strengths of our model.
25
+
26
+ Behind this success is the adoption of the transformer-based slot decoder recently proposed in SLATE (Singh et al., 2022). Because it is demonstrated in the paper that this decoder is the key to dealing with some visually complex synthetic images, it is of deep interest to the community (i) whether and how it can be extended to a temporal model utilizing dynamical observations, (ii) if it can eventually deal with complex naturalistic videos, and (iii) what lessons we can learn from this. To focus on investigating these central questions systematically, we intentionally choose not to pursue architectural novelty at the expense of adding complexity but to test a minimal architecture that combines the SLATE decoder with a standard slot-level recurrence model. Our experiment results on various complex and naturalistic videos show that the proposed architecture significantly outperforms previous state-of-the-art baseline models.
27
+
28
+ From these experiments, we discover important new knowledge to share with the community. We find that SLATE can deal with complex naturalistic images reasonably well despite not using temporal information. Although as a static model, SLATE has a fundamental limitation that it cannot take advantage of temporal information, e.g., maintaining consistent object identity across time, if we only look at its frame-level segmentation ability, it already performs better than the previous state-of-theart temporal model that applies slot attention to videos (Kipf et al., 2021). Crucially, we also find that SLATE alone is not enough since our model, STEVE, shows much better frame segmentation than SLATE, while also providing consistent tracking of slots in videos, which SLATE cannot do. In particular, we find that on some complex videos such as MOVi-Tex, SLATE fails significantly, suggesting that learning jointly from both temporal information and the powerful SLATE decoder is significant and essential to realize the full potential of object-centric representation learning in videos. Furthermore, our analysis shows that our model is robust to challenges such as static objects and camera motion and that it also generalizes well to out-of-distribution number of objects and unseen textures. Lastly, we propose several new datasets that are significantly more complex than those tackled by the previous unsupervised models.
29
+
30
+ # 2 Preliminaries
31
+
32
+ In unsupervised object-centric representation learning, the goal is to learn to obtain the representation of an observation as a set of object vectors, referred to as slots (Locatello et al., 2020). A common approach for this is to auto-encode: a slot-encoder $f _ { \phi . } ^ { \mathrm { e n c } } ( \mathbf { x } )$ extracts a set of slot representations $\mathbf { s } = \{ \mathbf { s } _ { 1 } , \ldots \mathbf { s } _ { N } \}$ from an image $\mathbf { x }$ and then a decoder $f _ { \phi } ^ { \mathrm { d e c } }$ (s) makes a reconstruction $\hat { \bf x }$ from these slots, where $\mathbf { x } \in \mathbb { R } ^ { H \times W \times C }$ and ${ \bf s } _ { n } \in \mathbb { R } ^ { D }$ . In the encoder, the slots compete with each other to learn about which area of the input will be explained by which slots. This provides a form of information bottleneck encouraging a slot to attend an area corresponding to a meaningful conceptual entity like an object. During training, a reconstruction objective provides the learning signal for training the complete model. One nice property of this method is that it only requires reconstructing the image and does not require any weak supervision or object-aware auxiliary loss terms. Ideally, we want to maintain this simplicity in video models, but current state-of-the-art requires weak supervision and optical flow to make it work on complex naturalistic videos (Kipf et al., 2021).
33
+
34
+ Mixture-based Decoder. The emergence of object-centric slots is strongly dependent on what decoder is used. The traditional way that most of the previous methods have taken is the mixturebased decoder or some variant of it. In this approach, the decoder decodes each slot ${ \bf s } _ { n }$ to obtain an object image $\hat { \mathbf { x } } _ { n }$ and an alpha mask ${ \bf m } _ { n }$ via decoding functions $g _ { \theta } ^ { \mathrm { R G B } }$ B and gmaskθ , respectively. The decoded object images are then weighted-summed to obtain the full image $\hat { \bf x }$ :
35
+
36
+ $$
37
+ \hat { \mathbf { x } } _ { n } = g _ { \theta } ^ { \mathrm { R G B } } ( \mathbf { s } _ { n } ) , \qquad \mathbf { m } _ { n } = \frac { \exp { g _ { \theta } ^ { \mathrm { m a s k } } ( \mathbf { s } _ { n } ) } } { \sum _ { m = 1 } ^ { N } \exp { g _ { \theta } ^ { \mathrm { m a s k } } ( \mathbf { s } _ { m } ) } } , \qquad \hat { \mathbf { x } } = \sum _ { n = 1 } ^ { N } \mathbf { m } _ { n } \cdot \hat { \mathbf { x } } _ { n } .
38
+ $$
39
+
40
+ These decoder networks are implemented using a CNN. The reconstruction objective is taken to be the squared error between the input and the reconstructed image i.e. $\mathcal { L } _ { \mathrm { m i x t u r e } } = \| \hat { \mathbf { x } } - \mathbf { x } \| ^ { 2 }$ . A critical limitation of this approach is that it has never been successful in dealing with scenes with high visual complexity like natural images.
41
+
42
+ Autoregressive Slot-Transformer Decoder. Recently, Singh et al. (2022) have challenged this traditional perspective that we need a mixture decoder for the emergence of objectness in slots. Arguing that a mixture decoder severely limits the interaction among slots and the reconstruction quality—hence a problem in obtaining good learning signal for complex images—they proposed a new architecture, SLATE, using a powerful autoregressive decoder based on a transformer conditioned on the slots (Chen et al., 2020). However, many critical questions about this new approach still remain because the focus of the SLATE paper is on image generation ability. To get a deeper understanding of the object representations that a model like SLATE produces, we would need to thoroughly investigate the quantitative evidence about its scene decomposition ability, its ability to deal with visual complexity close to that of natural images, and finally, the effect of extending this architecture to a temporal model. We aim to answer these in this paper.
43
+
44
+ # 3 STEVE: Slot Transformer for Videos
45
+
46
+ To study the effect of extending the slot-transformer decoder to a temporal model that can deal with videos, we choose to propose a minimal architecture. Specifically, our proposed model, STEVE, combines three main components: (1) a CNN-based image encoder, (2) a recurrent slot encoder that updates slots temporally with recurrent neural networks (RNNs), and (3) the slot-transformer decoder of SLATE. Although we may obtain additional performance gains by exploring further architectural novelty at the cost of additional complexity, we choose to investigate this minimal architecture to focus on our goal of investigating slot-transformer decoder models for video.
47
+
48
+ Given a video consisting of frames $\mathbf { x } _ { 1 } , \ldots . . . \mathbf { x } _ { T }$ , we want to maintain $N$ slots $\mathbf { s } _ { t } = \{ \mathbf { s } _ { t , 1 } , \ldots , \mathbf { s } _ { t , N } \}$ for each time-step $t \in \{ 1 , \ldots T \}$ by starting the temporal update from initial slots $\mathbf { s } _ { 0 }$ . We apply a recurrent slot encoder $f _ { \phi . } ^ { \mathrm { s l o t - r m n } }$ at each step $t$ to update the slot representations from $\mathbf { s } _ { t - 1 }$ to $\mathbf { s } _ { t }$ using the information from the input frame $\mathbf { x } _ { t }$ .
49
+
50
+ $$
51
+ \begin{array} { r } { { \mathbf { s } } _ { t } = f _ { \phi } ^ { \mathrm { s l o t - m n } } ( { \mathbf { x } } _ { t } ; { \mathbf { s } } _ { t - 1 } ) , \qquad { \mathbf { s } } _ { 0 } = \mathrm { i n i t i a l i z e } ( ) . } \end{array}
52
+ $$
53
+
54
+ It is expected that each slot $n$ would represent one object and track it consistently over time in a given video. For each frame, the slot representation $\mathbf { s } _ { t }$ is used to reconstruct the input frame $\mathbf { x } _ { t }$ using the slot-transformer decoder. For doing such reconstruction, each frame $\mathbf { x } _ { t }$ is treated as a sequence of discrete tokens provided by a discrete VAE encoder. Given the slots $\mathbf { s } _ { t }$ , the slot-transformer decoder learns to predict this sequence of tokens auto-regressively by minimizing a cross-entropy loss.
55
+
56
+ $$
57
+ \dot { \mathbf { \Psi } } _ { < \mathrm { E } } = \sum _ { t = 1 } ^ { T } \sum _ { l = 1 } ^ { L } \mathrm { C E } ( \mathbf { z } _ { t , l } , \mathbf { o } _ { t , l } ) , \quad \mathbf { z } _ { t , 1 } , \dots , \mathbf { z } _ { t , L } = f _ { \phi } ^ { \mathrm { d V A E } } ( \mathbf { x } _ { t } ) , \quad \mathbf { o } _ { t , l } = g _ { \theta } ^ { \mathrm { s l o t . r a n s f o r m e r } } ( \mathbf { s } _ { t } ; \mathbf { z } _ { t , 1 } \dots \mathbf { z } _ { t , l - 1 } ) .
58
+ $$
59
+
60
+ where $\operatorname { C E } ( \cdot , \cdot )$ denotes cross-entropy loss, $\mathbf { z } _ { t } = \{ \mathbf { z } _ { t , 1 } , . . . , \mathbf { z } _ { t , L } \}$ are $L$ discrete tokens that act as prediction targets for the transformer at time $t$ and $\mathbf { o } _ { t , l }$ contains the log-probabilities predicted by the transformer for the token at position $l$ for frame $t$ . To train the discrete VAE, an image reconstruction loss ${ \mathcal { L } } _ { \mathrm { d V A E } }$ is used as in SLATE.
61
+
62
+ $$
63
+ { \mathcal { L } } _ { \mathrm { d V A E } } = \sum _ { t = 1 } ^ { T } \Vert { \hat { \mathbf { x } } } _ { t } - \mathbf { x } _ { t } \Vert _ { 2 } ^ { 2 } , \qquad \mathbf { z } _ { t , 1 } , \ldots \mathbf { z } _ { t , L } = f _ { \phi } ^ { \mathrm { d V A E } } ( \mathbf { x } _ { t } ) , \qquad { \hat { \mathbf { x } } } _ { t } = g _ { \theta } ^ { \mathrm { d V A E } } ( \mathbf { z } _ { t , 1 } , \ldots \mathbf { z } _ { t , L } ) .
64
+ $$
65
+
66
+ The complete model is trained using ${ \mathcal { L } } _ { \mathrm { S T E V E } } = { \mathcal { L } } _ { \mathrm { C E } } + { \mathcal { L } } _ { \mathrm { d V A E } }$
67
+
68
+ Recurrent Slot Encoder. Several recent works have implemented recurrent object-centric models by incorporating an RNN-based dynamics model to update slots over timesteps (Veerapaneni et al., 2019; Jiang et al., 2020; Kossen et al., 2020; Lin et al., 2020a; Stanic & Schmidhuber, 2019). For ´ our model, we leverage a slot-based recurrent encoder that is also used as the backbone of Slot Attention Video (Kipf et al., 2021). Our slot-based recurrent encoder works as follows. At the start of an episode, we provide initial slots ${ \bf s } _ { 0 }$ by randomly sampling from a Gaussian distribution with learned mean and variance. For each input frame $\mathbf { x } _ { t }$ , we compute an encoding in the form of a feature map using a backbone CNN. This feature map is flattened to obtain a set of input features $\mathbf { e } _ { t } = \{ \mathbf { e } _ { t , 1 } , \mathbf { e } _ { t , 2 } , \ldots , \mathbf { e } _ { t , H W } \}$ . Next, the slots $\mathbf { s } _ { t - 1 }$ perform attention on the features $\mathbf { e } _ { t }$ and use the attention result to update the slots to $\mathbf { s } _ { t }$ . For this, the slots $\mathbf { s } _ { t - 1 }$ compute attention weights $\mathcal { A } _ { t } = \{ \mathcal { A } _ { t , 1 } , . . . , \mathcal { A } _ { t , N } \}$ over the input features, where $\boldsymbol { \mathcal { A } } _ { t , n }$ are the attention weights for slot $n$ . The attention weights are used to perform an attention-weighted sum of the input features. The attention result $\mathbf { r } _ { t , n }$ is then used to update the respective slot using an RNN $f _ { \phi } ^ { \mathrm { R N N } }$ .
69
+
70
+ $$
71
+ \mathrm { ~ \psi ~ } _ { t , n } = f _ { \phi } ^ { \mathrm { R N N } } ( { \bf r } _ { t , n } , { \bf s } _ { t - 1 , n } ) , \quad { \bf r } _ { t , n } = \frac { \sum _ { i = 1 } ^ { H W } \mathcal { A } _ { t , n , i } \cdot v ( { \bf e } _ { t , i } ) } { \sum _ { j = 1 } ^ { H W } \mathcal { A } _ { t , n , j } } , \quad \mathcal { A } _ { t } = { \bf s } \circ { \bf f } \tan \alpha \left( \frac { q ( { \bf s } _ { t - 1 } ) \cdot k ( { \bf e } _ { t } ) ^ { T } } { \sqrt { D } } \right) .
72
+ $$
73
+
74
+ Here, $q , k$ and $v$ are linear projections and $D$ is the output size of the projections. Finally, the slots
75
+ are made touse the slots teract via an interaction network: before the interaction step for rec $\mathbf { s } _ { t } = \bar { f } _ { \phi } ^ { \mathrm { i n t e r a c t } } \big ( \tilde { \mathbf { s } } _ { t } \big )$ . Following Kipf et al. (2021), wecomplete details of the architecture, $\tilde { \bf s } _ { t }$
76
+ see Appendix B.
77
+
78
+ # 4 Related Work
79
+
80
+ Unsupervised Object-Centric Representation Learning in Images. Unsupervised object-centric learning methods for static scenes have received significant interest in recent years (Greff et al., 2016; Burgess et al., 2019; Greff et al., 2019; Locatello et al., 2020; Greff et al., 2017; Engelcke et al., 2020, 2021; Eslami et al., 2016; Crawford & Pineau, 2019b; Lin et al., 2020b; Jiang & Ahn, 2020; Deng et al., 2020; Chen et al., 2021; Anciukevicius et al., 2020; von Kügelgen et al., 2020; Greff et al., 2020). These models learn through reconstruction, commonly adopting a mixture-based decoder. Another line of work has pursued object discovery by minimizing the mutual information between the predicted segments (Savarese et al., 2021; Yang et al., 2020). Approaches based on self-supervised representation learning have also been investigated (Caron et al., 2021; Löwe et al., 2020; Wang et al., 2022). Recently, scene decomposition ability has been shown to emerge in energy-based models (Du et al., 2021a; Yu et al., 2021). Complex-valued neural networks have also shown such emergence Lowe et al. (2022). Closely related to our work, Lamb et al. (2021) and Singh et al. (2022) have shown that a slot-based encoder combined with a transformer decoder can enable object emergence in visually complex images. However, all of these approaches deal only with static images unlike ours which can be applied to videos.
81
+
82
+ Unsupervised Object-Centric Representation Learning in Videos. A large body of work has approached fully-unsupervised video segmentation and tracking by combining recurrent slot-based encoders with a reconstruction objective. In this class, (Kosiorek et al., 2018; Stanic & Schmidhuber, ´ 2019; Jiang et al., 2020; Crawford & Pineau, 2019a; Lin et al., 2020a; Wu et al., 2021; Singh et al., 2021; He et al., 2019) use bounding boxes for tracking. A parallel line of research learns to localize objects via segmentation masks (Greff et al., 2017; Van Steenkiste et al., 2018; Veerapaneni et al., 2019; Watters et al., 2019; Weis et al., 2020; Du et al., 2020; Kipf et al., 2021; Kabra et al., 2021; Zoran et al., 2021; Besbinar & Frossard, 2021; Creswell et al., 2020, 2021). Our work lies along this line of research. Other approaches have considered using contrastive losses (Kipf et al., 2019; Carvalho et al., 2020) while some works have explored unsupervised object-centric learning in 3D scenes (Chen et al., 2021; Henderson & Lampert, 2020; Crawford & Pineau, 2020; Stelzner et al., 2021; Du et al., 2021b; Kabra et al., 2021). While dealing with 3D scenes would be an important future direction for our work, it is orthogonal to our current focus. However, unlike ours, all of the above works have only been successful on visually simple videos. In Appendix D, we discuss the related work that deals with unsupervised video object segmentation using motion cues and unsupervised segmentation propagation.
83
+
84
+ # 5 Experiments
85
+
86
+ Datasets. We evaluate our model on 8 datasets. These include 6 procedurally generated datasets: CATER (Girdhar & Ramanan, 2020), CATERTex, MOVi-Solid, MOVi-Tex, MOVi-D, and MOVi-E (Greff et al., 2022); and 2 natural datasets: Traffic and Aquarium. Out of these, 5 datasets are our contributions in this work which we now describe. i) CATERTex. We generated it by combining objects and textures of CLEVRTex (Karazija et al., 2021) with the object motion of CATER (Girdhar & Ramanan, 2020). ii) MOVi-Solid. We used Kubric (Greff et al., 2022) to generate this dataset and introduced textured backgrounds and more complex shapes to the MOVi dataset proposed by Kipf et al. (2021). iii) MOVi-Tex. We added the textures from the Describable Textures dataset (Cimpoi et al., 2014) as materials to the MOVi-Solid dataset to make this dataset. By applying the same material on all surfaces, the objects and their borders become significantly harder to distinguish, resulting in much higher visual complexity over MOVi-Solid. iv) Traffic and Aquarium. We created these two natural datasets by collecting a 6-hour long video stream from Youtube. For training, all models use only the raw videos as input with no other supervision or input whatsoever. For evaluation, we use the ground truth instance-level masks. For sample video frames and more details, see Appendix A. We will release all the proposed datasets which, we believe, will facilitate future research. For existing benchmarks i.e. CATER, MOVi-D and MOVi-E, we use the standard train and test splits as prescribed by their respective authors. We also note that in the MOVi benchmark i.e. MOVi-A to E, versions D and E are the two most challenging versions. Thus, we consider these sufficient for evaluating our hypothesis.
87
+
88
+ Baselines. We compare our performance with three baselines which are state-of-the-art in unsupervised object-centric scene decomposition. These include two baselines that use mixture-based reconstruction: Slot Attention Video (Kipf et al., 2021) and OP3 (Veerapaneni et al., 2019); and one baseline which uses transformer-based reconstruction: SLATE (Singh et al., 2022). For Slot Attention Video, we use the fully unsupervised version that is trained only using the image reconstruction objective without optical flow or label information in the first frame. For simplicity, we will refer to this unsupervised Slot Attention Video as SAVi. Comparison with SAVi is important because our model is most similar to it with one main difference: our model uses transformer-based decoding while SAVi uses mixture-based decoding. Therefore, a comparison of our model with SAVi will provide a clear insight into the effect of the decoding approach. For the baseline SLATE, we use the same CNN backbone as our model for a fair comparison. In line with the previous works, for SAVi and OP3, we take their decoding masks to be their predicted segmentation. Since our model STEVE and the baseline SLATE are based on transformer decoder, they do not provide decoding masks. Therefore, we use their input attention masks as our predicted segmentation. Note that this difference gives an advantage to the baselines but not to our model as in section 5.3, our analysis will show that the decoding masks perform better than the input attention masks.
89
+
90
+ ![](images/5815ecfd6c3bf5ada695c3475c19e1fdbc53de0c78eefc917c8c6cb40be4624e.jpg)
91
+ Figure 2: Unsupervised Image Segmentation. On the $y$ -axis, we plot Image FG-ARI of per-frame segmentation. Along the $x$ -axis, we show how the segmentation is affected as more frames are seen in a video. The FG-ARI of SLATE is computed on one-frame ‘videos’ and is broadcasted along the $x$ -axis to facilitate comparison with other models.
92
+
93
+ # 5.1 Unsupervised Image Segmentation
94
+
95
+ In this section, we evaluate how effective our model is for unsupervised image segmentation in videos.
96
+ We report Image FG-ARI which measures how well the predicted segmentation matches the ground truth segmentation of a given single image. In line with the previous works (Locatello et al., 2020;
97
+ Kabra et al., 2021; Kipf et al., 2021), we consider only the foreground segments of the ground truth.
98
+ In Figure 2, we plot the Image FG-ARI of per-frame segmentation.
99
+
100
+ Benefit over Mixture-based Methods. Comparing STEVE with SAVi and OP3, we see that STEVE achieves significantly higher FG-ARI compared with the baselines in 5 out of 6 datasets. All of these 5 datasets are characterized by complex textures. Therefore, our superior performance shows that our model is more effective in dealing with textured scenes compared to the baselines. Because the main difference of STEVE with SAVi is the reconstruction approach, this result provides strong evidence that the transformer-based reconstruction is the key driver of this improvement. Analyzing the qualitative results in Figures 4 (left), 5 and 9 reveals that the baselines fail completely in CATERTex, MOVi-Tex, MOVi-D, and MOVi-E, most commonly by splitting the image into fixed patch regions instead of meaningful object regions. Unlike simple datasets used in prior works such as CLEVR or CATER that provide strong color contrast between objects, our datasets such as CATERTex and MOVi-Tex provide no such color cues. Despite this, our model can remarkably discover the objects. With the state-of-the-art baselines completely failing, it is for the first time in this line of research that such complex datasets have been effectively handled. In one dataset i.e. CATER, our performance is comparable to OP3 and slightly worse than SAVi. As CATER does not have complex textures, it is not surprising to see baselines performing well on this dataset. In Figure 2, we also find that as the models see more frames, the segmentation tends to improve.
101
+
102
+ Benefit of Temporal Learning. We also analyze whether training STEVE on videos has any benefit in image segmentation compared to SLATE. As SLATE is applicable only for static images, we train and test it on one frame ‘videos’ of our datasets. Comparing STEVE with SLATE, we note that STEVE performs consistently better in all datasets. Noteworthy is the gap in MOVi-Tex which is especially large. This suggests that training on temporal data i.e. videos can be helpful for learning to segment. We conjecture that due to the similar texture in the background and foreground, inferring correct object regions from a static image can be harder than inferring them when the objects are moving. This may explain the significantly larger gap with SLATE in MOVi-Tex compared to the other datasets. Note that this gap exists even when evaluating STEVE with zero past frames (i.e. a static image), indicating that training on temporal data helps STEVE infer segments on static images.
103
+
104
+ # 5.2 Unsupervised Video Segmentation
105
+
106
+ In this section, we evaluate how well our predicted segmentation tracks the ground truth segmentation in both space and time without switching identities. For this, we compute Video FG-ARI which considers the full trajectory of a segment over the video length as one cluster. In line with the previous works Locatello et al. (2020); Kabra et al. (2021); Kipf et al. (2021), we consider only the foreground segments of the ground truth.
107
+
108
+ ![](images/a5ce6ba721f193f93e6e91c3edbf5c44d547338ccacd3478cdfb5eae6161e2a8.jpg)
109
+ Figure 3: Unsupervised Video Segmentation. On the $y$ -axis, we plot Video FG-ARI and compare our performance with the baselines. Along $x$ -axis, we show how the performance is affected by the length of the video at test time.
110
+
111
+ ![](images/b995f017e17d13d12b94a57830e851fbecfb275d23d828463d919b932a4973c4.jpg)
112
+ Figure 4: Left: Visualization of Unsupervised Video Segmentation in CATERTex and MOVi-Tex. We show the video frames and their true masks followed by foreground and background segmentation of each model. We separated the visualization of the foreground segments to make the result easier to interpret by applying a threshold on the segment area. See the supplementary material and the project website https://sites.google.com/view/slot-transformer-for-videos for more visualizations. Right: Unsupervised Video Segmentation in OOD and Natural Datasets. We plot the Video FG-ARI. In (a) and (b), we compare the performance of our model on IID and OOD test sets. In (c), we evaluate our performance in unsupervised video segmentation on natural scenes.
113
+
114
+ Video Segmentation Performance. In Figure 3, we see that in 5 out of 6 datasets, all of which are textured, STEVE significantly outperforms the baselines. In CATER, the baselines are able to perform comparably or slightly better than ours. As with the segmentation result of Section 5.1, this is not surprising given that CATER is visually simple enough for the baselines to handle well. We also observe the one major drawback of SLATE in these results i.e. SLATE cannot provide aligned slot representations for a video. This is because SLATE can only be applied to individual frames and the slots of each frame would be randomly permuted. We also show how the performance is affected by the length of the video. The models were trained on 3-length videos (6-length for CATER) while we evaluate on up to 24-length videos. As the likelihood of switching identities should increase with the video length, all models show some downward slope. Going from video length 6 to 24 in CATERTex, MOVi-D, and MOVi-E, our model deteriorates noticeably less than the baselines.
115
+
116
+ ![](images/27367198ff124076a37d1c33b72b8373077c9e6df90c9ae09b96f0a8d5469c30.jpg)
117
+ Figure 5: Visualization of Unsupervised Video Segmentation in MOVi-Solid, MOVi-E, and Natural Scenes. The rows (top to bottom) show the input video, the true segmentation followed by the predicted segments of the models. See the supplementary material and the project website https://sites.google.com/view/slot-transformer-for-videos for more visualizations.
118
+
119
+ Out-of-Distribution Generalization. In Figure 4 (a) and (b), we show how well our trained model can generalize at test time to out-of-distribution videos which have more number of objects and unseen objects and materials. We see that our model generalizes well and retains a similar performance as that on the IID test set. One exception is MOVi-Tex in which our model generalizes well to more objects but suffers on novel textures. Due to the modular structure of the recurrent encoder, each slot binds to input objects quite independently. We conjecture that this modularity is responsible for good generalization to more objects. However, for new materials, generalization depends on how well the backbone CNN can generalize. As the training set of MOVi-Tex was generated using a library of 240 textures, it would not be surprising if this CNN provides poor features of unseen textures. This, we believe, is affecting the performance of our model.
120
+
121
+ Natural Scenes. In Figure 4 (c), we evaluate video segmentation on two natural datasets taken from real-world videos: Traffic and Aquarium. We see that our model performs significantly better than the baselines, approximately doubling the FG-ARI in the Traffic dataset and tripling the FG-ARI in the Aquarium dataset. Noteworthy is the visual complexity of the Aquarium dataset in which the color and texture of fish are strongly camouflaged against the background and seeing them requires careful inspection even for a human (see Figure 5). Despite this, we note that our model is able to deal with this challenge effectively.
122
+
123
+ # 5.3 Analysis
124
+
125
+ Diagnosing Slot Representation in STEVE. In previous sections, we focused on segmentation quality and used input attention masks of STEVE. However, input attention masks do not provide a direct indication of the information content of slots. We would like to diagnose how well the slots represent the object-centric structure of the scene. For this, we take the slots from the pre-trained encoder of STEVE and, without propagating the gradient to the encoder, we train a mixture-based decoder to reconstruct the observation from the slots. We call this model STEVE-Diagnostic. In Figure 6 (a), we compare the performance of unsupervised video segmentation with the baselines using the decoding masks of STEVE-Diagnostic. The decoder of STEVE-diagnostic is made to be exactly the same as that of SAVi for a fair comparison. We find that STEVE-Diagnostic performs better than the baselines in all textured datasets, in line with our earlier results in Figures 2 and 3. This shows that the slots in STEVE represent the object-centric structure better than the baselines. In
126
+
127
+ ![](images/90cd88f01929614c2db583cb55e8c3b84c24ed7e0d16c96ce6b22da3982ce914.jpg)
128
+ Figure 6: Analysis. Based on the analyses described in Section 5.3 we evaluate various aspects of the models. In all plots, we report Video FG-ARI computed on videos of length 6.
129
+
130
+ Table 9 in Appendix C, we further analyze the slot contents by training a linear regressor to predict the object positions and find that STEVE performs favorably relative to the baselines.
131
+
132
+ Effect of Granularity of dVAE on STEVE. In this section, we analyze the effect of granularity of discrete VAE on the segmentation performance of STEVE. In the default configuration of our model, the discrete VAE divides the image uniformly into patches of size $4 \times 4$ and represents each patch with one discrete token. That is, an image of size $1 2 8 \times 1 2 8$ would be represented by a sequence of length 1024. In this analysis, we test the effect on segmentation performance if dVAE represents the image using larger patches i.e. $1 6 \times 1 6$ and $3 2 \times 3 2$ . In our results shown in Figure 6, we note that using larger patches results in a worsening of the performance. This suggests a possible scaling law that smaller patches lead to better performance. However, due to the prohibitive memory needs of the transformer on longer sequences, we were not able to experiment with smaller patches.
133
+
134
+ Effect of Transformer Capacity on STEVE. In Fig. 7 in the appendix, we analyze whether our segmentation performance is sensitive to the capacity of the decoder. For this, we test the effect of increasing the number of layers in the transformer decoder. We find that our segmentation performance is unaffected by this change, showing that our model is robust.
135
+
136
+ Comparison between Decoding Masks and Input Attention Masks in SAVi. In previous sections on unsupervised image and video decomposition, we used input attention masks of STEVE while for the baselines, we used the decoding masks. We would like to test how different are the performances of input attention masks and decoding masks. While OP3 only provides decoding masks, fortunately, SAVi provides both input masks and decoding masks which we compare in Figure 6 (c). We find that input attention masks tend to be worse than decoding masks of SAVi. Therefore, the attention masks of STEVE outperform both the input and decoding masks of the baseline SAVi.
137
+
138
+ Mixture-based decoding without Spatial Broadcast. Mixture-based decoding requires a CNN to decode the object image and the mask from each slot. To implement this CNN, the baselines prescribe using a Spatial Broadcast decoder, a type of CNN decoder that limits the expressiveness of the decoder to facilitate the discovery of objects. We would like to test if a more flexible CNN implemented completely using transposed convolutions would be enough to improve the performance or not. In Figure 6 (d), our results on the 5 textured datasets show that this change leads to a similar or slightly higher performance than the original decoder. However, the model still fails by splitting the image into fixed patches similarly to before and still performs significantly worse than our model. This shows that simply using a more flexible CNN with mixture-based decoding is not enough and the expressiveness of an auto-regressive transformer is important for achieving significant gains.
139
+
140
+ Computational Requirements of STEVE. In Table 6 in the Appendix, we empirically compare the computational requirements of STEVE and SAVi. We assess by how much the computational requirement change in going from the mixture-based to the transformer-based approach. We find that in videos with image size $6 4 \times 6 4$ , STEVE requires similar resources as SAVi and about twice for image size $1 2 8 \times 1 2 8$ . Given the quadratic memory complexity of transformers, the larger memory demand of STEVE is not surprising. However, one should also consider that the mixture-based baselines fail almost completely on datasets like CATERTex, MOVi-Tex, MOVi-D, and MOVi-E, unlike ours. We also provide a big- $O$ analysis of the memory costs in Appendix B.1.
141
+
142
+ Effect of Camera Motion. Our segmentation results on MOVi-D and MOVi-E in Figures 2 and 3 provide insight into the effect of camera motion as the MOVi-E dataset introduces a moving camera to MOVi-D. We observe that camera motion in MOVi-E leads to a slight improvement in performance over MOVi-D. We conjecture that this is because a moving camera causes relative motion between objects and can help better in bringing out patterns that tend to remain stable under motion.
143
+
144
+ Static Objects. We also note that our model is effective even when static objects are present in the scene such as in CATER, CATERTex, MOVi-D, and MOVi-E. In methods that rely purely on optical flow for discovering objects can suffer significantly with static objects. For MOVi-D and MOVi-E, Greff et al. (2022) report FG-ARI of 19.4 and 2.7 using SAVi trained with optical flow supervision. Compared to this, our model achieves a significantly better 47.67 and 52.15 on these datasets, respectively, despite the static objects and without using any supervision whatsoever.
145
+
146
+ # 6 Conclusion
147
+
148
+ In this paper, we study the effect of a powerful transformer-based slot decoder for unsupervised object-centric video learning. For this, we propose a simple model, STEVE, and demonstrate that it can deal with various complex and naturalistic videos without any supervision by significantly outperforming previous state-of-the-art baseline models. In experiments, we also find that although the slot-transformer decoder alone is an important component, for videos it is essential to learn also from temporal information for dealing with complex videos. The results of this paper and the SLATE paper jointly suggest using a powerful reconstruction decoder for unsupervised object-centric learning which is contrary to the traditional view advocating the use of weak mixture decoders. This raises a question to the community: is accurate reconstruction from slots all we need to capture the objectness? In the future, it seems worth investigating further in this direction. Also, because we choose to investigate a minimal architecture in this paper, it would be interesting to see what gains we could obtain additionally by exploring more advanced architectures. Lastly, it would be interesting to investigate applying this method to large-scale datasets. We further elaborate on these in Appendix F.
149
+
150
+ # Acknowledgments and Disclosure of Funding
151
+
152
+ This work is supported by Brain Pool Plus $\mathrm { ( B P + ) }$ Program (No. 2021H1D3A2A03103645) and Young Researcher Program (No. 2022R1C1C1009443) through the National Research Foundation of Korea (NRF) funded by the Ministry of Science and ICT.
153
+
154
+ # References
155
+
156
+ Anciukevicius, T., Lampert, C. H., and Henderson, P. Object-centric image generation with factored depths, locations, and appearances. arXiv preprint arXiv:2004.00642, 2020.
157
+ Bao, Z., Tokmakov, P., Jabri, A., Wang, Y.-X., Gaidon, A., and Hebert, M. Discovering objects that can move. ArXiv, abs/2203.10159, 2022.
158
+ Bapst, V., Sanchez-Gonzalez, A., Doersch, C., Stachenfeld, K. L., Kohli, P., Battaglia, P. W., and Hamrick, J. B. Structured agents for physical construction. arXiv preprint arXiv:1904.03177, 2019.
159
+ Besbinar, B. and Frossard, P. Self-supervision by prediction for object discovery in videos. arXiv preprint arXiv:2103.05669, 2021.
160
+ Bideau, P. and Learned-Miller, E. G. It’s moving! a probabilistic model for causal motion segmentation in moving camera videos. ArXiv, abs/1604.00136, 2016.
161
+ Bommasani, R., Hudson, D. A., Adeli, E., Altman, R., Arora, S., von Arx, S., Bernstein, M. S., Bohg, J., Bosselut, A., Brunskill, E., et al. On the opportunities and risks of foundation models. arXiv preprint arXiv:2108.07258, 2021.
162
+ Brown, T. B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. Language models are few-shot learners. arXiv preprint arXiv:2005.14165, 2020.
163
+ Brox, T. and Malik, J. Object segmentation by long term analysis of point trajectories. In ECCV, 2010.
164
+ Burgess, C. P., Matthey, L., Watters, N., Kabra, R., Higgins, I., Botvinick, M., and Lerchner, A. Monet: Unsupervised scene decomposition and representation. arXiv preprint arXiv:1901.11390, 2019.
165
+ Caron, M., Touvron, H., Misra, I., Jégou, H., Mairal, J., Bojanowski, P., and Joulin, A. Emerging properties in self-supervised vision transformers. In ICCV 2021 - International Conference on Computer Vision, 2021.
166
+ Carvalho, W., Liang, A., Lee, K., Sohn, S., Lee, H., Lewis, R. L., and Singh, S. Reinforcement learning for sparse-reward object-interaction tasks in first-person simulated 3d environments. arXiv preprint arXiv:2010.15195, 2020.
167
+ Chen, C., Deng, F., and Ahn, S. Roots: Object-centric representation and rendering of 3d scenes. Journal of Machine Learning Research, 22(259):1–36, 2021.
168
+ Chen, M., Radford, A., Child, R., Wu, J. K., Jun, H., Luan, D., and Sutskever, I. Generative pretraining from pixels. In ICML 2020: 37th International Conference on Machine Learning, volume 1, pp. 1691–1703, 2020.
169
+ Cho, K., Van Merriënboer, B., Gulcehre, C., Bahdanau, D., Bougares, F., Schwenk, H., and Bengio, Y. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
170
+ Cimpoi, M., Maji, S., Kokkinos, I., Mohamed, S., , and Vedaldi, A. Describing textures in the wild. In Proceedings of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR), 2014.
171
+ Crawford, E. and Pineau, J. Exploiting spatial invariance for scalable unsupervised object tracking. arXiv preprint arXiv:1911.09033, 2019a.
172
+ Crawford, E. and Pineau, J. Spatially invariant unsupervised object detection with convolutional neural networks. In Proceedings of AAAI, 2019b.
173
+ Crawford, E. and Pineau, J. Learning 3d object-oriented world models from unlabeled videos. In Workshop on Object-Oriented Learning at ICML, 2020.
174
+ Creswell, A., Nikiforou, K., Vinyals, O., Saraiva, A., Kabra, R., Matthey, L., Burgess, C., Reynolds, M., Tanburn, R., Garnelo, M., et al. Alignnet: Unsupervised entity alignment. arXiv preprint arXiv:2007.08973, 2020.
175
+ Creswell, A., Kabra, R., Burgess, C., and Shanahan, M. Unsupervised object-based transition models for 3d partially observable environments. arXiv preprint arXiv:2103.04693, 2021.
176
+ Deng, F., Zhi, Z., Lee, D., and Ahn, S. Generative scene graph networks. In International Conference on Learning Representations, 2020.
177
+ Dittadi, A., Papa, S., De Vita, M., Schölkopf, B., Winther, O., and Locatello, F. Generalization and robustness implications in object-centric learning. arXiv preprint arXiv:2107.00637, 2021.
178
+ Du, Y., Smith, K., Ulman, T., Tenenbaum, J., and Wu, J. Unsupervised discovery of 3d physical objects from video. arXiv preprint arXiv:2007.12348, 2020.
179
+ Du, Y., Li, S., Sharma, Y., Tenenbaum, J., and Mordatch, I. Unsupervised learning of compositional energy concepts. Advances in Neural Information Processing Systems, 34, 2021a.
180
+ Du, Y., Smith, K. A., Ulman, T., Tenenbaum, J. B., and Wu, J. Unsupervised discovery of 3d physical objects from video. ArXiv, abs/2007.12348, 2021b.
181
+ Engelcke, M., Kosiorek, A. R., Jones, O. P., and Posner, I. Genesis: Generative scene inference and sampling with object-centric latent representations. In ICLR 2020 : Eighth International Conference on Learning Representations, 2020.
182
+ Engelcke, M., Jones, O. P., and Posner, I. Genesis-v2: Inferring unordered object representations without iterative refinement. arXiv preprint arXiv:2104.09958, 2021.
183
+ Eslami, S. A., Heess, N., Weber, T., Tassa, Y., Szepesvari, D., and Hinton, G. E. Attend, infer, repeat: Fast scene understanding with generative models. In Advances in Neural Information Processing Systems, pp. 3225–3233, 2016.
184
+ Ghasemipour, S. K. S., Freeman, D., David, B., Kataoka, S., Mordatch, I., et al. Blocks assemble! learning to assemble with large-scale structured reinforcement learning. arXiv preprint arXiv:2203.13733, 2022.
185
+ Girdhar, R. and Ramanan, D. CATER: A diagnostic dataset for Compositional Actions and TEmporal Reasoning. In ICLR, 2020.
186
+ Greff, K., Rasmus, A., Berglund, M., Hao, T., Valpola, H., and Schmidhuber, J. Tagger: Deep unsupervised perceptual grouping. In Advances in Neural Information Processing Systems, pp. 4484–4492, 2016.
187
+ Greff, K., van Steenkiste, S., and Schmidhuber, J. Neural expectation maximization. In Advances in Neural Information Processing Systems, pp. 6691–6701, 2017.
188
+ Greff, K., Kaufmann, R. L., Kabra, R., Watters, N., Burgess, C., Zoran, D., Matthey, L., Botvinick, M., and Lerchner, A. Multi-object representation learning with iterative variational inference. arXiv preprint arXiv:1903.00450, 2019.
189
+ Greff, K., van Steenkiste, S., and Schmidhuber, J. On the binding problem in artificial neural networks. arXiv preprint arXiv:2012.05208, 2020.
190
+ Greff, K., Belletti, F., Beyer, L., Doersch, C., Du, Y., Duckworth, D., Fleet, D., Gnanapragasam, D., Golemo, F., Herrmann, C., Kipf, T., Kundu, A., Lagun, D., Laradji, I. H., Liu, H.-T., Meyer, H., Miao, Y., Nowrouzezahrai, D., Oztireli, C., Pot, E., Radwan, N., Rebain, D., Sabour, S., Sajjadi, M. S. M., Sela, M., Sitzmann, V., Stone, A., Sun, D., Vora, S., Wang, Z., Wu, T., Yi, K. M., Zhong, F., and Tagliasacchi, A. Kubric: A scalable dataset generator. ArXiv, abs/2203.03570, 2022.
191
+ He, Z., Li, J., Liu, D., He, H., and Barber, D. Tracking by animation: Unsupervised learning of multi-object attentive trackers. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1318–1327, 2019.
192
+ Henderson, P. and Lampert, C. H. Unsupervised object-centric video generation and decomposition in 3d. ArXiv, abs/2007.06705, 2020.
193
+ Janai, J., Güney, F., Ranjan, A., Black, M. J., and Geiger, A. Unsupervised learning of multi-frame optical flow with occlusions. In ECCV, 2018.
194
+ Jiang, J. and Ahn, S. Generative neurosymbolic machines. arXiv preprint arXiv:2010.12152, 2020.
195
+ Jiang, J., Janghorbani, S., de Melo, G., and Ahn, S. SCALOR: generative world models with scalable object representations. In International Conference on Learning Representations, 2020.
196
+ Jonschkowski, R., Stone, A., Barron, J. T., Gordon, A., Konolige, K., and Angelova, A. What matters in unsupervised optical flow. In ECCV, 2020.
197
+ Kabra, R., Zoran, D., Erdogan, G., Matthey, L., Creswell, A., Botvinick, M., Lerchner, A., and Burgess, C. P. Simone: View-invariant, temporally-abstracted object representations via unsupervised video decomposition. arXiv preprint arXiv:2106.03849, 2021.
198
+ Karazija, L., Laina, I., and Rupprecht, C. Clevrtex: A texture-rich benchmark for unsupervised multi-object segmentation. arXiv preprint arXiv:2111.10265, 2021.
199
+ Kipf, T., van der Pol, E., and Welling, M. Contrastive learning of structured world models. arXiv preprint arXiv:1911.12247, 2019.
200
+ Kipf, T., Elsayed, G. F., Mahendran, A., Stone, A., Sabour, S., Heigold, G., Jonschkowski, R., Dosovitskiy, A., and Greff, K. Conditional Object-Centric Learning from Video. arXiv preprint arXiv:2111.12594, 2021.
201
+ Kosiorek, A., Kim, H., Teh, Y. W., and Posner, I. Sequential attend, infer, repeat: Generative modelling of moving objects. In Advances in Neural Information Processing Systems, pp. 8606– 8616, 2018.
202
+ Kossen, J., Stelzner, K., Hussing, M., Voelcker, C., and Kersting, K. Structured object-aware physics prediction for video modeling and planning. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview.net/forum?id=B1e-kxSKDH.
203
+ Lai, Z. and Xie, W. Self-supervised learning for video correspondence flow. ArXiv, abs/1905.00875, 2019.
204
+ Lai, Z., Lu, E., and Xie, W. Mast: A memory-augmented self-supervised tracker. 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6478–6487, 2020.
205
+ Lamb, A., He, D., Goyal, A., Ke, G., Liao, C.-F., Ravanelli, M., and Bengio, Y. Transformers with competitive ensembles of independent mechanisms. In arXiv e-prints, 2021.
206
+ Lin, Z., Wu, Y.-F., Peri, S. V., Jiang, J., and Ahn, S. Improving generative imagination in object-centric world models. In International Conference on Machine Learning, pp. 4114–4124, 2020a.
207
+ Lin, Z., Wu, Y.-F., Peri, S. V., Sun, W., Singh, G., Deng, F., Jiang, J., and Ahn, S. Space: Unsupervised object-oriented scene representation via spatial attention and decomposition. In International Conference on Learning Representations, 2020b.
208
+ Locatello, F., Weissenborn, D., Unterthiner, T., Mahendran, A., Heigold, G., Uszkoreit, J., Dosovitskiy, A., and Kipf, T. Object-centric learning with slot attention, 2020.
209
+ Löwe, S., Greff, K., Jonschkowski, R., Dosovitskiy, A., and Kipf, T. Learning object-centric video models by contrasting sets. arXiv preprint arXiv:2011.10287, 2020.
210
+ Lowe, S., Lippe, P., Rudolph, M. R., and Welling, M. Complex-valued autoencoders for object discovery. ArXiv, abs/2204.02075, 2022.
211
+ Mambelli, D., Träuble, F., Bauer, S., Schölkopf, B., and Locatello, F. Compositional multi-object reinforcement learning with linear relation networks. arXiv preprint arXiv:2201.13388, 2022.
212
+ Oh, S. W., Lee, J.-Y., Xu, N., and Kim, S. J. Video object segmentation using space-time memory networks. 2019 IEEE/CVF International Conference on Computer Vision (ICCV), pp. 9225–9234, 2019.
213
+ Ren, Z., Yan, J., Ni, B., Liu, B., Yang, X., and Zha, H. Unsupervised deep learning for optical flow estimation. In AAAI, 2017.
214
+ Savarese, P., Kim, S. S. Y., Maire, M., Shakhnarovich, G., and McAllester, D. Information-theoretic segmentation by inpainting error maximization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4029–4039, 2021.
215
+ Schölkopf, B., Locatello, F., Bauer, S., Ke, N. R., Kalchbrenner, N., Goyal, A., and Bengio, Y. Toward causal representation learning. Proceedings of the IEEE, 109(5):612–634, 2021.
216
+ Singh, G., Peri, S., Kim, J., Kim, H., and Ahn, S. Structured world belief for reinforcement learning in pomdp. In International Conference on Machine Learning, pp. 9744–9755. PMLR, 2021.
217
+ Singh, G., Deng, F., and Ahn, S. Illiterate dall-e learns to compose. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id=h0OYV0We3oh.
218
+ Stanic, A. and Schmidhuber, J. R-sqair: relational sequential attend, infer, repeat. ´ arXiv preprint arXiv:1910.05231, 2019.
219
+
220
+ Stelzner, K., Kersting, K., and Kosiorek, A. R. Decomposing 3d scenes into objects via unsupervised volume segmentation. arXiv preprint arXiv:2104.01148, 2021.
221
+
222
+ Stone, A., Maurer, D., Ayvaci, A., Angelova, A., and Jonschkowski, R. Smurf: Self-teaching multi-frame unsupervised raft with full-image warping. 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 3886–3895, 2021.
223
+
224
+ Tangemann, M., Schneider, S., von Kügelgen, J., Locatello, F., Gehler, P., Brox, T., Kümmerer, M., Bethge, M., and Schölkopf, B. Unsupervised object learning via common fate. arXiv preprint arXiv:2110.06562, 2021.
225
+
226
+ Van Steenkiste, S., Chang, M., Greff, K., and Schmidhuber, J. Relational neural expectation maximization: Unsupervised discovery of objects and their interactions. arXiv preprint arXiv:1802.10353, 2018.
227
+
228
+ 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.
229
+
230
+ Veerapaneni, R., Co-Reyes, J. D., Chang, M., Janner, M., Finn, C., Wu, J., Tenenbaum, J. B., and Levine, S. Entity abstraction in visual model-based reinforcement learning. arXiv preprint arXiv:1910.12827, 2019.
231
+
232
+ von Kügelgen, J., Ustyuzhaninov, I., Gehler, P., Bethge, M., and Schölkopf, B. Towards causal generative scene models via competition of experts. arXiv preprint arXiv:2004.12906, 2020.
233
+
234
+ Vondrick, C., Shrivastava, A., Fathi, A., Guadarrama, S., and Murphy, K. P. Tracking emerges by colorizing videos. In ECCV, 2018.
235
+
236
+ Wang, N., Song, Y., Ma, C., gang Zhou, W., Liu, W., and Li, H. Unsupervised deep tracking. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 1308–1317, 2019a.
237
+
238
+ Wang, X., Jabri, A., and Efros, A. A. Learning correspondence from the cycle-consistency of time. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 2561–2571, 2019b.
239
+
240
+ Wang, Y., Yang, Y., Yang, Z., Zhao, L., and Xu, W. Occlusion aware unsupervised learning of optical flow. 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 4884–4893, 2018.
241
+
242
+ Wang, Y., Shen, X., Hu, S. X., Yuan, Y., Crowley, J. L., and Vaufreydaz, D. Self-supervised transformers for unsupervised object discovery using normalized cut. ArXiv, abs/2202.11539, 2022.
243
+
244
+ Watters, N., Matthey, L., Bosnjak, M., Burgess, C. P., and Lerchner, A. Cobra: Data-efficient model-based rl through unsupervised object discovery and curiosity-driven exploration. arXiv preprint arXiv:1905.09275, 2019.
245
+
246
+ Weis, M. A., Chitta, K., Sharma, Y., Brendel, W., Bethge, M., Geiger, A., and Ecker, A. S. Unmasking the inductive biases of unsupervised object representations for video sequences. arXiv preprint arXiv:2006.07034, 2, 2020.
247
+
248
+ Wu, Y.-F., Yoon, J., and Ahn, S. Generative video transformer: Can objects be the words? In International Conference on Machine Learning, pp. 11307–11318. PMLR, 2021.
249
+
250
+ Yang, C., Lamdouar, H., Lu, E., Zisserman, A., and Xie, W. Self-supervised video object segmentation by motion grouping. arXiv: Computer Vision and Pattern Recognition, 2021.
251
+
252
+ Yang, Y., Loquercio, A., Scaramuzza, D., and Soatto, S. Unsupervised moving object detection via contextual information separation. 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 879–888, 2019.
253
+
254
+ Yang, Y., Chen, Y., and Soatto, S. Learning to manipulate individual objects in an image. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 6558–6567, 2020.
255
+ Yu, P., Xie, S., Ma, X., Zhu, Y., Wu, Y. N., and Zhu, S.-C. Unsupervised foreground extraction via deep region competition. In NeurIPS, 2021.
256
+ Zhou, H., Kadav, A., Lai, F., Niculescu-Mizil, A., Min, M. R., Kapadia, M., and Graf, H. P. Hopper: Multi-hop transformer for spatiotemporal reasoning. arXiv preprint arXiv:2103.10574, 2021.
257
+ Zhu, F., Zhang, L., Fu, Y., Guo, G., and Xie, W. Self-supervised video object segmentation. ArXiv, abs/2006.12480, 2020.
258
+ Zoran, D., Kabra, R., Lerchner, A., and Rezende, D. J. Parts: Unsupervised segmentation with slots, attention and independence maximization. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 10439–10447, 2021.
259
+
260
+ # Checklist
261
+
262
+ 1. For all authors...
263
+
264
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
265
+ (b) Did you describe the limitations of your work? [Yes]
266
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes]
267
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
268
+
269
+ 2. If you are including theoretical results...
270
+
271
+ (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]
272
+
273
+ 3. If you ran experiments...
274
+
275
+ (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 supplementary material, we provide the architectural details and the hyperparameters used for our experiments. We will share the code and our proposed datasets at https://sites.google.com/view/slot-transformer-for-videos.
276
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
277
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
278
+ (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 the amount of resources used in Section B.1 in Appendix.
279
+
280
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
281
+
282
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
283
+ (b) Did you mention the license of the assets? [N/A]
284
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We will share them upon acceptance.
285
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
286
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
287
+
288
+ 5. If you used crowdsourcing or conducted research with human subjects...
289
+
290
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
291
+
292
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
293
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/fT9W53lLxNS/fT9W53lLxNS.md ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SAVi $^ { + + }$ : Towards End-to-End Object-Centric Learning from Real-World Videos
2
+
3
+ Gamaleldin F. Elsayed ∗†, Aravindh Mahendran∗, Sjoerd van Steenkiste∗, Klaus Greff, Michael C. Mozer & Thomas Kipf∗ Google Research
4
+
5
+ # Abstract
6
+
7
+ The visual world can be parsimoniously characterized in terms of distinct entities with sparse interactions. Discovering this compositional structure in dynamic visual scenes has proven challenging for end-to-end computer vision approaches unless explicit instance-level supervision is provided. Slot-based models leveraging motion cues have recently shown great promise in learning to represent, segment, and track objects without direct supervision, but they still fail to scale to complex real-world multi-object videos. In an effort to bridge this gap, we take inspiration from human development and hypothesize that information about scene geometry in the form of depth signals can facilitate object-centric learning. We introduce $\mathrm { S A V i + + }$ , an object-centric video model which is trained to predict depth signals from a slot-based video representation. By further leveraging best practices for model scaling, we are able to train $\mathrm { S A V _ { i + + } }$ to segment complex dynamic scenes recorded with moving cameras, containing both static and moving objects of diverse appearance on naturalistic backgrounds, without the need for segmentation supervision. Finally, we demonstrate that by using sparse depth signals obtained from LiDAR, $\mathrm { S A V i { + } { + } }$ is able to learn emergent object segmentation and tracking from videos in the real-world Waymo Open dataset.
8
+
9
+ Project page: https://slot-attention-video.github.io/savi++/
10
+
11
+ # 1 Introduction
12
+
13
+ The natural world consists of distinct entities—people, dogs, cars, trees, etc.— and its complexity emerges from the combined, mostly independent, actions of the entities. This compositional structure must be appreciated to predict future states of the world and to effect particular outcomes. People have an intrinsic understanding of objects: objects have spatiotemporal coherence, they interact when in close proximity, and they
14
+
15
+ ![](images/113185bce0ab08d66cb1693ec0c46d5edae17f5b1f0f2e4eb56d5b3fc9f7c04a.jpg)
16
+ Figure 1: Emergent segmentation and tracking in $\mathrm { S A V _ { 1 ^ { + + } } }$ .
17
+
18
+ possess persistent, latent characteristics that determine their behavior over extended periods of time [25, 46]. Just as object-centric representations are critical to human understanding, they have the potential in machine learning to greatly improve sample efficiency, robustness, visual reasoning, and interpretability of learning algorithms [15, 35]. For example, consider the challenge faced by an autonomous vehicle operating in diverse surroundings (Figure 1). Generalization across situations requires learning about recurring entities like cars, traffic lights, and pedestrians, and the rules that govern interactions among these entities.
19
+
20
+ In human brains, the ability to organize edges and surfaces into unitary, bounded, and persisting object representations develops through experience and/or maturation from infancy and without explicit instruction via a ‘core system of object representation’ [46], i.e., a form of cognitive inductive bias. In deep learning, such an inductive bias has been proposed in slot-based architectures which segregate knowledge about individual objects into nonoverlapping but interchangeable pools of neurons. The resulting representational modularity can facilitate causal reasoning and prediction for downstream tasks [15, 44].
21
+
22
+ A grand challenge in computer vision has been to discover the compositional structure of real-world dynamic visual scenes in an unsupervised fashion. By unsupervised, we mean no segmentation information is provided that specifies which pixels belong together as part of a single object. Initial efforts focused on single-frame, synthetic RGB images [13, 14, 36, 50], but extending this work to video and more complex scenes proved challenging. A key insight to further progress was the realization that a color-intensity pixel array is not the only source of visual information readily available, at least not to human perceptual systems. The human perceptual system extracts motion and depth cues early in the processing stream [9–11, 20, 39]. These cues are correlated with object identities, and can therefore bootstrap the formation of object-centric representations [45].
23
+
24
+ The recently introduced Slot Attention for Video (SAVi) model [31] leveraged optical flow (frameto-frame motion) as a prediction target to obtain object-centric representations of dynamic scenes involving complex 3D scanned objects and real-world backgrounds. However, motion prediction alone is insufficient to learn about the distinction between static objects and the background. Further, in real-world application domains such as self-driving cars, cameras themselves are subject to movement, which globally affects frame-to-frame motion as a prediction signal in non-trivial ways.
25
+
26
+ In the present work, we describe an enhanced slot-based model for video, referred to as $S A V i + +$ (Figure 2), which obtains qualitative improvements in object-centric representations by exploiting depth signals readily available from RGB-D cameras and LiDAR sensors. $\mathrm { S A V _ { i + + } }$ is the first slotbased, end-to-end trained model that successfully segments complex objects in naturalistic, real-world video sequences without using direct segmentation or tracking supervision.
27
+
28
+ A summary of our contributions is as follows:
29
+
30
+ • We introduce $\mathrm { S A V i { + } { + } }$ : an object-centric slot-based video model that makes several key improvements to SAVi [31] by utilizing depth prediction and by adopting best practices for model scaling in terms of architecture design and data augmentation.
31
+ • On the multi-object video (MOVi) benchmark containing synthetic videos of high visual and dynamic complexity [16], we find that $\mathrm { S A V i + + }$ is able to handle videos containing complex shapes and backgrounds, and a large number of objects per scene. Improving on SAVi, our approach accommodates both static and dynamic objects and both static and moving cameras.
32
+ • Finally, we demonstrate that $\mathrm { S A V _ { i + + } }$ trained with sparse depth signals obtained from LiDAR enables emergent object decomposition and tracking in real-world driving videos from the Waymo Open dataset [47].
33
+
34
+ # 2 Related work
35
+
36
+ Object-centric learning A growing body of research is addressing the problem of end-to-end learning of object-centric representations from raw perceptual data without direct supervision. Slotbased neural networks such as IODINE [14], MONet [4], and Slot Attention [36] rely on a factorized latent space and independent per-object decoders as inductive bias to enable object discovery in a simple auto-encoding setup. Architectures with stronger inductive biases using fixed object size, presence, or propagation priors have been explored in works such as SQAIR [33] and SCALOR [23], but generally these methods have faced challenges scaling to more complex real-world data when relying on auto-encoding alone. Our work primarily builds on recent advances in object-centric generative models for video sequences [24, 31, 50, 52, 59]. Different from our approach, these methods have so far been unable to scale to complex real-world multi-object video data. An alternative class of methods using contrastive learning for object discovery [19, 30, 37, 56], most notably GroupViT [56] and ODIN [19], has recently achieved some success in discovering semantic groupings in real-world images. However, neither GroupViT nor ODIN model dynamics and typically fail to separate semantically similar object instances in close proximity. In our work, we follow a generative approach, but instead of tasking the decoder to generate complex visual RGB pixel data, we utilize depth information to bootstrap object-centric learning without direct supervision.
37
+
38
+ Object discovery in driving scenes A range of recent methods [1, 17, 49, 53] use a multi-stage pipeline of 1) obtaining pseudo ground truth (PGT) segmentation or detection labels via some heuristic, and 2) training a model in a supervised fashion on PGT labels. While this class of methods achieves some success in discovering and tracking objects in real-world driving scenes, it crucially hinges on the quality of the PGT labels, requiring carefully engineered task-specific heuristics to extract objects. Earlier methods solely use clustering heuristics to extract approximate segmentation masks directly from motion trajectories for moving objects [3, 40]. In our work, we instead demonstrate that object segmentation and tracking can emerge in an end-to-end setting on complex real-world data without relying on PGT label generation.
39
+
40
+ Cross-modal learning For self-supervised object-centric learning from visual data, a range of target modalities and training signals have been explored in the literature. By using motion cues from optical flow as prediction targets, several recent methods [31, 57] were able to overcome limitations of purely RGB pixel-level generative models, which frequently failed in the presence of complicated textures [27]. However, this advantage is primarily limited to discovery of moving objects. Utilizing depth targets from a simulator [2] or from sparse LiDAR [17, 49, 53], has been explored in an effort to overcome these limitations. Different from prior works utilizing multi-stage pipelines and handcrafted heuristics for extraction of pseudo-labels from LiDAR [17, 49, 53], we directly utilize the (sparse) depth signal as target and demonstrate that this can enable emergent object segmentation and tracking on real-world driving data without any additional regularizers or pseudo-labeling techniques.
41
+
42
+ Scaling strategies for vision models It is common practice to scale architectural capacity with dataset complexity and size, while making use of strong data augmentation when addressing various supervised computer vision tasks [7, 8, 18, 32]. Nonetheless, self-supervised methods for end-toend object discovery have primarily been relying on overly simplistic and low-capacity backbone architectures [14, 36, 59], likely due to the simplicity of datasets and tasks considered in prior work. By scaling object-centric methods to larger, visually more complex datasets, we find that utilizing stronger visual backbone architectures—in combination with data augmentation—can provide substantial benefits. For simplistic datasets with lower visual complexity (and same number of examples), we found anecdotal evidence in preliminary experiments for the opposite effect: both architecture scaling and data augmentation can negatively affect object discovery performance, likely explaining why prior works have not explored these strategies.
43
+
44
+ Depth estimation Recent advances in supervised monocular depth estimation (see Ming et al. [38] for a review) could be combined with our method in future work, for instance using ordinal regression losses [12], transformer architectures [43], or more complex instance-wise decoder architectures [54].
45
+
46
+ # 3 Methods
47
+
48
+ We begin by providing a brief introduction to Slot Attention for Video (SAVi), which is the starting point for our exploration. With $\mathrm { S A V _ { i + + } }$ , we introduce several simple yet crucial improvements, which allow us to bridge the gap to complex real-world data. Our framework is summarized in Figure 2.
49
+
50
+ # 3.1 Background
51
+
52
+ Slot Attention for Video (or SAVi) is a recent state-of-the-art architecture for learning object-centric representations from video with minimal supervision. We briefly highlight some of its key components below and refer the reader for complete details to Kipf et al. [31].
53
+
54
+ SAVi can be viewed as an autoregressive encoder-decoder video model with a structured latent state composed of $K$ object slots. At a given time-step, an encoder first encodes the observed video frame to yield high-level image features that are useful for learning about objects. This is followed by Slot Attention [36] (the ‘corrector’), which updates the slots using these features and encourages individual slots to specialize to different parts of the observation. The content of each slot is decoded separately using a decoder, which additionally outputs a pixel-level alpha mask to indicate how the decoded values for each slot should be combined. Together, the mask and decoded slots determine the output of the model at the current time-step from which a loss is computed, e.g., to train the model to predict frame-to-frame motion (optical flow) for this frame. Slots for the next time-step (for the corrector to update) are obtained by applying a predictor, which can model interactions between slots and learn about object dynamics to predict their future state.
55
+
56
+ ![](images/ef2ded7fa265d293d1007559357466501a50c9a38d382c5e326fd67f3d4116dd.jpg)
57
+ Figure 2: $\mathrm { S A V _ { i + + } }$ is an object-centric video model based on Slot Attention for Video [31], which encodes a video into a set of temporally-consistent latent variables (object slots). Input frames and prediction targets are augmented using random crop augmentations. Augmented frames are passed through the improved $\mathrm { S A V i + + }$ encoder and mapped onto object slots using an attention mechanism [36]. Slots are updated recurrently for each frame and subsequently decoded independently into a depth map and per-slot alpha masks. $\mathrm { S A V _ { 1 ^ { + + } } }$ is trained using (sparse) depth targets, leading to emergence of temporally-consistent object segmentation in the decoded alpha masks.
58
+
59
+ In addition to optical flow prediction, SAVi introduces conditioning that helps reduce uncertainty about the part-whole division into objects by pointing the model to specific locations. Indeed, in the absence of a specific downstream task, scene decomposition can be ambiguous and providing additional information as a conditioning signal may help alleviate this. The conditioning takes place via the slot initializer, which initializes the slots used in the initial video frame. The initialization may be learned in an unconditional setting (i.e., learn the initial slot states) or obtained by conditioning the initial state on high-level cues such as bounding boxes of objects of interest in the first video frame. This direction of attention or input conditioning helped SAVi to succeed in decomposing more complex visual scenes.
60
+
61
+ # 3.2 SAVi++
62
+
63
+ As SAVi relies on optical flow prediction as its main training signal for object discovery, its application is primarily limited to settings where all objects in a scene have independent motion. In addition, SAVi struggled to generalize to scenes with a moving camera, even though the optical flow field encodes information about (static) scene geometry in this case.
64
+
65
+ Here, we identify two key directions for improving SAVi and bridging its capabilities to real-world video data, while preserving its core foundation for learning object representations from video: (1) exploiting depth as a prediction signal, which is readily available in many real-world settings, and (2) utilizing model scaling strategies in terms of encoder improvements and data augmentation, which, despite being commonly used for classic vision problems, are generally underutilized for objectcentric learning. Our improved approach, called $\mathrm { S A V _ { 1 ^ { + + } } }$ , successfully segments complex objects in naturalistic, real-world video sequences without using direct segmentation or tracking supervision.
66
+
67
+ Exploiting depth information Training object-centric models solely using RGB image or video frame reconstruction proves challenging in the presence of complex visual textures, frequently leading to failure modes such as clustering by color or into object-agnostic spatial regions [14, 17]. In SAVi, optical flow was proposed as a prediction signal to mitigate this issue, while still operating on visual RGB inputs [31]. However, relying solely on optical flow as a prediction target for learning about objects has a clear disadvantage: static objects, which make up the vast majority of visual entities we encounter on a daily basis, are not captured in this signal unless the observer or the entire scene is in motion. As a consequence, SAVi fails to represent objects that are at rest, and similarly struggles with scenes observed from a moving camera, as optical flow can prove challenging to model in this case.
68
+
69
+ ![](images/6878b7d872a241de614df5c284ba9a05f777aee232210809b5bb9cc2d45c03e3.jpg)
70
+ Figure 3: We consider three synthetic Multi-Object Video (MOVi) datasets [16] and the large-scale real-world driving dataset Waymo Open [47]. All datasets contain complex textures and moving objects. The MOVi datasets increase in complexity from MOVi-C (moving objects only) over MOViD $^ +$ static objects) to MOVi-E ( $^ +$ moving cameras). Waymo Open contains all these characterisics.
71
+
72
+ Here, we explore depth as a target signal, used in conjunction with flow or even in isolation. Depth estimation has received little attention in slot-based models, yet does not suffer from the limitation of optical flow in datasets with static objects and camera movement. We thus hypothesize that depth may greatly benefit obtaining emergent object decompositions of complex videos. In terms of practical applicability, we note how depth is a readily-available signal in many real-world settings thanks to the prevalence of RGB-D cameras and LiDAR in settings like self-driving cars [47]. Even in the absence of depth sensing capabilities, this signal can be cheaply estimated from multi-camera systems [34].
73
+
74
+ In our implementation, we represent the depth signal in image space, which we encode using a log transformation $\log ( 1 + d )$ , where $d$ is the distance of a pixel to the camera (see Figure 3a). This log-transform puts a stronger emphasis on close-by objects and—in early experiments—we found this form of normalization crucial for reliably training object-centric models using depth targets. $\mathrm { S A V _ { 1 ^ { + + } } }$ is then trained to minimize the squared difference between the decoder output and this target signal. In case of multiple available targets, such as depth and flow, we concatenate the target images along the channel dimension and predict them using an otherwise unchanged model.
75
+
76
+ For sparse targets such as depth obtained from LiDAR, we ignore any points in the image space for which no signal is present in the computation of the loss. For LiDAR specifically, we obtain the x, y, z coordinates of all the LiDAR points in the self-driving car (SDC) world and compute the distance of each of the points from the LiDAR sensor. We then use the camera and LiDAR calibration parameters to project the LiDAR point distances from the SDC domain to the camera frame. This projection represents a very sparse approximation of the ground-truth depth signal (Figure 3b).
77
+
78
+ Scaling strategies Visual complexity present in real-world videos necessitates a different class of encoders than those used for simple synthetic datasets. Inspired by successful visual backbone architectures for set-based supervised object detection models [6, 26], we use a more capable encoder that utilizes the ResNet34 [18] architecture followed by a transformer encoder [51] (with 4 layers, unless otherwise mentioned). To avoid computation of batch and/or temporal statistics, we replace the typical batch normalization in ResNet34 with group normalization [55]. We use a stride 1 convolution and use no max-pooling in the ResNet root block. This results in an overall backbone stride of 8 (as opposed 32), which was found to be important for retaining object decomposition capabilities. Please see the appendix for further architectural details.
79
+
80
+ Drawing inspiration from training schemes commonly used for real-world vision models [48], we further apply Inception-style cropping as data augmentation. In particular, we randomly crop a region of each frame with aspect ratio $\in [ 0 . 7 5 , 1 . 3 3 ]$ such that enough of the frame is retained after cropping. The same crop is applied consistently across all frames and the resulting video is resized to the original resolution. Flow fields and depth maps are adjusted accordingly to keep them accurate and spatially aligned with the video frame.
81
+
82
+ # 4 Experiments
83
+
84
+ The goal of our experimental evaluation is twofold: 1) on synthetic video data of varying complexity we would like to analyze the potential advantages of utilizing a depth signal and model scaling strategies for learning emergent segmentation and tracking, and 2) we would like to investigate whether these improvements enable bridging the gap to complex real-world video data.
85
+
86
+ Section 4.1 covers both qualitative and quantitative comparisons of $\mathrm { S A V i + + }$ against baselines on the synthetic MOVi datasets. In Section 4.2, we perform an ablation study on $\mathrm { S A V _ { i + + } }$ . Finally, in Section 4.3 we demonstrate and analyze results for a $\mathrm { S A V i + + }$ model applied to real-world driving videos from the Waymo Open [47] dataset.
87
+
88
+ Datasets As basis for our experiments, we use videos of different scene and camera complexities (Figure 3c). We use three synthetic Multi-Object Video (MOVi) datasets (Figure 3a) introduced in Kubric [16], which are created by simulating rigid body dynamics. We narrow our investigation to MOVi datasets with complex naturalistic backgrounds and 3D-scanned everyday objects (variants C, D, and E). MOVi-C is generated using a static camera, and all objects (max. 10) are initialized to move independently. MOVi-D introduces more objects, some of which are dynamic (1-3) and the majority rests statically in the scene (10-20). Finally, MOVi-E introduces random, linear camera movement. Each video contains 24 frames sampled at 12 frames per second (fps).
89
+
90
+ We also train and evaluate $\mathrm { S A V _ { i + + } }$ in a real-world driving setting using the Waymo Open dataset (Figure 3b). Waymo Open is comprised of high resolution video data of $1 2 8 0 \times 1 9 2 0$ original resolution from a multi-camera system collected by Waymo vehicles [47]. The dataset consists of 798 train and 202 validation scenes of 20s video each, sampled at 10 fps. We subsample the dataset at 5 fps both for training and validation. The dataset also includes LiDAR signals that we use to compute sparse depth maps as discussed in Section 3.
91
+
92
+ Training setup For all our experiments, unless stated otherwise, we resize frames to a height of 128 pixels while keeping the aspect ratio fixed, resulting in a $1 2 8 \times 1 2 8$ resolution for MOVi datasets, and a resolution of $1 2 8 \times 1 9 2$ for Waymo Open. We train $\mathrm { S A V _ { i + + } }$ for 500k steps on Tensor Processing Unit (TPU) accelerators with a batch size of 64 using Adam [29].
93
+
94
+ We train on randomly sampled sub-sequences of only 6 frames using 24 slots for MOVi and 11 slots for Waymo Open. See appendix for further training details and hyperparameters.
95
+
96
+ # 4.1 $\mathbf { S A V i + + }$ improves object-centric learning on complex synthetic video data
97
+
98
+ We investigate whether the key changes introduced to SAVi [31], which constitute our improved $\mathrm { S A V i + + }$ model, allow us to overcome limitations of SAVi and address the most challenging synthetic multi-object video (MOVi) benchmarks introduced in Kubric [16].
99
+
100
+ Setup We train all models independently on each dataset variant. Both SAVi and $\mathrm { S A V _ { i + + } }$ are trained in a conditional setting where we initialize slots using ground-truth bounding box information in the first frame. We report the same segmentation metrics as in prior work, i.e. Foreground Adjusted Rand Index (FG-ARI) [21, 42] and Mean Intersection over Union (mIoU). FG-ARI is a permutationinvariant clustering similarity metric frequently used for evaluating scene decomposition quality. It compares discovered segmentation masks with ground-truth masks while ignoring any pixels that belong to the background. It is sensitive to temporal consistency of masks, but insensitive to their ordering. The mIoU metric is a standard segmentation metric, here adapted for video as in [5]. We note that this implementation is sensitive to the correct ordering of masks, i.e. it also measures whether models used the conditioning signal (here, first-frame bounding boxes) correctly.
101
+
102
+ Baselines Besides comparing to SAVi [31], the most representative prior method for the task we are interested in, we compare against a range of baselines aimed at establishing the difficulty of the unsupervised, bounding box-conditioned video object segmentation task: 1) a bounding box copy (BBox copy) baseline, which simply repeats the first-frame boxes throughout the video, 2) a learned BBox propagation baseline that does not receive visual inputs, to test for easily exploitable biases in the datasets, 3) $\mathbf { k }$ -Means clustering baselines, that cluster the flow and/or depth signal across the video sequence (initialized using the ground-truth object centers in the first frame), and 4) a label propagation baseline, that uses visual features to propagate the initial boxes (rendered as rectangular masks) across the video, based on Contrastive Random Walks (CRW) [22]. See appendix for further details.
103
+
104
+ Table 1: MOVi results in terms of mean score $\pm$ standard error (5 seeds) from evaluating $\mathrm { S A V _ { i + + } }$ and baseline models on validation set video sequences of increased length (24 frames). \*: we use the official implementation of CRW [22], which does not report FG-ARI.
105
+
106
+ <table><tr><td rowspan="2">Model</td><td colspan="3">mIoU↑ (%)</td><td colspan="3">FG-ARI↑ (%)</td></tr><tr><td>MOVi-C</td><td>MOVi-D</td><td>MOVi-E</td><td>MOVi-C</td><td>MOVi-D</td><td>MOVi-E</td></tr><tr><td>BBox copy</td><td>12.3</td><td>42.8</td><td>32.9</td><td>11.8</td><td>68.0</td><td>54.7</td></tr><tr><td>BBox propagation</td><td>22.9±0.1</td><td>26.7±0.8</td><td>24.1 ± 1.1</td><td>9.6±0.5</td><td>24.9±3.7</td><td>18.4±3.9</td></tr><tr><td>K-Means (depth)</td><td>7.1±0.3</td><td>6.0±0.4</td><td>5.4±0.3</td><td>26.3± 1.0</td><td>30.9±0.7</td><td>32.2± 0.6</td></tr><tr><td>K-Means (flow)</td><td>10.7 ± 0.5</td><td>7.4±0.4</td><td>6.0±0.3</td><td>26.5± 1.0</td><td>30.9±0.8</td><td>33.1±0.7</td></tr><tr><td>K-Means (flow+depth)</td><td>10.6±0.6</td><td>6.7±0.4</td><td>5.3±0.3</td><td>26.6±1.0</td><td>35.9 ± 1.0</td><td>34.8±0.7</td></tr><tr><td>CRW [22]</td><td>27.8±0.2</td><td>45.3±0.0</td><td>47.5 ± 0.1</td><td>*</td><td>*</td><td>*</td></tr><tr><td>SAVi [31]</td><td>43.1± 0.7</td><td>22.7± 7.5</td><td>30.7±4.9</td><td>77.6±0.7</td><td>59.6± 6.7</td><td>55.3± 5.8</td></tr><tr><td>SAVi++ (ours)</td><td>45.2 ± 0.1</td><td>48.3±0.5</td><td>47.1 ± 1.3</td><td>81.9±0.2</td><td>86.0±0.3</td><td>84.1±0.9</td></tr></table>
107
+
108
+ Results Quantitative results can be seen in Table 1 and qualitative results on MOVi-E in Figure 4a. The BBox copy method serves as a trivial baseline which a learning-based approach should outperform. While the original SAVi model does so on MOVi-C, it clearly fails to model the more complex MOViD and -E datasets. The BBox copy baselines is—perhaps unsurprisingly—strongest on MOVi-D, where most objects are static. $\mathrm { S A V _ { i + + } }$ outperforms this baseline on all datasets, indicating that it learns non-trivial segmentation and tracking capabilities. Indeed, this advantage does not solely come from fitting certain biases in the datasets, as a learned BBox propagation baseline (using the same predictor as in $\mathrm { S A V i + + }$ ) that does not receive visual input, fails to generalize to unseen evaluation videos. It is worth noting that neither of the MOVi tasks can easily be solved by simply clustering the target signals, as the results for the $\mathbf { k }$ -Means baselines demonstrate.
109
+
110
+ Compared to CRW it can be seen how $\mathrm { S A V _ { i + + } }$ yields markedly better mIoU on MOVi-C and D, while performance on MOVi-E is similar. Note that, unlike $\mathrm { S A V _ { i + + } }$ , CRW is merely capable of propagating pixel-level annotations across frames in a video and does not by itself produce instance-level object segmentations or corresponding object-representations that could be used for down-stream tasks. Finally, comparing $\mathrm { S A V _ { i + + } }$ and SAVi directly, we see that $\mathrm { S A V _ { i + + } }$ overcomes the primary limitations of SAVi on the harder MOVi-D and -E datasets, both quantatively (Table 1) and qualitatively (Figure 4a), while also improving performance on MOVi-C.
111
+
112
+ Discussion It is evident that a small number of critical changes to SAVi [31], namely utilizing depth targets, a stronger architecture, and data augmentation, can have dramatic consequences on the ability of this slot-based model to learn emergent object segmentation and tracking in complex video sequences. The difference between $\mathrm { S A V _ { i + + } }$ and SAVi is especially evident for the more complex datasets in our study (e.g., improving the mIoU score on MOVi-E from $3 0 . 7 \%$ to $4 7 . 1 \%$ ; see also Figure 4a). These results demonstrate that $\mathrm { S A V _ { i + + } }$ is better suited for various data complexities in terms of object dynamics and camera movement, which are likely to exist in real-world data.
113
+
114
+ # 4.2 Ablation study
115
+
116
+ In this section, we report results of an ablation study to gauge the contribution of the different components of $\mathrm { S A V _ { i + + } }$ . The three main ingredients of $\mathrm { S A V _ { i + + } }$ are 1) the use of depth as training target, 2) the extra capacity added to SAVi by including a transformer encoder, and 3) the use of data augmentation. Figure 4b shows a systematic ablation of each of those components. Removing the transformer encoder reduces object segmentation quality, yet the degradation in performance is relatively limited. While data augmentation only has a mild effect on the simpler MOVi-C dataset, it makes a substantial difference on the more challenging datasets, MOVi-D and E. Finally, removing depth targets reduces performance further and is particularly catastrophic on MOVi-E.
117
+
118
+ In fact, we find that training solely using depth targets without relying on predicting optical flow as well (see w/o Flow in Figure 4b) still allows the model to accurately segment and track objects, especially on the more complex MOVi-D and E datasets. This result is particularly strong on MOVi-E where jointly predicting optical flow presents a difficult task for scenes with camera movement. Further, training on depth targets was very crucial to obtain good performance on the most complex synthetic data MOVi-E as demonstrated with the large drop in mIoU when ablating depth and relying only on optical flow to train the model.
119
+
120
+ ![](images/5704f2280467d4223a1225bd87e186e118f2dcfb2f173dbd4d326623a68a8f34.jpg)
121
+ Figure 4: Left: Qualitative results of $\mathrm { S A V _ { i + + } }$ compared to SAVi [31] on the synthetic MOVi-E dataset with camera motion. Right: $\mathrm { S A V _ { 1 + + } }$ ablation study on MOVi-C, D, and E. Bars reflect validation set mIoU (mean $\pm$ standard error for 5 seeds). We ablate: 1) the transformer encoder (w/o Trans.), 2) data augmentation (w/o Trans. & Aug.), and 3) depth targets (w/o Trans. & Aug. & Depth). We further report results for training without flow, while only using depth targets (w/o Flow).
122
+
123
+ ![](images/464f2070d15a1195919acb4e9d5c3a22ef20495ff206fdd18e01ddfaaa34b6bd.jpg)
124
+ Figure 5: Qualitative segmentation comparison on the Waymo Open validation set. Naive application of a SIMONe [24] baseline model to this dataset results in failure, while adapting SIMONe to predict (sparse) depth maps yields rough (but frequently misaligned) segmentation masks. $\mathrm { S A V _ { i + + } }$ generally produces highly accurate segmentation masks, while its unconditional results are promising. Here, we hide masks that occupy more than 1300 pixels on average per frame to ease interpretability.
125
+
126
+ # 4.3 $\mathbf { S A V i + + }$ enables emergent segmentation on real-world driving data
127
+
128
+ In the previous section, we found that solely using depth as a training target can be sufficient to learn emergent object segmentation and tracking. This finding provides a strong motivation for scaling this class of methods to real-world data, where the availability of optical flow relies on approximate and potentially inaccurate flow estimation methods, whereas depth can be accurately measured using technologies like LiDAR. To investigate this possibility, we use the Waymo Open dataset [47], which includes videos obtained from cameras mounted on cars in various traffic environments.
129
+
130
+ Setup To obtain a depth signal, we project 3D LiDAR points into the camera frame, resulting in a very sparse depth image for each time step (see Figure 3b for examples). We exclude pixels that do not have a valid LiDAR point when computing the L2 loss in image space. We train $\mathrm { S A V _ { i + + } }$ with 11 slots on 6 frames and evaluate the model on sequences of 10 frames. Due to the absence of ground-truth segmentation labels in Waymo Open, we quantitatively measure performance compared to ground-truth bounding boxes using three metrics. The Center-of-Mass (CoM) distance measures the average Euclidean distance between the centroid of the predicted segmentation masks and the centers of the ground-truth bounding boxes. We report the centroid distance normalized by the maximum achievable distance in the video frame. Additionally, we separately measure the fraction of cases where any sort of segment is predicted when a valid ground-truth box exists, denoted as bounding box recall (B. Recall). The Bounding Box mIoU (B. mIoU) is analog to mIoU using predicted and ground-truth bounding boxes. The former are obtained by training a readout MLP to predict bounding boxes from the slot representations. See appendix for further details.
131
+
132
+ ![](images/5d742316fb224c9b63fbba8ec8a973056332f42027856c41af94de6d1bcc2b17.jpg)
133
+ Figure 6: Waymo Open qualitative results of $\mathrm { S A V _ { i + + } }$ (conditional) over long sequences.
134
+
135
+ Baselines We quantitatively compare to the subset of previous baselines that work with (sparse) depth. Further, we report qualitative results for $\mathrm { S A V _ { i + + } }$ in the unconditional setting, i.e. without providing first-frame bounding boxes to the model to initialize slots, and compare to SIMONe [24] as a representative object-centric video model baseline from the literature.
136
+
137
+ Results Quantitative results can be seen in Table 2 and qualitative results in Figures 5–6. We find that $\mathrm { S A V _ { i + + } }$ markedly outperforms the BBox copy and propagation baselines, as well as the clustering baseline in terms of object tracking. Further, the bounding box recall is high indicating that valid objects are rarely ignored. The qualitative results in Figures 5–6 even better reflect the significance of $\mathrm { S A V _ { i } + + }$ ’s performance as well as its potential utility for object-centric representation learning from real-world videos (for $\mathrm { S A V i { + } { + } }$ results divided per object category see appendix).
138
+
139
+ Our results using sparse depth targets suggest that $\mathrm { S A V _ { 1 ^ { + + } } }$ does not need complete (i.e. dense) depth supervision. To investigate how accurate this signal needs to be, we explored the degree of sensitivity of $\mathrm { S A V i + + }$ to noise in the depth signal. We trained $\mathrm { S A V _ { i + + } }$ with noisy depth targets by applying additive Gaussian noise to the ground-truth sparse LiDAR depth signals with standard deviations of $1 0 \mathrm { c m }$ , $2 0 \mathrm { c m }$ and $4 0 \mathrm { c m }$ . We found that $\mathrm { S A V i + + }$ was able to retain its emergent tracking performance even at the highest considered noise scale of $4 0 \mathrm { c m }$ (see Table 3 in appendix).
140
+
141
+ We additionally experimented with removing the bounding box conditioning in $\mathrm { S A V _ { 1 ^ { + + } } }$ in the initial frame. Removing this conditioning signal and using a learned initialization together with a simplified encoder also yielded good object decompositions (see $\mathrm { S A V _ { i + + } }$ (unconditional) in Figure 5). Compared to using plain SIMONe [24], we observe that $\mathrm { S A V i { + } { + } }$ (unconditional) performs markedly better. Interestingly, modifying the non-autoregressive SIMONe baseline similar to $\mathrm { S A V i { + } { + } }$ by predicting sparse depth instead of RGB also showed improvement in object emergence. This gives further evidence that using depth is suitable for learning object-centric representations from real videos. Quantitatively, $\mathrm { S A V _ { i + + } }$ achieves a CoM distance of $6 . 9 \pm 0 . 5$ while SIMONe (with depth loss)
142
+
143
+ Table 2: Waymo Open results (mean $\pm$ standard error in $\%$ , 3 seeds) from evaluating models on sequences of 10 frames. $\mathrm { S A V _ { i + + } }$ HR is a variant trained on higher-resolution $2 5 6 \times 3 8 4 )$ video frames.
144
+
145
+ <table><tr><td></td><td colspan="3">(%)</td></tr><tr><td>Model</td><td>CoM↓</td><td>B.mIoU个</td><td>B. Recall 个</td></tr><tr><td>BBox Copy</td><td>5.0</td><td>44.3</td><td>100</td></tr><tr><td>BBox Prop.</td><td>5.1±0.1</td><td>38.5±0.5</td><td>100</td></tr><tr><td>K-Means (depth)</td><td>13.0±0.1</td><td>1</td><td>100</td></tr><tr><td>SAVi (RGB)</td><td>21.5 ± 1.8</td><td>7.9± 0.9</td><td>95.8± 2.7</td></tr><tr><td>SAVi (depth)</td><td>24.7 ± 0.7</td><td>10.3± 2.4</td><td>97.4±0.6</td></tr><tr><td>SAVi++</td><td>4.4±0.2</td><td>49.7± 0.7</td><td>96.5± 0.7</td></tr><tr><td>SAVi++ HR</td><td>3.9±0.1</td><td>51.9± 0.4</td><td>96.2 ± 0.4</td></tr><tr><td>Supervised</td><td>1.1±0.0</td><td>67.6± 0.6</td><td></td></tr></table>
146
+
147
+ achieves $7 . 4 \pm 0 . 2$ over a sequence of 12 frames at test time, evaluated using Hungarian matching.
148
+
149
+ We show qualitative results for longer sequences in Figure 6 and in video-format in the supplementary material. It is worth noting that $\mathrm { S A V _ { 1 ^ { + + } } }$ was only trained on 6 frames and did not receive any tracking supervision. Interestingly, we find that objects are often consistently tracked until the moment they leave the scene. At this stage, slots are freed up again and tend to bind to previously unexplained or new objects. This behaviour indicates that our reported tracking metrics are an underestimation of the capabilities of the model, as such re-binding is not accounted for. It is, however, conceivable that re-binding events could be identified post-hoc if one were to use the representations learned by $\mathrm { S A V _ { 1 ^ { + + } } }$ for downstream tasks, which is an interesting avenue for future work.
150
+
151
+ # 4.4 Limitations
152
+
153
+ With $\mathrm { S A V i { + } { + } }$ , we demonstrated the first proof of concept that an emergent object-centric decomposition of real-world complex videos is possible with an end-to-end slot-based approach. Yet, there is still a lot of room for improvement.
154
+
155
+ Reliance on conditioning We focused our exploration on the conditional setup where we provided cues in the form of bounding boxes of objects in the first frame. Although the use of such “object hints” may share some similarity to how human visual attention (and how humans parse a visual scene) can be directed via external signals (e.g., via gestures such as pointing), it ultimately limits the practical applicability of our approach. Preliminary results with unconditional $\mathrm { S A V _ { i + + } }$ suggest that this information may not be strictly necessary and could be removed in future research.
156
+
157
+ Reliance on ground-truth target signals In a similar vein, the reliance of $\mathrm { S A V _ { 1 ^ { + + } } }$ on ground-truth target signals for training is a limitation that may affect its practical applicability. Fortunately, LiDAR sensors for depth estimation are readily available in many application domains (such as in robotics and self-driving), and there is also a rich literature on monocular depth estimation. While estimated, depth (or flow) are expected to be noisier compared to the signals considered in our experiments, our experiment with “noisy depth” offers an initial sign that this may not affect performance much.
158
+
159
+ Gap to videos recorded in the wild It is also important to point out that although Waymo Open offers a challenging real-world benchmark for learning about objects, its videos are relatively structured compared to real-world videos recorded “in the wild”, and especially heavy on cars, roads, traffic signs, pedestrians, etc. Other datasets, such as DAVIS [41] or Kinetics [28] offer greater complexity in that regard and it is foreseeable that further development of $\mathrm { S A V _ { i + + } }$ will be needed to truly support these. An example of this is that objects in Waymo Open usually do not re-appear, which is an aspect that is currently not explicitly modeled in $\mathrm { S A V _ { i + + } }$ (e.g. to ensure that the same object is re-captured by the same slot). More generally, there is substantial headroom to improve the modeling of disappearing and reappearing objects in future work, such as by explicitly modeling object presence [33], or by explicitly attending to past latent states [58].
160
+
161
+ Gap to supervised approaches Finally, we note how both in the conditional and the unconditional setting, the segmentation and tracking performance, though impressive given the minimal amount of supervision the model receives, still qualitatively lags behind supervised approaches. Improving on the temporal consistency of object tracks, especially in the unconditional setting, is another promising direction for future work.
162
+
163
+ # 5 Conclusion
164
+
165
+ We demonstrate that object tracking and segmentation can emerge from utilizing information about scene geometry in the form of depth signals in complex video data with slot-based neural architectures. We utilize a series of synthetic multi-object video benchmarks with increasing complexity to find a simple yet effective set of changes to an existing state-of-the-art object-centric video model (SAVi), allowing us to bridge the gap from synthetic to complex real-world driving videos.
166
+
167
+ Our work marks a first step towards building end-to-end trainable systems that learn to perceive the world in an object-centric, decomposed fashion without relying on detailed human supervision. While many open challenges remain, this result evidences that object-centric deep neural networks are not inherently limited to simple synthetic environments, and we are excited about the potential for this class of methods to radically reduce the need for human supervision in building scalable perceptual systems for the real world.
168
+
169
+ # 6 Acknowledgements
170
+
171
+ We would like to thank Ben Caine, Alex Bewley and Pei Sun for assistance with self-driving data. We are grateful to Jie Tan, Daniel Keysers, David Fleet, Matthias Minderer, Mehdi Sajjadi and Mario Luciˇ c for general advice and feedback. ´
172
+
173
+ References
174
+ [1] Zhipeng Bao, Pavel Tokmakov, Allan Jabri, Yu-Xiong Wang, Adrien Gaidon, and Martial Hebert. Discovering objects that can move. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
175
+ [2] Daniel M Bear, Chaofei Fan, Damian Mrowca, Yunzhu Li, Seth Alter, Aran Nayebi, Jeremy Schwartz, Li Fei-Fei, Jiajun Wu, Joshua B Tenenbaum, et al. Learning physical graph representations from visual scenes. In Advances in Neural Information Processing Systems, 2020.
176
+ [3] Thomas Brox and Jitendra Malik. Object segmentation by long term analysis of point trajectories. In European Conference on Computer Vision, pages 282–295. Springer, 2010.
177
+ [4] Christopher P Burgess, Loic Matthey, Nicholas Watters, Rishabh Kabra, Irina Higgins, Matt Botvinick, and Alexander Lerchner. MONet: Unsupervised scene decomposition and representation. arXiv preprint arXiv:1901.11390, 2019.
178
+ [5] Sergi Caelles, Jordi Pont-Tuset, Federico Perazzi, Alberto Montes, Kevis-Kokitsi Maninis, and Luc Van Gool. The 2019 DAVIS challenge on vos: Unsupervised multi-object segmentation. arXiv preprint arXiv:1905.00737, 2019.
179
+ [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.
180
+ [7] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European Conference on Computer Vision, pages 213–229. Springer, 2020.
181
+ [8] 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.
182
+ [9] J. Driver, P. McLeod, and Z. Dienes. Motion coherence and conjunction search: Implications for guided search theory. Perception and Psychophysics, 51:79–85, 1992.
183
+ [10] J. T. Enns and R. A. Rensink. Influence of scene-based properties on visual search. Science, 247:721–723, 1990.
184
+ [11] J. T. Enns and R. A. Rensink. Sensitivity to three-dimensional orientation in visual search. Psychological Science, 1(5):323–326, 1990.
185
+ [12] Huan Fu, Mingming Gong, Chaohui Wang, Kayhan Batmanghelich, and Dacheng Tao. Deep ordinal regression network for monocular depth estimation. In CVPR, June 2018.
186
+ [13] Klaus Greff, Sjoerd van Steenkiste, and Jürgen Schmidhuber. Neural expectation maximization. In Advances in Neural Information Processing Systems, pages 6691–6701, 2017.
187
+ [14] Klaus Greff, Raphaël Lopez Kaufman, Rishabh Kabra, Nick Watters, Christopher Burgess, Daniel Zoran, Loic Matthey, Matthew Botvinick, and Alexander Lerchner. Multi-object representation learning with iterative variational inference. In International Conference on Machine Learning, pages 2424–2433, 2019.
188
+ [15] Klaus Greff, Sjoerd van Steenkiste, and Jürgen Schmidhuber. On the binding problem in artificial neural networks. arXiv preprint arXiv:2012.05208, 2020.
189
+ [16] Klaus Greff, Francois Belletti, Lucas Beyer, Carl Doersch, Yilun Du, Daniel Duckworth, David J Fleet, Dan Gnanapragasam, Florian Golemo, Charles Herrmann, Thomas Kipf, Abhijit Kundu, Dmitry Lagun, Issam Laradji, Hsueh-Ti (Derek) Liu, Henning Meyer, Yishu Miao, Derek Nowrouzezahrai, Cengiz Oztireli, Etienne Pot, Noha Radwan, Daniel Rebain, Sara Sabour, Mehdi S. M. Sajjadi, Matan Sela, Vincent Sitzmann, Austin Stone, Deqing Sun, Suhani Vora, Ziyu Wang, Tianhao Wu, Kwang Moo Yi, Fangcheng Zhong, and Andrea Tagliasacchi. Kubric: a scalable dataset generator. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
190
+ [17] Adam W Harley, Yiming Zuo, Jing Wen, Ayush Mangal, Shubhankar Potdar, Ritwick Chaudhry, and Katerina Fragkiadaki. Track, check, repeat: An EM approach to unsupervised tracking. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
191
+ [18] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016.
192
+ [19] Olivier J Hénaff, Skanda Koppula, Evan Shelhamer, Daniel Zoran, Andrew Jaegle, Andrew Zisserman, João Carreira, and Relja Arandjelovic. Object discovery and representation networks. ´ arXiv preprint arXiv:2203.08777, 2022.
193
+ [20] Todd S Horowitz, Jeremy M Wolfe, Jennifer S DiMase, and Sarah B Klieger. Visual search for type of motion is based on simple motion primitives. Perception, 36(11):1624–1634, 2007.
194
+ [21] Lawrence Hubert and Phipps Arabie. Comparing partitions. Journal of Classification, 2(1):193–218, 1985.
195
+ [22] Allan Jabri, Andrew Owens, and Alexei A Efros. Space-time correspondence as a contrastive random walk. In Advances in Neural Information Processing Systems, 2020.
196
+ [23] Jindong Jiang, Sepehr Janghorbani, Gerard de Melo, and Sungjin Ahn. SCALOR: Generative world models with scalable object representations. In International Conference on Learning Representations, 2020.
197
+ [24] Rishabh Kabra, Daniel Zoran, Loic Matthey Goker Erdogan, Antonia Creswell, Matthew Botvinick, Alexander Lerchner, and Christopher P. Burgess. SIMONe: View-invariant, temporally-abstracted object representations via unsupervised video decomposition. In Advances in Neural Information Processing Systems, 2021.
198
+ [25] Daniel Kahneman, Anne Treisman, and Brian J Gibbs. The reviewing of object files: Object-specific integration of information. Cognitive psychology, 24(2):175–219, 1992.
199
+ [26] Aishwarya Kamath, Mannat Singh, Yann LeCun, Ishan Misra, Gabriel Synnaeve, and Nicolas Carion. MDETR – Modulated Detection for End-to-End Multi-Modal Understanding. arXiv preprint arXiv:2104.12763, 2021.
200
+ [27] Laurynas Karazija, Iro Laina, and Christian Rupprecht. ClevrTex: A texture-rich benchmark for unsupervised multi-object segmentation. In NeurIPS Track on Datasets and Benchmarks, 2021.
201
+ [28] Will Kay, Joao Carreira, Karen Simonyan, Brian Zhang, Chloe Hillier, Sudheendra Vijayanarasimhan, Fabio Viola, Tim Green, Trevor Back, Paul Natsev, et al. The kinetics human action video dataset. arXiv preprint arXiv:1705.06950, 2017.
202
+ [29] Diederik P Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
203
+ [30] Thomas Kipf, Elise van der Pol, and Max Welling. Contrastive learning of structured world models. In International Conference on Learning Representations, 2020.
204
+ [31] Thomas Kipf, Gamaleldin F Elsayed, Aravindh Mahendran, Austin Stone, Sara Sabour, Georg Heigold, Rico Jonschkowski, Alexey Dosovitskiy, and Klaus Greff. Conditional object-centric learning from video. In International Conference on Learning Representations, 2022.
205
+ [32] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (BiT): General visual representation learning. In European Conference on Computer Vision, pages 491–507. Springer, 2020.
206
+ [33] Adam Kosiorek, Hyunjik Kim, Yee Whye Teh, and Ingmar Posner. Sequential attend, infer, repeat: Generative modelling of moving objects. In Advances in Neural Information Processing Systems, pages 8606–8616, 2018.
207
+ [34] Hamid Laga, Laurent Valentin Jospin, Farid Boussaid, and Mohammed Bennamoun. A survey on deep learning techniques for stereo-based depth estimation. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020.
208
+ [35] Brenden M Lake, Tomer D Ullman, Joshua B Tenenbaum, and Samuel J Gershman. Building machines that learn and think like people. Behavioral and brain sciences, 40, 2017.
209
+ [36] Francesco Locatello, Dirk Weissenborn, Thomas Unterthiner, Aravindh Mahendran, Georg Heigold, Jakob Uszkoreit, Alexey Dosovitskiy, and Thomas Kipf. Object-centric learning with slot attention. In Advances in Neural Information Processing Systems, 2020.
210
+ [37] Sindy Löwe, Klaus Greff, Rico Jonschkowski, Alexey Dosovitskiy, and Thomas Kipf. Learning objectcentric video models by contrasting sets. arXiv preprint arXiv:2011.10287, 2020.
211
+ [38] Yue Ming, Xuyang Meng, Chunxiao Fan, and Hui Yu. Deep learning for monocular depth estimation: A review. Neurocomputing, 2021.
212
+ [39] K. Nakayama and G. H. Silverman. Serial and parallel processing of visual feature conjunctions. Nature, 320:264–265, 1986.
213
+ [40] Peter Ochs and Thomas Brox. Object segmentation in video: a hierarchical variational approach for turning point trajectories into dense regions. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2011.
214
+ [41] Federico Perazzi, Jordi Pont-Tuset, Brian McWilliams, Luc Van Gool, Markus Gross, and Alexander Sorkine-Hornung. A benchmark dataset and evaluation methodology for video object segmentation. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 724–732, 2016.
215
+ [42] William M Rand. Objective criteria for the evaluation of clustering methods. Journal of the American Statistical Association, 66(336):846–850, 1971.
216
+ [43] René Ranftl, Alexey Bochkovskiy, and Vladlen Koltun. Vision transformers for dense prediction. In ICCV, October 2021.
217
+ [44] Bernhard Schölkopf, Francesco Locatello, Stefan Bauer, Nan Rosemary Ke, Nal Kalchbrenner, Anirudh Goyal, and Yoshua Bengio. Toward causal representation learning. Proceedings of the IEEE, 109(5): 612–634, 2021.
218
+ [45] E. S. Spelke. Principles of object perception. Cognitive Science, 14:29–56, 1990.
219
+ [46] Elizabeth S Spelke and Katherine D Kinzler. Core knowledge. Developmental science, 10(1):89–96, 2007.
220
+ [47] Pei Sun, Henrik Kretzschmar, Xerxes Dotiwalla, Aurelien Chouard, Vijaysai Patnaik, Paul Tsui, James Guo, Yin Zhou, Yuning Chai, Benjamin Caine, et al. Scalability in perception for autonomous driving: Waymo open dataset. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2020.
221
+ [48] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In CVPR, pages 1–9, 2015.
222
+ [49] Hao Tian, Yuntao Chen, Jifeng Dai, Zhaoxiang Zhang, and Xizhou Zhu. Unsupervised object detection with lidar clues. In IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2021.
223
+ [50] Sjoerd van Steenkiste, Michael Chang, Klaus Greff, and Jürgen Schmidhuber. Relational neural expectation maximization: Unsupervised discovery of objects and their interactions. In International Conference on Learning Representations, 2018.
224
+ [51] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, pages 5998–6008, 2017.
225
+ [52] Rishi Veerapaneni, John D Co-Reyes, Michael Chang, Michael Janner, Chelsea Finn, Jiajun Wu, Joshua Tenenbaum, and Sergey Levine. Entity abstraction in visual model-based reinforcement learning. In Conference on Robot Learning, pages 1439–1456, 2020.
226
+ [53] Antonin Vobecky, David Hurych, Oriane Siméoni, Spyros Gidaris, Andrei Bursuc, Patrick Pérez, and Josef Sivic. Drive&segment: Unsupervised semantic segmentation of urban scenes via cross-modal distillation. arXiv preprint arXiv:2203.11160, 2022.
227
+ [54] Lijun Wang, Jianming Zhang, Oliver Wang, Zhe Lin, and Huchuan Lu. SDC-depth: Semantic divide-andconquer network for monocular depth estimation. In CVPR, 2020.
228
+ [55] Yuxin Wu and Kaiming He. Group normalization. In European Conference on Computer Vision (ECCV), pages 3–19, 2018.
229
+ [56] Jiarui Xu, Shalini De Mello, Sifei Liu, Wonmin Byeon, Thomas Breuel, Jan Kautz, and Xiaolong Wang. Groupvit: Semantic segmentation emerges from text supervision. arXiv preprint arXiv:2202.11094, 2022.
230
+ [57] Charig Yang, Hala Lamdouar, Erika Lu, Andrew Zisserman, and Weidi Xie. Self-supervised video object segmentation by motion grouping. In Proceedings of the IEEE International Conference on Computer Vision, 2021.
231
+
232
+ [58] Yi Zhou, Hui Zhang, Hana Lee, Shuyang Sun, Pingjun Li, Yangguang Zhu, ByungIn Yoo, Xiaojuan Qi, and Jae-Joon Han. Slot-vps: Object-centric representation learning for video panoptic segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 3093–3103, 2022.
233
+
234
+ [59] Daniel Zoran, Rishabh Kabra, Alexander Lerchner, and Danilo J Rezende. Parts: Unsupervised segmentation with slots, attention and independence maximization. In Proceedings of the IEEE International Conference on Computer Vision, pages 10439–10447, 2021.
235
+
236
+ # Checklist
237
+
238
+ 1. For all authors...
239
+
240
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
241
+ (b) Did you describe the limitations of your work? [Yes] See Limitations section.
242
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] Yes, see Societal Impact section in appendix.
243
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
244
+
245
+ 2. If you are including theoretical results...
246
+
247
+ (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]
248
+
249
+ 3. If you ran experiments...
250
+
251
+ (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] Instructions to reproduce experiments are included in the main text and appendix sections. For our code release, see our project website at https://slot-attention-video.github.io/savi $+ + /$ We only used publicly available datasets.
252
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Please see experimental section and appendix.
253
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
254
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] Please see experimental section and appendix.
255
+
256
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
257
+
258
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
259
+ (b) Did you mention the license of the assets? [Yes]
260
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A]
261
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
262
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] We use publicly available data. For Waymo Open all faces and license plates are blurred and made unrecognizable by default.
263
+
264
+ 5. If you used crowdsourcing or conducted research with human subjects...
265
+
266
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
267
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
268
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/fwzUgo0FM9v/fwzUgo0FM9v.md ADDED
@@ -0,0 +1,476 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ROBBING THE FED: DIRECTLY OBTAINING PRIVATE DATA IN FEDERATED LEARNING WITH MODIFIED MODELS
2
+
3
+ Liam Fowl∗ Department of Mathematics University of Maryland
4
+
5
+ Jonas Geiping∗ Department of Computer Science University of Maryland
6
+
7
+ Wojtek Czaja Department of Mathematics University of Maryland
8
+
9
+ Micah Goldblum Center for Data Science New York University
10
+
11
+ Tom Goldstein Department of Computer Science University of Maryland
12
+
13
+ # ABSTRACT
14
+
15
+ Federated learning has quickly gained popularity with its promises of increased user privacy and efficiency. Previous works have shown that federated gradient updates contain information that can be used to approximately recover user data in some situations. These previous attacks on user privacy have been limited in scope and do not scale to gradient updates aggregated over even a handful of data points, leaving some to conclude that data privacy is still intact for realistic training regimes. In this work, we introduce a new threat model based on minimal but malicious modifications of the shared model architecture which enable the server to directly obtain a verbatim copy of user data from gradient updates without solving difficult inverse problems. Even user data aggregated over large batches – where previous methods fail to extract meaningful content – can be reconstructed by these minimally modified models.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ Federated learning (Konecnˇ y et al., 2015), also known as collaborative learning (Shokri & ´ Shmatikov, 2015), is a mechanism for training machine learning models in a distributed fashion on multiple user devices. In the simplest setting, a central server sends out model states to a group of users, who compute an update to the model based on their local data. These updates are then returned to the server, aggregated, and used to train the model. Over multiple rounds, this protocol can train a machine learning model, distributed over all users, without exchanging local data – only model updates are exchanged. Two central goals of federated learning are to improve training efficiency by decreasing communication overhead and to side-step issues of user-level privacy and data access rights that have become a focus of public attention in recent years (Veale et al., 2018).
20
+
21
+ Accordingly, many organizations, ranging from large tech companies (McMahan & Ramage, 2017) to medical institutions with especially strict privacy laws, such as hospitals (Jochems et al., 2016), have utilized federated learning to train machine learning models. However, in practice, data privacy is not guaranteed in general, but is dependent on a large number of interdependent settings and design choices specific to each federated learning system. In this work, we focus on the user perspective of privacy, and we study federated learning systems in which the central server is not able to directly view user data.
22
+
23
+ The key privacy concern for users is whether model updates reveal too much about the data on which they were calculated. Although Kairouz et al. (2021) discuss that “model updates are more focused on the learning task at hand than is the raw data (i.e. they contain strictly no additional information about the user, and typically significantly less, compared to the raw data)”, scenarios can be constructed in which the model updates themselves can be inverted to recover their input user information (Wang et al., 2018; Melis et al., 2018). Simple knowledge of the shared model state and model update can be sufficient for such an attack (Zhu et al., 2019; Geiping et al., 2020). These inversion attacks are particularly fruitful if a user’s model update is based on a single data point or only a small batch. Accordingly, a strong defense against these attacks is aggregation. The user only reports model updates aggregated over a significant number of local data points, and data from multiple users can be combined with secure aggregation protocols (Bonawitz et al., 2017) before being passed to the server. This ability to aggregate user updates while maintaining their utility is thought to be the main source of security in federated learning. Averaging raw local data in similar amounts would make it unusable for training, but model updates can be effectively aggregated.
24
+
25
+ Previous inversion attacks typically focus on a threat model in which the server (server here is a stand-in for any party with root access to the server or its incoming and outgoing communication) is interested in uncovering user information by examining updates, but without modifying the federated learning protocol, a behavior also referred to as honest-but-curious or semi-honest (Goldreich, 2009). In our case, where the party intending to recover user data is the server, this “honest” scenario appears contrived, as the server can modify its behavior to obtain private information. In this work, we are thus interested in explicitly malicious servers that may modify the model architecture and model parameters sent to the user.
26
+
27
+ We focus on scenarios in which an agent obtains data without making suspicious changes to the client code or learning behavior. One scenario which enables this threat model involves recently introduced APIs that allow organizations to train their own models using established federated learning protocols (Cason, 2020). In this environment, a malicious API participant can change their model’s architecture and parameters but cannot force unsuspecting edge devices to send user data directly.
28
+
29
+ We introduce minimal changes to model architectures that enable servers to breach user privacy, even in the face of large aggregations that have been previously deemed secure. These changes induce a structured pattern in the model update, where parts of the update contain information only about a fixed subset of data points. The constituent data points can then be recovered exactly, while evading existing aggregation defenses. For architectures that already contain large linear layers, the attack even works directly, modifying only the parameters of these layers.
30
+
31
+ # 2 LIMITATIONS OF EXISTING ATTACK STRATEGIES
32
+
33
+ A range of possible attacks against privacy in federated learning have been proposed in recent literature. In the simplest case of analytic attacks, Phong et al. (2017b) were among the first to discuss that the input to a learnable affine function can be directly computed from the gradient of its weights and bias, and additional analysis of this case can be found in Qian & Hansen (2020); Fan et al. (2020), and in Section 3.2. However, analytic recovery of this kind only succeeds for a single data point. For multiple data points, only the average of their inputs can be recovered, leading the attack to fail in most realistic scenarios.
34
+
35
+ Recursive attacks as proposed in Zhu & Blaschko (2021) can extend analytic attacks to models with more than only linear layers - a construction also mentioned in Fan et al. (2020). However, these attacks still recover only the average of inputs in the best case. Improvements in Pan et al. (2020) transform linear layers with ReLU activations into systems of linear equations that allow for a degree of recovery for batched inputs to these linear layers, although preceding convolutional layers still have to be deconvolved by recursion or numerical inversion techniques.
36
+
37
+ Surprisingly, optimization-based attacks turn out to be highly effective in inverting model updates. Wang et al. (2018) propose the direct recovery of input information in a setting where the users’ model update is the model parameter gradient averaged over local data. In a supervised learning setting, we define this update by $g$ and the loss function over this model by $\mathcal { L }$ with model parameters $\theta$ and data points $( x , y ) \in [ 0 , 1 ] ^ { n } \times \mathbb { R } ^ { m }$ . The server can then attempt recovery by solving the gradient matching problem of
38
+
39
+ $$
40
+ \operatorname* { m i n } _ { x \in [ 0 , 1 ] ^ { n } } | | \nabla _ { \theta } \mathcal { L } ( x , y , \theta ) - g | | ^ { 2 }
41
+ $$
42
+
43
+ and solve this optimization objective using first-order methods or any nonlinear equation solver. Subsequent work in Zhu et al. (2019); Zhao et al. (2020) and Wainakh et al. (2021) proposes solutions that also handle recovery of targets $y$ and variants of this objective are solved for example in Geiping et al. (2020) with cosine similarity and improved optimization and in Jeon et al. (2021)
44
+
45
+ with additional generative image priors. Reconstruction of input images can be further boosted by additional regularizers as in Yin et al. (2021) and Qian et al. (2021).
46
+
47
+ Most attacks in the literature focus on the described fedSGD setting (Konecnˇ y et al., 2015) in which ´ the users return gradient information to the server, but numerical attacks can also be performed against local updates with multiple local steps Geiping et al. (2020), for example against fedAVG (McMahan et al., 2017). In this work, we will discuss both update schemes, noting that gradient aggregation in “time”, with multiple local update steps, is not fundamentally more secure than aggregation over multiple data points. Previous attacks also focus significantly on learning scenarios where the user data is comprised of images. This is an advantage to the attacker, given that image data is highly structured, and a multitude of image priors are known and can be employed to improve reconstruction. In contrast, data types with weaker structure, such as tabular data, do not lend themselves to regularization based on strong priors, and we will show that our approach, on the other hand, does not rely on such tricks, and is therefore more data-agnostic.
48
+
49
+ The central limitation of these attack mechanisms is the degradation of attack success when user data is aggregated over even moderately large batches of data (either by the user themselves or by secure aggregation). State-of-the-art attacks such as Yin et al. (2021) recover only $2 8 \%$ of the user data (given a charitable measure of recovery) on a batch size of 48 for a ResNet-50 (He et al., 2015) model on ImageNet (ILSVRC2012 (Russakovsky et al., 2015)) with unlikely label collisions. The rate of images that can be successfully recovered drops drastically with increased batch sizes. Even without label collisions, large networks such as a ResNet-32-10 (Zagoruyko & Komodakis, 2016) leak only a few samples for a batch size of 128 in Geiping et al. (2020). These attacks further reconstruct only approximations to the actual user data which can fail to recover parts of the user data or replace it with likely but unrelated information in the case of strong image priors.
50
+
51
+ Further, although all of the previous works nominally operate under an honest-but-curious server model, they do often contain model adaptations on which reconstruction works especially well, such as large vision models with large gradient vectors, models with many features (Wang et al., 2018; Zhu & Blaschko, 2021), special activation functions (Zhu et al., 2019; Zhu & Blaschko, 2021), wide models (Geiping et al., 2020), or models trained with representation learning (Yin et al., 2021; Chen et al., 2020). These may be seen as malicious models with architectural choices that breach user privacy. In the same vein, we ask, what is the worst-case (but small) modification that can be applied to a neural network to break privacy?
52
+
53
+ # 3 MODEL MODIFICATIONS
54
+
55
+ In this section, we detail an example of a small model modification that has a major effect on user privacy, even allowing for the direct recovery of verbatim user data from model updates.
56
+
57
+ # 3.1 THREAT MODEL
58
+
59
+ We define two parties: the server $s$ and the users $\mathcal { U }$ . The server could be a tech company, a third party app using a federated learning framework on a mobile platform, or an organization like a hospital. The server $S$ defines a model architecture and distributes parameters $\theta$ for this architecture to the users, who compute local updates and return them to the server. The server cannot deviate from standard federated learning protocol in ways beyond changes to model architecture (within limits imposed by common ML frameworks) and model parameters. We measure the strength of a malicious modification of the architecture using the number of additional parameters inserted into the model. While it is clear that models with more parameters can leak more information, we will see that clever attacks can have a disproportionate effect on attack success, compared to more benign increases in parameter count, such as when model width is increased.
60
+
61
+ # 3.2 A SIMPLE EXAMPLE
62
+
63
+ To motivate the introduction of malicious modifications, we start with the simple case of a fully connected layer. A forward pass on this layer is written as $y = W x + b$ where $W$ is a weight matrix, $b$ is a bias, and $x$ is the layer’s input. As seen in Phong et al. (2017a); Qian & Hansen (2020); Fan et al. (2020), when the parameters of the network are updated according to some objective $\mathcal { L }$ , the $i ^ { t h }$
64
+
65
+ row of the update to $W$ :
66
+
67
+ $$
68
+ \nabla _ { W ^ { i } } \mathcal { L } = \frac { \partial \mathcal { L } } { \partial y ^ { i } } \cdot \nabla _ { W ^ { i } } y ^ { i } = \frac { \partial \mathcal { L } } { \partial y ^ { i } } \cdot x ,
69
+ $$
70
+
71
+ where we use the shorthand $\mathcal { L } = \mathcal { L } ( \boldsymbol { x } ; W , b )$ . Similarly,
72
+
73
+ $$
74
+ { \frac { \partial { \mathcal { L } } } { \partial b ^ { i } } } = { \frac { \partial { \mathcal { L } } } { \partial y ^ { i } } } { \frac { \partial y ^ { i } } { \partial b ^ { i } } } = { \frac { \partial { \mathcal { L } } } { \partial y ^ { i } } } .
75
+ $$
76
+
77
+ So as long as there exists some index $i$ with $\textstyle { \frac { \partial { \mathcal { L } } } { \partial b ^ { i } } } \neq 0$ , the single input $x$ is recovered perfectly as:
78
+
79
+ $$
80
+ x = \nabla _ { W ^ { i } } \mathcal { L } \oslash \frac { \partial \mathcal { L } } { \partial b ^ { i } }
81
+ $$
82
+
83
+ where $\oslash$ denotes entry-wise division.
84
+
85
+ computation can only recover However, for batched input $x$ , all derivatives are summed over the batch dimension $\begin{array} { r } { \sum _ { t = 1 } ^ { n } \nabla _ { W _ { l } ^ { i } } \mathcal { L } _ { t } \oslash \sum _ { t = 1 } ^ { n } \frac { \partial \mathcal { L } _ { t } } { \partial b _ { l } ^ { i } } } \end{array}$ 1 ∂Lt∂bi from each row where Pnt=1 ∂Lt∂bi $\begin{array} { r } { \sum _ { t = 1 } ^ { n } \frac { \partial \mathcal { L } _ { t } } { \partial b _ { l } ^ { i } } \neq 0 } \end{array}$ $n$ and the same , which is merely proportional to a linear combination of the $x _ { t }$ ’s. However, data points $x _ { t }$ only appear in the average if $\frac { \partial \mathcal { L } _ { t } } { \partial y _ { t } ^ { i } }$ is non-zero, a phenomenon also discussed in Sun et al. (2021). If $\mathcal { L }$ has a sparse gradient, e.g. in a multinomial logistic regression, then this structured gradient weakens the notion of averaging: Let $x$ be a batch of data with unique labels $1 , \ldots , n$ . In this setting $\begin{array} { r } { \frac { \partial \mathcal { L } _ { t } } { \partial y _ { t } ^ { i } } = 0 } \end{array}$ for all $i \neq t$ , so that each row $i$ actually recovers
86
+
87
+ $$
88
+ x _ { t } = \sum _ { t = 1 } ^ { n } { \frac { \partial { \mathcal { L } } _ { t } } { \partial y _ { t } ^ { i } } } x _ { t } \oslash \sum _ { t = 1 } ^ { n } { \frac { \partial { \mathcal { L } } _ { t } } { \partial y _ { t } ^ { i } } } = { \frac { \partial { \mathcal { L } } _ { t } } { \partial y _ { t } ^ { i } } } x _ { t } \oslash { \frac { \partial { \mathcal { L } } _ { t } } { \partial y _ { t } ^ { i } } } .
89
+ $$
90
+
91
+ For a batch of $n$ data points with unique labels, we could thus recover all data points exactly for this multinomial logistic regression. We visualize this in Appendix Fig. 11 for ImageNet data Russakovsky et al. (2015) (image classification, 1000 classes), where we could technically recover up to 1000 unique data points in the optimal case. However, this setup is impractical and suffers from several significant problems:
92
+
93
+ • Averaging: Multiple image reconstruction as described above is only possible in the linear setting, and with a logistic regression loss, a loss that depends on sparse logits is used. Even in this restrictive setting, reconstruction fails as soon as labels are repeated in a user update (which is the default case and outside the control of the server), especially if the accumulation size of a user update is larger than the underlying label space of the data. In this case, the server reconstructs the average of repeated classes. In Appendix Fig. 11, we see that in the worst-case scenario where all data points fall into the same class, each piece of user data contributes to the gradient equally, resulting in a mashup reconstruction that leaks little private information.
94
+ • Integration: As stated above, the naive reconstruction is only guaranteed to work only if the linear (single-layer) model is a standalone model, and not within a larger network. If the naive linear model was placed before another network, like a ResNet-18, then gradient entries for the linear layer contain elements averaged over all labels, as the combined network ostensibly depends on each output of the linear layer.
95
+ • Scalability: on an industrial scale dataset like ImageNet, the naive logistic regression model would require $> ~ 1 5 0 M$ parameters to retrieve an image from each label, which is of course far from any practical application.
96
+
97
+ # 3.3 IMPRINTING USER INFORMATION INTO MODEL UPDATES
98
+
99
+ Nonetheless, the perfect reconstruction afforded by the linear model remains an attractive feature. To this end, we introduce the imprint module class of modifications which overcome the previously described issues, while maintaining the superior reconstruction abilities of an analytic reconstruction as described above. Further, the imprint module can be constructed from a combination of commonly used architectural features with maliciously modified parameters that can create structured gradient entries for large volumes of data.
100
+
101
+ The imprint module can be constructed with a single linear layer (with bias), together with a ReLU activation. Formally, let $\{ x _ { i } \} _ { i = 1 } ^ { n } = X \in \mathbb { R } ^ { n \times m }$ be a batch of size $n$ of user data, then a malicious server can define an imprint module whose forward pass (on a single datapoint, $x$ ) looks like
102
+
103
+ $$
104
+ M ( x ) = f ( W _ { * } x + b _ { * } ) ,
105
+ $$
106
+
107
+ where $f$ is a standard ReLU nonlinearity. The crux of the imprint module lies in the construction of $W _ { * } \in \dot { \mathbb { R } } ^ { k \times m }$ and $b _ { * } \in \mathbb { R } ^ { k }$ . We denote the $i ^ { t h }$ row (or channel) of $W _ { * }$ and the $i ^ { t h }$ entry of $b _ { * }$ as $W _ { * } ^ { i }$ and $b _ { * } ^ { i }$ , respectively. We then construct $\boldsymbol { W } _ { * } ^ { ( i ) }$ so that
108
+
109
+ $$
110
+ \langle W _ { * } ^ { i } , x \rangle = h ( x ) ,
111
+ $$
112
+
113
+ where $h$ is any linear function of the data where the server can estimate the distribution of values $\{ h ( x ) \} _ { x \sim \mathcal { D } }$ of this function on the user data distribution. For example, if the user data are images, $h$ could be average brightness, in which case $\boldsymbol { W } _ { * } ^ { i }$ is simply the row vector with entries identically equal to $\frac { 1 } { m }$ . In order to define the entries of the bias vector, we assume that the server knows some information about the cumulative density function (CDF), assumed to be continuous for the quantity measured by $h$ . Note this attack does not require the server to know the full distribution of user data, but rather can estimate the distribution of some scalar quantity associated with the user data (a much easier task). In Appendix Fig. 5, we see this can be quite easy for a server, and can even be done with a small amount of surrogate data. We also stress that the choice of $h$ here is not important to our method. For the purpose of explanation, we will assume that the quantity measured by $h$ is distributed normally, with $\mu = 0$ , $\sigma = 1$ . Then, the biases of the imprint module are determined by
114
+
115
+ $$
116
+ b _ { * } ^ { i } = - \Phi ^ { - 1 } ( \frac { i } { k } ) = - c _ { i } ,
117
+ $$
118
+
119
+ where $\Phi ^ { - 1 }$ is the inverse of the standard Gaussian CDF. In plain language, we first measure some quantity, like brightness, with the matrix $W _ { * }$ . We duplicate this measurement along the $k$ channels (rows) of $W _ { * }$ . In the meantime, we create $k$ “bins” for the data corresponding to intervals of equal mass according to the CDF of $h$ . Then, the measurement for a given datapoint will land somewhere in the distribution of $h$ .
120
+
121
+ For example, consider the case when the brightness of some image $x _ { t }$ lands between two values: $c _ { l } \leq h ( x _ { t } ) \leq c _ { l + 1 }$ , and no other image in the same batch has brightness in this range. In this situation, we say that $x _ { t }$ alone activates bin $l$ . Then, if the image $x _ { t }$ is passed through the imprint module, we have
122
+
123
+ $$
124
+ \left( \nabla _ { W _ { * } ^ { l } } \mathcal { L } - \nabla _ { W _ { * } ^ { l + 1 } } \mathcal { L } \right) \mathcal { O } \left( \frac { \partial \mathcal { L } } { \partial b _ { * } ^ { l } } - \frac { \partial \mathcal { L } } { \partial b _ { * } ^ { l + 1 } } \right) = x _ { t } + \sum _ { s = 1 } ^ { p } x _ { i _ { s } } - \sum _ { s = 1 } ^ { p } x _ { i _ { s } } = x _ { t } ,
125
+ $$
126
+
127
+ where images $\{ x _ { i _ { s } } \}$ are images from the batch with brightness $> c _ { l }$ . That is, the difference in successive rows $l , l + 1$ of the gradient entry for $W _ { * }$ correspond to all elements with brightness $c _ { l } \leq h ( x ) \leq c _ { l + 1 }$ (in this case, assumed to be just $x _ { t }$ - see Appendix $\mathbf { B }$ for remark). This is because all of $x _ { t } \cup \{ x _ { i _ { s } } \}$ activate the non-linearity for layer $l$ , since all these images have brightness $\geq c _ { l }$ , however, only images $\{ x _ { s } \}$ have brightness $\geq c _ { l + 1 }$ , so only these images activate the non-linearity for layer $l + 1$ . An interesting biproduct of this setup is that it would be difficult even for hand inspection of the parameters to reveal the inclusion of this module as the server could easily permute the bins, and add random rows to $W _ { * }$ which do not correspond to actual bins and only contribute to model performance. The gradient does not directly contain user data, so that the leak is also difficult to find by analyzing the gradient data and checking for matches with user data therein.
128
+
129
+ How successful will this attack be? Recall the parameter $k$ defined in the construction of the imprint module. This corresponds to the number of bins the malicious server can create to reconstruct user data. If a batch of data is passed through the imprint module, depending on the batch size $n$ used to calculate the update sent to the server, and number of bins, $k$ , the server can expect several bins to activate for only one datapoint. And the corresponding entries of the gradient vector can be appropriately combined, and inverted easily. The following result quantifies the user vulnerability in terms of the number of imprint bins, $k$ , and the amount of data, $n$ , averaged in a given update.
130
+
131
+ Proposition 1. If the server knows the CDF (assumed to be continuous) of some quantity associated with user data that can be measured with a linear function $h : \mathbb { R } ^ { m } \mathbb { R }$ , then for a batch of size $n$ and a number of imprint bins $k > n > 2$ , by using an appropriate combination of linear layer and ReLU activation, the server can expect to exactly recover
132
+
133
+ $$
134
+ \frac { 1 } { \binom { k + n - 1 } { k - 1 } } [ \sum _ { i = 1 } ^ { n - 2 } i \cdot \binom { k } { i } \cdot \binom { \lfloor \frac { n - i } { 2 } \rfloor } { j = 1 } \binom { k - i } { j } \binom { n - i - j - 1 } { j - 1 } ) ] + r ( n , k )
135
+ $$
136
+
137
+ samples of user data (where the data is in $\mathbb { R } ^ { m }$ ) perfectly. Note: $r ( n , k )$ is a correction term (see proof for full expansion).
138
+
139
+ Proof. See Appendix A.1.
140
+
141
+ This can be thought of as a lower bound on privacy breaches since, often, identifiable information can be extracted from a mixture of two images. Note that increasing the expected number of perfectly reconstructed images requires increasing the number of imprint bins, which in turn requires increasing the number of channels of the matrix $W _ { * }$ and thus the number of parameters. Thus, to visualize the result above in terms of the server-side hyperparameter, $k$ , we plot the expected proportion of data recovered as a function of number of bins in Fig. 1(a). Note that this inversion is analytic, and significantly more efficient and realistic than optimization based methods which often require tens of thousands of update steps.
142
+
143
+ ![](images/684b0394352953007520a94100be5c1ec5b36d9b4bcb943bfb107a8c0a75bf61.jpg)
144
+ Figure 1: Left (a): Expected proportion of a batch of 64 images perfectly recovered as a function of number of bins added via an imprint block in front of a ResNet-18 on ImageNet. With only 156 bins, an attacker can expect to recover over $50 \%$ of a batch of user images perfectly. Right (b): Probability of a successful “one-shot” attack on a batch of 4096 images as a function of mass captured in the one-shot bin. An attacker can optimize their bin size given an expected batch size.
145
+
146
+ The imprint module as described can be inserted in any position in any neural network which receives a non-zero gradient signal. To recover the input feature dimension of the module, a second linear layer can be appended, or – if no additional parameters are of interest – the sum of the outputs of the imprint module can be added to the next layer in the network. The binning behavior of the imprint module is independent of the structure of succeeding layers as long as any gradient signal is propagated. This flexibility allows for wide trade-offs between inconspicuousness and effectiveness of the imprint module. The module can be placed in later stages of model whereas an early linear layer might be suspicious to observers (now that they have seen this trick), but depending on the data modality, early linear layers can be a feature of an architecture anyway, in which case there is even no model modification necessary, only parameter changes. The parameter alterations necessary to trigger this vulnerability can furthermore be hidden from inspection until use. The layer can lay “dormant”, functioning and training as a normal linear layer initialized with random activations, as long as the server desires. At any point, a party with access to the server can send out parameter updates containing $W ^ { * } , b ^ { * }$ and trigger the attack.
147
+
148
+ ![](images/e55de9b90bebbe5c0d6b8df3dbf4a02262c99091e5de9a72fc0bc4038353c112.jpg)
149
+ Figure 2: Left: Ground truth batch of 64 user images. Right: Analytic reconstruction for an imprint model with 128 bins in front of a ResNet-18. Gray reconstructions denote bins in which no data point falls.)
150
+
151
+ # 4 EXPERIMENTS
152
+
153
+ In the following section, we provide empirical examples of imprint modules. In all experiments we evaluate ImageNet examples to relate to previous work (Yin et al., 2021), but stress that the approach is entirely data agnostic. Given an aggregated gradient update, we always reconstruct as discussed in Section 3. When, in the case of imprecision due to noise, more candidate data points are extracted than the expected batch size, only the candidates with highest gradient mean per row in $W ^ { * }$ are selected and the rest discarded. For analysis, we then use ground-truth information to order all data points in their original order (as much as possible) and measure PSNR scores as well as Image Identifiability Precision (IIP) scores as described in Yin et al. (2021). For IIP we search for nearest-neighbors in pixel space to evaluate a model-independent distance - a more strict metric compared to IIP as used in Yin et al. (2021). All computations run in single floating point precision.
154
+
155
+ # 4.1 FULL BATCH RECOVERY
156
+
157
+ We begin with a straightforward and realistic case as a selling point for our method - user gradient updates aggregated over a batch of 64 ImageNet images. We modify a ResNet-18 to include an imprint module with 128 bins in front. This relatively vanilla setup presents is a major stumbling block for optimization based techniques. For example, for a much smaller batch size of 8, the prior art in optimization based batched reconstruction achieves only 12.93 average PSNR (Yin et al., 2021). We do of course operate in different threat models (although Yin et al. (2021) also uses non-obvious parameter modifications). However, our imprint method is successfully able to recover almost perfect reconstructions of a majority of user data (see Fig. 2), and achieves an average PSNR of 75.75. We further stress that a batch size of 64 is by no means a limitation of the method. If bins, and hence additional rows in $W ^ { * }$ are added proportionally to the expected batch size, then recovery of significant proportions (see Fig. 1) of batches of arbitrary size – albeit with the incurred cost in additional parameters for each row – is possible. Note that concurrent work, Boenisch et al. (2021) also proposes a method to recover user data from large-batch updates by malicious modifications - operating in the same setting/threat model as our work . However, in a direct comparison, we find that our imprint module presents a much more significant threat to privacy compared to Boenisch et al. (2021) - see Appendix Fig. 21.
158
+
159
+ # 4.2 PRIVACY BREACHES IN INDUSTRIAL-SIZED BATCHES – ONE-SHOT ATTACKS
160
+
161
+ A breach in privacy can occur if even a single piece of user data is compromised. Unfortunately, there is a threatening modification of the imprint module for exactly such an attack. If a server has access to enough users, then it becomes feasible for the server to start fishing for private data among all updates, and attempt to recover a single data point from each incoming batch of data. Attacks of this nature require only as many additional parameters as twice the size of a single piece of targeted user data, as only two bins are needed. For this, $k$ bins are constructed initially, and then all bins are “fused” to create 2 final bins: a one-shot bin containing mass $n / k$ , and the other containing the remaining mass $( n + 1 ) / k$ . For perspective, for a ResNet-18 on ImageNet, this would require only an additional $1 \%$ of parameters - this is tiny compared to potentially massive increases in the number of parameters when no bins were fused, which could raise suspicion under inspection. Further, based on Proposition 1, it is always possible to select an optimal bin size, so that a data point is leaked on average once every four batches of incoming data, no matter how large the batch size. We demonstrate this statistical property by recovering a single image from an aggregated batch of $2 ^ { 1 4 } = 1 6$ , 384 ImageNet images (see Fig. 3). Even though the gradient updates are averaged over a vast number of data points, there can be no perfect privacy, and one data point is leaked in its entirety by only a minor model modification.
162
+
163
+ ![](images/f654dd31508d251b83151bf33386700b41d204ec5a9c4c209173ddc28b406bdf.jpg)
164
+ Figure 3: Left (a): A true user image from class “minibus”. Right (b): The reconstructed image from class “minibus” captured via our one-shot attack from averages aggregated over 16,384 datapoints. The PSNR is 161.36, i.e. a verbatim copy at machine precision. This user could potentially be identified via their recovered license plate, which was blanked out (by us!) to preserve privacy.
165
+
166
+ # 4.3 VARIANTS
167
+
168
+ Flexible placement The imprint module does not depend on its placement within a given model. No matter its position in a network, the incoming input features will be leaked to the server. Furthermore, the server can also change the parameters of preceding layers to represent (near)-identity mappings, allowing for the recovery of raw input data from inconspicuous positions deep in a network. For a convolutional network, we show off this variant in Fig. 14 for a ResNet-18. Here, the model parameters are manipulated to contain identity maps up to the location of the imprint module, while the downsampling operations remain. Even these later layers leak enough information that their inputs can be upsampled to breach privacy of the inputs. We remark that we show a simplified version of this attack here where the first three channels in each layer act as an identity, and all other channels are zero, but the model can also be modified to provide off-set pixels in all other channels, effectively increasing the spatial resolution in any layer proportionally with the number of channels.
169
+
170
+ Multiple local updates: In several federated learning protocols, such as fedAVG, users take several local update steps on data before sending model updates to the server Konecnˇ y et al. (2015). The ´ imprint module is threatening when a large amount of user data is used for a single update step. In this case, the only variable that matters is amount of total data used in the update. That is to say, 10 users sending updates on 100 datapoints each is equivalent (recovery-wise) to a single user sending an update calculated on 1000 datapoints. However, when multiple steps are taken, inverting gradients from pairwise differences (as in Eq. (4)) becomes more difficult, as entries in $W ^ { * }$ shift with local updates. However, an imprint variant that produces sparse gradients per data point is a threat to such federated averaging. Defining a forward pass in this new variant as $\bar { M ^ { \prime } } ( x )$ as $M ^ { \prime } ( x ) = g ( W _ { \ast } x + b _ { \ast } )$ where the non-linearity $g$ is a thresholding function:
171
+
172
+ $$
173
+ g ( t ) = \left\{ { \begin{array} { l l } { 0 } & { t \leq 0 } \\ { t } & { 0 \leq t \leq 1 } \\ { 1 } & { 1 \leq t } \end{array} } \right.
174
+ $$
175
+
176
+ Note this non-linearity can be simply constructed with a combination of two ReLUs, or with an implementation of a Hardtanh. We now define $\boldsymbol { W } _ { * } ^ { i }$ as: $\begin{array} { r } { \langle W _ { * } ^ { i } , x \rangle = \frac { h ( x ) } { \delta _ { i } } } \end{array}$ where $h$ is the a linear function of the data as described before, and the biases are defined as:
177
+
178
+ $$
179
+ b _ { * } ^ { i } = - { \frac { c _ { i } } { \delta _ { i } } } \quad \mathrm { w h e r e } \quad \delta _ { i } = \Phi ^ { - 1 } ( { \frac { i + 1 } { k } } ) - \Phi ^ { - 1 } ( { \frac { i } { k } } ) .
180
+ $$
181
+
182
+ This setup creates sparse bins where inversion is directly possible (without taking pairwise differences) in gradient entries, at the cost of an additional activation layer. Analyzing a local update step with $W _ { * } ^ { i , j }$ as the $i ^ { t h }$ row of $W _ { * }$ at update step $j$ , reveals that
183
+
184
+ $$
185
+ W _ { * } ^ { i , j } = W _ { * } ^ { i , j - 1 } - \alpha \frac { \partial \mathcal { L } } { \partial a ^ { i , j } } x _ { j }
186
+ $$
187
+
188
+ where $x _ { j }$ denotes the data from the previous batch that activated bin $i$ , and $a ^ { i , j }$ denotes the $i ^ { t h }$ activation at step $j$ , and $\alpha$ is the local learning rate. Note that if either a linear layer, or a convolutional layer follows this imprint module, then $\frac { \partial \mathcal { L } } { \partial a ^ { i , j } }$ does not depend on the scale of $W _ { * } ^ { i , j }$ . Therefore, a simple way to increase the effectiveness of the new imprint module, $M ^ { \prime }$ in the fedAVG case is to scale the linear function associated to the rows of $W _ { * }$ - i.e. $h ^ { \prime } ( x ) = c _ { 0 } \cdot h ( x )$ . This “flattens” the distribution of values, and increases the relative size of $b _ { * } ^ { i , j }$ compared to the gradient update $\frac { \partial \mathcal { L } } { \partial a ^ { i , j } }$ , which prevents the bins from shifting too significantly during local updates. As bin shift goes to 0, we recover the situation where the only variable that matters is the total data used in an update.
189
+
190
+ ![](images/fd63da0ef3a437114be88d7143b307239da61cba8833aafd6ecabb691f7372f9.jpg)
191
+ Figure 4: Left: Identification Success vs bin size. Right: Identification Success (via IIP score) vs. bin size and position in a ResNet-18 model. We find that the attack is stable over a range of batch sizes and positions in a model.
192
+
193
+ With this modification, reconstruction quality remains similar to the fedSGD setting. For example, splitting the batch of 64 ImageNet images up into 8 local updates with learning rate $\tau = 1 e - 4$ yields an IIP score of $7 0 . 3 1 \%$ , due to minor image duplications where images hit multiple shifted bins, which we visualize in Appendix Fig. 19.
194
+
195
+ Other data modalities: Yet another advantage to our imprint module over existing optimization based gradient inversion techniques is the flexibility in data domain. Other techniques have demonstrated some success in the image domain by leveraging strong regularizers including total variation (TV), image registration, matching batch norm statistics, and DeepInversion priors (Geiping et al., 2020; Yin et al., 2021). Such strong regularizers do not always exist in other domains of interest, such as text or tabular data. The discussed imprint module, however, is data-agnostic, and while we focus our experiments on the image domain, nowhere do we use any assumptions unique to vision. In fact, linear layers often appear in language models, and tabular data models - cases in which the attacker only needs to modify parameters of an existing model to breach user privacy (Vaswani et al., 2017; Somepalli et al., 2021) without architecture modifications.
196
+
197
+ # 5 POTENTIAL DEFENSE AND MITIGATION STRATEGIES
198
+
199
+ If aggregation is the only source of security in a FL system, then the proposed attack breaks it, uncovering samples of private data from arbitrarily large batches, especially via the One-shot mechanism. In light of this attack, the effectiveness of secure aggregation is reduced to only secure shuffling (Kairouz et al., 2021): When private data is uncovered via the imprint module, based on data that has been securely aggregated, then the data is breached, but is not directly connected to any specific user (aside from possible revealing information in the data itself). A mitigation strategy for users that does not require coordination (or consent) of a central server is to employ local differential privacy (Dwork & Roth, 2013). Adding sufficient gradient noise can be a defense against this attack as the division in Eq. (2) leads to potentially unbounded errors in the scale of the data. Yet, in practice, privacy is often still broken even if the correct scale cannot be determined, so that the amount of noise that has to be added is large. In Appendix Fig. 20, even with $\sigma = 0 . 0 1$ , private data is visibly leaked. Additional discussion on defenses can be found in Appendix A.7
200
+
201
+ # 6 CONCLUSIONS
202
+
203
+ Federated learning offers a promising avenue for training models in a distributed fashion. However, the use of federated learning, even with large scale averaging, does not guarantee user privacy. Using common and inconspicuous machine learning modules, a malicious server can breach user privacy by sending minimally modified models and parameters in a federated setup. We hope that constructing these examples clarifies current limitations and informs discussions on upcoming applications, especially concerning API design.
204
+
205
+ # ETHICS STATEMENT
206
+
207
+ In this work, we uncover an attack on federated learning that has the potential to compromise user privacy. While this method has the potential to be used for malicious purposes, the fundamental purpose of this research is to inform the community about the state of privacy in federated learning, and to help users and technical experts better understand the limitations of federated learning for the purpose of preserving user privacy.
208
+
209
+ # REPRODUCIBILITY STATEMENT
210
+
211
+ We provide additional technical details and the proof Proposition 1 in the appendix. Further, we provide open-source implementations of all attacks investigated in this work. The repository at https://github.com/lhfowl/robbing_the_fed shows a minimalistic implementation of the principles of this attack and the repository at https://github.com/JonasGeiping/ breaching embeds the attack in a larger framework of privacy attacks against federated learning. The experiments in this work require no GPU resources and can be cheaply evaluated on almost any machine with sufficient RAM.
212
+
213
+ # ACKNOWLEDGEMENTS
214
+
215
+ This work was supported by DARPA GARD, the Office and Naval Research, and the National Science Foundation Division of Mathematical Sciences. Addition support was provided by the Sloan Foundation, JP Morgan Chase, and Capital One Bank.
216
+
217
+ # REFERENCES
218
+
219
+ Franziska Boenisch, Adam Dziedzic, Roei Schuster, Ali Shahin Shamsabadi, Ilia Shumailov, and Nicolas Papernot. When the curious abandon honesty: Federated learning is not private. arXiv preprint arXiv:2112.02918, 2021.
220
+
221
+ Kallista Bonawitz, Vladimir Ivanov, Ben Kreuter, Antonio Marcedone, H. Brendan McMahan, Sarvar Patel, Daniel Ramage, Aaron Segal, and Karn Seth. Practical Secure Aggregation for Privacy Preserving Machine Learning. Technical Report 281, 2017. URL http://eprint.iacr. org/2017/281.
222
+
223
+ Patrick Cason. Announcing 4 New Libraries for Federated Learning on Web and Mobile Devices, 2020. https://blog.openmined.org/ announcing-new-libraries-for-fl-on-web-and-mobile/.
224
+
225
+ Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved Baselines with Momentum Contrastive Learning. arXiv:2003.04297 [cs], March 2020. URL http://arxiv.org/abs/ 2003.04297.
226
+
227
+ Cynthia Dwork and Aaron Roth. The Algorithmic Foundations of Differential Privacy. Foundations and Trends® in Theoretical Computer Science, 9(3-4):211–407, 2013. ISSN 1551-305X, 1551- 3068. doi: 10.1561/0400000042.
228
+
229
+ Lixin Fan, Kam Woh Ng, Ce Ju, Tianyu Zhang, Chang Liu, Chee Seng Chan, and Qiang Yang. Rethinking Privacy Preserving Deep Learning: How to Evaluate and Thwart Privacy Attacks. In Federated Learning: Privacy and Incentive, Lecture Notes in Computer Science, pp. 32–50. Springer International Publishing, Cham, 2020. ISBN 978-3-030-63076-8. doi: 10.1007/978-3-030-63076-8 3.
230
+
231
+ Jonas Geiping, Hartmut Bauermeister, Hannah Droge, and Michael Moeller.¨ Inverting Gradients - How easy is it to break privacy in federated learning? In Advances in Neural Information Processing Systems, volume 33, December 2020. URL https://proceedings.neurips.cc//paper_files/paper/2020/hash/ c4ede56bbd98819ae6112b20ac6bf145-Abstract.html.
232
+
233
+ Micah Goldblum, Jonas Geiping, Avi Schwarzschild, Michael Moeller, and Tom Goldstein. Truth or backpropaganda? An empirical investigation of deep learning theory. In Eighth International Conference on Learning Representations (ICLR 2020, Oral Presentation), April 2020. URL https://iclr.cc/virtual_2020/poster_HyxyIgHFvr.html.
234
+
235
+ Oded Goldreich. Foundations of Cryptography: Volume 2, Basic Applications. Cambridge University Press, Cambridge, 1st edition edition, September 2009. ISBN 978-0-521-11991-7.
236
+
237
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep Residual Learning for Image Recognition. arXiv:1512.03385 [cs], December 2015. URL http://arxiv.org/abs/ 1512.03385.
238
+
239
+ Jinggang Huang and David Mumford. Statistics of natural images and models. In Proceedings. 1999 IEEE Computer Society Conference on Computer Vision and Pattern Recognition (Cat. No PR00149), volume 1, pp. 541–547 Vol. 1, June 1999. doi: 10.1109/CVPR.1999.786990.
240
+
241
+ Jinwoo Jeon, Jaechang Kim, Kangwook Lee, Sewoong Oh, and Jungseul Ok. Gradient Inversion with Generative Image Prior. In International Workshop on Federated Learning for User Privacy and Data Confidentiality, pp. 12, 2021.
242
+
243
+ Arthur Jochems, Timo M. Deist, Johan van Soest, Michael Eble, Paul Bulens, Philippe Coucke, Wim Dries, Philippe Lambin, and Andre Dekker. Distributed learning: Developing a predictive model based on data from multiple hospitals without data leaving the hospital – A real life proof of concept. Radiotherapy and Oncology, 121(3):459–467, December 2016. ISSN 0167-8140, 1879-0887. doi: 10.1016/j.radonc.2016.10.002.
244
+
245
+ Peter Kairouz, H. Brendan McMahan, Brendan Avent, Aurelien Bellet, Mehdi Bennis, Arjun Nitin ´ Bhagoji, Kallista Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, Rafael G. L. D’Oliveira, Hubert Eichner, Salim El Rouayheb, David Evans, Josh Gardner, Zachary Garrett, Adria Gasc \` on, Badih Ghazi, Phillip B. Gibbons, Marco Gruteser, Zaid Harchaoui, Chaoyang He, ´ Lie He, Zhouyuan Huo, Ben Hutchinson, Justin Hsu, Martin Jaggi, Tara Javidi, Gauri Joshi, Mikhail Khodak, Jakub Konecnˇ y, Aleksandra Korolova, Farinaz Koushanfar, Sanmi Koyejo, ´ Tancrede Lepoint, Yang Liu, Prateek Mittal, Mehryar Mohri, Richard Nock, Ayfer \` Ozg ¨ ur, Rasmus ¨ Pagh, Mariana Raykova, Hang Qi, Daniel Ramage, Ramesh Raskar, Dawn Song, Weikang Song, Sebastian U. Stich, Ziteng Sun, Ananda Theertha Suresh, Florian Tramer, Praneeth Vepakomma, \` Jianyu Wang, Li Xiong, Zheng Xu, Qiang Yang, Felix X. Yu, Han Yu, and Sen Zhao. Advances and Open Problems in Federated Learning. arXiv:1912.04977 [cs, stat], March 2021. URL http://arxiv.org/abs/1912.04977.
246
+
247
+ Jakub Konecnˇ y, Brendan McMahan, and Daniel Ramage. Federated Optimization:Distributed ´ Optimization Beyond the Datacenter. arXiv:1511.03575 [cs, math], November 2015. URL http://arxiv.org/abs/1511.03575.
248
+
249
+ E.Y. Lam and J.W. Goodman. A mathematical analysis of the DCT coefficient distributions for images. IEEE Transactions on Image Processing, 9(10):1661–1666, October 2000. ISSN 10577149. doi: 10.1109/83.869177.
250
+
251
+ Brendan McMahan and Daniel Ramage. Federated Learning: Collaborative Machine Learning without Centralized Training Data, April 2017. URL http://ai.googleblog.com/2017/ 04/federated-learning-collaborative.html.
252
+
253
+ H. Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera ¨ y Arcas. Communication-Efficient Learning of Deep Networks from Decentralized Data. arXiv:1602.05629 [cs], February 2017. URL http://arxiv.org/abs/1602.05629.
254
+
255
+ Luca Melis, Congzheng Song, Emiliano De Cristofaro, and Vitaly Shmatikov. Exploiting Unintended Feature Leakage in Collaborative Learning. arXiv:1805.04049 [cs], November 2018. URL http://arxiv.org/abs/1805.04049.
256
+
257
+ Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer Sentinel Mixture Models. November 2016. URL https://openreview.net/forum?id $=$ Byj72udxe.
258
+
259
+ Xudong Pan, Mi Zhang, Yifan Yan, Jiaming Zhu, and Min Yang. Theory-Oriented Deep Leakage from Gradients via Linear Equation Solver. arXiv:2010.13356 [cs, stat], October 2020. URL http://arxiv.org/abs/2010.13356.
260
+
261
+ 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.
262
+
263
+ Le Trieu Phong, Yoshinori Aono, Takuya Hayashi, Lihua Wang, and Shiho Moriai. PrivacyPreserving Deep Learning via Additively Homomorphic Encryption. Technical Report 715, 2017a. URL http://eprint.iacr.org/2017/715.
264
+
265
+ Le Trieu Phong, Yoshinori Aono, Takuya Hayashi, Lihua Wang, and Shiho Moriai. PrivacyPreserving Deep Learning: Revisited and Enhanced. In Applications and Techniques in Information Security, Communications in Computer and Information Science, pp. 100–110, Singapore, 2017b. Springer. ISBN 978-981-10-5421-1. doi: 10.1007/978-981-10-5421-1 9.
266
+
267
+ Jia Qian and Lars Kai Hansen. What can we learn from gradients? September 2020. URL https: //openreview.net/forum?id $=$ gQn5xeVtz0I.
268
+
269
+ Jia Qian, Hiba Nassar, and Lars Kai Hansen. Minimal conditions analysis of gradient-based reconstruction in Federated Learning. arXiv:2010.15718 [cs, eess], March 2021. URL http: //arxiv.org/abs/2010.15718.
270
+
271
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language Models are Unsupervised Multitask Learners. pp. 24, 2019.
272
+
273
+ Daniel L. Ruderman. The statistics of natural images. 5(4):517–548, January 1994. ISSN 0954- 898X. doi: 10.1088/0954-898X/5/4/006.
274
+
275
+ 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, 115(3):211–252, December 2015. ISSN 1573-1405. doi: 10.1007/s11263-015-0816-y.
276
+
277
+ Reza Shokri and Vitaly Shmatikov. Privacy-Preserving Deep Learning. In Proceedings of the 22nd ACM SIGSAC Conference on Computer and Communications Security - CCS ’15, pp. 1310–1321, Denver, Colorado, USA, 2015. ACM Press. ISBN 978-1-4503-3832-5. doi: 10.1145/2810103. 2813687.
278
+
279
+ Gowthami Somepalli, Micah Goldblum, Avi Schwarzschild, C Bayan Bruss, and Tom Goldstein. Saint: Improved neural networks for tabular data via row attention and contrastive pre-training. arXiv preprint arXiv:2106.01342, 2021.
280
+
281
+ Jingwei Sun, Ang Li, Binghui Wang, Huanrui Yang, Hai Li, and Yiran Chen. Soteria: Provable Defense Against Privacy Leakage in Federated Learning From Representation Perspective. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9311–9319, 2021. URL https://openaccess.thecvf.com/content/CVPR2021/ html/Sun_Soteria_Provable_Defense_Against_Privacy_Leakage_in_ Federated_Learning_From_CVPR_2021_paper.html.
282
+
283
+ 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.
284
+
285
+ Michael Veale, Reuben Binns, and Lilian Edwards. Algorithms that remember: Model inversion attacks and data protection law. Philosophical Transactions of the Royal Society A: Mathematical, Physical and Engineering Sciences, 376(2133):20180083, November 2018. doi: 10.1098/rsta. 2018.0083.
286
+
287
+ Aidmar Wainakh, Fabrizio Ventola, Till Mußig, Jens Keim, Carlos Garcia Cordero, Ephraim Zim-¨ mer, Tim Grube, Kristian Kersting, and Max Muhlh ¨ auser. User Label Leakage from Gradients ¨ in Federated Learning. arXiv:2105.09369 [cs], June 2021. URL http://arxiv.org/abs/ 2105.09369.
288
+
289
+ Jianyu Wang, Zachary Charles, Zheng Xu, Gauri Joshi, H. Brendan McMahan, Blaise Aguera y Arcas, Maruan Al-Shedivat, Galen Andrew, Salman Avestimehr, Katharine Daly, Deepesh Data, Suhas Diggavi, Hubert Eichner, Advait Gadhikar, Zachary Garrett, Antonious M. Girgis, Filip Hanzely, Andrew Hard, Chaoyang He, Samuel Horvath, Zhouyuan Huo, Alex Ingerman, Martin Jaggi, Tara Javidi, Peter Kairouz, Satyen Kale, Sai Praneeth Karimireddy, Jakub Konecny, Sanmi Koyejo, Tian Li, Luyang Liu, Mehryar Mohri, Hang Qi, Sashank J. Reddi, Peter Richtarik, Karan Singhal, Virginia Smith, Mahdi Soltanolkotabi, Weikang Song, Ananda Theertha Suresh, Sebastian U. Stich, Ameet Talwalkar, Hongyi Wang, Blake Woodworth, Shanshan Wu, Felix X. Yu, Honglin Yuan, Manzil Zaheer, Mi Zhang, Tong Zhang, Chunxiang Zheng, Chen Zhu, and Wennan Zhu. A Field Guide to Federated Optimization. arXiv:2107.06917 [cs], July 2021. URL http://arxiv.org/abs/2107.06917.
290
+
291
+ Zhibo Wang, Mengkai Song, Zhifei Zhang, Yang Song, Qian Wang, and Hairong Qi. Beyond Inferring Class Representatives: User-Level Privacy Leakage From Federated Learning. arXiv:1812.00535 [cs], December 2018. URL http://arxiv.org/abs/1812.00535.
292
+
293
+ Hongxu Yin, Arun Mallya, Arash Vahdat, Jose M. Alvarez, Jan Kautz, and Pavlo Molchanov. See Through Gradients: Image Batch Recovery via GradInversion. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16337–16346, 2021. URL https://openaccess.thecvf.com/content/CVPR2021/html/Yin_See_ Through_Gradients_Image_Batch_Recovery_via_GradInversion_CVPR_ 2021_paper.html.
294
+
295
+ Sergey Zagoruyko and Nikos Komodakis. Wide Residual Networks. arXiv:1605.07146 [cs], May 2016. URL http://arxiv.org/abs/1605.07146.
296
+
297
+ Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The Unreasonable Effectiveness of Deep Features as a Perceptual Metric. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 586– 595, 2018. URL https://openaccess.thecvf.com/content_cvpr_2018/html/ Zhang_The_Unreasonable_Effectiveness_CVPR_2018_paper.html.
298
+
299
+ Bo Zhao, Konda Reddy Mopuri, and Hakan Bilen. iDLG: Improved Deep Leakage from Gradients. arXiv:2001.02610 [cs, stat], January 2020. URL http://arxiv.org/abs/2001.02610.
300
+
301
+ Junyi Zhu and Matthew Blaschko. R-GAP: Recursive Gradient Attack on Privacy. arXiv:2010.07733 [cs], March 2021. URL http://arxiv.org/abs/2010.07733.
302
+
303
+ Ligeng Zhu, Zhijian Liu, and Song Han. Deep Leakage from Gradients. In Advances in Neural Information Processing Systems 32, pp. 14774–14784. Curran Associates, Inc., 2019. URL http: //papers.nips.cc/paper/9617-deep-leakage-from-gradients.pdf.
304
+
305
+ # A APPENDIX
306
+
307
+ # A.1 PROOF OF PROPOSITION 1
308
+
309
+ Proposition. If the server knows the CDF (assumed to be continuous) of some quantity associated with user data that can be measured with a linear function $h : \mathbb { R } ^ { m } \mathbb { R }$ , then for a batch size of $n$ , and a number of imprint bins $k > n > 2$ , by using an appropriate combination of linear layer and ReLU activation, the server can expect to recover
310
+
311
+ $$
312
+ \frac { 1 } { \binom { k + n - 1 } { k - 1 } } [ \sum _ { i = 1 } ^ { n - 2 } i \cdot \binom { k } { i } \cdot \binom { \lfloor \frac { n - i } { 2 } \rfloor } { j = 1 } \binom { k - i } { j } \binom { n - i - j - 1 } { j - 1 } ) ] + r ( n , k )
313
+ $$
314
+
315
+ amount of user data (where the data is in $\mathbb { R } ^ { m }$ ) perfectly. Note: $r ( n , k )$ is a correction term (see proof for expression).
316
+
317
+ Proof. By construction of the imprint module, given a random sample (batch) $X _ { 1 } , \ldots , X _ { n }$ (iid) the server perfectly recovers data whenever an imprint bin has exactly 1 element of the batch. Because we know the CDFs, we can create partitions of equal mass corresponding to imprint bins $\{ b _ { j } \} =$ $\{ [ a _ { j } , b _ { j } ] \}$ where $P ( X _ { i } \in [ a _ { j } , b _ { j } ] ) = 1 / k \forall i , j$ .
318
+
319
+ We can then phrase the problem of expected number of perfectly recovered samples as a modified “stars and bars” problem. For a given batch of data, to calculate the amount of data recovered, we first calculate:
320
+
321
+ $$
322
+ \sum _ { i = 1 } ^ { n } i \cdot { \binom { k } { i } } \cdot N _ { i }
323
+ $$
324
+
325
+ Where $\textstyle { \binom { k } { i } }$ is the number of ways to select the $i$ bins that have exactly 1 element, and $N _ { i }$ is the number of orientations of the remaining data into the remaining bins so that no bin has exactly 1 element. Note that we can do this because the bins all have equal mass, and thus we can factor out the (uniform) probability of any configuration from the sum.
326
+
327
+ Simply put, we first take the configuration where there is only 1 bin with exactly 1 element, and weight it by 1, then we take the number of configurations with 2 bins with exactly 1 element, and weight it by 2, and so on.
328
+
329
+ In order to calculate $N _ { i }$ , we notice that in our construction, once the $i$ bins with exactly 1 element are chosen, every other bin has either 0 or $\geq 2$ elements. We focus on the bins that have $\geq 2$ elements. By a simple “reverse” pigeon hole argument, we can now have at most $\lfloor { \frac { n - i } { 2 } } \rfloor$ of the remaining bins containing any elements, as otherwise, one bin would be guaranteed to contain exactly 1 element.
330
+
331
+ So we further select any $1 \leq j \leq \lfloor { \frac { n - i } { 2 } } \rfloor$ number of the remaining $k - i$ bins all to contain at least 2 elements. Formally, this is equivalent to calculating the number of orientations of integers $\{ x _ { l } \} _ { l = 1 } ^ { j }$ so that
332
+
333
+ $$
334
+ x _ { 1 } + \cdot \cdot \cdot + x _ { j } = n - i
335
+ $$
336
+
337
+ constrained with $x _ { l } \geq 2 \forall l$
338
+
339
+ Now, we make a change of variables to instead calculate the number of orientations of integers
340
+
341
+ $$
342
+ \{ p _ { l } \} _ { l = 1 } ^ { j }
343
+ $$
344
+
345
+ so that
346
+
347
+ $$
348
+ p _ { 1 } + \cdot \cdot \cdot + p _ { j } = n - i - 2 j
349
+ $$
350
+
351
+ constrained with $p _ { l } \geq 0 \forall l$ . Now we just have a “stars and bars” problem with $k ^ { \prime } = j$ bars and $n ^ { \prime } = n - i - 2 j$ stars. This reduces to:
352
+
353
+ $$
354
+ \binom { n - i - j - 1 } { j - 1 }
355
+ $$
356
+
357
+ orientations for the remaining bins with exactly $j$ elements. Once these $i$ bins with 1 element, and $j$ bins with $\geq 2$ elements are chosen, all the other bins are required to have 0 elements.
358
+
359
+ Table 1: Ablation study linear functions and distributions.
360
+
361
+ <table><tr><td>Linear Function</td><td>Assumed Distribution</td><td>MSE</td><td>PSNR</td><td>IIP-Pixel</td></tr><tr><td>Mean</td><td>Normal</td><td>0.0183</td><td>75.75</td><td>65.62%</td></tr><tr><td>Mean</td><td>Laplacian</td><td>0.0174</td><td>79.63</td><td>71.88%</td></tr><tr><td>Cosine</td><td>Laplacian</td><td>0.0167</td><td>99.82</td><td>79.69%</td></tr><tr><td>Random</td><td>Normal</td><td>0.0203</td><td>91.29</td><td>75.00%</td></tr></table>
362
+
363
+ So adding these parts together, we have the expected amount data the server can expect to reconstruct perfectly becomes:
364
+
365
+ $$
366
+ \frac { 1 } { \binom { k + n - 1 } { k - 1 } } \left[ \sum _ { i = 1 } ^ { n - 2 } i \cdot \binom { k } { i } \cdot \left( \sum _ { j = 1 } ^ { \lfloor \frac { n - i } { 2 } \rfloor } \binom { k - i } { j } \binom { n - i - j - 1 } { j - 1 } \right) \right] + \overbrace { \frac { \binom { n } { k + n - 1 } } { \binom { k + n - 1 } { k - 1 } } \binom { k } { n } - \frac { n } { k } } ^ { r ( n , k ) }
367
+ $$
368
+
369
+ We call the last two “residual” terms $r ( n , k )$ . The first of these terms corresponds to the term in the expectation where all elements of the batch end up in separate bins, and the second term is the expected number of elements that land in the tail of the CDF not covered in any bin. □
370
+
371
+ # A.2 OTHER CHOICES OF LINEAR FUNCTIONS AND DISTRIBUTIONS
372
+
373
+ In previous experiments we have restrthat measures average brightness, i.e. ns to the linear function which we approximate t $h : \mathbb { R } ^ { m } \mathbb { R }$ $\begin{array} { r } { h ( x ) = \frac { 1 } { m } \sum _ { i = 1 } ^ { m ^ { - } } x _ { i } } \end{array}$ distributed. Given that ImageNet (and this also applies to most image datasets) is pre-processed by normalization by color in each channel, and that the number of pixels is large and they are not perfectly correlated, this is a reasonable approximation based on the central limit theorem that could similarly apply to other data modalities as well. For analysis, we visualize the closeness of this approximation based on an evaluation over the full ImageNet validation set in Fig. 6.
374
+
375
+ We verify that the actual ground truth distribution can be approximated by a normal distribution, but we also see that the approximation is imperfect. The attack works well in Fig. 2 even with this discrepancy, however it could be further improved if the attacker has more accurate about the CDF. Image brightness is better described by a Laplacian distribution Ruderman (1994); Huang & Mumford (1999). Replacing the normal distribution by a Laplacian distribution with scale $1 / \sqrt { 2 }$ does improve the accuracy slightly. This distribution can be further stabilized by considering higher frequencies compared to the mean, e.g. via DCT coefficients Lam & Goodman (2000); Huang & Mumford (1999). We accordingly also visualize this distribution for e.g. the 32nd DCT coefficient in Fig. 6 and use this cosine wave for the imprint module (with scaling factor $\textstyle { \frac { 4 } { m } } f$ . This leads to the strongest attack against image data, but of course utilizes attacker knowledge that the users train on natural images.
376
+
377
+ On the flip side, the estimation can also be improved by replacing the linear function $h$ with a Gaussian random vector of independent draws from $\begin{array} { r } { \mathcal { N } ( 0 , \frac { 1 } { \sqrt { m } } ) } \end{array}$ . The resulting distribution (4th figure in Fig. 6) approximates a normal distribution much better. While not as optimal as the Laplacian distribution for higher frequencies, this variant is applicable for other data modalities if the data has bounded variance. Visualizations of the reconstruction with other linear functions can be found in Fig. 7.
378
+
379
+ Finally, even with a small amount of data, the server could estimate the density of the quantity of interest. Visually, we plot the the estimated density as for several amounts of ImageNet data used to estimate the brightness distribution. We find that even with $0 . 1 \%$ of the data used, the server could obtain a close approximation to the distribution of interest (see Fig. 5).
380
+
381
+ # A.3 COMPARISON TO HONEST SERVERS AND OPTIMIZATION-BASED ATTACKS
382
+
383
+ We argue that the proposed attack operating in our threat model is significantly more threatening than existing optimization-based attacks in the honest-but-curious server model. To illustrate this point and show by example that the change is threat model which amounts to only a minor architectural change in the neural network leads to a massive difference in reconstruction, we run the attack of Geiping et al. (2020) in the scenario of Fig. 2. The results can be found in Fig. 8. The attack leads to an IIP score of $6 . 2 5 \%$ when measuring in pixel space, $6 . 2 5 \%$ when measuring in LPIPS (Zhang et al., 2018) and, and $2 0 . 3 1 \%$ when measuring the cosine distances in feature space of this model (the metric of Yin et al. (2021)).
384
+
385
+ ![](images/9fb992d6a1ba084ace783d87b441fded0bd1843cc23690f70ea7131982b18eb4.jpg)
386
+ Figure 5: Density of image brightness estimated from access to different amounts of data from the ImageNet dataset.
387
+
388
+ ![](images/ff2394fa3bfcd3692ed73865e556bcc7fb66affb521c5d12743556db5d27356d.jpg)
389
+ Figure 6: Distributions on the ImageNet validation set for several linear query functions. From left to right: Mean compared to normal distribution, mean compared to Laplacian distribution, 32nd DCT coeffcient compared to Laplacian distribution, random normal vector compared to normal distribution. In each plot the approximate distribution used by the attacker is visualized in blue/black and the ground-truth (GT) distribution in green/red.
390
+
391
+ As an additional ablation, we also investigate whether the optimization-based attacks can find the optimal solution in the malicious server threat model that we consider. However, the right side of Fig. 8 shows that at least conventional optimization-based methods have trouble finding the vulnerability introduced by the imprint module. The vulnerability that the attack solves analytically might be hard to exploit by first-order optimization or require specifically tuned optimization schemes to succeed. This also shows that defenses that attempt to detect privacy breaches by evaluating a range of optimization-based attacks would not have triggered an alarm for this attack.
392
+
393
+ # A.4 OTHER DATA MODALITIES - TEXT
394
+
395
+ As discussed in the main body, the attack is entirely data-agnostic and could be launched against any kind of input data, e.g. not only image data but also tabular features or text. In principle the input data could be comprised of random signals - these can still be binned and separated by the proposed attack. We verify this property by launching the same attack against text data.
396
+
397
+ We investigate the transformer architecture discussed in Wang et al. (2021) specifically for language tasks in federated learning scenarios and insert the imprint module as malicious block right after the word embeddings. This is strictly a maliciously modified architecture - normal feedforward blocks in a transformer would not span across the entire length of the sequence. We initialize the linear function as a Gaussian random vector and make no modifications to the attack hyperparameters. We recover the input tokens ids from a direct lookup of their closest match in the word embedding layer (Zhu et al., 2019). To evaluate the success of the attack we generate sample batches of sentences from the wikitext dataset (Merity et al., 2016) with a batch size of 128 and a sequence length of 32, tokenized via the GPT-2 tokenizer (Radford et al., 2019). Instantiating the attack with 512 bins immediately reveals 110 out of 128 sentences perfectly, leading to an overall reconstruction accuracy of $8 6 . 3 3 \%$ which is also a BLEU score of $8 8 \%$ and ROUGE-L of $8 7 \%$ . We refer to our open source implementation for further details.
398
+
399
+ ![](images/a519f6cd240bca0244b740ef671956ef9357177f8e22763ba3d959d111107120.jpg)
400
+ Figure 7: Analytic reconstruction for an imprint model with 128 bins in front of a ResNet-18. Left: The linear function is the 32nd DCT coefficient and bins are based on a Laplacian distribution. Right: Linear function is a Gaussian random vector and bins are based on a normal distribution. Gray reconstructions denote bins in which no data point falls.)
401
+
402
+ ![](images/2858a7b7baab9051aa473718e8cf3ad4c91a1e04597f6720d0b5ed55cbc2a13d.jpg)
403
+ Figure 8: Optimization-based attack of Geiping et al. (2020) for a ResNet-18 and a batch size of 64, the setting of Fig. 2. Left: An honest server model. Right: Gradient inversion attack applied to a module that contains the imprint module.
404
+
405
+ We show examples of recovered data below, but note that printing the recovered text is not that insightful. The attack perfectly recovers a subset of sentences of user text and cannot recover some other sentences entirely, in full analogy to the results for images in e.g. Fig. 7:
406
+
407
+ # Recovered wikitext data:
408
+
409
+ The Tower Building of the Little Rock Arsenal, also known as U.S. Arsenal Building, is a building located in MacArthur Park in downtown Little Rock, Arkansas . Built in 1840, it was part of Little Rock’s first military installation. Since its decommissioning, The Tower Building has housed two museums. It was home to the Arkansas Museum of Natural History and Antiquities from 1942 to 1997 and the MacArthur Museum of Arkansas Military History since 2001. It has also been the headquarters of the Little Rock Æsthetic Club since 1894. The building receives its name from its distinct octagonal tower. Besides being the last
410
+
411
+ # A.5 TECHNICAL DETAILS
412
+
413
+ All experiments were implemented in PyTorch (Paszke et al., 2017) and were run on several laptop and machine CPUs, as the reconstruction itself requires only a few tensor operations. Especially, compared to optimization-based reconstruction techniques, this makes the approach significantly faster and significantly more portable. For visualization purposes and to measure accurate PSNR and IIP scores all images (which are recovered in the order given by the chosen function $h$ ) are matched with possible correspondences in the ground truth batch. The matching is found based on LPIPS feature similarities scores (Zhang et al., 2018) which are matched using a linear sum assignment solver. No labels are recovered using the proposed approach which is entirely labelagnostic, but labels could be assigned a-posteriori using model predictions of the reconstructed data if required. For experiments where the imprint module is placed deeper into a network, the network (which is here a ResNet) is linearized by resetting batch normalization parameters and buffers to the identity map, setting all residual paths to zero and initializing the first convolution and the shortcut convolutions to identity maps. The nonlinearities can be bypassed by bias shifting as in Goldblum et al. (2020).
414
+
415
+ PSNR scores are computed as average PSNR where we first compute PSNR scores per image and then average. This procedure is standard in computer vision, but does bias the score toward successful reconstructions, as the minimal PSNR score is bounded at 0, but its potential upside unbounded. For the image identifiability precision (IIP) score of Yin et al. (2021) we implement the score as proposed therein, but measure nearest neighbors not in the model feature space (which we consider biased, given that the model parameters are already used for reconstruction), but directly in image pixel space, where we check whether the given reconstruction is indeed closer to its true counterpart in euclidean distance than any other image from this class in the validation set.
416
+
417
+ # A.6 ADDITIONAL IMAGES
418
+
419
+ This section contains additional image examples, such as using CIFAR-10 in Fig. 12 and Fig. 13 where an attack with the imprint module on this dataset shows that almost all of the user data is perfectly recovered. Furthermore, example panels of imprint modules inserted in later ResNet layers are visualized as well as the results of the sparse variant that is used to attack a federated averaging scheme.
420
+
421
+ # A.7 DEFENSE DISCUSSION
422
+
423
+ An algorithmic defense against the proposed attack would be to validate the incoming model parameters on the user side. There, the attack with multiple bins requires repeated computations of the same quantity. At first, this pattern could be detected by rank analysis of all linear layers (which would return a rank of 1 for the linear layer of the imprint module described above). Yet, the attacker can easily randomize a few entries of the linear layer to increase its rank without significantly weakening the attack, or introduce additional rows that compute normal deep features, so that we do not believe a defender can win by model analysis under the given threat model.
424
+
425
+ ![](images/7958ca0f938d2c749a12fe78011c47e551992b81f6f9a5e1e61817e34a112651.jpg)
426
+ Figure 9: Expected number of data points recovered for several batch sizes and increased bins and corresponding parameter increase. Model: ResNet50 with ImageNet, targeting the input to the 3rd residual block.
427
+
428
+ ![](images/3fa1e4a81c59c83f8d8c5d165e9e6c84057c658ce8080ec372152b53139e2dfe.jpg)
429
+ Figure 10: Left: Raw data for the 64 ImageNet images with separate classes. Right: Raw data for the 64 images from the white shark class.
430
+
431
+ # A.8 COMPARISON TO CONCURRENT WORK
432
+
433
+ We include a comparison to the concurrent attack of Boenisch et al. (2021) operating in the same threat model in Fig. 21. The threat model is characterized purely as a parameter modification therein that only applies to models with input-sized linear layers followed by ReLU activations. In the same vein the attack discussed in this work does not require malicious architecture modifications if these vulnerable layers are already present.
434
+
435
+ # B REMARK ON RECOVERY
436
+
437
+ $W$ te that for the recovery in Eq. (2), we place either an averaging operation, or linewith identical row elements. This is because in Eq. (2), the attacker needs $\begin{array} { r } { \frac { \partial \mathcal { L } } { \partial b _ { i } } \dot { } = \frac { \partial \mathcal { L } } { \partial b _ { i + 1 } } } \end{array}$ ing. A sufficient condition for this is that the operation proceeding the imprint module, such as averaging,
438
+
439
+ ![](images/aff098f20b67d7b660c7a0ae33fb870be088b9d11a335d26fb8826d10fa018fc.jpg)
440
+ Figure 11: Left: Analytic reconstruction for a linear model of 64 ImageNet images with separate classes (PSNR: 36.45 versus true user data). Right: Same recovery algorithm but for 64 images from the same class (white shark), (PSNR: 13.84 versus true user data.)
441
+
442
+ ![](images/98ead8b6f00f7b34fa2a6970947f768243e913f0972e33c75f63559cfecea69a.jpg)
443
+ Figure 12: Left (a): A batch of 64 CIFAR10 images. Right (b): The same batch of images reconstructed naively using Eq. (2).
444
+
445
+ can be expressed as a matrix operation with identical row elements. This falls squarely within our assumed threat model and is empirically how we implement our attack.
446
+
447
+ # C CODE RELEASE
448
+
449
+ We provide open-source implementations of all attacks investigated in this work. The repository at https://github.com/lhfowl/robbing_the_fed shows a minimalistic implementation of the principles of this attack and the repository at https://github.com/JonasGeiping/ breaching embeds the attack in a larger framework of privacy attacks against federated learning.
450
+
451
+ ![](images/b31e9216e03856f4e3d4272efd7ddff6b8f79ce442bcdef218738460b6d4291d.jpg)
452
+ Figure 13: Left (a): A batch of 64 CIFAR10 images. Right (b): The same batch of images reconstructed using the imprint module with 300 bins. Gray images can result from collisions within a given bin.
453
+
454
+ ![](images/3a4daefbeb7905427055448267e108f73aae70ae42d7b6f0bfdf4f77e34aad43.jpg)
455
+ Figure 14: Different placements of the imprint module in a ResNet-18. From left to right: Before the first block $\left( 5 6 x 5 6 \right)$ , before the third block $( 2 8 x 2 8 )$ , before the fourth block $( 1 4 x 1 4 )$ and before the last average pooling $( 7 x 7 )$ . Compare to a placement before the first convolution $( 2 2 4 x 2 2 4 )$ and raw input data in Fig. 2. Enlarged versions of each panel can be seen in Figs. 15 - 18
456
+
457
+ ![](images/4b997851745b4be439f015a13984102a7563406e20ded4cccec0ad63bc171467.jpg)
458
+ Figure 15: Different placements of the imprint module in a ResNet-18. Before the first block $( 5 6 \times$ 56). Only the first three channels at this position are utilized in this demonstration.
459
+
460
+ ![](images/b592604c5920776626dc0a692cd016bf234a212cd938bdc1ff11890b0adccd3f.jpg)
461
+ Figure 16: Different placements of the imprint module in a ResNet-18. Before the third block $( 2 8 \times 2 8 )$ . Only the first three channels at this position are utilized in this demonstration.
462
+
463
+ ![](images/e58a519b239dd698f5cd85764d6abf723769205e4c6e746f92efd3f7ada30902.jpg)
464
+ Figure 17: Different placements of the imprint module in a ResNet-18. Before the fourth block $( 1 4 \times 1 4 )$
465
+
466
+ ![](images/da0175b7c2fd719d4b86527193342daa33534a25dbc1bef7d2fc16ea38b43ec7.jpg)
467
+ Figure 18: Different placements of the imprint module in a ResNet-18. Before the last averagepooling layer $( 7 \times 7 )$ . Only the first three channels at this position are utilized in this demonstration.
468
+
469
+ ![](images/598348f878dbd0fa9e807f5bc5d2f27e071beae4f7a5c20484274d540e2f87f9.jpg)
470
+ Figure 19: Results for federated averaging for 8 steps with 8 images each, i.e. 64 unique data points for a single user, and 128 bins. PSNR: 32.65. IIP: $7 0 . 3 1 \%$ . Drift of bins during local updates leads to a few duplicated entries.
471
+
472
+ ![](images/dbbce34022a24c7813c3273828d7b91a2ac234b525d6d400c821b57e7863ae40.jpg)
473
+ Figure 20: Left: IIP score vs Laplacian gradient noise. Right: Exemplary recovery for $\sigma = 0 . 0 1$ . Recovery is stable for a large range of Laplacian gradient noise injections.
474
+
475
+ ![](images/136b4d6f1f22506c121bf789fa979c5de029208483072371217e9ac0d05e00d5.jpg)
476
+ Figure 21: Comparison to the ”Curious Abandon Honesty” (CAH) attack proposed in Boenisch et al. (2021). We find our attack outperforms their attack at every scale.
md/dev/gERv_uy69IA/gERv_uy69IA.md ADDED
@@ -0,0 +1,349 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # K-LITE: Learning Transferable Visual Models with External Knowledge
2
+
3
+ Sheng Shen⇤\, Chunyuan $\mathbf { L i } ^ { * \dagger } \triangleq$ , Xiaowei $\mathbf { H } \mathbf { u } ^ { * \dagger }$ , Jianwei Yang†, Yujia Xie†, Pengchuan Zhang†, Zhe $\mathbf { G a n } ^ { \dagger }$ , Lijuan Wang†, Lu Yuan†
4
+ Ce Liu†, Kurt Keutzer\, Trevor Darrell\, Anna Rohrbach\, Jianfeng Gao† †Microsoft \University of California, Berkeley
5
+
6
+ # Abstract
7
+
8
+ The new generation of state-of-the-art computer vision systems are trained from natural language supervision, ranging from simple object category names to descriptive captions. This form of supervision ensures high generality and usability of the learned visual models, due to the broad concept coverage achieved via largescale data collection process. Alternatively, we argue that learning with external knowledge is a promising way which leverages a much more structured source of supervision and offers sample efficiency. We propose K-LITE1, a simple strategy to leverage external knowledge for building transferable visual systems: In training, it enriches entities in text with WordNet and Wiktionary knowledge, leading to an efficient and scalable approach to learning image representations that uses knowledge about the visual concepts. In evaluation, the text is also augmented with external knowledge and then used to reference learned visual concepts (or describe new ones) to enable zero-shot and few-shot transfer of the pre-trained models. We study the performance of K-LITE on two important computer vision problems, image classification and object detection, benchmarking on 20 and 13 different existing datasets, respectively. The proposed knowledge-augmented models show significant improvement in transfer learning performance over existing methods. 2
9
+
10
+ # 1 Introduction
11
+
12
+ One of the core aspirations in computer vision (CV) is to develop systems that endow computers with the ability to effectively learn general visual representations, which can be transferred to a variety of downstream recognition datasets with arbitrary visual concepts in the wild. Though excellent performance has been achieved on standard benchmarks, the traditional supervised approaches are limited to learning a fixed set of concepts, e.g., 22K concepts on ImageNet $\mathbb { \ m }$ or 18K concepts on JFT-300M $\lVert \overline { { 8 2 } } \rVert$ . This leads to a few issues: $( i )$ Annotating each individual vision dataset is not only labor intensive, but also results in a narrow set of visual concepts; $( i i )$ Visual models trained on such datasets are good at one task (with the given concept set) and this task only, and show poor transfer learning performance to customized datasets that usually come with a different set of concepts $\pmb { \left. 2 7 \right. }$ .
13
+
14
+ To tackle this problem, recent large-scale language-augmented visual models, such as CLIP [71], ALIGN $\left[ \left[ 3 6 \right] \right]$ and Florence [101], are trained on a wide variety of images with natural language supervision that is abundantly available on the Internet. These models demonstrate strong zero-shot transfer capabilities, since they acquire open-set recognition abilities through problem reformulation from classification to retrieval. Moreover, model generalization is improved as natural language supervision typically contains rich semantics. While these models usually perform well on recognizing common objects, they still struggle on visual concepts that are absent or rare in the pre-training stage. To ensure good transfer performance, it is required to train such models on huge datasets with sufficient concept coverage(e.g., ${ \bf \Gamma } > 4 0 0 \bf { M }$ image-text pairs), which is both labor and compute expensive.
15
+
16
+ Instead of scaling the number of image-text pairs to increase concept coverage, we propose to leverage structured external knowledge to augment language supervision. The inspiration comes from how humans generalize to novel concepts: instead of trying to memorize all concepts, humans leverage the structured knowledge such as definitions and concept hierarchy. For example, when we visit a Japanese restaurant for the first time, we may struggle to understand the menu by only looking at the dish names (e.g., Takoyaki, Sashimi), as it is hard to imagine what they are. However, it becomes much clearer once a waiter introduces these concepts (Figure $\bigstar \bigstar \bigstar \bigstar$ , leading to success in ordering food (i.e., matching content to a name). Similar intuitions have been exploited in computer vision for class-level transfer $\pm \mathbb { E } \mathbb { L } 2 \mathbb { I }$ , but not yet for task-level transfer settings (similar to that of CLIP).
17
+
18
+ To this end, we explore a systematic approach to acquire and learn with external knowledge sources from databases such as WordNet $\pmb { \| } \overline { { 6 3 } } \dot { \| }$ and Wiktionary $\pmb { \Vert 6 2 \Vert }$ to train more transferable and sampleefficient visual models. The concept descriptions and concept hierarchies are purely textual, and the process of collecting external knowledge is fully automatic without extra human annotation. The acquired knowledge typically provides information that is shared between seen and unseen concepts to facilitate effective transfer. Specifically, rare concepts, e.g., Takoyaki, Sashimi in Figure $\mathbb { L } ,$ are explained with more common concepts. Such knowledge sources are generally available for a variety of domains and datasets, making it possible to build a generic approach for task-level transfer.
19
+
20
+ ![](images/585de1c1e1edeabc3ac348d50ffe9df3766495fc72e6866699466f59cea8bebe.jpg)
21
+ Figure 1: Motivating examples: knowledge explains the content of the rare dish concepts.
22
+
23
+ Our main findings and contributions can be summarized as follows:
24
+
25
+ • We present the first strong evidence that external knowledge can benefit large-scale task-level transfer for two core CV problems, image classification (IC) and object detection (OD), by exploring external knowledge sources, including WordNet and Wiktionary.
26
+
27
+ • A simple and effective strategy K-LITE (Knowledge-augmented Language Image Training and Evaluation) is proposed: The acquired knowledge is appended to the original textual concepts as model input during pre-training and evaluation. It can be viewed as an automatic knowledge-aware language prompting, which makes it easier for the model to access relevant information shared between the training and evaluation data. A modularized approach is also developed to enable efficient adaptation from vanilla visual models to their knowledge-augmented versions.
28
+
29
+ • To demonstrate the generality of the K-LITE, we instantiate it with two recent visual models and develop our knowledge-augmented counterparts: UniCL [95] for IC and GLIP $\pmb { \Vert 5 0 }$ for OD. Extensive experiments in zero-shot and few-shot learning settings demonstrate that knowledgeaugmented models can significantly improve over prior work. Notably, our model can achieve similar zero-shot performance to previous methods using only half of pre-training image-text pairs in some scenarios, demonstrating sample efficiency of the proposed approach.
30
+
31
+ # 2 Related Work
32
+
33
+ Zero-shot Visual Recognition: Zero-shot learning, i.e., classifying images where there is a lack of labeled training data, has been studied for decades $\left[ \left[ 2 1 \right] \right]$ , and its popularity has recently increased further $\mathbb { \underline { { \nabla 4 } } }$ . Based on the technique evolution, it can be broadly categorized into two generations: the traditional class-level zero-shot and recently popular task-level zero-shot setting.
34
+
35
+ Class-level Transfer. Class-level zero-shot learning aims to recognize object classes whose instances have not been observed during training. The goal for the zero-shot learning methods is to associate observed and non-observed classes through some form of auxiliary information, which can be either implicit such as pre-trained semantic embeddings [92, 78, 10], or explicit such as attributes [21, 43, $\textcircled { 3 5 } \textcircled { 1 }$ , text [18, 19, 72, 70], knowledge graphs [91, 74], or rules and ontologies $\mathbb { \left| \left[ 2 3 \right] \right| }$ . Please, refer to the recent survey on knowledge-aware zero-shot learning for a more detailed review [12]. Recently, it has been suggested to move away from the restricted nature of standard zero-shot evaluation and make the task more practical by including training classes at test time, i.e., generalized zero-shot learning setting $\underline { { \| 9 4 \| } }$ . Despite the progress in this area, the traditional setting is typically limited to studying zero-shot transfer across classes in a single domain with manually defined splits, such as Animal with Attributes (AwA) [44], Birds-200 [89], SUN attributes [67], and ZS-ImageNet [73, 26]. Concurrently, $[ | 8 5 | |$ explore leveraging external knowledge to improve long-tailed visual recognition within individual domains, which falls into the category of class-level transfer.
36
+
37
+ Task-level Transfer. Another line of work focuses on task-level zero-shot transfer [52, 46, 64, 71, 36, 97]. They pre-train visual models on hundreds of millions of web-crawled image-caption or image-tags pairs, and evaluate their transfer ability by directly performing inference in a wide range of downstream datasets, without tuning the model weights. We argue that the task-level transfer is more practical and attractive than class-level transfer, as it is more relevant to real-world scenarios, where we may want to develop models that can serve many visual recognition applications.
38
+
39
+ Our work bridges the gap between the two lines of works above: it borrows the spirit of exploring knowledge in class-level transfer, and generalizes it for task-level transfer, leveraging the best of both worlds. To summarize, our work is different in two major aspects: (i) Settings. We focus on the task-level transfer learning across domains, i.e., from large publicly available datasets to a diverse set of downstream datasets in different domains, and demonstrate that external knowledge benefits task-level transfer. (ii) Modeling. Existing class-level transfer works are built upon pre-trained visual features/backbones and shallow word embeddings or tf-idf scores, and only train the classifiers. One representative example is DeViSE [25], where a skip-gram word embedding model and an image classifier are fine-tuned jointly. In contrast, we are training large Transformer-based models in an end-to-end manner from scratch as in CLIP/ALIGN, providing the first empirical evidence that external knowledge can help train a general visual backbone.
40
+
41
+ Knowledge-Intensive Models: In natural language processing (NLP), with the increase of model capacity via pre-trained language models $\bar { \mathbb { E } \ b { \mathscr { A } } }$ , there emerges the need for more knowledgeable models $\begin{array} { r l } { \| \boldsymbol { \bar { 5 } } \boldsymbol { \bar { 5 } } \| } & { { } } \end{array}$ with advanced functionalities such as making use of encyclopedic [88, 4, 6] and commonsense knowledge [79, 102]. To address this, a large number of language models augmented with external knowledge sources have been proposed [68, 29, 45, 56, 100, 7], achieving strong performance on a variety of NLP tasks [69, 42]. Please refer to a recent survey $\pmb { \Vert } \pmb { \Vert } \pmb { \Vert }$ for a comprehensive review.
42
+
43
+ In vision-and-language $( \mathrm { V } { + } \mathrm { L } )$ domain, researchers have also started exploring knowledge-intensive tasks, e.g., OK-VQA $\pmb { \mathbb { E } } \pmb { \mathbb { 1 } }$ and WebQA [9]. They often require additional information sources (e.g., factual and commonsense knowledge) beyond the QA pairs, compared to the established tasks such as VQA [3, 34] and image captioning [54, 2]. Hence, existing pre-trained models [49, 83, 58, 51, 81, 103, 38, 48, 30, 99, $\textcircled { 7 7 }$ would perform poorly on these knowledge-intensive $_ { \mathrm { V + L } }$ tasks [9]. To address the problem, acquiring external knowledge becomes an essential component for success [93, 60, 96].
44
+
45
+ The success of knowledge in NLP and $_ { \mathrm { V + L } }$ tasks inspires us to ask a natural question: Can we learn a transferable visual backbone model with external knowledge? Thus, we dissect and borrow the vital elements such as knowledge sources $\mathbb { \lVert 6 3 \rVert 6 2 \rVert }$ and modeling techniques $\mathbb { P 9 0 , } \overline { { 1 0 0 } }$ , and carry out studies for core computer vision tasks.
46
+
47
+ # 3 Knowledge-Augmented Visual Models
48
+
49
+ Problem setup. Computer vision systems have achieved strong transfer performance, when learning with large-scale image-label data $\textcircled { 1 3 9 } \textcircled { 1 }$ and image-caption data $\dot { \mathbb { Z } } \dot { \mathbb { I } }$ . Recently, it has been demonstrated in $\pmb { \boxed { 9 5 } } \boxed { 1 0 1 }$ that the unification of image-label and image-text formats into image-text-label achieves superior performance over either of them. We follow the setting in $\mathbb { \lVert \underline { { 9 5 } } \rVert }$ , and define a unified triplet-wise data format $\boldsymbol { \mathcal { D } } = \{ ( \boldsymbol { x } _ { n } , t _ { n } , y _ { n } ) \} _ { n = 1 } ^ { N }$ , where $\mathbf { \boldsymbol { x } } \in \mathcal { X }$ is an image, $t \in \tau$ is its language description, and $y \in \mathcal { V }$ is a label indicating the index of the unique language description in the dataset. In a general form, the language description is a text sequence $\pmb { t } = [ t _ { 1 } , \cdots , t _ { L } ]$ . It ranges from simple category names representing visual concepts when $L$ is small, to more free-form and semantic-rich sentences such as captions when $L$ is relatively large.
50
+
51
+ In this paper, we assume there exists an external knowledge source $s$ , where one may use the language description $\pmb { t }$ as a query to seek additional knowledge description $s \in { \mathcal { S } }$ for $\pmb { t }$ . Given these triplet data instances $\mathcal { D }$ and an external knowledge source $s$ , our goal is to learn generic visualsemantic representations, which are readily transferable to a wide range of downstream datasets, whose category names are not necessarily observed during training. In Figure 2, we visually illustrate the proposed knowledge-augmentation process and two considered application scenarios.
52
+
53
+ ![](images/72d2fbfaa3e1ec4edebd3efa2fab6b527ceeb336e0a8bcf3ad93cc8a88d16910.jpg)
54
+ Figure 2: Left: Illustration of data construction process of the proposed knowledge-augmented language-image learning, in contrast to the baseline language-image learning. The query $q$ is constructed from Eq. $\mathbb { \underline { { \left( 1 \right) } } }$ . The same process is performed for both pre-training and downstream tasks. Right: The proposed strategy is applied to IC and OD for task-level transfer.
55
+
56
+ # 3.1 External Knowledge
57
+
58
+ Query Construction. For a text sequence associated with an image, different tokens may play different roles in contributing to describing the main semantics of the image. Humans leverage this prior inherently in parsing the sentences to understand the image. Further, it is infeasible to employ the entire sequence as a query, as this may lead to the lack of coverage in the knowledge bases. Instead, we propose to construct a query $\pmb q \in \mathcal { Q }$ as a compact form of original language description $\pmb { t }$ represented with the words that convey the main concepts of the image.
59
+
60
+ Specifically, we consider a divide-and-conquer approach. For short text sequences $\pmb { t }$ such as category names in image-tag/label datasets (e.g., ImageNet $\mathbb { I } 1 5 \mathbb { I } )$ , we directly use the category name as the query. For long text sequences $\pmb { t }$ such as captions (e.g., YFCC $\pmb { \mathbb { B 4 } }$ ), we first parse the sentence to extract the noun-phrases, among which the most rare noun-phrase over the corpus is used as a query for this sentence. The intuition is to convert the rare concepts into “explanations” represented in common words using external knowledge. Noun phrases are useful for summarizing the sentence and thus inferring what is being talked about in the image. For example, in “professional boxer is introduced to the crowd”, the noun-phrases are “boxer”, “professional boxer”, and “the crowd”. We summarize the query construction process $g _ { q u e r y }$ below for clarity:
61
+
62
+ $\pmb { t }$ $\pmb { t }$
63
+
64
+ Knowledge Acquisition from External Sources. We consider three knowledge sources $s$ to enrich the language descriptions $\pmb { t }$ . They are constructed based on the two knowledge bases: WordNet $\pmb { \mathbb { E 3 } } ] $ and Wiktionary $\pmb { \mathbb { E 2 } }$ . To measure the breadth of a knowledge base, we define the concept coverage as the percentage of non-empty knowledge items retrieved for a given set of issued queries.(i) WordNet $\pmb { \mathbb { \left[ 6 3 \right] } }$ is a lexical database which links words into semantic relations including synonyms, hyponyms, and meronyms. Both nouns and verbs are organized into hierarchies, defined by hypernym relationships. The synonyms in WordNet are grouped into synsets, expressing the same distinct concept. The synsets serve as a natural link between language and vision domains. For example, ImageNet is an image database organized according to the WordNet hierarchy, where each node is depicted by hundreds/thousands of images. $( i i )$ Wiktionary $\pmb { \Vert 6 2 \Vert }$ is a web-based content dictionary of terms (including words, phrases, proverbs, linguistic reconstructions). These entries may contain definitions, illustrations, usage examples etc.. Next, we provide our knowledge retrieval process $\pmb { s } = g _ { r e t r i e v e } ( \pmb { q } )$ for each source $s$ , followed by an example result for the query “boxer”:
65
+
66
+ • WordNet Hierarchy ${ \mathcal { S } } _ { \mathrm { w n \_ p a t h } }$ . A WordNet node of the query is located, then we repeatedly search its parent node. The words along the traversal path are recorded as the knowledge.
67
+ - [boxer, combatant, person, causal_agent, physical_entity, entity]
68
+ WordNet Definition $S _ { \mathrm { { w n \_ d e f } } }$ . The definition from the synsets is used to explain the query.
69
+ - someone who fights with his fists for sport
70
+ • Wiktionary Definition $S _ { \mathrm { w i k i \_ d e f h } }$ . The query is used for dictionary look-up in Wiktionary, and the corresponding definition is used.
71
+ - a fighter in a boxing match
72
+
73
+ When multiple meanings (senses) exist for a given query, we simply consider the first one for simplicity, and leave more sophisticated designs as future work. After querying each knowledge source, we represent the external knowledge for each language description $\pmb { t }$ in the form of concatenation of its query and the corresponding retrieved result: $[ q , s ]$ . This external knowledge introduces additional supervision signals to guide visual models to learn better aligned visual-semantic representations, as we explain later. We next describe how to encode knowledge in multimodal models to improve transfer in the image-level task of image classification and the region-level task of object detection.
74
+
75
+ # 3.2 Image Classification
76
+
77
+ Recent works that learn visual models with language supervision $\mathbb { \ m }$ often employ a dual-encoder architecture. For each image $_ { \textbf { \em x } }$ , an image encoder model $f _ { \theta }$ parameterized by $\pmb { \theta }$ first represents $_ { \textbf { \em x } }$ as a visual feature vector $\tilde { v } \in \mathbb { R } ^ { P \times 1 }$ : $\tilde { v } = f _ { \theta } ( { \boldsymbol { x } } )$ . For each language description $\mathbf { \boldsymbol { t } } \in \mathcal { T }$ , we encode it with a text encoder $f _ { \phi } ( t )$ parameterized by $\phi$ , and get the [EOS] feature as the vector representation of the sentence $\tilde { \pmb { u } } \in \mathbb { R } ^ { P \times 1 } : \tilde { \pmb { u } } = f _ { \phi } ( \pmb { t } )$ . In this paper, we further leverage this text encoder to encode the external knowledge. First, the query $\pmb q$ is represented in natural language $\pmb { p } = g _ { p r o m p t } ( \pmb { q } )$ using the language prompt as in $\pmb { \mathbb { Z } } \mathbf { \mathbb { 1 } }$ . Depending on the language input $\pmb { t }$ and our augmentation scheme, the knowledge-augmented text sequence $\mathbf { \boldsymbol { t } } ^ { \tilde { k } } \in \mathcal { T } ^ { k }$ $k$ stands for knowledge) is represented as:
78
+
79
+ $$
80
+ t ^ { k } = \left\{ \begin{array} { l l } { t _ { e } ^ { k } = [ p , q , s ] , } & { \mathrm { ~ w h e n ~ } t \mathrm { ~ i s ~ a ~ c a t e g o r y , ~ c l a s s ~ o r ~ t a g ~ n a m e } , } \\ { t _ { c } ^ { k } = [ t , q , s ] , } & { \mathrm { ~ w h e n ~ } t \mathrm { ~ i s ~ a ~ c a p t i o n , ~ a n d ~ a ~ c o n c a t ~ s c h e m e ~ i s ~ u s e d } , } \\ { \{ t _ { c } ^ { k } , t _ { e } ^ { k } \} , } & { \mathrm { ~ w h e n ~ } t \mathrm { ~ i s ~ a ~ c a p t i o n , ~ a n d ~ a ~ c o m b i n e ~ s c h e m e ~ i s ~ u s e d } } \end{array} \right.
81
+ $$
82
+
83
+ For example, for category name $\pmb { t = }$ boxer or for caption $\pmb { t = }$ professional boxer is introduced to the crowd, we have $\mathbf { \nabla } q =$ boxer, and the corresponding language description are:
84
+
85
+ • $t _ { e } ^ { k } = \mathsf { a }$ photo of a cool boxer ; boxer , a fighter in a boxing match • $t _ { c } ^ { k } =$ professional boxer is introduced to the crowd ; boxer , a fighter in a boxing match
86
+
87
+ We re-use the same text encoder $f _ { \phi }$ to encode $t ^ { k }$ as the original $\pmb { t }$ as supervision for image $_ { \textbf { \em x } }$ .
88
+
89
+ Training. For $i$ -th image $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { i } }$ and $j$ -th language description $t _ { j }$ in a batch $\boldsymbol { B }$ , we normalize their feature vectors in a hyper-sphere using $\begin{array} { r } { \pmb { u } _ { i } = \frac { f _ { \pmb { \theta } } \left( \pmb { x } _ { i } \right) } { \left\| \int _ { \pmb { \theta } } \left( \pmb { x } _ { i } \right) \right\| } } \end{array}$ and $\begin{array} { r } { v _ { j } = \frac { { \bar { f } } _ { \phi } ( t _ { j } ) } { \| f _ { \phi } ( t _ { j } ) \| } } \end{array}$ , and their similarity is calculated as $\pmb { u } _ { i } ^ { \top } \pmb { v } _ { j }$ . A bidirectional supervised contrastive objective is considered to train the model:
90
+
91
+ $$
92
+ \mathcal { C } _ { i 2 t } = - \sum _ { i \in B } \frac { 1 } { | \mathcal { P } ( i ) | } \sum _ { \boldsymbol { k } \in \mathcal { P } ( i ) } \log \frac { \exp ( \tau u _ { i } ^ { \top } \boldsymbol { v } _ { k } ) } { \sum _ { j \in B } \exp ( \tau u _ { i } ^ { \top } \boldsymbol { v } _ { j } ) } \mathrm { ~ a n d ~ } \mathcal { L } _ { t 2 i } = - \sum _ { j \in B } \frac { 1 } { | \mathcal { Q } ( j ) | } \sum _ { \boldsymbol { k } \in \mathcal { Q } ( j ) } \log \frac { \exp ( \tau u _ { k } ^ { \top } \boldsymbol { v } _ { j } ) } { \sum _ { i \in B } \exp ( \tau u _ { i } ^ { \top } \boldsymbol { v } _ { j } ) }
93
+ $$
94
+
95
+ where $\mathcal { P } ( i ) = \{ k | k \in B , y _ { k } = y _ { i } \}$ , $\mathcal { Q } ( j ) = \{ k | k \in B , y _ { k } = y _ { j } \}$ , and $\tau$ is a temperature hyperparameter controlling the strength of penalties on hard negative samples. Note $( 3 )$ is a general form; it reduces to the training objective of CLIP $\mathbb { \ m }$ or ALIGN $\begin{array} { r l r } { { \mathbb { I } \mathscr { 3 } 6 \| } } \end{array}$ when there is a one-to-one mapping between an image and its paired caption in a batch, i.e., $\mathcal { P } ( i ) = \{ i \}$ and $\mathcal { Q } ( j ) = \{ j \}$ .
96
+
97
+ Evaluation. Given a downstream image classification task with a custom set of category names, we represent them with the knowledge-augmented prompt form in $\textcircled{2}$ ; they are fed into the pre-trained text encoder $f _ { \phi }$ to obtain the class embedding. The test image $_ { \textbf { \em x } }$ is encoded with $f _ { \pmb \theta } ( \pmb x )$ , and compared to all class embeddings to get its label from the best matching class.
98
+
99
+ Extensions with Modularized Modeling. In our study, we found it is key to ensure consistency between training and evaluation stages: if a model is trained with knowledge, it performs well when also evaluated with knowledge. Similarly, if a model is trained without knowledge (e.g., CLIP/UniCL), adding knowledge directly in the evaluation stage results in performance drop. However, due to the limited knowledge coverage in existing knowledge bases, $\pmb { s }$ could be empty for a large number of queries $\pmb q$ . When the low coverage happens for a downstream evaluation dataset, it may result in a training-evaluation inconsistency for our knowledge-augmented models, and thus lower performance.
100
+
101
+ It is desired to have a modularized model that can switch between “with” and “without” knowledge settings. Inspired by $\mathbb { \lVert \underline { { 9 0 } } \rVert }$ , we propose to employ adapters $\pmb { \mathbb { B 3 } }$ to build the network branch to encode knowledge-augmented language $\dot { \mathbf { \Omega } } _ { t ^ { k } } ^ { k }$ , where serial MLP adapters are inserted after each self-attention and MLP modules for all Transformer layers of the text encoder, and $t ^ { k }$ is passed through $f _ { \phi }$ and adapters. Meanwhile, the original $f _ { \phi }$ is reserved as the branch to encode vanilla natural language $\pmb { t }$ . The proposed adapter-modularized architecture can also be used for efficient stage-wise continual pre-training: one may start with a vanilla language-image model pre-trained on $\mathcal { D }$ , and continue pre-train the adapters with knowledge-augmented data $( \mathcal { D } , \mathcal { S } )$ to build its knowledge version.
102
+
103
+ # 3.3 Object Detection
104
+
105
+ Object detection (OD) typically involves two tasks: $\mathcal { L } _ { \mathrm { O D } } = \mathcal { L } _ { \mathrm { c l s } } + \mathcal { L } _ { \mathrm { l o c } }$ , where the localization task $\mathcal { L } _ { \mathrm { l o c } }$ aims to locate the presence of objects in an image with a bounding box, and classification task $\mathcal { L } _ { \mathrm { c l s } }$ determines what object categories are present in that box. Similar to the IC task above, we improve the categorization task of individual boxes $\mathcal { L } _ { \mathrm { c l s } }$ in OD with external knowledge, and keep $\mathcal { L } _ { \mathrm { l o c } }$ the same. Specifically, we leverage GLIP $ { \mathbb { I } } ^ { { 5 } \mathrm { O } \| }$ to reformulate OD as a phrase grounding task, by grounding each region proposed by $\mathcal { L } _ { \mathrm { l o c } }$ $\mathbb { \left. 5 3 \right. }$ to phrases in a text sequence. For language encoding, we first augment a category name $\pmb { t }$ into its knowledge-augmented form ${ \pmb t } ^ { k } = [ { \pmb q } , s ]$ ; this is different from IC in that $\pmb { p }$ is excluded, as no prompt engineering is used in OD, as in $\pmb { \mathbb { B } } \pmb { \mathrm { O } } \Vert$ . In the original GLIP, a sequential text encoding scheme is used: a concatenated long sequence $[ \pmb q _ { 1 } , \cdots , \pmb q _ { K } ]$ over category names is considered as the text encoder input. In our case, simple concatenation $[ { \pmb q } _ { 1 } , { \pmb s } _ { 1 } \cdot \cdot \cdot , { \pmb q } _ { K } , { \pmb s } _ { K } ]$ will quickly break the max length requirement of the language encoder.
106
+
107
+ To resolve the issue, we propose a parallel text encoding scheme: each $t ^ { k }$ is passed through language encoder independently, we use the top-layer feature of [CLS] token as the contextual vector representation $\tilde { \pmb { u } } \in \mathbb { R } ^ { P \times 1 }$ of $t ^ { k }$ : $\tilde { \mathbf { u } } = f _ { \phi } ( \dot { t } ^ { k } )$ . Given $K$ categories, they can be encoded in parallel in a batch; the encoded phrase feature sequence is the concatenation $\mathbf { U } \in \mathbb { R } ^ { P \times K }$ : ${ \bf U } = [ \tilde { \pmb { u } } _ { 1 } , \cdots , \tilde { \pmb { u } } _ { K } ]$ The region encoding is the same as in GLIP. The feature pyramid is $\mathbf { V } \in \mathbb { R } ^ { M \times P } : \mathbf { V } = \dot { f } _ { \pmb { \theta } } ( \pmb { x } )$ · , where $M$ is the number of box features. The alignment scores $\mathbf { S } _ { \mathrm { g r o u n d } }$ are computed:
108
+
109
+ $$
110
+ \mathbf { S } _ { \mathrm { g r o u n d } } { = } \mathbf { V } \mathbf { U } , ~ \mathcal { L } _ { \mathrm { c l s } } { = } \mathcal { M } ( \mathbf { S } _ { \mathrm { g r o u n d } } ; \mathbf { T } ) ,
111
+ $$
112
+
113
+ where $\mathbf { T } \in \{ 0 , 1 \} ^ { M \times K }$ is the target indicating match or no match, and $\mathcal { M } ( \mathbf { S } ; \mathbf { T } )$ is the focal loss $\pmb { \Vert 5 3 \Vert }$ . The grounding model, consisting of the image encoder $f _ { \theta }$ , the language encoder $f _ { \phi }$ and a cross-modal interaction head introduced in $\pmb { \Vert \bar { 5 0 } } $ , is trained end-to-end by minimizing the loss defined in $( 4 )$ . In the evaluation stage, the external knowledge is also retrieved, and encoded in the same parallel encoding manner to enrich the category names in the downstream OD tasks.
114
+
115
+ # 4 Experimental Results
116
+
117
+ In this section, we examine our knowledge-augmented approach to answer two research questions. $\mathsf { Q 1 }$ : To what extent external knowledge benefits visual transfer learning, including sample-efficiency in pre-training and downstream? Q2: Why does external knowledge help zero-shot transfer (illustrated with success and failure case studies)?
118
+
119
+ # 4.1 Settings
120
+
121
+ Evaluation benchmark. We apply the proposed knowledge-augmented models to two task-level transfer settings defined in ELEVATER benchmark [47], which evaluates the transferability of the learned visual representations in the wild. We study our models based on the datasets described in Table $\nsupseteq$ . The license, PII, and consent details of each dataset are in the respective papers. Due to the limited computational resources, the pre-training datasets are constrained to the large publicly available datasets used in [95, 50]. This setting is defined as the “Academic Track” in [47], which friendly to the academic community to allow reproducibility of the results. The number of visual concepts is identical to the number of categories for datasets with category names (e.g., ImageNet
122
+
123
+ Table 1: Statistics of training and test datasets used in our experiments. #Instances indicates #Image for IC and #Regions for OD, respectively. For #Concept and Vocabulary size, we report numbers for the full set and for items with frequency larger than 5. #Ins/C. reports the mean and standard derivation for the numbers of instances per concept.
124
+
125
+ <table><tr><td rowspan="2">Task</td><td colspan="5">Pre-training</td><td colspan="2">Downstream</td></tr><tr><td></td><td>#Instances</td><td>#Concepts</td><td>Vocab. Size</td><td>#Ins/#C.</td><td colspan="2">Concept Overlap (%)</td></tr><tr><td rowspan="5">IC</td><td>Dataset ImageNet-21K[15]</td><td>13M</td><td></td><td></td><td></td><td>ImageNet-1K</td><td>|20-datasets</td></tr><tr><td></td><td></td><td>19.2K/18.4K</td><td>13.5K/12.9K</td><td>591 ±537</td><td>11.82</td><td>13.26</td></tr><tr><td>GCC-3M[ 国</td><td>3.3M</td><td>681K/64.5K</td><td>29.6K/13.0K</td><td>9.5 ±303</td><td>35.97</td><td>19.73</td></tr><tr><td>GCC-12M</td><td>12M</td><td>10.2M/728K</td><td>1.24M/264K</td><td>5.6±353</td><td>61.02</td><td>31.34</td></tr><tr><td>YFCC-14M 84</td><td>14M</td><td>14.2M/1.25M</td><td>2.41M/473K</td><td>8.3 ±1354</td><td>65.23</td><td>34.65</td></tr><tr><td rowspan="2">OD</td><td>Dataset</td><td></td><td></td><td></td><td></td><td>LVIS</td><td>13-datasets</td></tr><tr><td>Object-365 因</td><td>9.6M</td><td>365 /365</td><td>452/452</td><td>26.3K ± 12.4K</td><td>13.46</td><td>21.26</td></tr></table>
126
+
127
+ <table><tr><td>Training Method</td><td>Knowledge S</td><td>ImageNet-1K</td><td></td><td>ICinW (20 datasets)</td></tr><tr><td rowspan="4">1-branch,from scratch</td><td>、</td><td>28.16 4.93 29.03</td><td>27.15</td><td>17.10</td></tr><tr><td>Swn_hier</td><td>27.43</td><td>28.15</td><td>28.69</td></tr><tr><td>Swn_def</td><td>22.87 29.31</td><td>26.97</td><td>29.14</td></tr><tr><td>Swiki_def</td><td>22.05 30.23</td><td>29.03</td><td>33.44</td></tr><tr><td rowspan="2">2-branch,continue pre-training 2-branch,from scratch</td><td>Swiki_def</td><td>28.16</td><td>28.40/28.90 27.15</td><td>30.73/30.91</td></tr><tr><td>Swiki_def</td><td>28.16</td><td>32.52/32.44 27.15</td><td>32.46/33.49</td></tr></table>
128
+
129
+ Table 2: Zero-shot task transfer performance after pre-training on ImageNet-21K dataset. The top block studies the effectiveness of knowledge sources $s$ , and the bottom block studies the modularized approach. For each downstream task, the 1st and 2nd column reports the results without and with knowledge, namely green cells indicate “a match”, orange cells indicate “a mismatch” w.r.t. adding knowledge in training and evaluation. In the bottom block, we report two numbers when evaluated with knowledge: using the knowledge branch only, and using two branches selectively.
130
+
131
+ and Object-365). For image-text data (bottom 3 rows of the IC block), we use Spacy $\pmb { \Vert 3 2 } \Vert$ to extract the noun phrases. We also use a merged version of GCC-3M and GCC-12M denoted as GCC-15M. Given the pool of concepts, we calculate the number of unique words and report it as the vocabulary size. For Concepts and Vocab Size, we report 2 numbers: first for the full set, second for items with frequency larger than 5. The latter provides a sense of “long-tailness”. The statistics (e.g., ratio of #Instance / #Concept) illustrates the varied trade-off over different datasets: image diversity, semantic richness and long-tailness. For example, YFCC is the most long-tail dataset in IC, as it has low mean value and the largest standard derivation value in #Instance / #Concept. The concept overlap is computed as the percentage of concepts in a downstream dataset that are covered by the pre-training dataset. For 20-datasets and 13-datasets, the averaged overlap across individual datasets is reported. It measures the gap (or difficulty) in concept transfer between the pre-training and the downstream data. The dataset statistics are detailed in Section B.1 in Appendix.
132
+
133
+ Zero/Few-shot image classification. Following UniCL [95], this task evaluates to what extent a model understands novel concepts. We pre-train on ImageNet-21K [15] and GCC [76, 11]/YFCC [84] datasets, and report results on ImageNet-1K [15] and a suite of 20 datasets (ICinW) proposed in [47]. We use the same text prompts as in [71, 95], and report scores averaged over 20 datasets. UniCL/Florence [101] show superior performance to CLIP or ALIGN counterparts; UniCL is Florence in a controlled academic setting, trained on the large publicly available datasets [95].
134
+
135
+ Zero-shot object detection. Following GLIP $\mathbb { \left[ \left[ 5 0 \right] \right] }$ , we pre-train on Object365 $\mathbb { \left. \overline { { \boldsymbol { \mathscr { Z } } \boldsymbol { \cdot } \boldsymbol { \cdot } } } \right. }$ , and transfer the learned visual representations for object detection on LVIS $\pmb { \left[ \widetilde { \left| 2 8 \right| } \right] }$ and a suite of 13 small OD datasets (ODinW) proposed in [50, 47], to check the generalization ability. The box mAP is reported.
136
+
137
+ # 4.2 Image Classification
138
+
139
+ ImageNet-21K pre-training. We start by pre-training on ImageNet-21K, where all ImageNet-1K images are excluded. We still see a small amount of concept overlap in Table $\bigstar$ and hypothesize that some category names are given based on different level of WordNet hierarchy. The benefits of this setting are two-fold: it ensures distinctively less concept overlap, and all concepts can find their full WordNet knowledge. We report the results in Table $2 .$ For each checkpoint, we report the results without and with knowledge in the evaluation stage. We confirm two major findings below.
140
+
141
+ Table 3: Overall comparisons of our knowledge-augmented models. Each model is pre-trained with 32 epochs following CLIP [71]/UniCL $\boldsymbol { \| 9 5 \| }$ . } It indicates that the Combine scheme is used for the image-caption data, otherwise the default is the Concat scheme decribed in Section $3 . 2 .$ The linear probing and fine-tuning results are reported for 5-shot settings over 3 random seeds.
142
+
143
+ <table><tr><td colspan="2">Training Data Dataset</td><td rowspan="2">Method</td><td>ImageNet-1K</td><td colspan="3">ICinW (20 datasets)</td></tr><tr><td># Samples</td><td></td><td>Zero-shot</td><td>Zero-shot</td><td>Linear Probing</td><td>Fine-tuning</td></tr><tr><td rowspan="2">ImageNet-21K</td><td>13M (full)</td><td>UniCL</td><td>28.16</td><td>27.15</td><td>53.07 ± 4.15</td><td>55.96 ± 2.50</td></tr><tr><td>13M (full)</td><td>K-LITE</td><td>30.23</td><td>33.44</td><td>53.92 ± 1.05</td><td>57.81 ± 1.48</td></tr><tr><td rowspan="5">YFCC-14M + ImageNet-21K</td><td>14M (half)</td><td>UniCL</td><td>34.43</td><td>34.30</td><td>53.50 ± 2.22</td><td>56.45 ± 2.48</td></tr><tr><td>14M (half)</td><td>K-LITE</td><td>36.67</td><td>36.50</td><td>49.48 ± 2.23</td><td>55.88 ± 1.64</td></tr><tr><td>14M (half)</td><td>K-LITE</td><td>42.36</td><td>36.50</td><td>54.28 ± 3.66</td><td> 52.11 ± 4.90</td></tr><tr><td>27M (full)</td><td>UniCL</td><td>43.06</td><td>35.99</td><td>55.96 ± 3.38</td><td>58.25 ± 2.98</td></tr><tr><td>27M (full)</td><td>K-LITE</td><td>45.67</td><td>38.89</td><td>57.06 ± 1.48</td><td>58.24 ± 2.36</td></tr><tr><td rowspan="5">GCC-15M + ImageNet-21K</td><td>15M (half)</td><td>UniCL</td><td>41.64</td><td>36.31</td><td>53.86 ± 2.73</td><td>59.04 ± 3.13</td></tr><tr><td>15M (half)</td><td>K-LITE</td><td>44.26</td><td>39.53</td><td>55.91 ± 2.53</td><td>58.20 ± 3.39</td></tr><tr><td>15M (half)</td><td>K-LITE</td><td>47.30</td><td>40.32</td><td> 57.38 ± 2.70</td><td>60.72 ± 2.29</td></tr><tr><td>28M (full)</td><td>UniCL</td><td>46.83</td><td>38.90</td><td>57.92 ± 3.31</td><td>60.99 ± 2.74</td></tr><tr><td>28M (full)</td><td>K-LITE</td><td>48.76</td><td>41.34</td><td>58.56 ± 3.12</td><td>63.39 ± 1.74</td></tr></table>
144
+
145
+ F1: All three knowledge sources are beneficial. In Section $3 . 1 ,$ we have introduced WordNet hierarchy ${ \mathcal { S } } _ { \mathrm { w n \_ p a t h } }$ , WordNet definition $S _ { \mathrm { { w n \_ d e f } } }$ , and Wiktionary definition $\boldsymbol { S } _ { \mathrm { w i k i \_ d e f } }$ as external knowledge sources. It is shown that all three of them are effective, improving the zero-shot accuracy by absolute gain $1 \%$ on ImageNet-1K (from $2 8 . 1 6 \%$ to $3 0 . 2 3 \%$ ) and $2 \%$ on the dataset suite in average (from $2 7 . 1 5 \%$ to $3 3 . 4 4 \%$ , respectively. Among them, Wiktionary definition $\boldsymbol { S } _ { \mathrm { w i k i \_ d e f } }$ turns out to be the most effective, therefore, we use it as the default knowledge source throughout the remaining experiments.
146
+
147
+ F2: The modularized approach is effective. Our results in Table 2 reveal that training/test inconsistency in terms of involving knowledge can dramatically degrade the model performance. For example in the 1st row, the baseline UniCL is pre-trained without knowledge, its performance decreases from $2 8 . 1 6 \%$ to $4 . 9 3 \%$ when knowledge is added in the test stage. In contrast, in the 4th row, our K-LITE is pre-trained with knowledge, its performance decrease from $3 3 . 4 4 \%$ to $2 9 . 0 3 \%$ if knowledge is excluded in the evaluation stage. Therefore, we consider a modularized approach with 2-branch in the model. First, we continue pre-train our modularized model from a 32-epoch knowledge-free checkpoint by only updating the Adapters on knowledge-augmented image-text pairs for 10 epochs. It already shows a performance gain from $2 7 . 6 1 \%$ to $2 8 . 4 0 \%$ . This suggests a more affordable solution to obtain knowledge-augmented models from existing models. We can further boost the performance to $2 8 . 9 0 \%$ if we evaluate with two branches, each of which only passes its corresponding language version. Finally, we also train the modularized model from scratch, and it demonstrates a significant gain (absolute $4 \%$ ) on ImageNet-1K, and over $5 \%$ improvement on the 20 datasets. For fair comparisons with knowledge-free models, we train our models with one branch in the rest of experiments.
148
+
149
+ To demonstrate the performance of K-LITE in the extreme large-scale settings, we leverage the largest checkpoint of Florence $\mathbb { I O I }$ trained on 800M image-text pairs, and continue pre-training the model on ImageNet-21K with external knowledge. It improves the zero-shot ImageNet-1K accuracy of Florence from $8 3 . 7 4 \%$ to $8 5 . 8 0 \%$ . As an ablation baseline, continuing pre-training without knowledge yields $8 5 . 3 5 \%$ . The absolute $0 . 4 5 \%$ performance gain shows that external knowledge can still benefit transfer learning, though a huge amount of pre-training data is employed.
150
+
151
+ Pre-training on image-text-label data. The unification of image-label and image-caption as imagetext-label has been demonstrated superior over either one of them [95]. Therefore, we report overall results on the combined data in Table $\textcircled { 3 }$ The few-shot learning results are reported with 5 training examples, using two model adaptation method: linear probing and full model fine-tuning. The average numbers over 3 random seeds are reported. K-LITE improves its knowledge-free counterpart UniCL in almost all the cases. Importantly, K-LITE can outperform UniCL using only half of the pre-training image-text pairs in several cases. It demonstrate the high sample-efficiency of K-LITE, and that external knowledge is an effective source to consider, when collecting large-scale image-text pairs to develop language-augmented visual models at scale. We also compare K-LITE and UniCL with Swin-Base on the joint data including ImageNet-21K, GCC15M and YFCC15M. K-LITE
152
+
153
+ ![](images/111e2e78df18c63086604739a29be40563024dd31cd257c40ecd37c53d098afe.jpg)
154
+
155
+ ![](images/9f9e0b83fde95e9ade407f29c9df5b32572d2cb8954bad1f9947936261a762f6.jpg)
156
+ Figure 3: Performance improvement analysis with external knowledge. External knowledge can largely improve concept overlap between pre-training and evaluation stages, hence usually yields higher recognition scores. Knowledge coverage indicates the percentage of concepts that exist in theFood-101 (Wiki knowledge improves performance) knowledge base for each downstream dataset.
157
+
158
+ English marigold: Any of the Old World plants, of the genus Calendula, with orange, yellow or reddish flowers.
159
+
160
+ Bird of paradise: Any of variouLobster bisque: A thick creamy soup birds of the family Paradisaemade from fish, shellfish, meat or Oceanvegetables.
161
+
162
+ ![](images/39d5f9f8b47949857d70c04fb97b7f27a8b89aa8ddd96e645c1f43e81ccf7b87.jpg)
163
+
164
+ Wallflower: Any of several short-lived herbs or shrubs of the Erysimum genus with bright yellow to red flowers.
165
+
166
+ ![](images/6d0aefc03b86d0785c4666b6e332423e67805dd4ef25d1f34754821efd545b69.jpg)
167
+
168
+ Hot and sour soup: Any one of seve Canna lily: Any of several flowesoups, served in various Asian cuisi genus Lilium of the familywhich are both spicy and sour
169
+
170
+ (a) Success examples. The two datasets with largest improvement in Fig. 3: Flowers102 and Food101. The description of the parent concept, material, shape, color etc. clarifies the concepts, boosting performance for the fine-grained classification tasks.
171
+
172
+ ![](images/7164121dc7b74d7aa27339a2d4648dcc726d53eba1aeb9961932d13a9879ff17.jpg)
173
+
174
+ bus: A motor vehicle for transporting large numbers of people along roads.
175
+
176
+ ![](images/74f618d47f7821c77b41e8d9b432bc1d2ea3d3d6a79130edeedfaed96371d356.jpg)
177
+
178
+ ![](images/71ac5a431a5da2760fcd31d6dcbd3da7f238aec3eaa210680bceb3214f562e76.jpg)
179
+
180
+ car: A wheeled vehicle that moves independently, with at least three wheels
181
+
182
+ ![](images/ed267f431fecf26ae3778a407b78114bbaaab03a5edf1cd68e8559737c77ddd2.jpg)
183
+ Figure 4: Success and failure cases on image classification. For each image, the top row is the knowledge-based prediction, and the bottom row is the baseline prediction (no knowledge).
184
+
185
+ (b) Failure examples. The two datasets with the largest performance loss in Fig. 3. Left (EuroSat): both class names have the same knowledge. Middle & Right (VOC2007): The knowledge contains spurious words that confuse the models.
186
+
187
+ improve the zero-shot performance of UniCL from $5 2 . 1 8 \%$ to $5 7 . 7 8 \%$ on ImageNet-1K, and from from $4 3 . 2 0 \%$ to $4 5 . 4 7 \%$ on ICinW.
188
+
189
+ Breakdown Analysis. Next, we ask why does external knowledge improve the zero-shot task transfer performance on a broad range of datasets? To answer this question, we compare the breakdown performance on all 20 dataset in Figure $^ { 3 , }$ for the ImageNet-21K checkpoints trained with and without Wiki knowledge. Out of 20 datasets, external knowledge shows superior/comparable/inferior performance to the baseline on 16/1/3 datasets, respectively. One prominent observation is that Wiki knowledge improves concept overlap for train-evaluation from $1 3 . 2 6 \%$ to $5 1 . 2 4 \%$ by average. It is easy to understand, concepts are explained in more commonly used words in Wikitionary, providing a bridge for train and evaluation. This is reflected by the increased height of blue bar for most datasets in Figure $3 .$ Interestingly, for all datasets with increased accuracy scores, there shows an increase of the concept overlap. In summary, knowledge is an effective approach to improve concept overlap, a prerequisite for good task transfer performance. In Figure $^ 4$ (a), we provide success examples after adding knowledge; more examples are shown in Appendix.
190
+
191
+ Limitations. The failure cases where knowledge-augmented approach does not help mainly belong to two scenarios: (i) No external knowledge was extracted from the given knowledge base (i.e., Wiktionary in this case), e.g., StanfordCars and FGVC Aircraft. They often require domain-specific knowledge explanations to define a car brand (e.g., Volvo C30 Hatchback 2012) or an aircraft model type (e.g., 737-200), while Wiktionary can hardly provide such professional definitions. $( i i )$ While knowledge is available, the quality is too low to provide useful information. In Figure $\textcircled { 4 }$ (b), we provide failure examples from two datasets with the biggest performance loss after adding
192
+
193
+ <table><tr><td rowspan="2">Method</td><td colspan="10">LVIS</td><td colspan="4">ODinW (13 datasets)</td></tr><tr><td>APr</td><td>APc</td><td>APf</td><td>=</td><td>SLVIS</td><td>Swn_path</td><td></td><td>Swn_def</td><td>Swiki_def</td><td>-</td><td>Swn_path</td><td>Swn_def</td><td>Swiki_def</td></tr><tr><td>GLIP-A 四</td><td>14.2</td><td>13.9</td><td>23.4</td><td>18.5</td><td>-</td><td></td><td></td><td></td><td></td><td>28.8</td><td></td><td></td><td></td></tr><tr><td>Baseline GLIP</td><td>8.6</td><td>14.0</td><td>23.1</td><td>17.9</td><td>17.6</td><td>17.1</td><td>17.2</td><td></td><td>15.0</td><td>27.5</td><td>26.8</td><td>21.0</td><td>18.5</td></tr><tr><td>K-LITE</td><td>14.8</td><td>18.6</td><td>24.8</td><td>16.9</td><td>21.3</td><td>18.7</td><td></td><td>21.4</td><td>20.5</td><td>25.0</td><td>30.3</td><td>28.4</td><td> 31.7</td></tr></table>
194
+
195
+ Table 4: Zero-shot task transfer performance on OD. APr/APc/APf indicates the AP values for rare, common, frequent groups of categories on LVIS. Cell coloring follows the same protocol as in Table 2. ${ \mathcal { O } } _ { \mathrm { G L I P } }$ is implemented with parallel text encoding in Section 3.3 without external knowledge.
196
+
197
+ knowledge. In Figure 6 in the Appendix, we show more examples where knowledge only yields slight improvement. To summarize, a promising future research direction is to improve the knowledge quality to be more related to the given classification tasks.
198
+
199
+ # 4.3 Object detection
200
+
201
+ We evaluate the model’s ability to recognize diverse objects on LVIS $\left[ \left[ 2 8 \right] \right]$ and 13 downstream datasets used in $\pmb { \Vert 5 0 \Vert }$ in a zero-shot setting. We report on MiniVal containing 5,000 images on LVIS. Our K-LITE GLIP is trained with Wiktionary definitions. The results are presented in Table 4. The 1st row are the original numbers reported in $\left[ \left[ 5 0 \right] \right]$ , using the sequential text encoding. The 2nd row is our implementation of GLIP using parallel text encoding, whose effectiveness is validated by the comparable numbers with 1st row. The 3rd row is our knowledge-augmented GLIP, i.e., K-LITE. The benefit of using external knowledge is evident. On LVIS, the categories are divided into rare, common, frequent groups, based on the number of training images per category. K-LITE improves the detection performance for all three groups with an average of 2.8 points on LVIS, and particularly brings a 4.7 points improvement on MiniVal APc over the GLIP-A reported in $\pmb { \| 5 0 \| }$ . We conclude that the enriched semantics of external knowledge significantly helps the model recognize concepts with a decent number of instances. Since LVIS has its own knowledge source $\mathcal { S } _ { \mathrm { { L V I S } } }$ , mostly built upon WordNet definitions $[ [ 2 8 ] ]$ , we evaluate our model with $ { S _ { \mathrm { { L V I S } } } }$ . We alter the external knowledge source to ${ \mathcal { S } } _ { \mathrm { w n \_ p a t h } }$ , $S _ { \mathrm { { w n \_ d e f } } }$ , and $\boldsymbol { S } _ { \mathrm { w i k i \_ d e f } }$ in evaluation, which yields mAP 18.7, 21.4, 20.5, respectively. It verifies that our knowledge source extraction process is reliable. Similarly, K-LITE improve the 13 downstream OD datasets from 28.8 (or 27.5 with its own knowledge-free counterpart) to 31.7. The success and failure examples of OD are shown in Section $\mathbf { B . } 5$ in Appendix.
202
+
203
+ # 5 Conclusions
204
+
205
+ In this paper, we have presented a knowledge-augmented approach K-LITE to learn a generic visual model for task-level transfer. General external knowledge sources including WordNet and Wiktionary are explored to enrich the natural language supervision, which is then used in both the language-image pre-training stage and the prompt-based evaluation stage. We have demonstrated the generality and effectiveness of K-LITE in two core computer vision problems: image classification and object detection. Extensive experimental results show that our method can achieve superior performance over existing methods on $2 0 \ : \mathrm { I C }$ datasets and $1 3 \mathrm { \ O D }$ datasets, respectively. K-LITE also outperforms its knowledge-free counterpart UniCL using half of the pre-training data in the large-scale academic data setting, demonstrating that leveraging external knowledge is a promising direction in improving pre-training sample-efficiency for learning transferable visual models.
206
+
207
+ # Acknowledgments
208
+
209
+ The authors gratefully acknowledge Chenguang Zhu, Wenhao Yu, Yuwei Fang for the early insightful discussions on the use of dictionary for rare concepts in NLP task, Hao Cheng for the inspirations of external knowledge in open-domain QA. The project is partly done in the MSR-Berkeley collaboration program3. The work depends on publicly available knowledge databases; we acknowledge all the original authors and contributors who made their “knowledge” public. Sheng Shen and Kurt Keutzer are supported by Samsung SAIT, Intel corporation, Intel VLAB team, Intel One-API center of excellence, as well as funding through BDD and BAIR. The work of Sheng Shen, Anna Rohrbach and Trevor Darrell was supported in part by DoD including DARPA’s LwLL, PTG and/or SemaFor programs, as well as BAIR’s industrial alliance programs.
210
+
211
+ # References
212
+
213
+ [1] FER 2013: Kaggle challenges in representation learning facial expression recognition. https://www. kaggle.com/.
214
+ [2] Harsh Agrawal, Karan Desai, Yufei Wang, Xinlei Chen, Rishabh Jain, Mark Johnson, Dhruv Batra, Devi Parikh, Stefan Lee, and Peter Anderson. nocaps: novel object captioning at scale. In ICCV, 2019.
215
+ [3] Stanislaw Antol, Aishwarya Agrawal, Jiasen Lu, Margaret Mitchell, Dhruv Batra, C Lawrence Zitnick, and Devi Parikh. Vqa: Visual question answering. In ICCV, 2015.
216
+ [4] Sören Auer, Christian Bizer, Georgi Kobilarov, Jens Lehmann, Richard Cyganiak, and Zachary Ives. Dbpedia: A nucleus for a web of open data. In The semantic web, pages 722–735. Springer, 2007.
217
+ [5] Sven Bambach, Stefan Lee, David Crandall, and Chen Yu. Lending a hand: Detecting hands and recognizing activities in complex egocentric interactions. In ICCV, 2015.
218
+ [6] Kurt Bollacker, Colin Evans, Praveen Paritosh, Tim Sturge, and Jamie Taylor. Freebase: a collaboratively created graph database for structuring human knowledge. In ACM SIGMOD, 2008.
219
+ [7] Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. Improving language models by retrieving from trillions of tokens. arXiv preprint arXiv:2112.04426, 2021.
220
+ [8] Lukas Bossard, Matthieu Guillaumin, and Luc Van Gool. Food-101–mining discriminative components with random forests. In ECCV, 2014.
221
+ [9] Yingshan Chang, Mridu Narang, Hisami Suzuki, Guihong Cao, Jianfeng Gao, and Yonatan Bisk. Webqa: Multihop and multimodal qa. arXiv preprint arXiv:2109.00590, 2021.
222
+ [10] Soravit Changpinyo, Wei-Lun Chao, and Fei Sha. Predicting visual exemplars of unseen classes for zero-shot learning. In ICCV, 2017.
223
+ [11] 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.
224
+ [12] Jiaoyan Chen, Yuxia Geng, Zhuo Chen, Ian Horrocks, Jeff Z Pan, and Huajun Chen. Knowledge-aware zero-shot learning: Survey and perspective. IJCAI, 2021.
225
+ [13] Gong Cheng, Junwei Han, and Xiaoqiang Lu. Remote sensing image scene classification: Benchmark and state of the art. Proceedings of the IEEE, 2017.
226
+ [14] Mircea Cimpoi, Subhransu Maji, Iasonas Kokkinos, Sammy Mohamed, and Andrea Vedaldi. Describing textures in the wild. In CVPR, 2014.
227
+ [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.
228
+ [16] Li Deng. The MNIST database of handwritten digit images for machine learning research. IEEE signal processing magazine, 2012.
229
+ [17] 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.
230
+ [18] Mohamed Elhoseiny, Babak Saleh, and Ahmed Elgammal. Write a classifier: Zero-shot learning using purely textual descriptions. In ICCV, 2013.
231
+ [19] Mohamed Elhoseiny, Yizhe Zhu, Han Zhang, and Ahmed Elgammal. Link the head to the “beak”: Zero shot learning from noisy text description at part precision. In CVPR, 2017.
232
+ [20] Mark Everingham, Luc Van Gool, Christopher KI Williams, John Winn, and Andrew Zisserman. The pascal visual object classes (VOC) challenge. IJCV, 2010.
233
+ [21] Ali Farhadi, Ian Endres, Derek Hoiem, and David Forsyth. Describing objects by their attributes. In CVPR, 2009.
234
+ [22] Li Fei-Fei, Rob Fergus, and Pietro Perona. Learning generative visual models from few training examples: An incremental Bayesian approach tested on 101 object categories. In CVPR workshop, 2004.
235
+ [23] Rob Fergus, Hector Bernal, Yair Weiss, and Antonio Torralba. Semantic label sharing for learning with many categories. In ECCV, 2010.
236
+ [24] Jannik Fritsch, Tobias Kuehnl, and Andreas Geiger. A new performance measure and evaluation benchmark for road detection algorithms. In ITSC. IEEE, 2013.
237
+ [25] Andrea Frome, Greg S Corrado, Jon Shlens, Samy Bengio, Jeff Dean, Marc’Aurelio Ranzato, and Tomas Mikolov. Devise: A deep visual-semantic embedding model. NeurIPS, 2013.
238
+ [26] Yanwei Fu and Leonid Sigal. Semi-supervised vocabulary-informed learning. In CVPR, 2016.
239
+ [27] 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. arXiv preprint arXiv:1811.12231, 2018.
240
+ [28] Agrim Gupta, Piotr Dollar, and Ross Girshick. Lvis: A dataset for large vocabulary instance segmentation. In CVPR, 2019.
241
+ [29] Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Ming-Wei Chang. Realm: Retrievalaugmented language model pre-training. arXiv preprint arXiv:2002.08909, 2020.
242
+ [30] Weituo Hao, Chunyuan Li, Xiujun Li, Lawrence Carin, and Jianfeng Gao. Towards learning a generic agent for vision-and-language navigation via pre-training. In CVPR, 2020.
243
+ [31] Patrick Helber, Benjamin Bischke, Andreas Dengel, and Damian Borth. EuroSat: A novel dataset and deep learning benchmark for land use and land cover classification. IEEE Journal of Selected Topics in Applied Earth Observations and Remote Sensing, 2019.
244
+ [32] Matthew Honnibal and Ines Montani. spaCy 2: Natural language understanding with Bloom embeddings, convolutional neural networks and incremental parsing. To appear, 2017.
245
+ [33] Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin De Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for nlp. In ICML, 2019.
246
+ [34] Drew A Hudson and Christopher D Manning. Gqa: A new dataset for real-world visual reasoning and compositional question answering. In CVPR, 2019.
247
+ [35] Dinesh Jayaraman and Kristen Grauman. Zero shot recognition with unreliable attributes. arXiv preprint arXiv:1409.4327, 2014.
248
+ [36] 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.
249
+ [37] 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. NeurIPS, 2020.
250
+ [38] Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision. arXiv preprint arXiv:2102.03334, 2021.
251
+ [39] Alexander Kolesnikov, Lucas Beyer, Xiaohua Zhai, Joan Puigcerver, Jessica Yung, Sylvain Gelly, and Neil Houlsby. Big transfer (bit): General visual representation learning. In ECCV, 2020.
252
+ [40] Jonathan Krause, Michael Stark, Jia Deng, and Li Fei-Fei. 3d object representations for fine-grained categorization. In ICCV workshops, 2013.
253
+ [41] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
254
+ [42] Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, et al. Natural questions: a benchmark for question answering research. TACL, 2019.
255
+ [43] Christoph H Lampert, Hannes Nickisch, and Stefan Harmeling. Learning to detect unseen object classes by between-class attribute transfer. In CVPR, 2009.
256
+ [44] Christoph H Lampert, Hannes Nickisch, and Stefan Harmeling. Attribute-based classification for zero-shot visual object categorization. PAMI, 2013.
257
+ [45] Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, et al. Retrieval-augmented generation for knowledge-intensive NLP tasks. NeurIPS, 2020.
258
+ [46] Ang Li, Allan Jabri, Armand Joulin, and Laurens Van Der Maaten. Learning visual n-grams from web data. In ICCV, 2017.
259
+ [47] Chunyuan Li, Haotian Liu, Liunian Harold Li, Pengchuan Zhang, Jyoti Aneja, Jianwei Yang, Ping Jin, Houdong Hu, Zicheng Liu, Yong Jae Lee, and Jianfeng Gao. ELEVATER: A benchmark and toolkit for evaluating language-augmented visual models. In NeurIPS Track on Datasets and Benchmarks, 2022.
260
+ [48] Junnan Li, Ramprasaath R Selvaraju, Akhilesh Deepak Gotmare, Shafiq Joty, Caiming Xiong, and Steven Hoi. Align before fuse: Vision and language representation learning with momentum distillation. arXiv preprint arXiv:2107.07651, 2021.
261
+ [49] Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language. arXiv preprint arXiv:1908.03557, 2019.
262
+ [50] Liunian Harold Li, Pengchuan Zhang, Haotian Zhang, Jianwei Yang, Chunyuan Li, Yiwu Zhong, Lijuan Wang, Lu Yuan, Lei Zhang, Jenq-Neng Hwang, et al. Grounded language-image pre-training. CVPR, 2022.
263
+ [51] 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 ECCV, 2020.
264
+ [52] Yangguang Li, Feng Liang, Lichen Zhao, Yufeng Cui, Wanli Ouyang, Jing Shao, Fengwei Yu, and Junjie Yan. Supervision exists everywhere: A data efficient contrastive language-image pre-training paradigm. arXiv preprint arXiv:2110.05208, 2021.
265
+ [53] Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollár. Focal loss for dense object detection. In ICCV, 2017.
266
+ [54] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In ECCV, 2014.
267
+ [55] Angli Liu, Jingfei Du, and Veselin Stoyanov. Knowledge-augmented language model and its application to unsupervised named-entity recognition. arXiv preprint arXiv:1904.04458, 2019.
268
+ [56] Weijie Liu, Peng Zhou, Zhe Zhao, Zhiruo Wang, Qi Ju, Haotang Deng, and Ping Wang. K-BERT: Enabling language representation with knowledge graph. In AAAI, 2020.
269
+ [57] 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.
270
+ [58] 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.
271
+ [59] Subhransu Maji, Esa Rahtu, Juho Kannala, Matthew Blaschko, and Andrea Vedaldi. Fine-grained visual classification of aircraft. arXiv preprint arXiv:1306.5151, 2013.
272
+ [60] Kenneth Marino, Xinlei Chen, Devi Parikh, Abhinav Gupta, and Marcus Rohrbach. Krisp: Integrating implicit and symbolic knowledge for open-domain knowledge-based VQA. In CVPR, 2021.
273
+ [61] Kenneth Marino, Mohammad Rastegari, Ali Farhadi, and Roozbeh Mottaghi. OK-VQA: A visual question answering benchmark requiring external knowledge. In CVPR, 2019.
274
+ [62] Christian M Meyer and Iryna Gurevych. Wiktionary: A new rival for expert-built lexicons? Exploring the possibilities of collaborative lexicography. na, 2012.
275
+ [63] George A Miller. WordNet: An electronic lexical database. MIT press, 1998.
276
+ [64] Norman Mu, Alexander Kirillov, David Wagner, and Saining Xie. Slip: Self-supervision meets languageimage pre-training. arXiv preprint arXiv:2112.12750, 2021.
277
+ [65] Maria-Elena Nilsback and Andrew Zisserman. Automated flower classification over a large number of classes. In Indian Conference on Computer Vision, Graphics & Image Processing. IEEE, 2008.
278
+ [66] Omkar M Parkhi, Andrea Vedaldi, Andrew Zisserman, and CV Jawahar. Cats and dogs. In CVPR, 2012.
279
+ [67] Genevieve Patterson and James Hays. SUN attribute database: Discovering, annotating, and recognizing scene attributes. In CVPR, 2012.
280
+ [68] Matthew E Peters, Mark Neumann, Robert L Logan IV, Roy Schwartz, Vidur Joshi, Sameer Singh, and Noah A Smith. Knowledge enhanced contextual word representations. arXiv preprint arXiv:1909.04164, 2019.
281
+ [69] Fabio Petroni, Aleksandra Piktus, Angela Fan, Patrick Lewis, Majid Yazdani, Nicola De Cao, James Thorne, Yacine Jernite, Vladimir Karpukhin, Jean Maillard, et al. KILT: a benchmark for knowledge intensive language tasks. arXiv preprint arXiv:2009.02252, 2020.
282
+ [70] Ruizhi Qiao, Lingqiao Liu, Chunhua Shen, and Anton Van Den Hengel. Less is more: zero-shot learning from online textual documents with noise suppression. In CVPR, 2016.
283
+ [71] 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.
284
+ [72] Scott Reed, Zeynep Akata, Honglak Lee, and Bernt Schiele. Learning deep representations of fine-grained visual descriptions. In CVPR, 2016.
285
+ [73] Marcus Rohrbach, Michael Stark, and Bernt Schiele. Evaluating knowledge transfer and zero-shot learning in a large-scale setting. In CVPR, 2011.
286
+ [74] Ruslan Salakhutdinov, Antonio Torralba, and Josh Tenenbaum. Learning to share visual appearance for multiclass object detection. In CVPR, 2011.
287
+ [75] Shuai Shao, Zeming Li, Tianyuan Zhang, Chao Peng, Gang Yu, Xiangyu Zhang, Jing Li, and Jian Sun. Objects365: A large-scale, high-quality dataset for object detection. In ICCV, 2019.
288
+ [76] 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.
289
+ [77] 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? ICLR, 2022.
290
+ [78] Richard Socher, Milind Ganjoo, Christopher D Manning, and Andrew Ng. Zero-shot learning through cross-modal transfer. NeurIPS, 2013.
291
+ [79] Robyn Speer, Joshua Chin, and Catherine Havasi. Conceptnet 5.5: An open multilingual graph of general knowledge. In AAAI, 2017.
292
+ [80] Johannes Stallkamp, Marc Schlipsing, Jan Salmen, and Christian Igel. The german traffic sign recognition benchmark: a multi-class classification competition. In IJCNN, 2011.
293
+ [81] Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pre-training of generic visual-linguistic representations. arXiv preprint arXiv:1908.08530, 2019.
294
+ [82] Chen Sun, Abhinav Shrivastava, Saurabh Singh, and Abhinav Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, 2017.
295
+ [83] Hao Tan and Mohit Bansal. Lxmert: Learning cross-modality encoder representations from transformers. In EMNLP, 2019.
296
+ [84] 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, 2016.
297
+ [85] Changyao Tian, Wenhai Wang, Xizhou Zhu, Xiaogang Wang, Jifeng Dai, and Yu Qiao. Vl-ltr: Learning class-wise visual-linguistic representation for long-tailed visual recognition. arXiv preprint arXiv:2111.13579, 2021.
298
+ [86] 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.
299
+ [87] Bastiaan S Veeling, Jasper Linmans, Jim Winkens, Taco Cohen, and Max Welling. Rotation equivariant cnns for digital pathology. In MICCAI, 2018.
300
+ [88] Denny Vrandeciˇ c. Wikidata: A new platform for collaborative data collection. In ´ WWW, 2012.
301
+ [89] Catherine Wah, Steve Branson, Peter Welinder, Pietro Perona, and Serge Belongie. The caltech-ucsd birds-200-2011 dataset, 2011.
302
+ [90] Ruize Wang, Duyu Tang, Nan Duan, Zhongyu Wei, Xuanjing Huang, Guihong Cao, Daxin Jiang, Ming Zhou, et al. K-adapter: Infusing knowledge into pre-trained models with adapters. arXiv preprint arXiv:2002.01808, 2020.
303
+ [91] Xiaolong Wang, Yufei Ye, and Abhinav Gupta. Zero-shot recognition via semantic embeddings and knowledge graphs. In CVPR, 2018.
304
+ [92] Jason Weston, Samy Bengio, and Nicolas Usunier. Large scale image annotation: learning to rank with joint word-image embeddings. Machine learning, 2010.
305
+ [93] Jialin Wu, Jiasen Lu, Ashish Sabharwal, and Roozbeh Mottaghi. Multi-modal answer validation for knowledge-based VQA. arXiv preprint arXiv:2103.12248, 2021.
306
+ [94] Yongqin Xian, Christoph H Lampert, Bernt Schiele, and Zeynep Akata. Zero-shot learning—a comprehensive evaluation of the good, the bad and the ugly. PAMI, 2018.
307
+ [95] Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Bin Xiao, Lu Yuan, Ce Liu, and Jianfeng Gao. Unified contrastive learning in image-text-label space. CVPR, 2022.
308
+ [96] Zhengyuan Yang, Zhe Gan, Jianfeng Wang, Xiaowei Hu, Yumao Lu, Zicheng Liu, and Lijuan Wang. An empirical study of GPT-3 for few-shot knowledge-based VQA. arXiv preprint arXiv:2109.05014, 2021.
309
+ [97] 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.
310
+ [98] Da Yin, Li Dong, Hao Cheng, Xiaodong Liu, Kai-Wei Chang, Furu Wei, and Jianfeng Gao. A survey of knowledge-intensive nlp with pre-trained language models. arXiv preprint arXiv:2202.08772, 2022.
311
+ [99] Fei Yu, Jiji Tang, Weichong Yin, Yu Sun, Hao Tian, Hua Wu, and Haifeng Wang. Ernie-vil: Knowledge enhanced vision-language representations through scene graph. arXiv preprint arXiv:2006.16934, 2020.
312
+ [100] Wenhao Yu, Chenguang Zhu, Yuwei Fang, Donghan Yu, Shuohang Wang, Yichong Xu, Michael Zeng, and Meng Jiang. Dict-bert: Enhancing language model pre-training with dictionary. arXiv preprint arXiv:2110.06490, 2021.
313
+ [101] Lu Yuan, Dongdong Chen, Yi-Ling Chen, Noel Codella, Xiyang Dai, Jianfeng Gao, Houdong Hu, Xuedong Huang, Boxin Li, Chunyuan Li, et al. Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432, 2021.
314
+ [102] Hongming Zhang, Daniel Khashabi, Yangqiu Song, and Dan Roth. Transomcs: From linguistic graphs to commonsense knowledge. arXiv preprint arXiv:2005.00206, 2020.
315
+ [103] Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In CVPR, 2021.
316
+
317
+ # Checklist
318
+
319
+ 1. For all authors...
320
+
321
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
322
+ (b) Did you describe the limitations of your work? [Yes]
323
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] in Appendix
324
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
325
+
326
+ 2. If you are including theoretical results...
327
+
328
+ (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]
329
+
330
+ 3. If you ran experiments...
331
+
332
+ (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]
333
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] in Appendix
334
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] in Table 3
335
+ (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
336
+
337
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
338
+
339
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
340
+ (b) Did you mention the license of the assets? [Yes] in Appendix
341
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
342
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
343
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
344
+
345
+ 5. If you used crowdsourcing or conducted research with human subjects...
346
+
347
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
348
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
349
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/ggTNeg2fem/ggTNeg2fem.md ADDED
@@ -0,0 +1,483 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Multimodal Automated Fact-Checking: A Survey
2
+
3
+ Mubashara Akhtar1,\*, Michael Schlichtkrull2, Zhijiang $\mathbf { G u o } ^ { 2 }$ , Oana Cocarascu1, Elena Simperl1 and Andreas Vlachos2
4
+
5
+ 1Department of Informatics, King’s College London 2Department of Computer Science and Technology, University of Cambridge
6
+
7
+ {mubashara.akhtar,oana.cocarascu,elena.simperl}@kcl.ac.uk {mss84,zg283,av308}@cam.ac.uk
8
+
9
+ # Abstract
10
+
11
+ Misinformation is often conveyed in multiple modalities, e.g. a miscaptioned image. Multimodal misinformation is perceived as more credible by humans, and spreads faster than its text-only counterparts. While an increasing body of research investigates automated fact-checking (AFC), previous surveys mostly focus on text. In this survey, we conceptualise a framework for AFC including subtasks unique to multimodal misinformation. Furthermore, we discuss related terms used in different communities and map them to our framework. We focus on four modalities prevalent in real-world fact-checking: text, image, audio, and video. We survey benchmarks and models, and discuss limitations and promising directions for future research.
12
+
13
+ # 1 Introduction
14
+
15
+ Motivated by the challenges presented by misinformation in the modern media ecosystem, previous research has commonly modelled automated factchecking (AFC) as a pipeline consisting of different stages, surveyed in a variety of axes (Thorne and Vlachos, 2018; Kotonya and Toni, 2020a; Zeng et al., 2021; Nakov et al., 2021; Guo et al., 2022). However, these surveys focus on a single modality, text. This is different to real-world misinformation that often occurs via several modalities.
16
+
17
+ In AFC, the term multimodal has been used to refer to cases where the claim and/or evidence are expressed through different or multiple modalities (Hameleers et al., 2020; Alam et al., 2022; Biamby et al., 2022). Examples of multimodal misinformation include: (i) claims about digitally manipulated content (Agarwal et al., 2019; Rössler et al., 2018) such as photos depicting former US president Trump’s arrest (Figure 1); (ii) combining content from different modalities and contexts, e.g. using video footage in a misleading context (Aneja et al., 2021; Biamby et al., 2022; Abdelnabi et al., 2022); (iii) embedding a claim in another modality, e.g. a meme, an image with embedded text (Qu et al., 2022a), with notable real-world examples including a Brexit Vote Leave poster2 and TikTok videos with COVID misinformation (Shang et al., 2021); (iv) verifying a claim with evidence from a different modality than the input claim, e.g. verifying images against text (Shao et al., 2023), audio against textual metadata (Kopev et al., 2019), and text against images (Akhtar et al., 2023).
18
+
19
+ ![](images/d3c9dea520f54258ef203a40f97aa678c4713eb8cb786ccaadf6803692219948.jpg)
20
+ Figure 1: Manipulated image depicting arrest of former US president Donald Trump (source: BBC1).
21
+
22
+ Fact-checking multimodal misinformation is important for a number of reasons. First, multimodal content is perceived as more credible compared to text containing a similar claim (Newman et al., 2012). For example, previous research shows that visual content exhibits a “photo truthiness”- effect (Newman and Zhang, 2020), biasing readers to believe a claim is true. Second, multimodal content spreads faster and has a higher engagement than text-only posts (Li and Xie, 2020). Third, with recent advances in generative machine learning models (Rombach et al., 2022), the generation of multimodal misinformation has been simplified.
23
+
24
+ To validate the importance of multimodal factchecking, we manually annotated 9,255 claims from the AVeriTeC dataset (Schlichtkrull et al., 2023), which were collected with the Google FactCheck ClaimReview $\mathrm { A P I } ^ { 3 }$ . For each claim, we identified the modalities present in it and evidence strategies (e.g. identification of geolocation) used for fact-checking. We find that more than 2, 600 $( 2 8 . 6 8 \% )$ claims either contain multimodal data or require multimodal reasoning for verification, with $2 0 . 0 7 \%$ involving images, $8 . 0 6 \%$ videos, and $0 . 5 5 \%$ audios (see Table 1).4 These claims can neither be fact-checked by a text-only model, nor by a model with no text capabilities.
25
+
26
+ Table 1: Non-textual modalities present and/or used in addition to text in our manually annotated snapshot of real-world claims from the Google ClaimReview API.
27
+
28
+ <table><tr><td>Claim Modality</td><td>Percentage</td></tr><tr><td>Image</td><td>20.07%</td></tr><tr><td>Video</td><td>8.06%</td></tr><tr><td>Audio</td><td>0.55%</td></tr><tr><td>Total</td><td>28.68%</td></tr></table>
29
+
30
+ In this survey, we introduce a three-stage framework for multimodal automated fact-checking: claim detection and extraction, evidence retrieval, and verdict prediction encompassing veracity, manipulation and out-of-context classification, as well as justification production. The input and output data of each stage can have different or multiple modalities. For each stage, we discuss related terms and definitions developed in different research communities. In contrast to previous surveys on multimodal fact-checking that focus on individual subtasks (Cao et al., 2020; Alam et al., 2022; Abdali, 2022), we consider all subtasks surveying benchmarks and modeling approaches for them.
31
+
32
+ We focus on four prevalent modalities of realworld fact-checking identified in our annotations: text, image, audio, and video. While tables and knowledge graphs are increasingly used as evidence for benchmarks (Chen et al., 2020; Aly et al., 2021; Akhtar et al., 2022), they have been covered in previous surveys (Thorne and Vlachos, 2018; Zeng et al., 2021; Guo et al., 2022). Finally, we discuss the extent to which current approaches to AFC work for multimodal data, and promising directions for further research (Section 4). We accompany the survey with a repository,5 which lists the resources mentioned in our survey.
33
+
34
+ # 2 Task Formulation
35
+
36
+ This section introduces a conceptualisation of multimodal AFC as a three-stage process, including claim detection and extraction, evidence retrieval, and production of verdicts and justifications for various types of misinformation (Figure 2). Compared to the text-only pipeline presented in Guo et al. (2022), our framework extends their first stage with a claim extraction stage, and generalises their third stage to cover tasks that fall under multimodal AFC, thus accounting for its particular challenges.
37
+
38
+ Terminology. A number of works (Singhal et al., 2022; Fung et al., 2021) use the term multimedia, which is also more common in public discussions instead of multimodal (Lauer, 2009). However in in this survey we adopt the latter, following other surveys that use multimodal data (Liang et al., 2022; Guo et al., 2019). Adopting the terminology of previous surveys (Thorne and Vlachos, 2018; Alam et al., 2022) and following advice from institutions such as the UNO (Ireton and Posetti, 2018), we avoid multimodal fake news (Meel and Vishwakarma, 2021; Amri et al., 2021; Patwa et al., 2022) due to the term’s ambiguous use.
39
+
40
+ Stage 1: Claim Detection and Extraction. The first pipeline stage aims to find checkable (i.e. factually-verifiable) and check-worthy (i.e. important factual claims (Hassan et al., 2015b)) claims. Debunking a typical claim and writing the factchecking article takes approximately one day for a human fact-checker (Hassan et al., 2015a). This stage aims to focus the AFC process on claims which are verifiable and most impactful. Multimodal claims can be diverse and include: (1) a written claim embedded in another modality (Prabhakar et al., 2021; Maros et al., 2021) such as an image or a spoken claim in an audio or video; (2) a claim that a piece of content is authentic, e.g. that a video footage is from a specific geographic location (Zhang et al., 2018; Heller et al., 2018); (3) a claim for which the evidence is manipulated to support it, e.g. through lip-syncing (Rössler et al., 2018). While in some cases the claim is clearly specified (e.g. in form of a headline), in often multiple modalities are required to understand and extract a claim at this stage. Simply detecting potentially misleading content is often not enough – it is necessary to extract the claim before fact-checking it in the subsequent stages. For example, detecting text in images or videos and understanding it given the context (Qu et al., 2022b) or verifying audios by transcribing and extracting claims (Maros et al., 2021).
41
+
42
+ ![](images/fc150ff00c4eb676ab42d70333fa3782513644301dd4fe9bdc525c113eea4740.jpg)
43
+ Figure 2: Multimodal fact-checking pipeline.
44
+
45
+ Stage 2: Evidence Retrieval. Similarly to factchecking with text, multimodal fact-checking often relies on evidence to make judgments, similar to the process followed by human fact-checkers (Silverman, 2013; Nakov et al., 2021). Two main approaches have been used in the past: $( i )$ using the claim to-be-checked as evidence itself, e.g. to detect manipulation (Qi et al., 2019; Bonettini et al., 2020); this can be seen as the multimodal version of evidence-free fact-checking of text claims by checking logical fallacies in the text (Jin et al., 2022), and $( i i )$ retrieving additional evidence (Abdelnabi et al., 2022). In multimodal fact-checking, the evidence modality can be different from the claim modality. For example, to retrieve evidence for image or audio fact-checking, previous works have also used text e.g. metadata, social media comments, or captions (Gupta et al., 2013; Huh et al., 2018; Müller-Budack et al., 2020; Kopev et al., 2019).
46
+
47
+ Stage 3: Verdict Prediction and Justification Production. Following the fact-checking process of professional fact-checkers, the final stage comprises verdict prediction and the production of justification that explains the fact-check to humans (Graves, 2018). Verdict prediction is decomposed into three tasks considering prevalent multimodal misinformation types: manipulation, using content out-of-context, and veracity classification.
48
+
49
+ Stage 3.1: Manipulation Classification. Manipulation classification commonly addresses $( i )$ misinformative claims with manipulated content; $( i i )$ correct claims accompanied by manipulated content (e.g. to increase credibility). Many methods exist to manipulate text, visual and audio content. While some require more knowledge to use (e.g. speech synthesis), other manipulations can be achieved with simple tools (e.g. changing speed of videos) (Paris and Donovan, 2019). Different terms have been used for manipulated content in recent years. A deepfake is commonly defined as “the product of artificial intelligence (AI) applications that [...] create fake videos that appear authentic” (Maras and Alexandrou, 2019), with popular examples including realistic-looking videos where the speaker’s voice or face is modified (Paris and Donovan, 2019). On the other hand, cheap fake defines manipulated content created through more accessible methods (Paris and Donovan, 2019), e.g. changing captions or speed of videos (La et al., 2022). The term fauxtography was first coined in journalism for images manipulated to “convey a questionable (or outright false) sense of the events they seem to depict” (Cooper, 2007; Kalb and Saivetz, 2007). Other terms used in the literature for manipulated content are fake (Cheema et al., 2022), forgery (Cozzolino et al., 2021), and splice (Zampoglou et al., 2015).
50
+
51
+ Stage 3.2: Out-of-context Classification. Using unchanged content out-of-context is one of the most common and easiest methods to create multimodal misinformation (Luo et al., 2021; Aneja et al., 2021), and involves (possibly misinformative) textual claims paired with content (e.g. a video) taken out of context (Zhang et al., 2018; Abdelnabi et al., 2022; Garimella and Eckles, 2020). Recent work has also studied the applicability of traditional multimodal misinformation detection methods to identify out-of-context content (Zhang et al., 2023). Other terms used for combining multimodal content in a misleading way include cross-modal (in-) consistency (MüllerBudack et al., 2020) and repurposing (Luo et al., 2021).
52
+
53
+ Stage 3.3: Veracity Classification. This task is the multimodal counterpart to classifying the veracity of textual claims given retrieved evidence (Thorne and Vlachos, 2018). Veracity classification of claims embedded in audio is also commonly referred to as deception detection (Kopev et al., 2019; Kamboj et al., 2021). While earlier work considered mostly claims recorded in staged setups (Newman et al., 2003) or from court trials (Pérez-Rosas et al., 2015), more recently real-world political debates have become popular. (Kopev et al., 2019; Kamboj et al., 2021).
54
+
55
+ Stage 3.4: Justification Production. Different to previous research on automated justification production (Kotonya and Toni, 2020a), human factcheckers also give justifications for fact-checks involving images, audios, or videos (Silverman, 2013). Justifications for multimodal misinformation can be grouped in three categories: $( i )$ identifying which part of the claim input is misleading (e.g. specific areas in a visual claim or words in a textual one) (Kou et al., 2020; Purwanto et al., 2021; Lourenço and Paes, 2022); $( i i )$ providing natural language justifications following human fact-checkers (Yao et al., 2022); (iii) selecting and highlighting evidence parts used for verification (Atanasova et al., 2020; Shang et al., 2022). Justifications serve purposes beyond explaining veracity classification, e.g. human fact-checkers also use them to discuss uncertainties and potential errors – especially needed in fact-checking for rapidly developing events (Silverman, 2013).
56
+
57
+ # 3 Datasets and Modeling Approaches
58
+
59
+ # 3.1 Stage 1: Claim Detection and Extraction
60
+
61
+ Input. Typical inputs to claim detection are unimodal, including image (Garimella and Eckles, 2020; Qu et al., 2022a), audio (Maros et al., 2021), and video (Shang et al., 2021; Qi et al., 2022), which are collected from social media platforms such as WhatsApp and TikTok (see Table 2). The written or spoken claim is extracted from the input at this stage before fact-checking it.
62
+
63
+ Output. Claim detection is typically framed as a classification task. Models predict if a claim is checkable or check-worthy (Prabhakar et al., 2021; Cheema et al., 2022; Barrón-Cedeño et al., 2023). The verdict for factual-verifiability is often binary (Jin et al., 2017; Shang et al., 2021). For check-worthiness, Prabhakar et al. (2021) defines three categories of multimodal claims: statistical/numerical claims, claims about world events/places/noteworthy individuals, and other factual claims. Cheema et al. (2022) extend the binary labels for textual check-worthiness (Hassan et al., 2015b) with images to be considered as well. A tweet is considered check-worthy if it is potentially harmful, breaking news, or up-to-date.
64
+
65
+ Modeling Approaches. Detecting claims is a challenging task due to the vast number of posts that are published every day. Existing claim detection methods primarily rely on input content since the large volume of potentially check-worthy inputs makes it difficult to retrieve and use evidence. The early multimodal method directly concatenated visual and textual features for detection (Jin et al., 2017; Wang et al., 2018). However, simple modality fusion may not be sufficient to capture the complex relationships among multimodal information. As a result, later efforts focused on jointly learning representations across modalities. For instance, Khattar et al. (2019) leverage a variational autoencoder (Kingma and Welling, 2014) to learn a shared representation of visual and textual content. Various attention mechanisms have also been developed to fuse multimodal representations (Qian et al., 2021; Wu et al., 2021; Liu et al., 2023b; Qi et al., 2023). Another popular approach is to use graph neural networks (Kipf and Welling, 2017) to model the interactions among different modalities (Zheng et al., 2022; Sun et al., 2023).
66
+
67
+ Multimodal content can implicitly provide claims, as seen in images and videos on social media that often have accompanying text. To extract claims from visual input, OCR systems are commonly used (Garimella and Eckles, 2020; Prabhakar et al., 2021). Qu et al. (2022b) use Google Vision API to identify text in memes. Claim extraction becomes more challenging when dealing with video inputs. Shang et al. (2021) address this challenge by extracting captions and audio chunks after sampling video frames. These captions and audio chunks were then encoded into representations to guide the visual feature extraction process. For audio inputs, Maros et al. (2021) use Google’s Speech-to-Text API to produce transcripts.
68
+
69
+ # 3.2 Stage 2: Evidence Retrieval
70
+
71
+ Previous work uses different types of evidence and retrieval methods given the modalities involved. Evidence data and retrieval approaches can be grouped into $( i )$ content-based and $( i i )$ retrievalbased (see column evidence in Table 3).
72
+
73
+ Content-based. Content-based approaches use the claim and its context (i.e. the same information that is used for claim detection and extraction) as evidence instead of retrieving additional data. This is particularly common for audio and video misinformation (Table 3). Acoustic or visual features extracted from the input are used as evidence for verdict prediction (Wu et al., 2015; Yi et al., 2021; Ismael Al-Sanjary et al., 2016; Jiang et al., 2020). Most approaches use audio (or video) features and accompanying data (e.g. metadata, transcripts if available) as evidence to identify inconsistencies (Kopev et al., 2019; Rössler et al., 2018; Li et al., 2020b). Several datasets with image/text claims (Tan et al., 2020; Luo et al., 2021; Aneja et al., 2021) also do not retrieve additional evidence (Table 3) but rely on the given claim input or use accompanying metadata (Jaiswal et al., 2017; Sabir et al., 2018). Metadata is also often used as evidence for verdict prediction with images as input (Table 3). Jaiswal et al. (2017) and Sabir et al. (2018) use metadata (e.g. image timestamps) to provide additional information. Similarly, Huh et al. (2018) incorporate EXIF metadata (e.g. camera version, focal length, resolution settings) to detect manipulation. Image captions are also used as evidence sometimes (Shao et al., 2023).
74
+
75
+ <table><tr><td>Dataset</td><td>Input</td><td>Context</td><td>Output</td><td>#Input</td><td>Lang</td><td>Source</td></tr><tr><td>Weibo (Jin et al., 2017)</td><td>Img/Txt</td><td>Meta</td><td>2</td><td>9,528</td><td>Zh</td><td>Weibo/News</td></tr><tr><td>FauxBuster (Zhang et al.,2018)</td><td>Img/Txt</td><td>Txt/Meta</td><td>2</td><td>917</td><td>En</td><td>Twitter/Reddit</td></tr><tr><td>Exfaux (Kou et al., 2020)</td><td>Img/Txt</td><td>Txt</td><td>2/4</td><td>263</td><td>En</td><td>Twitter/Reddit</td></tr><tr><td>MuMIN (Nielsen and McConville, 2022)</td><td>Img/Txt</td><td>Meta</td><td>3</td><td>12,914</td><td>Mul</td><td>Twitter</td></tr><tr><td>MMClaims (Cheema et al., 2022)</td><td>Img/Txt</td><td>1</td><td>4</td><td>3,400</td><td>En</td><td>Twitter</td></tr><tr><td>ContrastFaux (Zong et al., 2023)</td><td>Img/Txt</td><td></td><td>2</td><td>1,841</td><td>En</td><td>Twitter/Reddit</td></tr><tr><td>CLEF2023 (Barrón-Cedeno et al., 2023)</td><td>Img/Txt</td><td></td><td>4</td><td>6.000</td><td>Mul</td><td>Twitter</td></tr><tr><td>MR2 (Hu et al., 2023)</td><td>Img/Txt</td><td>Txt/Img/Meta</td><td>3</td><td>14,700</td><td>Mul</td><td>Twitter/Weibo</td></tr><tr><td>IndiaWApp (Garimella and Eckles,2020)</td><td>Img</td><td>Meta</td><td>2</td><td>2,500</td><td>Mul</td><td>WhatsApp</td></tr><tr><td>DisinfoMeme (Qu et al., 2022a)</td><td>Img</td><td>-</td><td>2</td><td>1,170</td><td>En</td><td>Reddit</td></tr><tr><td>WhatsApp (Maros et al.,2021)</td><td>Aud</td><td>Meta</td><td>2</td><td>42,689</td><td>Pt</td><td>WhatsApp</td></tr><tr><td>TikTok (Shang et al.,2021)</td><td>Vid</td><td>Txt/Meta</td><td>2</td><td>891</td><td>En</td><td>TikTok</td></tr><tr><td>COVID-VTS (Liu et al.,2023a)</td><td>Vid</td><td>Txt/Aud</td><td>2</td><td>10,000</td><td>En</td><td>Twitter</td></tr><tr><td>FakeSV (Qi et al.,2022)</td><td>Vid</td><td>Txt/Meta</td><td>2</td><td>3,654</td><td>Zh</td><td>TikTok/Kuai</td></tr><tr><td>MisDissem (Resende et al., 2019)</td><td>Vid/Aud/Img/Text</td><td>Meta</td><td>2</td><td>121,781</td><td>Pt</td><td>WhatsApp</td></tr><tr><td>CheckMate (Prabhakar et al., 2021)</td><td>Vid/Img/Text</td><td>Meta</td><td>3</td><td>2,200</td><td>Hi</td><td>Sharechat</td></tr></table>
76
+
77
+ Table 2: Datasets for claim detection. Img, Txt, Vid, Aud, and Meta denote image, text, video, audio, and metadata, respectively. Output indicates the number classification labels. Mul indicates that the input has multiple languages.
78
+
79
+ Retrieval-based. Retrieved evidence external to the claim is mostly used for fact-checking text claims, text/image and image claims while audio and video fact-checks often don’t retrieve additional evidence data (Table 3) but rely on the content of the video/audio input. Fung et al. (2021) leverage a knowledge base for additional background knowledge. They first construct a knowledge graph of the input news article using its text and images. They extract entities/relations from this knowledge graph with an Information Extraction system (Li et al., 2020a; Lin et al., 2020) and map the entities to Freebase (Bollacker et al., 2008) as their background knowledge base. Two recent datasets scrape claims from fact-checking websites, and include text/image/video from those articles as evidence (Singhal et al., 2022; Yao et al., 2022). Akhtar et al. (2023) used chart images as evidence to verify textual claims. To determine if an image is used out-of-context, previous works also use (reverse) image search (Müller-Budack et al., 2020; Abdelnabi et al., 2022), to find evidence sources with images similar to or same as the claim image. Müller-Budack et al. (2020) query search engines and the WikiData knowledge graph using named entities from the claim text. Abdelnabi et al. (2022) use the claim image caption and the image itself as query.
80
+
81
+ # 3.3 Stage 3: Verdict Prediction
82
+
83
+ As introduced in Section 2, the verdict prediction stage includes manipulation, out-of-context, and veracity classification as sub-tasks.
84
+
85
+ Input. As shown in Table 3, inputs of manipulation classification datasets usually focus on one modality. For dataset creation, manipulated images are often collected from social media platforms such as Twitter, Reddit, and YouTube (Gupta et al., 2013; Heller et al., 2018). For verdict prediction datasets with videos, in addition to social media (Ismael Al-Sanjary et al., 2016), film clips (Guera and Delp, 2018), facial expressions (Rössler et al., 2018), and interviews (Li et al., 2020b) are used. Some works record videos to simulate real-world scenarios (Dolhansky et al., 2019; Jiang et al., 2020; Kwon et al., 2021). To create datasets of manipulated content, altering methods based on GANs have also been applied in earlier works (Zakharov et al., 2019; Nirkin et al., 2019; Karras et al., 2019). For audio manipulations, most benchmarks (Wu et al., 2015; Kinnunen et al., 2017; Reimao and Tzerpos, 2019; Wang et al., 2020; Yi et al., 2021) use speech synthesis and voice conversion algorithms to collect manipulated audios. To assess real-world audio manipulations, Lavrentyeva et al. (2019) emulate realistic telephone channels.
86
+
87
+ <table><tr><td>Dataset</td><td>Input</td><td>Evidence</td><td>Output</td><td>Tasks</td><td>#Input</td><td>Lang</td><td>Source</td></tr><tr><td>MAIM (Jaiswal et al., 2017)</td><td>Img/Txt</td><td>Meta</td><td>2</td><td>0</td><td>239,968</td><td>En</td><td>Flickr</td></tr><tr><td>MEIR (Sabir et al.,2018)</td><td>Img/Txt</td><td>Meta</td><td>2</td><td>0</td><td>140.096</td><td>En</td><td>Flickr</td></tr><tr><td>TNews (Muiller-Budack et al., 2020)</td><td>Img/Txt</td><td>Img</td><td>2</td><td>0</td><td>72,561</td><td>En</td><td>News</td></tr><tr><td>News400 (Muller-Budack et al.,2020)</td><td>Img/Txt</td><td>Img</td><td>2</td><td>0</td><td>400</td><td>En/De</td><td>News</td></tr><tr><td>NeuralNews (Tan et al.,2020)</td><td>Img/Txt</td><td></td><td>4</td><td>0</td><td>128.000</td><td>En</td><td>Grover/GoodNews</td></tr><tr><td>COSMOS (Aneja et al.,2021)</td><td>Img/Txt</td><td></td><td>2</td><td>0</td><td>201,700</td><td>En</td><td>News/Snopes</td></tr><tr><td>NewsCLIPings (Luo et al.,2021)</td><td>Img/Txt</td><td>=</td><td>2</td><td>0</td><td>988,283</td><td>En</td><td>CLIP/VisualNews</td></tr><tr><td>InfoSurgeon (Fung et al.,2021)</td><td>Img/Txt</td><td>KB/Meta</td><td>2</td><td>0</td><td>30,000</td><td>En</td><td>VoA</td></tr><tr><td>Factify (Suryavardan etal.,2023b)</td><td>Img/Txt</td><td>Txt</td><td>5</td><td>0</td><td>50.000</td><td>En</td><td>Twitter</td></tr><tr><td>FakingSandy (Gupta et al.,2013)</td><td>Img</td><td>Txt/Meta</td><td>2</td><td>M</td><td>16,117</td><td>1</td><td>Twitter</td></tr><tr><td>MediaEval (Boididou et al., 2014)</td><td>Img</td><td>Txt/Meta</td><td>2</td><td>M</td><td>13,924</td><td></td><td>Twitter</td></tr><tr><td>In-the-Wild(Huh et al.,2018)</td><td>Img</td><td>Meta</td><td>2</td><td>M</td><td>201</td><td></td><td>Reddit/Onion</td></tr><tr><td>PS-Battles (Heller et al., 2018)</td><td>Img</td><td>Txt/Meta</td><td>2</td><td>M</td><td>103,028</td><td></td><td>Reddit</td></tr><tr><td>DGM (Shao et al., 2023)</td><td>Img</td><td>Txt</td><td>2</td><td>M</td><td>230.000</td><td></td><td>News</td></tr><tr><td>VTD (Ismael Al-Sanjary et al., 2016)</td><td>Vid</td><td>-</td><td>2</td><td>M</td><td>33</td><td>En</td><td>YouTube</td></tr><tr><td>Faceforensics (Rossler et al., 2018)</td><td>Vid</td><td></td><td>2</td><td>M</td><td>1,004</td><td>En</td><td>YouTube</td></tr><tr><td>DeepfakeDetect (Guera and Delp,2018)</td><td>Vid</td><td></td><td>2</td><td>M</td><td>600</td><td>En</td><td>Vid Webs./HOHA</td></tr><tr><td>DFDC (Dolhansky et al., 2019)</td><td>Vid</td><td></td><td>2</td><td>M</td><td>128,154</td><td>En</td><td>Recorded</td></tr><tr><td>DeeperForensics-1.0 (Jiang et al., 2020)</td><td>Vid</td><td></td><td>2</td><td>M</td><td>60,000</td><td>En</td><td>Recorded</td></tr><tr><td>Celeb-DF (Li et al.,2020b)</td><td>Vid</td><td></td><td>2</td><td>M</td><td>6,229</td><td>En</td><td>YouTube</td></tr><tr><td>KoDF (Kwon et al., 2021)</td><td>Vid</td><td></td><td>2</td><td>M</td><td>237,942</td><td>Ko</td><td>Recorded</td></tr><tr><td>DF-Platter (Narayan etal.,2023)</td><td>Vid</td><td></td><td>2</td><td>M</td><td>133,260</td><td>En</td><td>YouTube</td></tr><tr><td>ASVspoof (Wu et al., 2015)</td><td>Aud</td><td></td><td>2</td><td>M</td><td>16,375</td><td>En</td><td>SAS</td></tr><tr><td>Phonespoof (Lavrentyeva et al.,2019)</td><td>Aud</td><td></td><td>2</td><td>M</td><td>34,407</td><td>En</td><td>ASVspoof</td></tr><tr><td>FoR (Reimao and Tzerpos,2019)</td><td>Aud</td><td></td><td>2</td><td>M</td><td>53,868</td><td>En</td><td>TTS Systems</td></tr><tr><td>DeepSonar (Wang et al.,2020)</td><td>Aud</td><td></td><td>2</td><td>M</td><td>18,614</td><td>En/Zh</td><td>TTS Systems/VCC</td></tr><tr><td>HAD (Yi et al., 2021)</td><td>Aud</td><td></td><td>3</td><td>M</td><td>88.035</td><td>Zh</td><td>AISHELL-3</td></tr><tr><td>FakeAVCeleb (Khalid et al., 2021)</td><td>Vid/Aud</td><td></td><td>4</td><td>M</td><td>20,000</td><td>En</td><td>VoxCeleb2</td></tr><tr><td>MedVideo (Hou et al.,2019)</td><td>Vid</td><td></td><td>2</td><td>VC</td><td>250</td><td>En</td><td>YouTube</td></tr><tr><td>CLEF2018 Audio (Kopev et al.,2019)</td><td>Aud</td><td>Meta</td><td>3</td><td>VC</td><td>286</td><td>En</td><td>Debates</td></tr><tr><td>FactDrill(Singhal et al.,2022)</td><td>Txt</td><td>Vid/Aud/Img/Txt/Meta</td><td>5</td><td>VC</td><td>22,435</td><td>Mul</td><td>FC webs.</td></tr><tr><td>MMM(Gupta et al., 2022)</td><td>Txt</td><td>Img/Meta</td><td>2</td><td>VC</td><td>10,473</td><td>Mul</td><td>FC webs.</td></tr><tr><td>ChartFC (Akhtar et al., 2023)</td><td>Txt</td><td>Img</td><td>2</td><td>VC</td><td>15,886</td><td>En</td><td>TabFact</td></tr><tr><td>Fauxtography (Zlatkova et al.,2019)</td><td>Img/Txt</td><td>Meta</td><td>2</td><td>VC</td><td>1,233</td><td>En</td><td>Snopes/Reuters</td></tr><tr><td>MOCHEG(Yao et al., 2022)</td><td>Img/Txt</td><td>Img/Txt</td><td>3</td><td>VC</td><td>21,184</td><td>En</td><td>FC webs.</td></tr><tr><td>r/Fakeddit (Nakamura et al., 2020)</td><td>Img/Txt</td><td>Meta</td><td>2/3/6</td><td>O/M/VC</td><td>1,063,106</td><td>En</td><td>Reddit</td></tr></table>
88
+
89
+ Table 3: Datasets for manipulation, out-of-context, and veracity classification. O, M and VC denote out-of-context, manipulation and veracity classification, respectively. Mul indicates the input has multiple languages.
90
+
91
+ Most out-of-context classification datasets have image-caption pairs as input (Table 3). Jaiswal et al. (2017) replace captions of Flickr images to get mismatched pairs. As replacing the entire caption can be easy to detect, later efforts (Sabir et al., 2018; Müller-Budack et al., 2020) propose to change specific entities in them. Luo et al. (2021) show that such text manipulations introduce linguistic biases and can be solved without the images. They use CLIP (Radford et al., 2021) to filter out pairs that do not require multimodal modeling. Popular sources for out of context datasets with text and image claims include Flickr and news/fact-checking websites (Aneja et al., 2021; Jaiswal et al., 2017; Sabir et al., 2018).
92
+
93
+ The primary input to multimodal veracity classification is the content-to-be-checked itself – typically text, audio or video in past benchmarks. Kopev et al. (2019) include verified speeches from the CLEF-2018 Task 2 (Nakov et al., 2018) while Hou et al. (2019) collect videos about prostate cancer verified by urologists. Zlatkova et al. (2019) and Yao et al. (2022) collect viral images with texts verified by dedicated agencies. Nakamura et al. (2020) collect image-text pairs from Reddit via distant supervision, e.g. labeling a post from the subreddit “fakefacts” as misleading and from “photoshopbattles” as manipulated. For veracity classification of spoken claims, real-world political debates are popular sources for claims (Kopev et al., 2019; Kamboj et al., 2021). For example, Kopev et al. (2019) and Kamboj et al. (2021) use claims labelled by fact checking organizations, and video recordings as well as transcripts of the respective political debates.
94
+
95
+ Output. Most manipulation and out-of-context classification datasets use binary labels: “out-ofcontext/not out-of-context” (Müller-Budack et al., 2020; Luo et al., 2021), “pristine/falsified” (Boididou et al., 2014; Heller et al., 2018), “manipulation/no manipulation” (Dolhansky et al., 2019; Li et al., 2020b). Following fact-checkers, veracity classification datasets (Singhal et al., 2022; Nakamura et al., 2020) sometimes employ multi-class labels to represent degrees of truthfulness (e.g. true, mostly-true, half-true) (see Table 3). Mishra et al. (2022) adopt labels to denote the entailment between different claim and evidence modalities, e.g. the label support text denotes that only the textual part of the evidence supports the claim but not the accompanying image while support multimodal includes both modalities.
96
+
97
+ Modeling Approaches. To detect visual manipulations, early approaches mostly use CNN models, such as VGG16 (Amerini et al., 2019; Dang et al., 2020), ResNet (Amerini et al., 2019; Sabir et al., 2019), and InceptionV3 (Guera and Delp, 2018). Some works extend them to capture temporal aspects of video manipulation classification. Amerini et al. (2019) adopt optical flow fields to capture the correlation between consequent video frames and detect dissimilarities caused by manipulation. Guera and Delp (2018) model temporal information with an LSTM model and a sequence of features vectors per video frame to classify manipulated videos. Sabir et al. (2019) similarly extract features for video frames and detect discrepancies between frames using a recurrent convolution network. Some recent models also integrate transformer-based components (Vaswani et al., 2017; Zheng et al., 2021). For example, Wang et al. (2022) combine CNNs and vision transformers (ViTs) (Dosovitskiy et al., 2021) while Wodajo and Atnafu (2021) introduce a multi-scale ViT with variable patch sizes.
98
+
99
+ Models for out-of-context and veracity classification typically consist of unimodal encoders, a fusion component to obtain joint, multimodal representations, and a classification component. To obtain text representations, early approaches used combinations of word2vec models (Mikolov et al., 2013), LSTMs (Hochreiter and Schmidhuber, 1997), and TF-IDF scores for n-grams (Jin et al., 2017; Tanwar and Sharma, 2020; Hou et al., 2019). More recent efforts use pretrained language models (Fung et al., 2021; Aneja et al., 2021; La et al., 2022). To encode visual data, many approaches first detect objects in visual content using a Mask R-CNN model (He et al., 2017) before extracting visual features (Aneja et al., 2021; La et al., 2022; Shang et al., 2022). Visual representations for images and videos are commonly obtained using CNN models such as ResNet (He et al., 2016; Garimella and Eckles, 2020; Abdelnabi et al., 2022), VGG (Simonyan and Zisserman, 2015; Jin et al., 2017; Sabir et al., 2018), and Inception (Szegedy et al., 2015; Guera and Delp, 2018; Roy and Ekbal, 2021). To obtain audio features for voice quality, loudness, and tonality, Shang et al. (2021) extract the Melfrequency cepstral coefficient, Kopev et al. (2019) use the INTERSPEECH 2013 ComParE feature set (Eyben et al., 2013), and Hou et al. (2019) use the openEAR toolkit (Eyben et al., 2009). Various approaches have been used to obtain multimodal representations. Early fusion, which joins representations immediately after the encoding step (Baltrusaitis et al., 2019) is more common (Aneja et al., 2021; Tanwar and Sharma, 2020; La et al., 2022) than late fusion (Yao et al., 2022). Moreover, model-agnostic methods (e.g. concatenation and dot product) are more prevalent (Aneja et al., 2021; Kopev et al., 2019; Jin et al., 2017; La et al., 2022) than model-based approaches (e.g. neural networks) (Jaiswal et al., 2017; Shang et al., 2022). Also popular for out-of-context classification are cross-modality checks that compare modalities present in a claim to each other, e.g. a video and its caption (Müller-Budack et al., 2020; Fung et al., 2021).
100
+
101
+ # 3.4 Stage 3: Justification Production
102
+
103
+ A small number of datasets is available for multimodal justification production. Previous work can be grouped into two categories: (1) highlighting parts of the input, and (2) generating natural language justifications.
104
+
105
+ Highlighting Input. The first category highlights input parts as justification which contribute to models’ results. A popular approach for this are Graph Neural Networks (Kipf and Welling, 2017). Several papers encode multimodal data as graph elements, combining entities and their relations in and between modalities. Models are trained to detect inconsistencies between different modalities, or to detect relations (i.e., between entities) that may be misinformative. This detection could be based on the local graph structure, or on an external knowledge base (Fung et al., 2021; Shang et al., 2022;
106
+
107
+ Kou et al., 2020). Highlighted entities and relations serve as explanations for the potential misinformativeness of the entire graph. Conversely, Zhou et al. (2018) and Wu et al. (2019) use a multitask model for manipulation classification and identification of manipulated regions. Rather than labeled data, some papers rely on attention mechanisms to highlight areas as explanations. Bonettini et al. (2020); Dang et al. (2020) use this approach to highlight manipulated image regions; Purwanto et al. (2021) also include captions.
108
+
109
+ Natural Language Justifications. Yao et al. (2022) recently introduced a multimodal dataset with natural language justifications. They scrape text and visual content from web pages referenced by fact-checking articles. The dataset includes summaries in the fact-checking articles as gold justifications for the verdicts. However, such a setting is not realistic, as fact-checking articles are not available when verifying a new claim.
110
+
111
+ # 4 Challenges and Future Directions
112
+
113
+ Claim extraction from multimodal content. Multimodal claims, e.g. manipulated videos, are often embedded in specific contexts and framed as (part of) larger stories. For example, countering the misinformation in Figure 1 requires not only classifying if the image is manipulated, but understanding that it depicts the arrest of the former president in one of the cases he is being charged in. Only then can relevant evidence data be extracted and used to verify the story of Trump’s arrest.To determine what is being claimed is a challenging first step in multimodal automated fact-checking. However, current efforts for multimodal claim extraction are limited to text extraction from visual content or transcribing audios and videos (Qu et al., 2022b; Garimella and Eckles, 2020; Maros et al., 2021). Addressing this challenge will require modeling approaches to effectively align and integrate all modalities present in and around the claim. For example, methods for pixel-based language modeling have recently been introduced to better align visually situated language with image content (Lee et al., 2022). Such approaches considering modalities beyond text and vision for multimodal data alignment can be useful for claim extracting from multimodal input.
114
+
115
+ Multimodal evidence retrieval. Evidence retrieval for audio and video fact-checking remains a major challenge. Different to other modalities, they cannot be easily searched on the web or social media networks (Silverman, 2013). Fact-checkers often use text accompanying the videos to find evidence (Silverman, 2013). Reverse image search engines, e.g. Google Lens or TinEye, require screenshots from the video as input – and thus require the correct timeframe, which can be challenging to extract. A dedicated adversary can render current tools very difficult to use. Very often evidence for image or audio fact-checking is retrieved using text accompanying them , e.g. metadata, social media comments, or captions (Gupta et al., 2013; Huh et al., 2018; Müller-Budack et al., 2020; Kopev et al., 2019). While incorporating the textual information and the other modality (e.g. audio/image) in retrieval would provide more information, this is missing currently. How to best retrieve evidence data that is non-textual or has a different modality than the claim, also remains a challenge.
116
+
117
+ Multilinguality and multimodality. While there is increasing work on multilingual factchecking (Gupta and Srikumar, 2021; Shahi and Nandini, 2020; Hammouchi and Ghogho, 2022), it is mostly limited to text-only benchmarks and models. Surveying benchmarks for different pipeline stages (Figure 2), we found limited multimodal datasets for non-English languages (see Table 3). Previous work on multilingual multimodality shows that training and testing on English data alone introduces biases, as models fail to capture concepts and images prevalent in other languages and cultures (Liu et al., 2021). Moreover, some types of multimodal misinformation exploit cross-lingual sources to mislead, e.g. images or videos from non-English newspapers appearing as out-of-context data for English multimodal misinformation (Silverman, 2013). To prevent false conclusions and biases, it is thus necessary to take approaches that are both multimodal and multilingual (Ruder et al., 2022). Construction of large-scale multimodal, multilingual AFC datasets would facilitate futures research in this direction, similar to benchmarks and shared tasks created for automated fact-checking tasks in English (Thorne et al., 2018; Suryavardan et al., 2023a).
118
+
119
+ Generalizing detection of visual manipulations. The recent popularity of diffusion models (DMs) for visual manipulation have raised questions regarding the generalizability of manipulation detectors developed for earlier models (e.g.
120
+
121
+ GANs (Goodfellow et al., 2020)). Detection models are biased towards specific manipulation models and struggle to generalize (Wu et al., 2023a; Ricker et al., 2022). A recent study (Ricker et al., 2022) shows that detectors initially developed for GANs, have average performance drops of around $1 5 \%$ for image by DMs. While new detection approaches for DM manipulations are already being developed (Guarnera et al., 2023; Wu et al., 2023b), the question how to generalize and increase robustness of manipulation detectors for potential future manipulation models remains open. Potential solutions can include evidence-based approaches, where the manipulated content is used to retrieve evidence data (e.g. the original video or counterfactual evidence) to prove the manipulation.
122
+
123
+ Justifications for multimodal fact-checking. While explainable fact-checking has received attention recently (Kotonya and Toni, 2020b; Atanasova et al., 2020), there is limited work on producing justifications for multimodal content. Previous efforts on multimodal justification production have mostly focused on highlighting parts of the input to increase interpretability (Kou et al., 2020; Shang et al., 2022). Natural language justifications that explain the fact-check of multimodal claims so that it is accessible to non-technical have not been developed yet. To develop solutions, we first need appropriate benchmarks to measure progress. Moreover, with the recent advances of neural models for visual and audio generation and editing, another so far unexplored direction presents itself: editing input images/videos/audios or generating entirely content to explain fact-checking results. This could include, for example, the generation of infographics or video clips to explanation factchecks. Such a system, especially if guided by human fact-checkers (Nakov et al., 2021), would be a potent tool. As noted in Lewandowsky et al. (2020), “well-designed graphs, videos, photos, and other semantic aids can be helpful to convey corrections involving complex or statistical information clearly and concisely”.
124
+
125
+ # 5 Conclusion
126
+
127
+ We survey research on multimodal automated factchecking and introduce a framework that combines and organizes tasks introduced in various communities studying misinformation. We discuss common terms and definitions in context of our framework. We further study popular benchmarks and modeling approaches, and discuss promising directions for future research.
128
+
129
+ # Limitations
130
+
131
+ While we cite many datasets and modeling approaches for multimodal fact-checking, we describe most of them only briefly due to space constraints. Our aim was to provide an overview of multimodal fact-checking and organise previous works in a framework. Moreover, the presented survey focuses primarily on four modalities. While there are other modalities we could have included, we concentrated on those prevalent in real-world fact-checking that have not been discussed as part of a fact-checking framework in previous surveys.
132
+
133
+ # Ethics Statement
134
+
135
+ As we mention in Section 4, most datasets for multimodal fact-checking tasks are available only in English. Thus, models are evaluated based on their performance on English benchmarks only. This can lead to a distorted view about advancements on multimodal automated fact-checking as it is limited to a single language out of more than 7000 world languages. While we call for future work on a variety of languages, this survey provides an overview on the state-of-the-art of mostly-English research efforts. Finally, we want to point out that multimodal fact-checking works we cite in this survey might include misleading statements or images given as examples.
136
+
137
+ # Acknowledgements
138
+
139
+ Zhijiang Guo, Michael Schlichtkrull and Andreas Vlachos are supported by the ERC grant AVeriTeC (GA 865958). This paper is produced as part of the MuseIT project which has been co-funded by the EU under the Grant Agreement number 101061441. MuseIT has supported the work of Mubashara Akhtar. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Research Executive Agency, REA. Neither the EU nor the granting authority can be held responsible for them.
140
+
141
+ # References
142
+
143
+ Sara Abdali. 2022. Multi-modal misinformation detection: Approaches, challenges and opportunities. CoRR, abs/2203.13883.
144
+
145
+ Sahar Abdelnabi, Rakibul Hasan, and Mario Fritz. 2022. Open-domain, content-based, multi-modal fact-checking of out-of-context images via online resources. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 14940–14949.
146
+
147
+ Shruti Agarwal, Hany Farid, Yuming Gu, Mingming He, Koki Nagano, and Hao Li. 2019. Protecting world leaders against deep fakes. In IEEE Conference on Computer Vision and Pattern Recognition Workshops, CVPR Workshops 2019, Long Beach, CA, USA, June 16-20, 2019, pages 38–45. Computer Vision Foundation / IEEE.
148
+
149
+ Mubashara Akhtar, Oana Cocarascu, and Elena Simperl. 2022. PubHealthTab: A public health table-based dataset for evidence-based fact checking. In Findings of the Association for Computational Linguistics: NAACL 2022, pages 1–16, Seattle, United States. Association for Computational Linguistics.
150
+
151
+ Mubashara Akhtar, Oana Cocarascu, and Elena Simperl. 2023. Reading and reasoning over chart images for evidence-based automated fact-checking. In Findings of the Association for Computational Linguistics: EACL 2023, pages 399–414, Dubrovnik, Croatia. Association for Computational Linguistics.
152
+
153
+ Firoj Alam, Stefano Cresci, Tanmoy Chakraborty, Fabrizio Silvestri, Dimiter Dimitrov, Giovanni Da San Martino, Shaden Shaar, Hamed Firooz, and Preslav Nakov. 2022. A survey on multimodal disinformation detection. In Proceedings of the 29th International Conference on Computational Linguistics, pages 6625–6643, Gyeongju, Republic of Korea. International Committee on Computational Linguistics.
154
+
155
+ Rami Aly, Zhijiang Guo, Michael Sejr Schlichtkrull, James Thorne, Andreas Vlachos, Christos Christodoulopoulos, Oana Cocarascu, and Arpit Mittal. 2021. FEVEROUS: fact extraction and verification over unstructured and structured information. In Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks 1, NeurIPS Datasets and Benchmarks 2021, December 2021, virtual.
156
+
157
+ Irene Amerini, Leonardo Galteri, Roberto Caldelli, and Alberto Del Bimbo. 2019. Deepfake video detection through optical flow based CNN. In 2019 IEEE/CVF International Conference on Computer Vision Workshops, ICCV Workshops 2019, Seoul, Korea (South), October 27-28, 2019, pages 1205–1207. IEEE.
158
+
159
+ Sabrine Amri, Dorsaf Sallami, and Esma Aïmeur. 2021. EXMULF: an explainable multimodal content-based fake news detection system. In Foundations and Practice of Security - 14th International Symposium, FPS 2021, Paris, France, December 7-10, 2021, Revised Selected Papers, volume 13291 of Lecture Notes in Computer Science, pages 177–187. Springer.
160
+
161
+ Shivangi Aneja, Christoph Bregler, and Matthias Nießner. 2021. Catching out-of-context misinformation with self-supervised learning. CoRR, abs/2101.06278.
162
+
163
+ Pepa Atanasova, Jakob Grue Simonsen, Christina Lioma, and Isabelle Augenstein. 2020. Generating fact checking explanations. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7352–7364, Online. Association for Computational Linguistics.
164
+
165
+ Tadas Baltrusaitis, Chaitanya Ahuja, and Louis-Philippe Morency. 2019. Multimodal machine learning: A survey and taxonomy. IEEE Trans. Pattern Anal. Mach. Intell., 41(2):423–443.
166
+
167
+ Alberto Barrón-Cedeño, Firoj Alam, Tommaso Caselli, Giovanni Da San Martino, Tamer Elsayed, Andrea Galassi, Fatima Haouari, Federico Ruggeri, Julia Maria Struß, Rabindra Nath Nandi, Gullal S. Cheema, Dilshod Azizov, and Preslav Nakov. 2023. The CLEF-2023 checkthat! lab: Checkworthiness, subjectivity, political bias, factuality, and authority. In Advances in Information Retrieval - 45th European Conference on Information Retrieval, ECIR 2023, Dublin, Ireland, April 2-6, 2023, Proceedings, Part III, volume 13982 of Lecture Notes in Computer Science, pages 506–517. Springer.
168
+
169
+ Giscard Biamby, Grace Luo, Trevor Darrell, and Anna Rohrbach. 2022. Twitter-COMMs: Detecting climate, COVID, and military multimodal misinformation. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 1530–1549, Seattle, United States. Association for Computational Linguistics.
170
+
171
+ Christina Boididou, Symeon Papadopoulos, Yiannis Kompatsiaris, Steve Schifferes, and Nic Newman. 2014. Challenges of computational verification in social multimedia. In Proceedings of the 23rd International Conference on World Wide Web, pages 743–748.
172
+
173
+ Kurt D. Bollacker, Colin Evans, Praveen K. Paritosh, Tim Sturge, and Jamie Taylor. 2008. Freebase: a collaboratively created graph database for structuring human knowledge. In Proceedings of the ACM SIGMOD International Conference on Management of Data, SIGMOD 2008, Vancouver, BC, Canada, June 10-12, 2008, pages 1247–1250. ACM.
174
+
175
+ Nicolò Bonettini, Edoardo Daniele Cannas, Sara Mandelli, Luca Bondi, Paolo Bestagini, and Stefano Tubaro. 2020. Video face manipulation detection through ensemble of cnns. In 25th International Conference on Pattern Recognition, ICPR 2020, Virtual Event / Milan, Italy, January 10-15, 2021, pages 5012–5019. IEEE.
176
+
177
+ Juan Cao, Peng Qi, Qiang Sheng, Tianyun Yang, Junbo Guo, and Jintao Li. 2020. Exploring the role of visual content in fake news detection. CoRR, abs/2003.05096.
178
+
179
+ Gullal Singh Cheema, Sherzod Hakimov, Abdul Sittar, Eric Müller-Budack, Christian Otto, and Ralph Ewerth. 2022. MM-claims: A dataset for multimodal claim detection in social media. In Findings of the Association for Computational Linguistics: NAACL 2022, pages 962–979, Seattle, United States. Association for Computational Linguistics.
180
+
181
+ Wenhu Chen, Hongmin Wang, Jianshu Chen, Yunkai Zhang, Hong Wang, Shiyang Li, Xiyou Zhou, and William Yang Wang. 2020. Tabfact: A large-scale dataset for table-based fact verification. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net.
182
+
183
+ Stephen Cooper. 2007. A concise history of the fauxtography blogstorm in the 2006 lebanon war. American Communication Journal, 9.
184
+
185
+ Davide Cozzolino, Andreas Rössler, Justus Thies, Matthias Nießner, and Luisa Verdoliva. 2021. Idreveal: Identity-aware deepfake video detection. In 2021 IEEE/CVF International Conference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021, pages 15088–15097. IEEE.
186
+
187
+ Hao Dang, Feng Liu, Joel Stehouwer, Xiaoming Liu, and Anil K. Jain. 2020. On the detection of digital face manipulation. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pages 5780–5789. Computer Vision Foundation / IEEE.
188
+
189
+ Brian Dolhansky, Russ Howes, Ben Pflaum, Nicole Baram, and Cristian Canton-Ferrer. 2019. The deepfake detection challenge (DFDC) preview dataset. CoRR, abs/1910.08854.
190
+
191
+ 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. 2021. An image is worth 16x16 words: Transformers for image recognition at scale. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net.
192
+
193
+ Florian Eyben, Felix Weninger, Florian Groß, and Björn W. Schuller. 2013. Recent developments in opensmile, the munich open-source multimedia feature extractor. In ACM Multimedia Conference, MM ’13, Barcelona, Spain, October 21-25, 2013, pages 835–838. ACM.
194
+
195
+ Florian Eyben, Martin Wöllmer, and Björn W. Schuller. 2009. Openear - introducing the munich open-source emotion and affect recognition toolkit. In Affective Computing and Intelligent Interaction, Third International Conference and Workshops, ACII 2009, Amsterdam, The Netherlands, September 10-12, 2009, Proceedings, pages 1–6. IEEE Computer Society.
196
+
197
+ Yi Fung, Christopher Thomas, Revanth Gangi Reddy, Sandeep Polisetty, Heng Ji, Shih-Fu Chang, Kathleen McKeown, Mohit Bansal, and Avi Sil. 2021. InfoSurgeon: Cross-media fine-grained information consistency checking for fake news detection. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pages 1683–1698, Online. Association for Computational Linguistics.
198
+
199
+ Kiran Garimella and Dean Eckles. 2020. Images and misinformation in political groups: Evidence from whatsapp in india. CoRR, abs/2005.09784.
200
+
201
+ Ian J. Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron C. Courville, and Yoshua Bengio. 2020. Generative adversarial networks. Commun. ACM, 63(11):139– 144.
202
+
203
+ D Graves. 2018. Understanding the promise and limits of automated fact-checking.
204
+
205
+ Luca Guarnera, Oliver Giudice, and Sebastiano Battiato. 2023. Level up the deepfake detection: a method to effectively discriminate images generated by GAN architectures and diffusion models. CoRR, abs/2303.00608.
206
+
207
+ David Guera and Edward J. Delp. 2018. Deepfake video detection using recurrent neural networks. In 15th IEEE International Conference on Advanced Video and Signal Based Surveillance, AVSS 2018, Auckland, New Zealand, November 27-30, 2018, pages 1–6. IEEE.
208
+
209
+ Wenzhong Guo, Jianwen Wang, and Shiping Wang. 2019. Deep multimodal representation learning: A survey. IEEE Access, 7:63373–63394.
210
+
211
+ Zhijiang Guo, Michael Schlichtkrull, and Andreas Vlachos. 2022. A survey on automated fact-checking. Transactions of the Association for Computational Linguistics, 10:178–206.
212
+
213
+ Aditi Gupta, Hemank Lamba, Ponnurangam Kumaraguru, and Anupam Joshi. 2013. Faking sandy: characterizing and identifying fake images on twitter during hurricane sandy. In 22nd International World Wide Web Conference, WWW ’13, Rio de Janeiro, Brazil, May 13-17, 2013, Companion Volume, pages 729–736. International World Wide Web Conferences Steering Committee / ACM.
214
+
215
+ Ashim Gupta and Vivek Srikumar. 2021. X-fact: A new benchmark dataset for multilingual fact checking. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 2: Short Papers), pages 675–682, Online. Association for Computational Linguistics.
216
+
217
+ Vipin Gupta, Rina Kumari, Nischal Ashok, Tirthankar Ghosal, and Asif Ekbal. 2022. MMM: an emotion and novelty-aware approach for multilingual multimodal misinformation detection. In Findings of the Association for Computational Linguistics: AACLIJCNLP 2022, Online only, November 20-23, 2022, pages 464–477. Association for Computational Linguistics.
218
+
219
+ Michael Hameleers, Thomas E Powell, Toni GLA Van Der Meer, and Lieke Bos. 2020. A picture paints a thousand lies? the effects and mechanisms of multimodal disinformation and rebuttals disseminated via social media. Political Communication, 37(2):281– 301.
220
+
221
+ Hicham Hammouchi and Mounir Ghogho. 2022. Evidence-aware multilingual fake news detection. IEEE Access, 10:116808–116818.
222
+
223
+ Naeemul Hassan, Bill Adair, James T Hamilton, Chengkai Li, Mark Tremayne, Jun Yang, and Cong Yu. 2015a. The quest to automate fact-checking. In Proceedings of the 2015 computation $^ +$ journalism symposium. Citeseer.
224
+
225
+ Naeemul Hassan, Chengkai Li, and Mark Tremayne. 2015b. Detecting check-worthy factual claims in presidential debates. In Proceedings of the 24th ACM International Conference on Information and Knowledge Management, CIKM 2015, Melbourne, VIC, Australia, October 19 - 23, 2015, pages 1835–1838. ACM.
226
+
227
+ Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. 2017. Mask r-cnn. In 2017 IEEE International Conference on Computer Vision (ICCV), pages 2980–2988.
228
+
229
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. 2016. Deep residual learning for image recognition. In 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 770–778.
230
+
231
+ Silvan Heller, Luca Rossetto, and Heiko Schuldt. 2018. The ps-battles dataset - an image collection for image manipulation detection. CoRR, abs/1804.04866.
232
+
233
+ Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural Comput., 9(8):1735–1780.
234
+
235
+ Rui Hou, Verónica Pérez-Rosas, Stacy L. Loeb, and Rada Mihalcea. 2019. Towards automatic detection of misinformation in online medical videos. In International Conference on Multimodal Interaction, ICMI 2019, Suzhou, China, October 14-18, 2019, pages 235–243. ACM.
236
+
237
+ Xuming Hu, Zhijiang Guo, Junzhe Chen, Lijie Wen, and Philip S. Yu. 2023. MR2: A benchmark for multimodal retrieval-augmented rumor detection in social media. In Proceedings of the 46th International ACM SIGIR Conference on Research and Development in Information Retrieval, SIGIR 2023, Taipei, Taiwan, July 23-27, 2023, pages 2901–2912. ACM.
238
+
239
+ Minyoung Huh, Andrew Liu, Andrew Owens, and Alexei A. Efros. 2018. Fighting fake news: Image splice detection via learned self-consistency. In Computer Vision - ECCV 2018 - 15th European Conference, Munich, Germany, September 8-14, 2018, Proceedings, Part XI, volume 11215 of Lecture Notes in Computer Science, pages 106–124. Springer.
240
+
241
+ Cherilyn Ireton and Julie Posetti. 2018. Journalism, fake news & disinformation: handbook for journalism education and training. Unesco Publishing.
242
+
243
+ Omar Ismael Al-Sanjary, Ahmed Abdullah Ahmed, and Ghazali Sulong. 2016. Development of a video tampering dataset for forensic investigation. Forensic Science International, 266:565–572.
244
+
245
+ Ayush Jaiswal, Ekraam Sabir, Wael Abd-Almageed, and Premkumar Natarajan. 2017. Multimedia semantic integrity assessment using joint embedding of images and text. In Proceedings of the 2017 ACM on Multimedia Conference, MM 2017, Mountain View, CA, USA, October 23-27, 2017, pages 1465–1471. ACM.
246
+
247
+ Liming Jiang, Ren Li, Wayne Wu, Chen Qian, and Chen Change Loy. 2020. Deeperforensics-1.0: A large-scale dataset for real-world face forgery detection. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pages 2886–2895. Computer Vision Foundation / IEEE.
248
+
249
+ Zhijing Jin, Abhinav Lalwani, Tejas Vaidhya, Xiaoyu Shen, Yiwen Ding, Zhiheng Lyu, Mrinmaya Sachan, Rada Mihalcea, and Bernhard Schoelkopf. 2022. Logical fallacy detection. In Findings of the Association for Computational Linguistics: EMNLP 2022, pages 7180–7198, Abu Dhabi, United Arab Emirates. Association for Computational Linguistics.
250
+
251
+ Zhiwei Jin, Juan Cao, Han Guo, Yongdong Zhang, and Jiebo Luo. 2017. Multimodal fusion with recurrent neural networks for rumor detection on microblogs. In Proceedings of the 2017 ACM on Multimedia Conference, MM 2017, Mountain View, CA, USA, October 23-27, 2017, pages 795–816. ACM.
252
+
253
+ Marvin Kalb and Carol Saivetz. 2007. The israeli—hezbollah war of 2006: The media as a weapon in asymmetrical conflict. Harvard International Journal of Press/Politics, 12(3):43–66.
254
+
255
+ Manvi Kamboj, Christian Hessler, Priyanka Asnani, Kais Riani, and Mohamed Abouelenien. 2021. Multimodal political deception detection. IEEE Multim., 28(1):94–102.
256
+
257
+ Tero Karras, Samuli Laine, and Timo Aila. 2019. A style-based generator architecture for generative adversarial networks. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pages 4401– 4410. Computer Vision Foundation / IEEE.
258
+
259
+ Hasam Khalid, Shahroz Tariq, Minha Kim, and Simon S. Woo. 2021. Fakeavceleb: A novel audio-video multimodal deepfake dataset. In Proceedings of the Neural Information Processing Systems Track on Datasets and Benchmarks 1, NeurIPS Datasets and Benchmarks 2021, December 2021, virtual.
260
+
261
+ Dhruv Khattar, Jaipal Singh Goud, Manish Gupta, and Vasudeva Varma. 2019. MVAE: multimodal variational autoencoder for fake news detection. In The World Wide Web Conference, WWW 2019, San Francisco, CA, USA, May 13-17, 2019, pages 2915–2921. ACM.
262
+
263
+ Diederik P. Kingma and Max Welling. 2014. Autoencoding variational bayes. In 2nd International Conference on Learning Representations, ICLR 2014, Banff, AB, Canada, April 14-16, 2014, Conference Track Proceedings.
264
+
265
+ Tomi Kinnunen, Md. Sahidullah, Héctor Delgado, Massimiliano Todisco, Nicholas W. D. Evans, Junichi Yamagishi, and Kong-Aik Lee. 2017. The asvspoof 2017 challenge: Assessing the limits of replay spoofing attack detection. In Interspeech 2017, 18th Annual Conference of the International Speech Communication Association, Stockholm, Sweden, August 20-24, 2017, pages 2–6. ISCA.
266
+
267
+ Thomas N. Kipf and Max Welling. 2017. Semisupervised classification with graph convolutional networks. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net.
268
+
269
+ Daniel Kopev, Ahmed Ali, Ivan Koychev, and Preslav Nakov. 2019. Detecting deception in political debates using acoustic and textual features. In IEEE Automatic Speech Recognition and Understanding Workshop, ASRU 2019, Singapore, December 14-18, 2019, pages 652–659. IEEE.
270
+
271
+ Neema Kotonya and Francesca Toni. 2020a. Explainable automated fact-checking: A survey. In Proceedings of the 28th International Conference on Computational Linguistics, pages 5430–5443, Barcelona, Spain (Online). International Committee on Computational Linguistics.
272
+
273
+ Neema Kotonya and Francesca Toni. 2020b. Explainable automated fact-checking for public health claims. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 7740–7754, Online. Association for Computational Linguistics.
274
+
275
+ Ziyi Kou, Daniel Yue Zhang, Lanyu Shang, and Dong Wang. 2020. Exfaux: A weakly supervised approach to explainable fauxtography detection. In 2020 IEEE International Conference on Big Data (IEEE BigData 2020), Atlanta, GA, USA, December 10-13, 2020, pages 631–636. IEEE.
276
+
277
+ Patrick Kwon, Jaeseong You, Gyuhyeon Nam, Sungwoo Park, and Gyeongsu Chae. 2021. Kodf: A largescale korean deepfake detection dataset. In 2021 IEEE/CVF International Conference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021, pages 10724–10733. IEEE.
278
+
279
+ Tuan-Vinh La, Quang-Tien Tran, Thanh-Phuc Tran, Anh-Duy Tran, Duc-Tien Dang-Nguyen, and MinhSon Dao. 2022. Multimodal cheapfakes detection by utilizing image captioning for global context. In ICDAR@ICMR 2022: Proceedings of the 3rd ACM Workshop on Intelligent Cross-Data Analysis and Retrieval, Newark, NJ, USA, June 27 - 30, 2022, pages 9–16. ACM.
280
+
281
+ Claire Lauer. 2009. Contending with terms: “multimodal” and “multimedia” in the academic and public spheres. Computers and Composition, 26(4):225– 239.
282
+
283
+ Galina Lavrentyeva, Sergey Novoselov, Marina Volkova, Yuri Matveev, and Maria De Marsico. 2019. Phonespoof: A new dataset for spoofing attack detection in telephone channel. In IEEE International Conference on Acoustics, Speech and Signal Processing, ICASSP 2019, Brighton, United Kingdom, May 12- 17, 2019, pages 2572–2576. IEEE.
284
+
285
+ Kenton Lee, Mandar Joshi, Iulia Turc, Hexiang Hu, Fangyu Liu, Julian Eisenschlos, Urvashi Khandelwal, Peter Shaw, Ming-Wei Chang, and Kristina Toutanova. 2022. Pix2struct: Screenshot parsing as pretraining for visual language understanding. CoRR, abs/2210.03347.
286
+
287
+ Stephan Lewandowsky, John Cook, and Doug Lombardi. 2020. Debunking Handbook 2020.
288
+
289
+ Manling Li, Alireza Zareian, Qi Zeng, Spencer Whitehead, Di Lu, Heng Ji, and Shih-Fu Chang. 2020a. Cross-media structured common space for multimedia event extraction. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 2557–2568, Online. Association for Computational Linguistics.
290
+
291
+ Yiyi Li and Ying Xie. 2020. Is a picture worth a thousand words? an empirical study of image content and social media engagement. Journal of Marketing Research, 57(1):1–19.
292
+
293
+ Yuezun Li, Xin Yang, Pu Sun, Honggang Qi, and Siwei Lyu. 2020b. Celeb-df: A large-scale challenging dataset for deepfake forensics. In 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition, CVPR 2020, Seattle, WA, USA, June 13-19, 2020, pages 3204–3213. Computer Vision Foundation / IEEE.
294
+
295
+ Paul Pu Liang, Amir Zadeh, and Louis-Philippe Morency. 2022. Foundations and recent trends in multimodal machine learning: Principles, challenges, and open questions. CoRR, abs/2209.03430.
296
+
297
+ Ying Lin, Heng Ji, Fei Huang, and Lingfei Wu. 2020. A joint neural model for information extraction with global features. In Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, pages 7999–8009, Online. Association for Computational Linguistics.
298
+
299
+ Fangyu Liu, Emanuele Bugliarello, Edoardo Maria Ponti, Siva Reddy, Nigel Collier, and Desmond Elliott. 2021. Visually grounded reasoning across languages and cultures. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 10467–10485, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
300
+
301
+ Fuxiao Liu, Yaser Yacoob, and Abhinav Shrivastava. 2023a. COVID-VTS: fact extraction and verification on short video platforms. In Proceedings of the 17th Conference of the European Chapter of the Association for Computational Linguistics, EACL 2023, Dubrovnik, Croatia, May 2-6, 2023, pages 178–188. Association for Computational Linguistics.
302
+
303
+ Hui Liu, Wenya Wang, and Haoliang Li. 2023b. Interpretable multimodal misinformation detection with logic reasoning. In Findings of the Association for Computational Linguistics: ACL 2023, Toronto, Canada, July 9-14, 2023, pages 9781–9796. Association for Computational Linguistics.
304
+
305
+ Vítor Lourenço and Aline Paes. 2022. A modality-level explainable framework for misinformation checking in social networks. CoRR, abs/2212.04272.
306
+
307
+ Grace Luo, Trevor Darrell, and Anna Rohrbach. 2021. NewsCLIPpings: Automatic Generation of Out-ofContext Multimodal Media. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 6801–6817, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
308
+
309
+ Marie-Helen Maras and Alex Alexandrou. 2019. Determining authenticity of video evidence in the age of artificial intelligence and in the wake of deepfake videos. The International Journal of Evidence & Proof, 23(3):255–262.
310
+
311
+ Alexandre Maros, Jussara M. Almeida, and Marisa Vasconcelos. 2021. A study of misinformation in audio messages shared in whatsapp groups. In Disinformation in Open Online Media - Third Multidisciplinary International Symposium, MISDOOM 2021, Virtual Event, September 21-22, 2021, Proceedings, volume 12887 of Lecture Notes in Computer Science, pages 85–100. Springer.
312
+
313
+ Priyanka Meel and Dinesh Kumar Vishwakarma. 2021. Han, image captioning, and forensics ensemble multimodal fake news detection. Information Sciences, 567:23–41.
314
+
315
+ Tomás Mikolov, Kai Chen, Greg Corrado, and Jeffrey Dean. 2013. Efficient estimation of word representations in vector space. In 1st International Conference on Learning Representations, ICLR 2013, Scottsdale, Arizona, USA, May 2-4, 2013, Workshop Track Proceedings.
316
+
317
+ Shreyash Mishra, Suryavardan S, Amrit Bhaskar, Parul Chopra, Aishwarya N. Reganti, Parth Patwa, Amitava Das, Tanmoy Chakraborty, Amit P. Sheth, and Asif Ekbal. 2022. FACTIFY: A multi-modal fact verification dataset. In Proceedings of the Workshop on Multi-Modal Fake News and Hate-Speech Detection (DE-FACTIFY 2022) co-located with the Thirty-Sixth AAAI Conference on Artificial Intelligence ( AAAI 2022), Virtual Event, Vancouver, Canada, February 27, 2022, volume 3199 of CEUR Workshop Proceedings. CEUR-WS.org.
318
+
319
+ Eric Müller-Budack, Jonas Theiner, Sebastian Diering, Maximilian Idahl, and Ralph Ewerth. 2020. Multimodal analytics for real-world news using measures of cross-modal entity consistency. In Proceedings of the 2020 on International Conference on Multimedia Retrieval, ICMR 2020, Dublin, Ireland, June 8-11, 2020, pages 16–25. ACM.
320
+
321
+ Kai Nakamura, Sharon Levy, and William Yang Wang. 2020. Fakeddit: A new multimodal benchmark dataset for fine-grained fake news detection. In Proceedings of The 12th Language Resources and Evaluation Conference, LREC 2020, Marseille, France, May 11-16, 2020, pages 6149–6157. European Language Resources Association.
322
+
323
+ Preslav Nakov, Alberto Barrón-Cedeño, Tamer Elsayed, Reem Suwaileh, Lluís Màrquez, Wajdi Zaghouani, Pepa Atanasova, Spas Kyuchukov, and Giovanni Da San Martino. 2018. Overview of the CLEF2018 checkthat! lab on automatic identification and verification of political claims. In Experimental IR Meets Multilinguality, Multimodality, and Interaction - 9th International Conference of the CLEF Association, CLEF 2018, Avignon, France, September 10-14, 2018, Proceedings, volume 11018 of Lecture Notes in Computer Science, pages 372–387. Springer.
324
+
325
+ Preslav Nakov, David P. A. Corney, Maram Hasanain, Firoj Alam, Tamer Elsayed, Alberto Barrón-Cedeño, Paolo Papotti, Shaden Shaar, and Giovanni Da San Martino. 2021. Automated fact-checking for assisting human fact-checkers. In Proceedings of the Thirtieth International Joint Conference on Artificial Intelligence, IJCAI 2021, Virtual Event / Montreal, Canada, 19-27 August 2021, pages 4551–4558. ijcai.org.
326
+
327
+ Kartik Narayan, Harsh Agarwal, Kartik Thakral, Surbhi Mittal, Mayank Vatsa, and Richa Singh. 2023. Dfplatter: Multi-face heterogeneous deepfake dataset. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 9739–9748.
328
+
329
+ Eryn Newman and Lynn Zhang. 2020. Truthiness: How Non-Probative Photos Shape Belief .
330
+
331
+ Eryn J Newman, Maryanne Garry, Daniel M Bernstein, Justin Kantner, and D Stephen Lindsay. 2012. Nonprobative photographs (or words) inflate truthiness. Psychonomic Bulletin & Review, 19(5):969–974.
332
+
333
+ Matthew L Newman, James W Pennebaker, Diane S Berry, and Jane M Richards. 2003. Lying words: Predicting deception from linguistic styles. Personality and social psychology bulletin, 29(5):665–675.
334
+
335
+ Dan Saattrup Nielsen and Ryan McConville. 2022. Mumin: A large-scale multilingual multimodal factchecked misinformation social network dataset. In SIGIR ’22: The 45th International ACM SIGIR Conference on Research and Development in Information Retrieval, Madrid, Spain, July 11 - 15, 2022, pages 3141–3153. ACM.
336
+
337
+ Yuval Nirkin, Yosi Keller, and Tal Hassner. 2019. FSGAN: subject agnostic face swapping and reenactment. In 2019 IEEE/CVF International Conference on Computer Vision, ICCV 2019, Seoul, Korea (South), October 27 - November 2, 2019, pages 7183–7192. IEEE.
338
+
339
+ Britt Paris and Joan Donovan. 2019. Deepfakes and cheap fakes. United States of America: Data & Society, 1.
340
+
341
+ Parth Patwa, Shreyash Mishra, Suryavardan S, Amrit Bhaskar, Parul Chopra, Aishwarya Reganti, Amitava Das, Tanmoy Chakraborty, Amit Sheth, Asif Ekbal, and Chaitanya Ahuja. 2022. Benchmarking multimodal entailment for fact verification.
342
+
343
+ Verónica Pérez-Rosas, Mohamed Abouelenien, Rada Mihalcea, and Mihai Burzo. 2015. Deception detection using real-life trial data. In Proceedings of the 2015 ACM on International Conference on Multimodal Interaction, Seattle, WA, USA, November 09 - 13, 2015, pages 59–66. ACM.
344
+
345
+ Tarunima Prabhakar, Anushree Gupta, Kruttika Nadig, and Denny George. 2021. Check mate: Prioritizing user generated multi-media content for fact-checking. In Proceedings of the Fifteenth International AAAI Conference on Web and Social Media, ICWSM 2021, held virtually, June 7-10, 2021, pages 1025–1033. AAAI Press.
346
+
347
+ Christian Nathaniel Purwanto, Joan Santoso, Po-Ruey Lei, Hui-Kuo Yang, and Wen-Chih Peng. 2021. Fakeclip: Multimodal fake caption detection with mixed languages for explainable visualization. In 2021 International Conference on Technologies and Applications of Artificial Intelligence, TAAI 2021, Taichung, Taiwan, November 18-20, 2021, pages 1–6. IEEE.
348
+
349
+ Peng Qi, Yuyan Bu, Juan Cao, Wei Ji, Ruihao Shui, Junbin Xiao, Danding Wang, and Tat-Seng Chua. 2022. Fakesv: A multimodal benchmark with rich social context for fake news detection on short video platforms. CoRR, abs/2211.10973.
350
+
351
+ Peng Qi, Juan Cao, Tianyun Yang, Junbo Guo, and Jintao Li. 2019. Exploiting multi-domain visual information for fake news detection. In 2019 IEEE International Conference on Data Mining, ICDM 2019, Beijing, China, November 8-11, 2019, pages 518–527. IEEE.
352
+
353
+ Peng Qi, Yuyang Zhao, Yufeng Shen, Wei Ji, Juan Cao, and Tat-Seng Chua. 2023. Two heads are better than one: Improving fake news video detection by correlating with neighbors. In Findings of the Association for Computational Linguistics: ACL 2023, Toronto, Canada, July 9-14, 2023, pages 11947–11959. Association for Computational Linguistics.
354
+
355
+ Shengsheng Qian, Jinguang Wang, Jun Hu, Quan Fang, and Changsheng Xu. 2021. Hierarchical multi-modal contextual attention network for fake news detection. In Proceedings of the 44th International ACM SIGIR Conference on Research and Development in Information Retrieval, pages 153–162.
356
+
357
+ Jingnong Qu, Liunian Harold Li, Jieyu Zhao, Sunipa Dev, and Kai-Wei Chang. 2022a. Disinfomeme: A multimodal dataset for detecting meme intentionally spreading out disinformation. CoRR, abs/2205.12617.
358
+
359
+ Jingnong Qu, Liunian Harold Li, Jieyu Zhao, Sunipa Dev, and Kai-Wei Chang. 2022b. Disinfomeme: A multimodal dataset for detecting meme intentionally spreading out disinformation. CoRR, abs/2205.12617.
360
+
361
+ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. 2021. Learning transferable visual models from natural language supervision. In Proceedings of the 38th International Conference on Machine Learning, ICML 2021, 18-24 July 2021, Virtual Event, volume 139 of Proceedings of Machine Learning Research, pages 8748–8763. PMLR.
362
+
363
+ Ricardo Reimao and Vassilios Tzerpos. 2019. For: A dataset for synthetic speech detection. In 2019 International Conference on Speech Technology and Human-Computer Dialogue, SpeD 2019, Timisoara, Romania, October 10-12, 2019, pages 1–10. IEEE.
364
+
365
+ Gustavo Resende, Philipe F. Melo, Hugo Sousa, Johnnatan Messias, Marisa Vasconcelos, Jussara M. Almeida, and Fabrício Benevenuto. 2019. (mis)information dissemination in whatsapp: Gathering, analyzing and countermeasures. In The World Wide Web Conference, WWW 2019, San Francisco, CA, USA, May 13-17, 2019, pages 818–828. ACM.
366
+
367
+ Jonas Ricker, Simon Damm, Thorsten Holz, and Asja Fischer. 2022. Towards the detection of diffusion model deepfakes. CoRR, abs/2210.14571.
368
+
369
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. 2022. Highresolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on
370
+
371
+ Computer Vision and Pattern Recognition (CVPR), pages 10684–10695.
372
+
373
+ Andreas Rössler, Davide Cozzolino, Luisa Verdoliva, Christian Riess, Justus Thies, and Matthias Nießner. 2018. Faceforensics: A large-scale video dataset for forgery detection in human faces. CoRR, abs/1803.09179.
374
+
375
+ Arjun Roy and Asif Ekbal. 2021. Mulcob-mulfav: Multimodal content based multilingual fact verification. In International Joint Conference on Neural Networks, IJCNN 2021, Shenzhen, China, July 18-22, 2021, pages 1–8. IEEE.
376
+
377
+ Sebastian Ruder, Ivan Vulic, and Anders Søgaard. ´ 2022. Square one bias in NLP: Towards a multidimensional exploration of the research manifold. In Findings of the Association for Computational Linguistics: ACL 2022, pages 2340–2354, Dublin, Ireland. Association for Computational Linguistics.
378
+
379
+ Ekraam Sabir, Wael AbdAlmageed, Yue Wu, and Prem Natarajan. 2018. Deep multimodal imagerepurposing detection. In 2018 ACM Multimedia Conference on Multimedia Conference, MM 2018, Seoul, Republic of Korea, October 22-26, 2018, pages 1337–1345. ACM.
380
+
381
+ Ekraam Sabir, Jiaxin Cheng, Ayush Jaiswal, Wael AbdAlmageed, Iacopo Masi, and Prem Natarajan. 2019. Recurrent convolutional strategies for face manipulation detection in videos. In IEEE Conference on Computer Vision and Pattern Recognition Workshops, CVPR Workshops 2019, Long Beach, CA, USA, June 16-20, 2019, pages 80–87. Computer Vision Foundation / IEEE.
382
+
383
+ Michael Sejr Schlichtkrull, Zhijiang Guo, and Andreas Vlachos. 2023. Averitec: A dataset for real-world claim verification with evidence from the web. CoRR, abs/2305.13117.
384
+
385
+ Gautam Kishore Shahi and Durgesh Nandini. 2020. Fakecovid- A multilingual cross-domain fact check news dataset for COVID-19. In Workshop Proceedings of the 14th International AAAI Conference on Web and Social Media, ICWSM 2020 Workshops, Atlanta, Georgia, USA [virtual], June 8, 2020.
386
+
387
+ Lanyu Shang, Ziyi Kou, Yang Zhang, and Dong Wang. 2021. A multimodal misinformation detector for COVID-19 short videos on tiktok. In 2021 IEEE International Conference on Big Data (Big Data), Orlando, FL, USA, December 15-18, 2021, pages 899–908. IEEE.
388
+
389
+ Lanyu Shang, Ziyi Kou, Yang Zhang, and Dong Wang. 2022. A duo-generative approach to explainable multimodal COVID-19 misinformation detection. In WWW ’22: The ACM Web Conference 2022, Virtual Event, Lyon, France, April 25 - 29, 2022, pages 3623– 3631. ACM.
390
+
391
+ Rui Shao, Tianxing Wu, and Ziwei Liu. 2023. Detecting and grounding multi-modal media manipulation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pages 6904–6913.
392
+
393
+ Craig Silverman. 2013. Verification handbook.
394
+
395
+ Karen Simonyan and Andrew Zisserman. 2015. Very deep convolutional networks for large-scale image recognition. In 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings.
396
+
397
+ Shivangi Singhal, Rajiv Ratn Shah, and Ponnurangam Kumaraguru. 2022. Factdrill: A data repository of fact-checked social media content to study fake news incidents in india. In Proceedings of the Sixteenth International AAAI Conference on Web and Social Media, ICWSM 2022, Atlanta, Georgia, USA, June 6-9, 2022, pages 1322–1331. AAAI Press.
398
+
399
+ Tiening Sun, Zhong Qian, Peifeng Li, and Qiaoming Zhu. 2023. Graph interactive network with adaptive gradient for multi-modal rumor detection. In Proceedings of the 2023 ACM International Conference on Multimedia Retrieval, ICMR 2023, Thessaloniki, Greece, June 12-15, 2023, pages 316–324. ACM.
400
+
401
+ S. Suryavardan, Shreyash Mishra, Megha Chakraborty, Parth Patwa, Anku Rani, Aman Chadha, Aishwarya Reganti, Amitava Das, Amit P. Sheth, Manoj Chinnakotla, Asif Ekbal, and Srijan Kumar. 2023a. Findings of factify 2: Multimodal fake news detection. CoRR, abs/2307.10475.
402
+
403
+ S Suryavardan, Shreyash Mishra, Parth Patwa, Megha Chakraborty, Anku Rani, Aishwarya Reganti, Aman Chadha, Amitava Das, Amit P. Sheth, Manoj Chinnakotla, Asif Ekbal, and Srijan Kumar. 2023b. Factify 2: A multimodal fake news and satire news dataset. CoRR, abs/2304.03897.
404
+
405
+ Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. 2015. Going deeper with convolutions. In 2015 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pages 1–9.
406
+
407
+ Reuben Tan, Bryan A. Plummer, and Kate Saenko. 2020. Detecting cross-modal inconsistency to defend against neural fake news. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing, EMNLP 2020, Online, November 16-20, 2020, pages 2081–2106. Association for Computational Linguistics.
408
+
409
+ Vidhu Tanwar and Kapil Sharma. 2020. Multi-model fake news detection based on concatenation of visual latent features. In 2020 International Conference on Communication and Signal Processing (ICCSP), pages 1344–1348.
410
+
411
+ James Thorne and Andreas Vlachos. 2018. Automated fact checking: Task formulations, methods and future directions. In Proceedings of the 27th International Conference on Computational Linguistics, pages 3346–3359, Santa Fe, New Mexico, USA. Association for Computational Linguistics.
412
+
413
+ 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), pages 1– 9, Brussels, Belgium. Association for Computational Linguistics.
414
+
415
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. 2017. Attention is all you need. In Advances in Neural Information Processing Systems 30: Annual Conference on Neural Information Processing Systems 2017, December 4-9, 2017, Long Beach, CA, USA, pages 5998–6008.
416
+
417
+ Junke Wang, Zuxuan Wu, Wenhao Ouyang, Xintong Han, Jingjing Chen, Yu-Gang Jiang, and Ser-Nam Li. 2022. M2TR: multi-modal multi-scale transformers for deepfake detection. In ICMR ’22: International Conference on Multimedia Retrieval, Newark, NJ, USA, June 27 - 30, 2022, pages 615–623. ACM.
418
+
419
+ Run Wang, Felix Juefei-Xu, Yihao Huang, Qing Guo, Xiaofei Xie, Lei Ma, and Yang Liu. 2020. Deepsonar: Towards effective and robust detection of ai-synthesized fake voices. In MM ’20: The 28th ACM International Conference on Multimedia, Virtual Event / Seattle, WA, USA, October 12-16, 2020, pages 1207–1216. ACM.
420
+
421
+ Yaqing Wang, Fenglong Ma, Zhiwei Jin, Ye Yuan, Guangxu Xun, Kishlay Jha, Lu Su, and Jing Gao. 2018. EANN: event adversarial neural networks for multi-modal fake news detection. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, KDD 2018, London, UK, August 19-23, 2018, pages 849–857. ACM.
422
+
423
+ Deressa Wodajo and Solomon Atnafu. 2021. Deepfake video detection using convolutional vision transformer. CoRR, abs/2102.11126.
424
+
425
+ Haiwei Wu, Jiantao Zhou, and Shile Zhang. 2023a. Generalizable synthetic image detection via languageguided contrastive learning. CoRR, abs/2305.13800.
426
+
427
+ Xiaoshuai Wu, Xin Liao, and Bo Ou. 2023b. Sepmark: Deep separable watermarking for unified source tracing and deepfake detection. CoRR, abs/2305.06321.
428
+
429
+ Yang Wu, Pengwei Zhan, Yunjian Zhang, Liming Wang, and Zhen Xu. 2021. Multimodal fusion with coattention networks for fake news detection. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 2560–2569, Online. Association for Computational Linguistics.
430
+
431
+ Yue Wu, Wael AbdAlmageed, and Premkumar Natarajan. 2019. Mantra-net: Manipulation tracing network for detection and localization of image forgeries with anomalous features. In IEEE Conference on Computer Vision and Pattern Recognition, CVPR 2019, Long Beach, CA, USA, June 16-20, 2019, pages 9543– 9552. Computer Vision Foundation / IEEE.
432
+
433
+ Zhizheng Wu, Tomi Kinnunen, Nicholas W. D. Evans, Junichi Yamagishi, Cemal Hanilçi, Md. Sahidullah, and Aleksandr Sizov. 2015. Asvspoof 2015: the first automatic speaker verification spoofing and countermeasures challenge. In INTERSPEECH 2015, 16th Annual Conference of the International Speech Communication Association, Dresden, Germany, September 6-10, 2015, pages 2037–2041. ISCA.
434
+
435
+ Barry Menglong Yao, Aditya Shah, Lichao Sun, Jin-Hee Cho, and Lifu Huang. 2022. End-to-end multimodal fact-checking and explanation generation: A challenging dataset and models. CoRR, abs/2205.12487.
436
+
437
+ Jiangyan Yi, Ye Bai, Jianhua Tao, Haoxin Ma, Zhengkun Tian, Chenglong Wang, Tao Wang, and Ruibo Fu. 2021. Half-truth: A partially fake audio detection dataset. In Interspeech 2021, 22nd Annual Conference of the International Speech Communication Association, Brno, Czechia, 30 August - 3 September 2021, pages 1654–1658. ISCA.
438
+
439
+ Egor Zakharov, Aliaksandra Shysheya, Egor Burkov, and Victor S. Lempitsky. 2019. Few-shot adversarial learning of realistic neural talking head models. In 2019 IEEE/CVF International Conference on Computer Vision, ICCV 2019, Seoul, Korea (South), October 27 - November 2, 2019, pages 9458–9467. IEEE.
440
+
441
+ Markos Zampoglou, Symeon Papadopoulos, and Yiannis Kompatsiaris. 2015. Detecting image splicing in the wild (WEB). In 2015 IEEE International Conference on Multimedia & Expo Workshops, ICME Workshops 2015, Turin, Italy, June 29 - July 3, 2015, pages 1–6. IEEE Computer Society.
442
+
443
+ Xia Zeng, Amani S. Abumansour, and Arkaitz Zubiaga. 2021. Automated fact-checking: A survey. Lang. Linguistics Compass, 15(10).
444
+
445
+ Daniel Yue Zhang, Lanyu Shang, Biao Geng, Shuyue Lai, Ke Li, Hongmin Zhu, Md. Tanvir Al Amin, and Dong Wang. 2018. Fauxbuster: A content-free fauxtography detector using social media comments. In IEEE International Conference on Big Data (IEEE BigData 2018), Seattle, WA, USA, December 10-13, 2018, pages 891–900. IEEE.
446
+
447
+ Yizhou Zhang, Loc Trinh, Defu Cao, Zijun Cui, and Yan Liu. 2023. Detecting out-of-context multimodal misinformation with interpretable neural-symbolic model. CoRR, abs/2304.07633.
448
+
449
+ Jiaqi Zheng, Xi Zhang, Sanchuan Guo, Quan Wang, Wenyu Zang, and Yongdong Zhang. 2022. MFAN: multi-modal feature-enhanced attention networks for rumor detection. In Proceedings of the Thirty-First
450
+
451
+ International Joint Conference on Artificial Intelligence, IJCAI 2022, Vienna, Austria, 23-29 July 2022, pages 2413–2419. ijcai.org.
452
+
453
+ Yinglin Zheng, Jianmin Bao, Dong Chen, Ming Zeng, and Fang Wen. 2021. Exploring temporal coherence for more general video face forgery detection. In 2021 IEEE/CVF International Conference on Computer Vision, ICCV 2021, Montreal, QC, Canada, October 10-17, 2021, pages 15024–15034. IEEE.
454
+
455
+ Peng Zhou, Xintong Han, Vlad I. Morariu, and Larry S. Davis. 2018. Learning rich features for image manipulation detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR).
456
+
457
+ Dimitrina Zlatkova, Preslav Nakov, and Ivan Koychev. 2019. Fact-checking meets fauxtography: Verifying claims about images. 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 2099–2108, Hong Kong, China. Association for Computational Linguistics.
458
+
459
+ Ruohan Zong, Yang Zhang, Lanyu Shang, and Dong Wang. 2023. Contrastfaux: Sparse semi-supervised fauxtography detection on the web using multi-view contrastive learning. In Proceedings of the ACM Web Conference 2023, WWW 2023, Austin, TX, USA, 30 April 2023 - 4 May 2023, pages 3994–4003. ACM.
460
+
461
+ # A Methodology
462
+
463
+ We applied the following methodological approach to find and select relevant research papers for the survey.
464
+
465
+ First, after defining the research scope, we collected pivotal, highly-cited work (e.g. Nakamura et al. (2020)) and related surveys (e.g. (Alam et al., 2022)), resulting in 25 papers, as well as papers citing or cited by these works. We collected further works using the scholarly search engines Google Scholar6, Semantic Scholar7, DBLP8 and ACL Anthology9, and keyword-based search with Cartesian products of following keyword sets: {“fact checking”, “fact verification”, “misinformation”, “disinformation”, “fake news”}, {“multimodal”, “text”, “image”, “audio”, “video”}, and {“machine learning”, “automated”}. The databases were queried primarily during the time frame July 26, 2022 and August 10, 2022. This step resulted in a collection of 123 papers.
466
+
467
+ ![](images/ab32e685d021e58a42c7b290caa5c99a2e3a211307e24ba6f38bae607af338bd.jpg)
468
+ Figure 3: Example from the FaceForensic video manipulation dataset (Rössler et al., 2018) showing the manipulation generation approach.
469
+
470
+ ![](images/50ef9db26a39b5989b61ba41964cfaed0dac09f4db972418a839689da5dcea5a.jpg)
471
+ Figure 4: An entry from the MAIM dataset (Jaiswal et al., 2017) showing an image/text claim with metadata.
472
+
473
+ We manually screened and filtered the papers based on abstracts and introduction sections, before creating an overview of papers across the following dimensions: (1) modality; (2) fact-checking task; (3) contribution type (i.e. dataset, modeling approach, demo); (4) paper type (i.e. survey, position paper, solution paper (e.g. introducing a new benchmark or modeling approach), or evaluation paper (e.g. investigating previously proposed approaches)). Papers were mostly excluded because they focused on other tasks than fact-checking (e.g. hate speech detection) or used modalities out of our scope (e.g. tables). Moreover, during the screening process we found and added further related works, and concluded the screening with 84 unique papers.
474
+
475
+ The taxonomy of tasks (Section 2) was created in an iterative manner starting with the task labels we assigned to works during screening. As a starting point we also used taxonomies of text-only factchecking surveys (Guo et al., 2022; Thorne and Vlachos, 2018) and adapted them for multimodal fact-checking works.
476
+
477
+ B Examples: multimodal misinformation
478
+
479
+ ![](images/ac04a265a92a13ed7fe034d7f34cdd7e17ac534faa9c2f1d312224f9a2aa6565.jpg)
480
+ Figure 5: An entry from the Factify dataset (Suryavardan et al., 2023b) depicting an image/text claim and supporting image/text evidence document.
481
+
482
+ ![](images/9c19e009cf8216685dd4b9e070437db2c9171f139234c868e7f0d1719c4ae9f2.jpg)
483
+ Figure 6: Left a misleading, right a non-misleading video screenshot from the Shang et al. (2021) dataset on COVID-19 TikTok Short Videos.
md/dev/gmL46YMpu2J/gmL46YMpu2J.md ADDED
@@ -0,0 +1,410 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PROMPTAGATOR FEW-SHOT DENSE RETRIEVAL FROM 8 EXAMPLES
2
+
3
+ Zhuyun Dai∗†, Vincent Y. Zhao∗†, Ji $\mathbf { M } \mathbf { a } ^ { * \dagger }$ , Yi Luan∗†, Jianmo Ni, Jing Lu, Anton Bakalov,
4
+ Kelvin Guu, Keith B. Hall and Ming-Wei Chang†
5
+ Google Research
6
+ {zhuyundai, vzhao, maji, luanyi, mingweichang}@google.com
7
+ ∗equal contributions †corresponding authors
8
+
9
+ # ABSTRACT
10
+
11
+ Much recent research on information retrieval has focused on how to transfer from one task (typically with abundant supervised data) to various other retrieval tasks where supervision is limited, with the implicit assumption that it is possible to generalize from one task to all the rest. However, this overlooks the fact that there are many diverse and unique retrieval problems, each targeting different search intents, queries, and search domains. In this paper, we suggest to work on Few-shot Dense Retrieval, a setting where each task comes with a short description and a few examples. To address this, we introduce Prompt-based Query Generation for Retrieval (PROMPTAGATOR ): for each task, we feed the few-shot examples to a large language model (LLM) and prompt it to behave as a task-specific query generator. Using this, we can synthetically generate a large number of relevant queries for any document, yielding abundant data for training task-specific retrievers — with no reliance on traditional resources such as Natural Questions (Kwiatkowski et al., 2019) or MS MARCO (Nguyen et al., 2016). Surprisingly, PROMPTAGATOR using only 8 annotated examples enables efficient dual encoder retrievers to outperform computationally more expensive models trained on MS MARCO such as ColBERT v2 (Santhanam et al., 2022) by more than 1.2 points $\mathrm { n D C G } @ 1 0$ on average on 11 retrieval sets. Further training standard-size rerankers using the same generated data yields another 5.0 points $\mathrm { n D C G } @ 1 0$ improvement. Our studies show that synthetic query generation can be far more effective than previously observed, especially when a small amount of task-specific knowledge is given.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Significant progress has been made on neural retrieval models such as dual encoders, which can search over a large collection of documents containing millions to billions of passages (Yih et al., 2011; Lee et al., 2019; Karpukhin et al., 2020). However, Thakur et al. (2021) recently proposed the BEIR heterogeneous retrieval benchmark, and showed that it is still difficult for neural retrievers to perform well on a wide variety of retrieval tasks that lack dedicated training data. To address this problem, many previous approaches focus on transferring knowledge from high-resource question answering (QA) datasets such as MS MARCO (Nguyen et al., 2016), and propose architectures that possess good inductive biases, such as models that allow fine-grained token-level interaction (e.g., ColBERT (Khattab & Zaharia, 2020; Santhanam et al., 2022) and SPLADE (Formal et al., 2021)) which often come with higher inference cost. Data augmentation via synthetic query generation has previously been explored (Ma et al., 2021; Shakeri et al., 2020), but these question generators are learned from high-resource QA datasets, and often cannot generalize well to new retrieval tasks.
16
+
17
+ We argue that it is hard to anticipate models based on one or two QA datasets to perform well across all retrieval tasks. First, different retrieval tasks have very different search intents; in other words, different definitions of “relevance”. For example, consider Figure 1(a): both DbpediaEntity (Hasibi et al., 2017) and FEVER (Thorne et al., 2018) are tasks to retrieve documents from Wikipedia. However, Dbpedia-Entity is a task to retrieve entities that are mentioned in the query, while FEVER is a task to find evidence that either supports or refutes a given statement. Which document is relevant to the query can be very different from one task to another task even if they share the same domain. Moreover, different tasks have distinct distributions of queries even when their search intents are similar. For example, queries in HotpotQA (Yang et al., 2018) are long compositional questions, while queries in FiQA (Maia et al., 2018) are short financial questions.
18
+
19
+ ![](images/ee0c43785d29c1f62b49c195278b442952aaf7a8f03a8a4f888a0e81832b1f12.jpg)
20
+ Figure 1: Few-shot retrieval with PROMPTAGATOR. Left (a): Retrieval tasks from BEIR differ in query distribution, retrieval corpus, and search intents. Middle (b): Most prior work uses supervised setting (2) which trains model on a large QA retrieval datasets and transfer to other retrieval tasks. Right (c): Few-shot PROMPTAGATOR performance. Average nDCG $@ 1 0$ on 11 datasets from BEIR from our PROMPTAGATOR models and previously MS MARCO-supervised models (SPLADE v2).
21
+
22
+ Motivated by these observations, we advocate to work on the setting of Few-shot Retrieval for diverse retrieval tasks (§2), where each task comes with a short description and a few annotated examples to clearly illustrate the search intent. To address this challenge, we propose Prompt-based Query Generation for Retrieval (PROMPTAGATOR) (§3): for each new retrieval task, we feed the few-shot examples to a large language model (LLM) such as FLAN1 (Wei et al., 2022a) and prompt it to perform doc-to-query generation. Importantly, the few-shot examples ensure that we capture the specific search intent of that task. Using this query generator, we can synthetically generate a large number of relevant queries for any document, yielding abundant data for training any retriever, including highly efficient dual encoder models.
23
+
24
+ We find that our few-shot LLM query generator can produce good queries without any fine-tuning (§3.1). In fact, as shown in Figure 1(b), our synthetically generated data is strong enough to completely forego using annotated query-document pairs from traditional high-resource datasets such as Natural Questions (Kwiatkowski et al., 2019) or MS MARCO (Nguyen et al., 2016).
25
+
26
+ While PROMPTAGATOR is not the first application of LLMs for retrieval, prior work did not explore task-specific few-shot adaptation, and often came with high inference cost. Neelakantan et al. (2022) proposes to use GPT-3 (Brown et al., 2020) in dual encoders. However, their embedding dimension is $1 2 \mathrm { k }$ , which makes the search index footprint and inference cost prohibitively high for many applications. Sachan et al. (2022) and Bonifacio et al. (2022) prompt LLMs for question generation, but did not explore the idea of using task-specific few-shot prompts for rapid task adaptation.2 They also focus primarily on models that rerank top retrievals from an existing retriever, rather than directly adapting the underlying retriever which must efficiently search over millions or billions of documents.
27
+
28
+ To summarize, the contributions of the paper are as follows:
29
+
30
+ • We highlight previously overlooked differences across retrieval tasks (e.g., search intent and query distribution), and propose a Few-Shot Retrieval evaluation for the BEIR dataset. We propose PROMPTAGATOR, a simple recipe for few-shot retrieval by prompting an LLM to generate synthetic task-specific training data. For the first time, we can train fully neural retrievers and rerankers solely based on a few supervised examples. Our results show that, surprisingly, PROMPTAGATOR with two-to-eight examples produces significantly better retrievers than recent models trained on MS MARCO or NQ that have over 500k human annotated examples (Figure 1(c)) and utilize more expensive architectures: PROMPTAGATOR outperforms ColBERT v2 and SPLADE v2 on 11 retrieval tasks we tested, while reranking boosts results by another 5 points on standard retrieval evaluation metric.
31
+
32
+ # 2 FEW-SHOT RETRIEVAL TASK
33
+
34
+ In this section, we first introduce the definition of a few-shot retrieval task and discuss the differences among tasks. We then propose a new Few-Shot Retrieval setting for the BEIR benchmark.
35
+
36
+ # 2.1 RETRIEVAL TASK
37
+
38
+ Given a large corpus, a retrieval model is responsible for finding the documents that are most relevant to a provided query $q$ according to a pre-defined notion of relevance. Formally, a retrieval task is:
39
+
40
+ $$
41
+ T = \{ \mathcal { D } , \mathcal { Q } , \mathcal { Z } \} ,
42
+ $$
43
+
44
+ where $\mathcal { D } = \{ d _ { 1 } , d _ { 2 } , . . . , d _ { n } \}$ is a large corpus of documents for retrieval, $\mathcal { Q }$ is a query distribution, and $\mathcal { T }$ is the underlying search intent for the task. Depending on the task, $\mathcal { D }$ can be any document collection, such as the web or Wikipedia. $Q$ also varies across tasks, e.g., short keyword search queries, questions, arguments, etc. If $\textstyle { \mathcal { I } } ( q , d ) = 1$ , it means the search intent of $q$ has been satisfied by the document $d$ . For example, in a question answering task $\mathcal { T } _ { \mathrm { Q A } } ( q , d ) = 1$ if $d$ answers $q$ . For the same $( q , d )$ pair, relevance may be either 1 or 0 depending on the search intent. For example, some argument retrieval tasks only seek to retrieve supporting arguments, while others aim to retrieve counterarguments.
45
+
46
+ In this work, we assume a target retrieval corpus $\mathcal { D } _ { \mathcal { T } }$ is given, but the amount of annotated querydocument pairs for the new task is limited. Most prior research efforts focused on adapting retrievers to a new corpus $\mathcal { D } _ { \mathcal { T } }$ , but didn’t fully account for divergence in queries $\mathcal { Q } _ { T }$ or intents $\mathcal { T } _ { T }$ . Next, we explore how a search intent can be expressed with a short description and very few examples.
47
+
48
+ # 2.2 FEW-SHOT BEIR SETTING
49
+
50
+ Intuitively, a person can understand a retrieval task by reading a short prompt and going over a few examples. In this work, we ask if a few (8 or fewer) examples are sufficient to learn a task-specific retriever. To facilitate our study and future research on few-shot retrieval, we define a new few-shot retrieval evaluation built upon the BEIR heterogeneous retrieval benchmark (Thakur et al., 2021).
51
+
52
+ BEIR has 18 information retrieval datasets across 9 domains, including Bio-Medical, Finance, News, Twitter, Wikipedia, StackExchange, Quora, Scientific, and Misc. These datasets also cover a diverse range of search intents: QA retrieval (question-to-document), duplicate question discovery (questionto-question), fact checking (claim-to-document), etc. Following Santhanam et al. (2022) and Formal et al. (2021), we narrow our focus to the publicly-available datasets in BEIR. The original BEIR evaluation used a zero-shot setup, where no queries or relevant query-document pairs from the evaluation datasets can be used for training.
53
+
54
+ We relax BEIR to the few-shot setting by randomly taking a few (2 to 8) in-domain relevant querydocument examples as task-specific supervision — in realistic applications, this number of examples is almost always possible to obtain. The examples are sampled from the development set when it is available. For BEIR tasks which only have a test set, we use samples from the test data. To be fair when evaluating our models, we always mark these test-set examples as ‘failed‘: we remove the documents from our retrieved results when computing metrics, even if they are correctly retrieved (the worst possible outcome). The prompts and few-shot examples will be released to the public.
55
+
56
+ # 3 PROMPTAGATOR
57
+
58
+ The key idea of PROMPTAGATOR is to transform a few examples into many more examples by prompting an LLM to generate more data, instead of using them to train a retriever directly.
59
+
60
+ PROMPTAGATOR consists of three components: prompt-based query generation, consistency filtering, and retriever training. During prompt-based query generation, a task-specific prompt will be combined with a large language model to produce relevant queries for all documents in $\mathcal { D } _ { T }$ . Then, a filtering step cleans the generated data based on round-trip consistency. Surprisingly, we found that a retriever trained only on our synthetic data can be used to filter the synthetic data. Finally, a retriever (in this paper, dual encoders) and a cross attention reranker are trained based on the filtered data. Figure 5 in Appendix shows the overall procedure.
61
+
62
+ # 3.1 PROMPT-BASED QUERY GENERATION
63
+
64
+ In this first step, we feed our task-specific few-shot examples into a large language model (LLM) and prompt it to perform document-to-query generation. More precisely, let $\{ ( q _ { i } , - d _ { i } ) \bar \} ^ { k }$ be the $k$ few-shot examples, where each example is a query $( q _ { i } \sim \mathcal { Q } _ { T } )$ and a document relevant to that query $( d _ { i } \in \mathcal { D } _ { T }$ ) according to the target task $T$ $( \mathbb { Z } _ { T } ( q _ { i } , d _ { i } ) = 1 )$ ).
65
+
66
+ ollowing FLAN (Wei et al., 2022a), we instruction-prompt the LLM with the following string prefix:
67
+
68
+ $$
69
+ e _ { d o c } ( d _ { i } ) \diamond e _ { q u e r y } ( q _ { 1 } ) \diamond . . . \diamond e _ { d o c } ( d _ { k } ) \diamond e _ { q u e r y } ( q _ { k } ) \diamond e _ { d o c } ( d ) ,
70
+ $$
71
+
72
+ where $\diamond$ is a separator token, $e _ { d o c } ( d )$ and $e _ { q u e r y } ( q )$ are task-specific document and query descriptions respectively, and $d$ is a new document presented at inference time. Using the ArguAna task as an example, we set $e _ { d o c } ( d ) = \mathrm { \ " { s } ~ } \mathrm { \bar { s } ~ } _ { \mathrm { \bar { d } r g u m e n t : } } \left\{ \mathrm { \Omega } \right.$ $\{ d \}$ ” and $e _ { q u e r y } =$ “Counter Argument: $\{ { q \} } ^ { , }$ to inform the LLM to generate counterarguments 3. The LLM is expected to generate $e _ { q u e r y } ( \hat { q } )$ . We consider it a generation failure if the query description does not precede the actual query; otherwise, we accept $\hat { q }$ and form a synthetic relevant example $( \hat { q } , d )$ .
73
+
74
+ Running the prompt on all documents from $\mathcal { D } _ { T }$ , we obtain a large set of synthetic $( \hat { q } , d )$ examples, amplifying the information from a few examples into a large synthetic dataset whose query distribution is similar to the true task distribution $\mathcal { Q } _ { T }$ and whose query-document pairs convey the true search intent $\mathcal { I } _ { T }$ . This form of few-shot data extrapolation is similar to Lee et al. (2021).
75
+
76
+ We use FLAN (Wei et al., 2022a) as our LLM, and refer to our query generator as $p _ { \mathrm { F L A N } } ( q | d )$ . FLAN is trained on a collection of tasks described via instructions and was shown to have good zero/few-shot performance on unseen tasks. We use the 137B parameter checkpoint. During prompt engineering, we use at most 8 examples, and reduce the number if they exceed the input length limit of FLAN. We also manually truncate individual queries and documents in the examples if they are too long. We randomly sample up to 1 million documents from each corpus and generate 8 questions per document using sampling-based decoding with temperature 0.7.
77
+
78
+ # 3.2 ROUND-TRIP FILTERING GENERATED DATA
79
+
80
+ We employ round-trip filtering (Alberti et al., 2019; Lewis et al., 2021) to improve the quality of our synthetic data. The main intuition is that for any synthetic query $\hat { q }$ generated from passage $d$ , a good $\hat { q }$ should also retrieve its original passage $d$ . In other words, the original $d$ should have high probability under some retriever, $p ( d | \hat { q } )$ (the reverse direction of query generation). If not, then we filter out $\hat { q }$ .
81
+
82
+ Round-trip filtering has been very effective for synthetic question generation on QA tasks. However, these techniques typically rely on a question-answering model for the reverse direction filter. Since not all retrieval tasks resemble question-answering, this will not suffice in our setting.
83
+
84
+ Instead, we train an initial retriever from the unfiltered synthetic data, and then use it to filter the synthetic data. This works surprisingly well over the different search intents observed in BEIR. More precisely, given a synthetic query-document pair $( \hat { q } , d )$ , we use the initial retriever to predict the most relevant passages for $\hat { q }$ . We keep $\hat { q }$ only when $d$ occurs among the Top- $K$ passages returned by the retriever. We show this filter substantially reduces the number of synthetic queries and significantly improves retrieval performance. In Appendix F, we provide more insight into why this can work by viewing our synthetic queries as latent variables.
85
+
86
+ # 3.3 FEW-SHOT PROMPTAGATOR RETRIEVER
87
+
88
+ Our synthetically generated data allows training task-specific neutral retrievers for tasks where indomain fine-tuning is challenging due to data scarcity. In this work, we use a standard dual encoder retrieval architecture and we propose a simple pretrain-finetune recipe.
89
+
90
+ We pretrain our retriever on C4 with the independent cropping task from Contriever (Izacard et al., 2022a), where we treat two random crops from the same document as an artificial positive (query, document) pair and train with a cross-entropy loss over in-batch random negatives. Next, we fine-tune the dual encoder on $( \hat { q } , d )$ pairs from our prompt-based query generation, again with in-batch random negatives. After training for a set number of epochs, we apply round-trip filtering on our synthetic
91
+
92
+ <table><tr><td rowspan="2"></td><td colspan="2">Training Recipe</td><td colspan="4">Retrieval Architecture</td><td>QGen</td></tr><tr><td>Retrieval Supervision</td><td>Cross-Attn Distillation</td><td>Retriever</td><td>Token-level Retrieval</td><td>#Reranking Doc.</td><td>Serving Model Size</td><td>Model</td></tr><tr><td>Contriever</td><td>NA</td><td></td><td>self</td><td></td><td></td><td>110M</td><td></td></tr><tr><td>GTR-XXL</td><td>MS MARCO (500K)</td><td></td><td>self</td><td></td><td></td><td>6B</td><td></td></tr><tr><td>Splade v2</td><td>MS MARCO (500K)</td><td>//vv</td><td>self</td><td>√</td><td></td><td>110M</td><td></td></tr><tr><td>ColBERT v2</td><td>MS MARCO (500K)</td><td></td><td>self</td><td>√</td><td></td><td>110M</td><td></td></tr><tr><td>GenQ</td><td>MS MARCO (500K)</td><td></td><td>self</td><td></td><td></td><td>110M</td><td>T5 (MS MARCO)</td></tr><tr><td>GPL</td><td>MS MARCO (500K)</td><td></td><td>self</td><td></td><td></td><td>110M</td><td>T5 (MS MARCO)</td></tr><tr><td>MonoT5</td><td>MS MARCO (500K)</td><td></td><td>BM25</td><td>√</td><td>1000</td><td>3B</td><td></td></tr><tr><td>InPars</td><td>Few (3 from MS MARCO)</td><td></td><td>BM25</td><td>√</td><td>1000</td><td>3B</td><td>GPT-3</td></tr><tr><td>UPR</td><td>NA</td><td></td><td>Contriever</td><td></td><td>1000</td><td>110M+3B</td><td>T0*</td></tr><tr><td>PROMPTAGATOR</td><td>Few (0-8)</td><td></td><td>self</td><td></td><td></td><td>110M</td><td>FLAN</td></tr><tr><td>PROMPTAGATOR++</td><td>Few (0-8)</td><td></td><td>PROMPTAGATOR</td><td></td><td>200</td><td>110M+125M</td><td>FLAN</td></tr></table>
93
+
94
+ Table 1: Comparison of different retrieval frameworks. Our serving models are just a 110M-size dual encoder PROMPTAGATOR and a 125M-size reranker PROMPTAGAT $\mathrm { \Phi _ { O R + + } }$ , as good quality generated data allows simple models/pipeline to achieve strong performance.4 InPars’s few-shot examples are from MS MARCO and is task-independent. See text for more details for UPR’s QGen model5.
95
+
96
+ data as described in $\ S 3 . 2$ using this initial dual encoder, and then continue to fine-tune the dual encoder on the filtered data.
97
+
98
+ We also propose PROMPTAGATOR $^ { + + }$ , a reranker trained on the same synthetic data generated from our prompt-based QGen, which refines the retrieved candidates using a slower but more accurate cross-attention model. We train the reranker using a cross-entropy loss with 31 sampled negatives from top 200 passages retrieved by the PROMPTAGATOR retriever, which approximates the inference time distribution (reranking top 200 from the retriever).
99
+
100
+ Zero-shot PROMPTAGATOR Our prompt-based query generation can run in a zero-shot manner, where we universally apply the following prompt irrespective of the target task: ’{d} Read the passage and generate a query.’. Here {d} denotes the document text. Training retrievers and rerankers on this data leads to zero-shot PROMPTAGATOR and zero-shot PROMPTAGATOR $^ { + + }$ . This recipe serves as a baseline to show the benefits of adapting the few-shot prompt to the target task.
101
+
102
+ # 3.4 COMPARISON WITH PRIOR METHODS
103
+
104
+ Table 1 compares the setting of PROMPTAGATOR to some recently proposed approaches. Several dimensions of our recipe are simpler: our dual encoder does not employ hard negative mining, distillation from a cross-attention teacher or token-level retrieval. Also, our 125M parameter reranker is smaller than most other rerankers. We aim to show that even simpler and smaller architectures can achieve excellent results if trained with synthetic data that has been few-shot adapted $( \ S 4 . 3 )$ . Compared to InPars (Bonifacio et al., 2022) and UPR (Sachan et al., 2022), our approach employs task-specific few-shot adaption, while InPars and UPR’s prompts are task-independent and thus bear the same limitation of previous query generation approach (Ma et al., 2021; Wang et al., 2022). Another key difference is that prior works focused on reranking, while we enable few-shot learning for both reranking and retrieval.
105
+
106
+ # 4 EXPERIMENTS
107
+
108
+ We evaluate PROMPTAGATOR on the BEIR benchmark. We then dive deeper into the results through ablation studies and qualitative analysis.
109
+
110
+ # 4.1 IMPLEMENTATION
111
+
112
+ The original FLAN training set overlapped with 2 datasets in BEIR: NQ and Quora6. Most existing systems use MS MARCO for fully supervised learning and therefore do not report few or zeroshot results on MS MARCO. Therefore we exclude MS MARCO, NQ and Quora from our main evaluations. We report $\mathrm { n D C G } @ 1 0$ , the standard retrieval evaluation metric on BEIR.
113
+
114
+ Table 2: Main Results. $\mathrm { n D C G } @ 1 0$ on BEIR. Retriever Comparisons (Upper Half): Among the various kind of retrievers, both zero-shot and few-shot PROMPTAGATOR produce strong results. Retriever+Reranker Comparisons (Lower Half): In the scenario where speed is not a concern, reranker is often used. We train PROMPTAGATOR $^ { + + }$ use the same generated data and get significant improvement. See text for more details for Climate-FEVER and Webis-Touché2020.
115
+
116
+ <table><tr><td></td><td>arg</td><td>touché</td><td>covid</td><td>nfc</td><td>hotpot</td><td>dbp</td><td>climate</td><td>fever</td><td>scifact</td><td>scidocs</td><td>fiqa</td><td>AVG.</td></tr><tr><td colspan="10"></td><td></td><td></td><td></td><td></td></tr><tr><td>Unsupervised</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>BM25</td><td>31.5</td><td>36.7</td><td>65.6</td><td>32.5</td><td>60.3</td><td>31.3</td><td>21.3</td><td></td><td>75.3</td><td>66.5</td><td>15.8</td><td>23.6</td><td>41.8</td></tr><tr><td>Contriever</td><td>37.9</td><td>19.3</td><td></td><td>27.4</td><td>31.7 48.1</td><td>29.2</td><td></td><td>15.5</td><td>68.2</td><td>64.9</td><td>14.9</td><td>24.5</td><td>34.7</td></tr><tr><td colspan="10">Supervised by MS MARCO</td><td></td><td>16.1</td><td></td><td></td></tr><tr><td>GTR-XXL</td><td>54.0</td><td>25.6</td><td>50.1</td><td>34.2</td><td>59.9</td><td>40.8</td><td>26.7</td><td>74.0</td><td>66.2</td><td></td><td></td><td>46.7</td><td>44.9</td></tr><tr><td>SPLADE v2</td><td>47.9</td><td>27.2</td><td>71.0</td><td>33.4</td><td>68.4</td><td>43.5</td><td>23.5</td><td></td><td>78.6</td><td>69.3</td><td>15.8</td><td>33.6</td><td>46.6</td></tr><tr><td>ColBERTv2</td><td>46.3</td><td>26.3</td><td>73.8</td><td>33.8</td><td>66.7</td><td>44.6</td><td>17.6</td><td></td><td>78.5</td><td>69.3</td><td>15.4</td><td>35.6</td><td>46.2</td></tr><tr><td>GenQ</td><td>49.3</td><td>18.2</td><td>61.9 70.0</td><td>31.9</td><td>53.4</td><td>32.8</td><td></td><td>17.5</td><td>66.9</td><td>64.4</td><td>14.3</td><td>30.8</td><td>40.1</td></tr><tr><td>GPL</td><td>55.7</td><td>25.5</td><td></td><td>34.5</td><td>58.2</td><td>38.4</td><td></td><td>23.5</td><td>75.9</td><td>67.4</td><td>16.9</td><td>34.4</td><td>45.5</td></tr><tr><td colspan="10">PROMPTAGATOR (110M)</td><td></td><td></td><td></td><td></td></tr><tr><td>Zero-shot</td><td>53.8</td><td>26.6</td><td>72.7</td><td>33.4</td><td>60.4</td><td>36.4</td><td>21.4</td><td>76.2</td><td></td><td>62.3</td><td>16.3</td><td>40.4</td><td>45.5</td></tr><tr><td>Few-shot</td><td>59.4</td><td>34.5</td><td>75.6</td><td>33.4</td><td>61.4</td><td>38.0</td><td>16.8 (24.0*)</td><td></td><td>77.0</td><td>65.0</td><td>18.4</td><td>46.2</td><td>47.8</td></tr><tr><td colspan="10">Retriever+ Reranker</td><td></td><td></td><td></td><td></td></tr><tr><td colspan="10">Unsupervised</td><td></td><td></td><td></td><td></td></tr><tr><td>UPR (3B) InPars (3B)</td><td>50.3</td><td>21.3</td><td></td><td>60.4 33.3</td><td>72.2</td><td>33.8</td><td>9.5</td><td></td><td>57.3 1</td><td>69.6</td><td>17.3</td><td>45.0</td><td>42.7</td></tr><tr><td></td><td></td><td>1</td><td>78.4</td><td></td><td></td><td>1</td><td>1</td><td></td><td></td><td></td><td>1</td><td>1</td><td>1</td></tr><tr><td colspan="10">Supervised by MS MARCO</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>monoT5 (220M)</td><td>13.2</td><td>27.7</td><td>77.8</td><td>35.7</td><td>69.5</td><td>41.9</td><td>24.5</td><td></td><td>80.2</td><td>73.6</td><td>16.5</td><td>41.4</td><td>45.6</td></tr><tr><td>monoT5 (3B)</td><td>28.8</td><td>20.0</td><td>79.5</td><td>38.4</td><td>75.9</td><td>47.8</td><td>28.0</td><td></td><td>85.0</td><td>77.7</td><td>19.7</td><td>51.4</td><td>51.1</td></tr><tr><td colspan="10">PROMPTAGATOR++(110M+ 125M)</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Zero-shot</td><td>52.1</td><td>27.8</td><td>76.0</td><td>36.0</td><td>71.2</td><td>41.3</td><td>22.6</td><td></td><td>83.8 86.6</td><td>73.2 73.1</td><td>19.1 20.1</td><td>45.9</td><td>49.9</td></tr><tr><td>Few-shot</td><td>63.0</td><td>38.1</td><td>76.2</td><td>37.0</td><td>73.6</td><td>43.4</td><td>20.3 (24.1*)</td><td></td><td></td><td></td><td></td><td>49.4</td><td>52.8</td></tr></table>
117
+
118
+ For PROMPTAGATOR’s query generation, we sample questions from FLAN with a temperature of 0.7. For round-trip filtering, we find that setting filtering threshold $K$ to 1 gives the best results on MS MARCO and thus use 1 for all BEIR datasets, We implement PROMPTAGATOR’s dual encoders following GTR (Ni et al., 2021).To ensure efficiency, we use the T5-base encoder architecture consisting of 110M parameters. For PROMPTAGATOR $^ { + + }$ reranking models, we initialize from a T5- base version 1.1 encoder checkpoint which has 125M parameters . More details of the reranker implementation can be found in Appendix C. At inference time, we rerank the top 200 candidates retrieved from the PROMPTAGATOR dual encoder.
119
+
120
+ We mostly follow the hyperparameters used in Ni et al. (2021). By default, we use batch size 6k; however, some of the corpora in BEIR contain only a few thousand documents, making multiple relevant documents appear in the same batch, which interacts negatively with our in-batch softmax loss. To address this issue, we split all datasets into three groups based on corpus size: small $( < 5 0 \mathrm { k } )$ , medium $( 5 0 \mathbf { k } { - } 5 0 0 \mathbf { k } )$ and large $( > 5 0 0 \mathrm { k } )$ . For dual encoder training, we use 128 batch size for small datasets and 6k for others. We finetune for 5k steps for large datasets and 1k for others. For ranking models, we use batch size 64 for all datasets and finetune large datasets for $2 0 \mathrm { k }$ steps, $5 \mathrm { k }$ for others.
121
+
122
+ # 4.2 MAIN RESULTS
123
+
124
+ Table 2 shows the experimental results. We first notice that zero-shot PROMPTAGATOR already serves as a strong baseline, comparing favorably to other retrieval baselines trained on $\mathcal { O } ( 1 0 0 \mathrm { K } )$ examples from MS MARCO. Nonetheless, few-shot PROMPTAGATOR markedly improves upon zeroshot PROMPTAGATOR, increasing average nDCG $@ 1 0$ by over 2 points, which highlights the impact of few-shot learning. Few-shot PROMPTAGATOR, despite having a simple training procedure and model architecture, outperforms strong baselines such as GenQ (Thakur et al., 2021) and GPL (Wang et al., 2022) which also use query generation to augment training data, as well as ColBERT v2 (Santhanam et al., 2022) and SPLADE v2 (Formal et al., 2021) which rely on token level interaction architectures and distillation recipes.
125
+
126
+ ![](images/8fd7de3bf06be111ea0a3c358116bf0648d406528f07ae2fda10ca3417e0c05f.jpg)
127
+ Figure 2: Left (a). Delta in $\mathrm { n D C G } @ 1 0$ between few-shot PROMPTAGATOR with and without filtering. Middle (b): Comparing the effect of the generated data versus the number of supervised data on MS MARCO. PROMPTAGATOR with 8 examples can catch up with 50k labeled examples, when simple dual encoders are used. Right (c): Ablation on query generation model. GenQ is a prior system from Thakur et al. (2021), while NQ-QGen is our in-house NQ-trained T5 query generation model. Other than the generated data, NQ-QGen and PROMPTAGATOR uses the same hyper parameters.
128
+
129
+ Our reranker PROMPTAGATOR $^ { + + }$ boosts performance by another 5 points on nDCG $@ 1 0$ . It significantly outperforms UPR (Sachan et al., 2022) whose reranker uses T0 (Sanh et al., 2022), an instruction tuned LLM similar to FLAN. It also outperforms monoT5-3B (Nogueira et al., 2020), which achieved previous state-of-the-art reranking performance on BEIR in a recent study (Rosa et al., 2022). Note that most of these reranker approaches use a large 3B parameter model for better generalization, while PROMPTAGATOR $^ { + + }$ uses a standard $1 2 5 \mathbf { M }$ reranker.
130
+
131
+ Comparing few-shot PROMPTAGATOR to baselines, the biggest improvement is on Webis-Touché2020 (touché), followed by ArguAna (arg) . Webis-Touché2020’s goal is to retrieve documents for a controversial topic, e.g., “should felons who have completed their sentence be allowed to vote?”. ArguAna’s goal is to find the counter-arguments that oppose the input argument, and the input arguments are often several-sentence long. Both tasks are extremely different from traditional QA retrieval data that other models use, which are dominated by factoid questions. On the other hand, few-shot PROMPTAGATOR can successfully adapt to this task with a few examples.
132
+
133
+ # 4.3 ANALYSIS
134
+
135
+ Impact of round-trip filtering. In Figure 2(a), we show quality differences between few-shot PROMPTAGATOR with and without filtering. Filtering improves performance on 8 out of 11 datasets and leads to 2.5 points improvement on average, demonstrating the effectiveness of our filtering strategy. Nonetheless, filtering hurts model quality on NFCorpus and SciFact. These are the smallest datasets in terms of generated queries and may indicate overfitting of our retrievers.
136
+
137
+ We find that the majority of filtered examples are either queries that are too generic that match many documents, or queries that contain additional terms that are irrelevant to the document. Examples are in Fig. 6 in the Appendix. There are also cases where high quality data was incorrectly removed. We suspect that designing dynamic filtering thresholds would help, and leave it to future exploration.
138
+
139
+ Can generated queries replace human annotated queries? In Figure 2(b), we evaluate 8-shot PROMPTAGATOR on MS MARCO, comparing it against dual encoders trained on MS MARCO’s supervised data. Note that we did not add other components, to make the comparison simple. We chose MS MARCO as there are enough labeled data for this task and neither FLAN nor our models are trained on MS MARCO examples. The results show that eight examples plus an LLM can replace a significant portion of supervised examples.
140
+
141
+ How does PROMPTAGATOR compare to other query generation approaches? Figure 2(c) compares zero-shot PROMPTAGATOR to two other query generation approaches: GenQ is prior system from Thakur et al. (2021) using a MS MARCO trained T5 query generation model, and NQ-QGen is our in-house T5 QGen model finetuned on NQ. The figure shows the advantages of zero-shot PROMPTAGATOR, outperforming both baselines by large margins. Importantly, NQ-QGen uses the same filtering, dual-encoder training, batch sizes and training steps as PROMPTAGATOR, providing a faircomparison of query generators. This indicates that the main contributing factor to PROMPTAGATOR is better queries from prompting an LLM, not the specific training recipe or hyperparameters.
142
+
143
+ <table><tr><td></td><td>arg</td><td>touche</td><td>covid</td><td>nfc</td><td>hotpot</td><td>dbp</td><td>climate</td><td>fever</td><td>scifact</td><td>scidocs</td><td>fiqa</td><td>AVG.</td></tr><tr><td>FLAN original</td><td>59.4</td><td>34.5</td><td>75.6</td><td>33.4</td><td>61.4</td><td>38.0</td><td>(24.0*)</td><td>77.0</td><td>65.0</td><td>18.4</td><td>46.2</td><td>48.5</td></tr><tr><td>FLAN w/o NQ and Quora</td><td>58.8</td><td>33.3</td><td>70.2</td><td>33.7</td><td>61.7</td><td>34.4</td><td>(23.5*)</td><td>76.2</td><td>63.8</td><td>18.3</td><td>43.0</td><td>47.0</td></tr></table>
144
+
145
+ ![](images/6b0deda12c0ebe78b5a86065c0e4184c528a916a77041c1ebe8bcd8119ad8c08.jpg)
146
+ Table 3: Impact of different FLAN versions. This study uses Fever prompt for Climate Fever (§4.3)
147
+ Figure 3: Top first word distribution on queries generated from different models in the ArguAna dataset. Left (a)(b)(c): Compare gold queries (a) and generated queries (b)(c). Queries generated by few-shot models has closer distribution to the gold queries, while the NQ-QGen queries are mostly questions. Right (d): The few shot FLAN can generate diverse queries even though there are only 4 examples in the prompt. Statistics of more datasets are available in the Appendix (Figure 4).
148
+
149
+ Does few-shot always improve over zero-shot? As shown in Table 2, few-shot PROMPTAGATOR almost always outperforms zero-shot PROMPTAGATOR except for Climate-FEVER. The original Climate-FEVER dataset uses one of three tags to annotate a query-document pair, namely “supports”, “refutes”, or “not enough info”. However, BEIR treats all these three annotations as relevant, which is problematic. Using query-document pairs annotated “not enough info” in our prompt could be detrimental to generation quality. Therefore, we tried switching to FEVER’s few-shot prompt, as the two datasets share same corpus and similar search intents. With the better annotated examples, few-shot PROMPTAGATOR indeed surpass zero-shot. This result provides some evidence that low quality few-shot examples negatively affect PROMPTAGATOR.
150
+
151
+ Impact of FLAN Versions FLAN was trained on a collection of datasets which have some overlap with BEIR; specifically, it includes Natural Questions (NQ) and Quora. It was not trained on querydocument pairs from NQ or Quora; however, in order to determine whether the inclusion of this data biased the results on the final retrieval evaluation, we designed an additional ablation experiment. Following the original FLAN recipe (Wei et al., 2022a), we trained an additional LLM excluding both the NQ and Quora datasets. Table 4 shows the results. While the accuracy drops slightly, the overall performance still outperform prior retrievers.
152
+
153
+ Qualitative Analysis In order to understand the advantages of few-shot PROMPTAGATOR, we analyze the distribution of queries generated by different query generation methods for ArguAna in Figure 3. To easily see the differences, for each distribution we plot the histogram of each query’s first word. Note that the distribution of few-shot PROMPTAGATOR (Fig. 3b) is much closer to the real distribution (Fig. 3a) while the NQ-QGen (Fig. 3c) mostly generated questions even when the queries in this task are generally arguments, not questions. More examples are showcased in Table 6 in the Appendix.
154
+
155
+ Use few-shot examples directly To study the effect of using the few-shot examples directly, we conduct a study of fine-tuning task-specific models using the GTR dual encoder (110M) (Ni et al., 2021) with the few-shot examples in appendix A. As expected, it does not provide a large amount of impact for GTR base, where the average nDCG decreases from 40.4 to 38.7.
156
+
157
+ # 5 RELATED WORK
158
+
159
+ Neural Retrieval and Reranking Models The majority of neural retrievers today employ a dual encoder architecture that encodes queries and documents independently into dense vectors and retrieves documents using maximum inner product search (MIPS). Recent research has primarily focused on the following aspects: developing better pre-training tasks (Lee et al., 2019; Chang et al., 2020; Izacard et al., 2022a; Gao & Callan, 2021; Oguz et al., 2022), improving contrastive negatives (Qu et al., 2021; Xiong et al., 2021; Lu et al., 2021), and improving generalization across different domains (Thakur et al., 2021; Ren et al., 2022).
160
+
161
+ Although dual encoders enable fast retrieval, their expressivity is limited due to the fact that their score is just a dot-product between a query vector and a document vector. A common solution is to use a cross-attention model to rerank retrieved candidates (Nogueira & Cho, 2019; Nogueira et al., 2020), as cross-attention rerankers can explicitly model the interaction between query and document tokens. Distilling cross-attention models into dual encoders has been effective in closing the gap between the two (Hofstätter et al., 2020; Ren et al., 2021; Reddi et al., 2021; Zhang et al., 2022).
162
+
163
+ Neural Retrieval with Fine-Grained Interactions An alternative for bridging dense retrievers and cross-attention models is to allow some amount of fine-grained query-document interactions in the retriever. Humeau et al. (2020) and Luan et al. (2021) represent and retrieve queries and documents with multiple vectors instead of a single vector. ColBERT (Khattab & Zaharia, 2020), COIL (Gao et al., 2021a) and SPLADE (Formal et al., 2021) take this further by using token-level interactions between queries and documents. Because these models are not just modeling a dot product, MIPS algorithms cannot be used directly. Hence, these models usually have much higher inference/serving cost compared to dual encoders.
164
+
165
+ Prompt-based Query Generation The idea of using prompted LLMs for query generation has previously been proposed for improving retrieval reranking. UPR (Sachan et al., 2022) proposed to use prompted LLMs to rerank passages directly. InPars (Bonifacio et al., 2022) is probably the most closely related work to ours. They proposed to use few-shot prompting with GPT-3 to generate synthetic data for training a T5-based reranker. Though InPars was tested on multiple retrieval datasets, they used a task-independent prompt constructed from MS MARCO and did not explore task-specific few-shot learning. They also focused exclusively on reranking, whereas we also address full-scale retrieval.
166
+
167
+ Few-shot Learning pre-trained LLMs have significantly advanced few-shot learning, thanks to prompting strategies such as in-context learning and instruction-prompting (Brown et al., 2020; Wei et al., 2022b). Some approaches fine-tune LLMs specifically for few-shot learning (Schick & Schütze, 2021a;b;c; Gao et al., 2021b; Logan IV et al., 2022; Izacard et al., 2022b) while others do not (Brown et al., 2020; Bonifacio et al., 2022). We use LLMs as few-shot data generators — this form of data augmentation via few-shot example extrapolation is similar to Lee et al. (2021).
168
+
169
+ # 6 CONCLUSION AND DISCUSSIONS
170
+
171
+ In this paper, we present PROMPTAGATOR, a novel approach to few-shot retrieval. We showed that it is possible to create task-specific retrievers and rerankers with only a few annotated examples. The few-shot examples, amplified by prompt-based LLM query generation, simplifies the complexity of training neural retrievers for new tasks and leads to promising performance gains. It hopefully inspires future research towards generalizable retrieval systems that can seamlessly and efficiently adapt to many tasks.
172
+
173
+ While we demonstrate that LLM-based query generation can be very effective, many questions remain. One of the key issue requiring further investigation is on the generated data efficiency. We have not yet explored exactly how many query-document pairs are needed for each task, or how to use these generated examples more efficiently. Another issue is the sensitivity of the final retriever’s performance with respect to the prompt. Finally, we would like to draw a connection from PROMPTAGATOR to distillation, as the final dual encoders indirectly “learn” from the LLM. Analyzing the headroom and understanding how we can better transfer knowledge from LLMs to retrievers would be a critical topic for the future.
174
+
175
+ As mentioned in $\ S 6$ , PROMPTAGATOR can be viewed as distilling LLM to standard-sized dual encoders via prompt-based query generation. While the distillation process is computationally expensive, it significantly reduces cost for inference.
176
+
177
+ # ACKNOWLEDGEMENTS
178
+
179
+ We thank Kenton Lee, Tom Kwiatkowski, and Daniel Gillick for technical discussion and providing feedback on our manuscript. We thank Alex Salcianu for developing a bulk inference pipeline for large language models.
180
+
181
+ # REFERENCES
182
+
183
+ Chris Alberti, Daniel Andor, Emily Pitler, Jacob Devlin, and Michael Collins. Synthetic QA corpora generation with roundtrip consistency. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 6168–6173, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1620. URL https://aclanthology. org/P19-1620.
184
+
185
+ Luiz Bonifacio, Hugo Abonizio, Marzieh Fadaee, and Rodrigo Nogueira. Inpars: Unsupervised dataset generation for information retrieval. In Proceedings of the 45th International ACM SIGIR Conference on Research and Development in Information Retrieval, SIGIR ’22, pp. 2387–2392, New York, NY, USA, 2022. Association for Computing Machinery. ISBN 9781450387323. doi: 10.1145/3477495.3531863. URL https://doi.org/10.1145/3477495.3531863.
186
+
187
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and 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.
188
+
189
+ Wei-Cheng Chang, Felix X. Yu, Yin-Wen Chang, Yiming Yang, and Sanjiv Kumar. Pre-training tasks for embedding-based large-scale retrieval. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $=$ rkg-mA4FDr.
190
+
191
+ A. P. Dempster, N. M. Laird, and D. B. Rubin. Maximum likelihood from incomplete data via the em algorithm. JOURNAL OF THE ROYAL STATISTICAL SOCIETY, SERIES B, 39(1):1–38, 1977.
192
+
193
+ Thibault Formal, Carlos Lassance, Benjamin Piwowarski, and Stéphane Clinchant. SPLADE v2: Sparse lexical and expansion model for information retrieval. CoRR, abs/2109.10086, 2021. URL https://arxiv.org/abs/2109.10086.
194
+
195
+ Luyu Gao and Jamie Callan. Condenser: a pre-training architecture for dense retrieval. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 981–993, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.75. URL https://aclanthology.org/ 2021.emnlp-main.75.
196
+
197
+ Luyu Gao, Zhuyun Dai, and Jamie Callan. COIL: Revisit exact lexical match in information retrieval with contextualized inverted list. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 3030–3042, Online, June 2021a. Association for Computational Linguistics. doi: 10.18653/v1/ 2021.naacl-main.241. URL https://aclanthology.org/2021.naacl-main.241.
198
+
199
+ Tianyu Gao, Adam Fisch, and Danqi Chen. Making pre-trained language models better few-shot learners. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 3816–3830, Online, August 2021b. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.295. URL https://aclanthology.org/2021.acl-long. 295.
200
+
201
+ Faegheh Hasibi, Fedor Nikolaev, Chenyan Xiong, Krisztian Balog, Svein Erik Bratsberg, Alexander Kotov, and Jamie Callan. Dbpedia-entity v2: A test collection for entity search. In Proceedings of the 40th International ACM SIGIR Conference on Research and Development in Information Retrieval, SIGIR ’17, pp. 1265–1268, New York, NY, USA, 2017. ISBN 9781450350228. URL https://doi.org/10.1145/3077136.3080751.
202
+
203
+ Sebastian Hofstätter, Sophia Althammer, Michael Schröder, Mete Sertkan, and Allan Hanbury. Improving efficient neural ranking models with cross-architecture knowledge distillation. $A r X i \nu$ , abs/2010.02666, 2020. URL https://arxiv.org/abs/2010.02666.
204
+
205
+ Samuel Humeau, Kurt Shuster, Marie-Anne Lachaux, and Jason Weston. Poly-encoders: Architectures and pre-training strategies for fast and accurate multi-sentence scoring. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. URL https://openreview.net/forum?id $=$ SkxgnnNFvH.
206
+
207
+ Gautier Izacard, Mathilde Caron, Lucas Hosseini, Sebastian Riedel, Piotr Bojanowski, Armand Joulin, and Edouard Grave. Unsupervised dense information retrieval with contrastive learning. Transactions on Machine Learning Research, 2022a. URL https://openreview.net/ forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ jKN1pXi7b0.
208
+
209
+ Gautier Izacard, Patrick Lewis, Maria Lomeli, Lucas Hosseini, Fabio Petroni, Timo Schick, Jane Dwivedi-Yu, Armand Joulin, Sebastian Riedel, and Edouard Grave. Few-shot learning with retrieval augmented language models, 2022b. URL https://arxiv.org/abs/2208.03299.
210
+
211
+ Vladimir Karpukhin, Barlas Oguz, Sewon Min, Patrick Lewis, Ledell Wu, Sergey Edunov, Danqi Chen, and Wen-tau Yih. Dense passage retrieval for open-domain question answering. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 6769–6781, Online, November 2020. Association for Computational Linguistics. doi: 10.18653/v1/ 2020.emnlp-main.550. URL https://aclanthology.org/2020.emnlp-main.550.
212
+
213
+ Omar Khattab and Matei Zaharia. ColBERT: Efficient and effective passage search via contextualized late interaction over BERT. In Jimmy Huang, Yi Chang, Xueqi Cheng, Jaap Kamps, Vanessa Murdock, Ji-Rong Wen, and Yiqun Liu (eds.), Proceedings of the 43rd International ACM SIGIR conference on research and development in Information Retrieval, SIGIR 2020, Virtual Event, China, July 25-30, 2020, pp. 39–48. ACM, 2020. doi: 10.1145/3397271.3401075. URL https: //doi.org/10.1145/3397271.3401075.
214
+
215
+ Tom Kwiatkowski, Jennimaria Palomaki, Olivia Redfield, Michael Collins, Ankur Parikh, Chris Alberti, Danielle Epstein, Illia Polosukhin, Jacob Devlin, Kenton Lee, Kristina Toutanova, Llion Jones, Matthew Kelcey, Ming-Wei Chang, Andrew M. Dai, Jakob Uszkoreit, Quoc Le, and Slav Petrov. Natural questions: A benchmark for question answering research. Transactions of the Association for Computational Linguistics, 7:452–466, March 2019. doi: 10.1162/tacl_a_00276. URL https://aclanthology.org/Q19-1026.
216
+
217
+ Kenton Lee, Ming-Wei Chang, and Kristina Toutanova. Latent retrieval for weakly supervised open domain question answering. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 6086–6096, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1612. URL https://aclanthology.org/P19-1612.
218
+
219
+ Kenton Lee, Kelvin Guu, Luheng He, Tim Dozat, and Hyung Won Chung. Neural data augmentation via example extrapolation. CoRR, abs/2102.01335, 2021. URL https://arxiv.org/abs/ 2102.01335.
220
+
221
+ Patrick Lewis, Yuxiang Wu, Linqing Liu, Pasquale Minervini, Heinrich Küttler, Aleksandra Piktus, Pontus Stenetorp, and Sebastian Riedel. PAQ: 65 million probably-asked questions and what you can do with them. Transactions of the Association for Computational Linguistics, 9:1098–1115, 2021. doi: 10.1162/tacl_a_00415. URL https://aclanthology.org/2021.tacl-1. 65.
222
+
223
+ Robert Logan IV, Ivana Balazevic, Eric Wallace, Fabio Petroni, Sameer Singh, and Sebastian Riedel. Cutting down on prompts and parameters: Simple few-shot learning with language models. In Findings of the Association for Computational Linguistics: ACL 2022, pp. 2824–2835, Dublin,
224
+
225
+ Ireland, May 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.findings-acl.
226
+ 222. URL https://aclanthology.org/2022.findings-acl.222.
227
+
228
+ Jing Lu, Gustavo Hernandez Abrego, Ji Ma, Jianmo Ni, and Yinfei Yang. Multi-stage training with improved negative contrast for neural passage retrieval. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 6091–6103, Online and Punta Cana, Dominican Republic, November 2021. Association for Computational Linguistics. doi: 10.18653/v1/ 2021.emnlp-main.492. URL https://aclanthology.org/2021.emnlp-main.492.
229
+
230
+ Yi Luan, Jacob Eisenstein, Kristina Toutanova, and Michael Collins. Sparse, Dense, and Attentional Representations for Text Retrieval. Transactions of the Association for Computational Linguistics, 9:329–345, 04 2021. doi: 10.1162/tacl_a_00369. URL https://doi.org/10.1162/ tacl_a_00369.
231
+
232
+ Ji Ma, Ivan Korotkov, Yinfei Yang, Keith Hall, and Ryan McDonald. Zero-shot neural passage retrieval via domain-targeted synthetic question generation. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pp. 1075–1088, Online, April 2021. Association for Computational Linguistics. doi: 10.18653/v1/ 2021.eacl-main.92. URL https://aclanthology.org/2021.eacl-main.92.
233
+
234
+ Macedo Maia, Siegfried Handschuh, André Freitas, Brian Davis, Ross McDermott, Manel Zarrouk, and Alexandra Balahur. Www’18 open challenge: financial opinion mining and question answering. In Companion proceedings of the the web conference 2018, pp. 1941–1942, 2018. URL https: //doi.org/10.1145/3184558.3192301.
235
+
236
+ Arvind Neelakantan, Tao Xu, Raul Puri, Alec Radford, Jesse Michael Han, Jerry Tworek, Qiming Yuan, Nikolas A. Tezak, Jong Wook Kim, Chris Hallacy, Johannes Heidecke, Pranav Shyam, Boris Power, Tyna Eloundou Nekoul, Girish Sastry, Gretchen Krueger, David P. Schnurr, Felipe Petroski Such, Kenny Sai-Kin Hsu, Madeleine Thompson, Tabarak Khan, Toki Sherbakov, Joanne Jang, Peter Welinder, and Lilian Weng. Text and code embeddings by contrastive pre-training. ArXiv, abs/2201.10005, 2022. URL https://arxiv.org/abs/2201.10005.
237
+
238
+ Tri Nguyen, Mir Rosenberg, Xia Song, Jianfeng Gao, Saurabh Tiwary, Rangan Majumder, and Li Deng. Ms marco: A human generated machine reading comprehension dataset. In CoCo@NIPS, 2016. URL http://ceur-ws.org/Vol-1773/CoCoNIPS_2016_paper9.pdf.
239
+
240
+ Jianmo Ni, Chen Qu, Jing Lu, Zhuyun Dai, Gustavo Hernández Ábrego, Ji Ma, Vincent Y. Zhao, Yi Luan, Keith B. Hall, Ming-Wei Chang, and Yinfei Yang. Large dual encoders are generalizable retrievers. CoRR, abs/2112.07899, 2021. URL https://arxiv.org/abs/2112.07899.
241
+
242
+ Rodrigo Nogueira and Kyunghyun Cho. Passage re-ranking with bert. arXiv, 2019. URL https: //arxiv.org/abs/1901.04085.
243
+
244
+ Rodrigo Nogueira, Zhiying Jiang, Ronak Pradeep, and Jimmy Lin. Document ranking with a pretrained sequence-to-sequence model. In Trevor Cohn, Yulan He, and Yang Liu (eds.), Findings of the Association for Computational Linguistics: EMNLP 2020, Online Event, 16-20 November 2020, volume EMNLP 2020 of Findings of ACL, pp. 708–718. Association for Computational Linguistics, 2020. doi: 10.18653/v1/2020.findings-emnlp.63. URL https://doi.org/10. 18653/v1/2020.findings-emnlp.63.
245
+
246
+ Barlas Oguz, Kushal Lakhotia, Anchit Gupta, Patrick Lewis, Vladimir Karpukhin, Aleksandra Piktus, Xilun Chen, Sebastian Riedel, Scott Yih, Sonal Gupta, and Yashar Mehdad. Domain-matched pre-training tasks for dense retrieval. In Findings of the Association for Computational Linguistics: NAACL 2022, pp. 1524–1534, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.findings-naacl.114. URL https://aclanthology. org/2022.findings-naacl.114.
247
+
248
+ Yingqi Qu, Yuchen Ding, Jing Liu, Kai Liu, Ruiyang Ren, Wayne Xin Zhao, Daxiang Dong, Hua Wu, and Haifeng Wang. RocketQA: An optimized training approach to dense passage retrieval for open-domain question answering. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 5835–5847, June 2021. doi: 10.18653/v1/2021.naacl-main.466. URL https: //aclanthology.org/2021.naacl-main.466.
249
+
250
+ Sashank J. Reddi, Rama Kumar Pasumarthi, Aditya Krishna Menon, Ankit Singh Rawat, Felix X. Yu, Seungyeon Kim, Andreas Veit, and Sanjiv Kumar. Rankdistil: Knowledge distillation for ranking. In AISTATS, pp. 2368–2376, 2021. URL http://proceedings.mlr.press/ v130/reddi21a.html.
251
+
252
+ Ruiyang Ren, Shangwen Lv, Yingqi Qu, Jing Liu, Wayne Xin Zhao, QiaoQiao She, Hua Wu, Haifeng Wang, and Ji-Rong Wen. PAIR: Leveraging passage-centric similarity relation for improving dense passage retrieval. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pp. 2173–2183, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/ v1/2021.findings-acl.191. URL https://aclanthology.org/2021.findings-acl. 191.
253
+
254
+ Ruiyang Ren, Yingqi Qu, Jing Liu, Wayne Xin Zhao, Qifei Wu, Yuchen Ding, Hua Wu, Haifeng Wang, and Ji-Rong Wen. A thorough examination on zero-shot dense retrieval, 2022. URL https://arxiv.org/abs/2204.12755.
255
+
256
+ Guilherme Moraes Rosa, Luiz Henrique Bonifacio, Vitor Jeronymo, Hugo Abonizio, Marzieh Fadaee, Roberto de Alencar Lotufo, and Rodrigo Nogueira. No parameter left behind: How distillation and model size affect zero-shot retrieval. CoRR, abs/2206.02873, 2022. doi: 10.48550/arXiv.2206. 02873. URL https://doi.org/10.48550/arXiv.2206.02873.
257
+
258
+ Devendra Singh Sachan, Mike Lewis, Mandar Joshi, Armen Aghajanyan, Wen-tau Yih, Joelle Pineau, and Luke Zettlemoyer. Improving passage retrieval with zero-shot question generation. arXiv, 2022. URL https://arxiv.org/abs/2204.07496.
259
+
260
+ Victor Sanh, Albert Webson, Colin Raffel, Stephen Bach, Lintang Sutawika, Zaid Alyafeai, Antoine Chaffin, Arnaud Stiegler, Arun Raja, Manan Dey, M Saiful Bari, Canwen Xu, Urmish Thakker, Shanya Sharma Sharma, Eliza Szczechla, Taewoon Kim, Gunjan Chhablani, Nihal V. Nayak, Debajyoti Datta, Jonathan Chang, Mike Tian-Jian Jiang, Han Wang, Matteo Manica, Sheng Shen, Zheng Xin Yong, Harshit Pandey, Rachel Bawden, Thomas Wang, Trishala Neeraj, Jos Rozen, Abheesht Sharma, Andrea Santilli, Thibault Févry, Jason Alan Fries, Ryan Teehan, Teven Le Scao, Stella Biderman, Leo Gao, Thomas Wolf, and Alexander M. Rush. Multitask prompted training enables zero-shot task generalization. In The Tenth International Conference on Learning Representations, ICLR 2022, Virtual Event, April 25-29, 2022. OpenReview.net, 2022. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ 9Vrb9D0WI4.
261
+
262
+ Keshav Santhanam, Omar Khattab, Jon Saad-Falcon, Christopher Potts, and Matei Zaharia. ColBERTv2: Effective and efficient retrieval via lightweight late interaction. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 3715–3734, July 2022. URL https://aclanthology.org/2022.naacl-main.272.
263
+
264
+ Timo Schick and Hinrich Schütze. Exploiting cloze-questions for few-shot text classification and natural language inference. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pp. 255–269, Online, April 2021a. Association for Computational Linguistics. doi: 10.18653/v1/2021.eacl-main.20. URL https://aclanthology.org/2021.eacl-main.20.
265
+
266
+ Timo Schick and Hinrich Schütze. It’s not just size that matters: Small language models are also few-shot learners. In Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 2339–2352, Online, June 2021b. Association for Computational Linguistics. doi: 10.18653/v1/2021.naacl-main. 185. URL https://aclanthology.org/2021.naacl-main.185.
267
+
268
+ Timo Schick and Hinrich Schütze. Few-shot text generation with natural language instructions. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pp. 390–402, Online and Punta Cana, Dominican Republic, November 2021c. Association for Computational Linguistics. doi: 10.18653/v1/2021.emnlp-main.32. URL https: //aclanthology.org/2021.emnlp-main.32.
269
+
270
+ Siamak Shakeri, Cicero Nogueira dos Santos, Henghui Zhu, Patrick Ng, Feng Nan, Zhiguo Wang, Ramesh Nallapati, and Bing Xiang. End-to-end synthetic data generation for domain adaptation of question answering systems. In Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 5445–5460. Association for Computational Linguistics, 2020. URL https://aclanthology.org/2020.emnlp-main.439.
271
+
272
+ Nandan Thakur, Nils Reimers, Andreas Rücklé, Abhishek Srivastava, and Iryna Gurevych. BEIR: A heterogeneous benchmark for zero-shot evaluation of information retrieval models. In Thirty-fifth Conference on Neural Information Processing Systems Datasets and Benchmarks Track (Round 2), 2021. URL https://openreview.net/forum?id ${ . } = { }$ wCu6T5xFjeJ.
273
+
274
+ Romal Thoppilan, Daniel De Freitas, Jamie Hall, Noam Shazeer, Apoorv Kulshreshtha, Heng-Tze Cheng, Alicia Jin, Taylor Bos, Leslie Baker, Yu Du, YaGuang Li, Hongrae Lee, Huaixiu Steven Zheng, Amin Ghafouri, Marcelo Menegali, Yanping Huang, Maxim Krikun, Dmitry Lepikhin, James Qin, Dehao Chen, Yuanzhong Xu, Zhifeng Chen, Adam Roberts, Maarten Bosma, Yanqi Zhou, Chung-Ching Chang, Igor Krivokon, Will Rusch, Marc Pickett, Kathleen S. Meier-Hellstern, Meredith Ringel Morris, Tulsee Doshi, Renelito Delos Santos, Toju Duke, Johnny Soraker, Ben Zevenbergen, Vinodkumar Prabhakaran, Mark Diaz, Ben Hutchinson, Kristen Olson, Alejandra Molina, Erin Hoffman-John, Josh Lee, Lora Aroyo, Ravi Rajakumar, Alena Butryna, Matthew Lamm, Viktoriya Kuzmina, Joe Fenton, Aaron Cohen, Rachel Bernstein, Ray Kurzweil, Blaise Aguera-Arcas, Claire Cui, Marian Croak, Ed H. Chi, and Quoc Le. Lamda: Language models for dialog applications. CoRR, abs/2201.08239, 2022. URL https://arxiv.org/abs/2201. 08239.
275
+
276
+ James Thorne, Andreas Vlachos, Christos Christodoulopoulos, and Arpit Mittal. FEVER: a large-scale dataset for fact extraction and VERification. In Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long Papers), pp. 809–819, New Orleans, Louisiana, June 2018. Association for Computational Linguistics. doi: 10.18653/v1/N18-1074. URL https://aclanthology.org/N18-1074.
277
+
278
+ Kexin Wang, Nandan Thakur, Nils Reimers, and Iryna Gurevych. GPL: Generative pseudo labeling for unsupervised domain adaptation of dense retrieval. In Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 2345–2360, Seattle, United States, July 2022. Association for Computational Linguistics. doi: 10.18653/v1/2022.naacl-main.168. URL https://aclanthology.org/ 2022.naacl-main.168.
279
+
280
+ Jason Wei, Maarten Paul Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew Mingbo Dai, and Quoc V. Le. Finetuned language models are zero-shot learners. In International Conference on Learning Representations, 2022a. URL https://openreview. net/forum?id ${ . } = { }$ gEZrGCozdqR.
281
+
282
+ 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, 2022b. URL https://openreview.net/forum? id $=$ yzkSU5zdwD.
283
+
284
+ Lee Xiong, Chenyan Xiong, Ye Li, Kwok-Fung Tang, Jialin Liu, Paul N. Bennett, Junaid Ahmed, and Arnold Overwijk. Approximate nearest neighbor negative contrastive learning for dense text retrieval. In International Conference on Learning Representations, 2021. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ zeFrfgyZln.
285
+
286
+ Zhilin Yang, Peng Qi, Saizheng Zhang, Yoshua Bengio, William Cohen, Ruslan Salakhutdinov, and Christopher D. Manning. HotpotQA: A dataset for diverse, explainable multi-hop question answering. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2369–2380, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1259. URL https://aclanthology.org/D18-1259.
287
+
288
+ Wen-tau Yih, Kristina Toutanova, John C. Platt, and Christopher Meek. Learning discriminative projections for text similarity measures. In Proceedings of the Fifteenth Conference on Computational Natural Language Learning, pp. 247–256, Portland, Oregon, USA, June 2011. Association for Computational Linguistics. URL https://aclanthology.org/W11-0329.
289
+
290
+ Hang Zhang, Yeyun Gong, Yelong Shen, Jiancheng Lv, Nan Duan, and Weizhu Chen. Adversarial retriever-ranker for dense text retrieval. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $=$ MR7XubKUFB.
291
+
292
+ <table><tr><td></td><td>arg</td><td>touché</td><td>covid</td><td>nfc</td><td>hotpot</td><td>dbp</td><td>climate</td><td>fever</td><td>scifact</td><td>scidocs</td><td>fiqa</td><td>AVG.</td></tr><tr><td>GTR-base</td><td>51.1</td><td>20.5</td><td>53.9</td><td>30.8</td><td>53.5</td><td>34.7</td><td>(24.1*)</td><td>66.0</td><td>60.0</td><td>14.9</td><td>34.9</td><td>40.4</td></tr><tr><td>GTR-base with 8 examples</td><td>51.9</td><td>24.1</td><td>56.2</td><td>30.5</td><td>23.4</td><td>35.4</td><td>(25.4*)</td><td>68.2</td><td>60.1</td><td>14.8</td><td>35.3</td><td>38.7</td></tr></table>
293
+
294
+ Table 4: Directly using eight examples might not improve the results. To showcase this, we fine-tuned a GTR-based model with the same few-shot examples used for tuning.
295
+
296
+ # COMPUTE USAGE AND ENVIRONMENTAL IMPACT
297
+
298
+ We used the 137B FLAN, which is based on LaMDA (Thoppilan et al., 2022). LaMDA was pretrained on a large corpus consisting of 1.56T words, costing 451 MWh energy and $2 5 . 2 \mathrm { t C O } 2 \mathrm { e }$ carbon footprint. In PROMPTAGATOR, we generated 29.23M queries $^ { * } 2$ prompts $= 5 8 . 4 6 \mathrm { M }$ queries, for a total of 610M words.
299
+
300
+ # A FINE-TUNING GTR WITH FEW-SHOT EXAMPLES
301
+
302
+ We study the effect of directly adding few-shot (no more than 8 examples) on top of a 110M dual encoder, GTR-base Ni et al. (2021). To maximum the utilities of the 8 examples, we associated each positive example with 32 random negative examples from the target corpus to construct a batch, and ran 50 steps of fine-tuning for each task. As expected, the 8 examples did not provide a large amount of impact for GTR base, where the average ndcg go from 40.4 to 38.7 after fine-tuning using few-shot examples.
303
+
304
+ # B ANALYSIS ON PROMPTS
305
+
306
+ Table 5 shows the list of prompt templates on different BEIR datasets. In order to further analysis the difference between zero-shot and few-shot prompts, we compare the few-shot and zero-shot generated queries given the same paragraph, randomly sampled from three datasets in Table 6. We observe that in general, the few-shot generated queries are closer to the original queries, while zero-shot queries are mostly questions. For example, in the ArguAna dataset, the few-shot queries are in general longer and more claim-like. In contrary, the zero-shot queries are most short question-like queries. Interestingly, for the HotpotQA dataset, even though both few-shot and zero-shot queries are generating questions-like queries, few-shot queries sometimes generate multi-hop questions, while zero-shot mostly generates single-hop questions. We further conduct first word distribution across different generation models for all datasets in Figure 4.
307
+
308
+ Table 5: Prompt template for each dataset.
309
+
310
+ <table><tr><td>Dataset</td><td colspan="8">Prompt</td></tr><tr><td>ArguAna</td><td></td><td>0 Argument: passage X 1 Counter argument: query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>FiQA</td><td></td><td>0 passage X 1 query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>HotpotQA</td><td></td><td>l0 Evidence: passage X 1 Vexed question: query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>DBPedia-Entity</td><td></td><td>0 entity: passage X 1 query: query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>NFCorpus</td><td></td><td>l0 Article: passage X 1 Query: query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>Toucheé-2020</td><td></td><td>|0 passage X 1 Debate: query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>TREC-Covid</td><td></td><td>l0 passage X 1 Question: query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SciFact</td><td></td><td>l0 passage X 1 Finding: query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>SCIDOCS</td><td></td><td>l0 passage X 1 The passage is about query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>FEVER</td><td></td><td>|0 passage X 1 Is it true that query X</td><td></td><td></td><td></td><td></td><td></td><td></td></tr></table>
311
+
312
+ Table 6: Few-shot and zero-shot generated queries randomly sampled from ArguAna, FiQA and HotpotQA dataset.
313
+
314
+ <table><tr><td>Paragraph</td><td>Few-shot</td><td>Zero-shot</td><td>Analysis In ArguAna dataset,</td></tr><tr><td>ArguAna: Banning skin whiten- ing on such a basis also requires the acceptance of the racial over- tones.Some form of tan is popular in many societies of people of Eu- ropean ethnic origins- that is not a racial matter, it is more based on economic social perceptions (that of holidays to warmer climates). Ascribing a racial element to ev- erything to do with skin tone is at best a lazy analysis.Irrespective of issues of race and perceptions of ethnic origins,and its intersec- tion with beauty standards,some people will be given advantages in life due to their appearance.Ban- ninga certain form of cosmetic, even if it can have some racial and ethnic undertones,won&#x27;t change that.</td><td>Query 1:1 Banning skin whitening on such a ba- sis also requires the accep- tance of the racial overtones. However,the racial over- tones are simply a side ef- fect of the product being used incorrectly in order to attain a lighter skin tone than they are naturally born with. The product itself is not racist, but rather the peo- ple who use it. For exam- ple,a person of Asian de- scent may use a skin whiten- ing cream to attain a lighter skin tone so that they may fit into a more white-dominant society. The cream itself is not racist,but rather the fact that the person has used it to attain a lighter skin tone so that they may fit into a more</td><td>Query 1: What did they try to ban? Query 2: Is skin whitening racist? Query 3:Banning skin whiten- ing on such a basis also re- quires the acceptance of the racial overtones.Some form of tan is popular in many so- cieties of people of European ethnic origins- that is not a racial matter, it is more based on economic social perceptions (that of holidays to warmer cli- mates). Query 4: What are some of the racial overtones in skin- whitening? Query 5: Are tans a sign of af- fluence?</td><td>the few-shot ex- amplesaremore statement-likeand are longer than zero-shot.</td></tr><tr><td>white-dominant society. Touché-2020:Psychologically, diet-wiseandacademically. Housewives can be both educated and uneducated but the fact that they spend more time with their children means that they put in a greater effort and since they are not preoccupied with their job(read:cellphone); they_pay the close attention needed to keep their children out of trouble. Think of housewives as inspectors in your home...</td><td>Query 1: Housewives are better parents Query 2: Should house- wives be considered better parents?</td><td>Query 1: diet-wise and aca- demically. Query 2: People want to be relaxed all the time(At home AND at work) that is why all the research on work-life bal- ance. Query 3: has shown that home- makers are more relaxed, less stressed,healthier,happier - the list goes on.</td><td>The few-shot gener- atesargument-like queries that are more controversial, while zero-shot generate randomstatements that sometimes even have grammar problems.</td></tr><tr><td>HotpotQA: The Yung See San Fong House,or Young&#x27;s Home in the Heart of the Hills, is a house in Los Gatos in the U.S.state of California.It is a combination of Asian decorative motifs and pagoda roofs together with West- ern massing and layout.It was completed in 1917 forRuth Com- fort Mitchell Young,a writer,and her husband, Sanborn Young,a gentleman farmer,conservationist and later California State Senator.</td><td>Query 1: Which author was the husband of Ruth Com- fort Mitchell Young? Query 2: Which is known as the Yount-Lee House Query 3:Who is the archi- tect of the Yung See San Fong House? Query 4:The Yung See San Fong House,or Young&#x27;s Home in the Heart of the Hills;isa house in which U.S. state?</td><td>Query 1: Yung See San Fong House was completed in 1917 for Ruth Comfort Mitchell Young,a writer,and her hus- band, Sanborn Young. Query 2: How old is the Yung See San Fong House? Query 3: Yung See San Fong House was completed in 1917 for Ruth Comfort Mitchell Young,a writer,and her hus- band, Sanborn Young.</td><td>Few-shot examples sometimes will create multihop questions indicated in blue, whichrarelyhap- pensin zero-shot examples.</td></tr></table>
315
+
316
+ # C DETAILED IMPLEMENTATION
317
+
318
+ Figure 5 shows the overall process of PROMPTAGATOR $^ { + + }$ , the details of which are in Section 3.
319
+
320
+ Our cross attention reranker is a listwise model based on T5. Specifically, it takes a list of documents given a query as the input. We represent each query-document pair as “Query: {q} Document: $\{ \mathrm { d } \} ^ { \prime \prime }$ and feed it into the encoder of a T5 model. We then apply a projection layer on the output encodings of the first token and use the output as the ranking score. We optimize the model using softmax cross entropy loss over over a ranking list consisting of a positive $( q , \bar { d } ^ { + } )$ pair and 31 sampled negative $( q , d ^ { - } )$ pairs. Unlike monoT5 (Nogueira et al., 2020), which is pointwise reranker that uses an encoder-decoder model and is trained to generate a relevance label, our model is a listwise reranker and is directly optimizes for ranking performance.
321
+
322
+ # D QUERY GENERATION STATISTICS
323
+
324
+ In Table 7, we analyze the length of the generated questions by different query generation systems. Note that NQ-QGen always generates short queries due to the query generation models being fine-tuned on the NQ dataset, and all of the generated questions have similar length to those questions of NQ. Interestingly, zero-shot PROMPTAGATOR already obtains more variance in terms of length compared to NQ-QGen. Finally, few-shot PROMPTAGATOR offers significantly more variance in terms of the length of generated queries.
325
+
326
+ Table 7: Average query length.
327
+
328
+ <table><tr><td></td><td>Few-shot</td><td>Zero-shot</td><td>NQ QGen</td></tr><tr><td>ArguAna</td><td>98.2</td><td>26.0</td><td>9.7</td></tr><tr><td>Touche-2020</td><td>7.8</td><td>13.4</td><td>9.8</td></tr><tr><td>TREC-Covid</td><td>10.8</td><td>11.4</td><td>10.2</td></tr><tr><td>NFCorpus</td><td>8.3</td><td>11.5</td><td>10.3</td></tr><tr><td>HotpotQA</td><td>11.2</td><td>12.2</td><td>8.8</td></tr><tr><td>DBPedia-Entity</td><td>8.2</td><td>13.8</td><td>8.8</td></tr><tr><td>Fever</td><td>12.1</td><td>10.7</td><td>8.8</td></tr><tr><td>Climate-Fever</td><td>12.9</td><td>10.7</td><td>8.8</td></tr><tr><td>SciFact</td><td>12.6</td><td>12.4</td><td>10.0</td></tr><tr><td>SCIDOCS</td><td>7.4</td><td>15.7</td><td>10.7</td></tr><tr><td>FiQA-2018</td><td>12.5</td><td>10.1</td><td>9.5</td></tr><tr><td>AVG.</td><td>17.8</td><td>13.5</td><td>9.6</td></tr></table>
329
+
330
+ # E ROUND-TRIP FILTERING EXAMPLES
331
+
332
+ Figure 6 shows examples of queries from few-shot PROMPTAGATOR that were removed by round-trip filtering.
333
+
334
+ # F ROUND-TRIP FILTERING AS LATENT VARIABLE MODELING
335
+
336
+ This section aims to share some insight into why our round-trip filtering method is effective, by viewing queries as latent variables that we estimate. First, consider a hypothetical graphical model in which each query $q$ is a latent variable and the documents retrieved for that query are observed variables following some distribution, $p ( d | q , \theta ^ { * } )$ , where $\theta ^ { * }$ represents the parameters of a hypothetical “optimal” retriever that always selects the “best” documents for any query. For synthetic data generation, we make it our goal to sample queries from the posterior, $p ( q | d , \theta ^ { * } )$ , which according to Bayes rule is:
337
+
338
+ $$
339
+ p ( q | d , \theta ^ { * } ) = \frac { p ( d | q , \theta ^ { * } ) p ( q | \theta ^ { * } ) } { \sum _ { q ^ { \prime } } p ( d | q ^ { \prime } , \theta ^ { * } ) p ( q ^ { \prime } | \theta ^ { * } ) }
340
+ $$
341
+
342
+ where $p ( q | \theta ^ { * } )$ is a prior over queries. We will assume it is an “uninformative prior”that is uniform over all $q$ and later write it as just $p ( q )$ . If we knew $\theta ^ { * }$ (the parameters of an optimal retriever), we could just directly compute the above expression. But in practice we do not, so we will estimate $\theta$ using expectation maximization (EM) (Dempster et al., 1977), which will turn out to mirror our round-trip filtering algorithm. EM and other latent variable learning methods have long been used to impute missing data with great success.
343
+
344
+ In EM, we estimate $\theta$ by approximately maximizing the marginal likelihood of the observed variables:
345
+
346
+ $$
347
+ \hat { \theta } = \arg \operatorname* { m a x } _ { \theta } \prod _ { d \in \mathcal { D } _ { T } } p ( d ) = \prod _ { d \in \mathcal { D } _ { T } } \sum _ { q } p ( d | q , \theta ) p ( q )
348
+ $$
349
+
350
+ The first step in EM is to make an initial estimate of $p ( q | d )$ for every document $d$ . We use our FLAN query generator as our initial estimate: $p _ { \mathrm { F L A N } } ( q | d )$ . We then proceed to the M-step of EM, which computes:
351
+
352
+ $$
353
+ \hat { \theta } = \arg \operatorname* { m a x } _ { \theta } \sum _ { d \in \mathcal { D } _ { T } } \sum _ { q } p _ { \mathrm { F L A N } } ( q | d ) p ( d | q , \theta )
354
+ $$
355
+
356
+ This is equivalent to training an initial retriever $p ( d | q , \hat { \theta } )$ on documents from $\mathcal { D } _ { T }$ that have been paired with our FLAN-generated queries (what we do). Finally, we proceed to the E-step of EM, which estimates $p ( q | d , \hat { \theta } )$ for every document $d$ :
357
+
358
+ $$
359
+ p ( q | d , \hat { \theta } ) \propto p ( d | q , \hat { \theta } ) p ( q )
360
+ $$
361
+
362
+ From this, we see that the highest probability queries under $p ( q | d , \hat { \theta } )$ are the ones with the highest probability of retrieving $d$ under our initial retriever (since $p ( q )$ is an uninformative prior that is uniform over all $q$ ).
363
+
364
+ To sample from $p ( q | d , \hat { \theta } )$ , we could employ importance sampling. In importance sampling, we first sample $q$ from any proposal distribution that we choose, ${ \bar { p } } _ { \mathrm { p r o p } } { \bar { ( } } q | d )$ . We would then weight that sample by the ratio $p ( q | d , \hat { \theta } ) / p _ { \mathrm { p r o p } } ( q | d )$ . We choose $p _ { \mathrm { F L A N } } ( q | d )$ as our proposal distribution. Then, instead of actually importance-weighting each sample, our filtering procedure just discards samples with a low value of $p ( d | q , \hat { \theta } )$ , which is proportional to the numerator in the importance weight. This reveals both the differences and connections between our method and EM.
365
+
366
+ Although we could repeat this EM-like procedure until convergence, we found that a single round of filtering yielded sufficient quality gains. It is also worth noting that the training of our final retriever could be viewed as another M-step.
367
+
368
+ ![](images/f2f805a5569b3d0696d3404b4ca626a70ebadd14470da677cc8df0ac5633e8f4.jpg)
369
+
370
+ ![](images/c557b60c369f7c8ad18b9f3ad02e06ce7bb6d6e40b24a596c8fcb9c6da9a6602.jpg)
371
+ Figure 4: Top first word distribution on queries generated from different models in all other BEIR datasets.
372
+
373
+ ![](images/9e9f4dad11d0e8ff0ddf2ffc474843fddec973536abf8c874edfde444b984b73.jpg)
374
+ Figure 5: PROMPTAGATOR $^ { + + }$ Training pipeline.
375
+
376
+ Passage: As the COVID-19 pandemic sweeps the globe, evolving containment measures have created an unprecedented need for rapid and effective science communication that is able to engage the public in behavioural change on a mass scale. Public health bodies, governments, and media outlets have turned to comics in this time of need and found a natural and capable medium for responding to the challenge...
377
+
378
+ Query: What is the authors’ purpose for writing this article?
379
+
380
+ Remarks: The query lacks context. This query is also generic and can be used to all articles
381
+
382
+ Passage: Big Bad Love is a 2001 film directed by Arliss Howard , who co-wrote the script with his brother , James Howard , based on a collection of short stories of the same name by Larry Brown . The story recounts an episode in the life of an alcoholic Vietnam veteran and struggling writer named Leon Barlow , who is played by Arliss Howard , and his wife , played by Howard ’s wife Debra Winger . The soundtrack includes music by Tom Verlaine , the Kronos Quartet , and R. L. Burnside .
383
+
384
+ Query: music artist is from the United States
385
+
386
+ Remarks: The query lacks context.
387
+
388
+ Passage: Aminopeptidase N (APN) is the major cell surface receptor for group 1 coronaviruses. In this study, we have isolated and characterized a feline APN cDNA and shown that the transfection of human embryonic kidney cells with this cDNA renders them susceptible to infection with the feline coronavirus feline infectious peritonitis virus, the human coronavirus (HCV) 229E and the porcine coronavirus porcine transmissible gastroenteritis virus. ...
389
+
390
+ Query: What is the function of Aminopeptidase N?
391
+
392
+ Remarks: The query is too general and can match many documents that mentions APN.
393
+
394
+ Passage: Selena Danielle Coppa (born February 25, 1983) was a military intelligence Sergeant in the United States Army. She is primarily notable for her organizing and activism against the US Occupation of Iraq while serving as an active duty military member, including serving on the Executive Board of Iraq Veterans Against the War. In 2009 it was announced that she was heading a committee responsible for gaining and training more active duty anti-war soldiers.
395
+
396
+ Query: who was the first president of the senate?
397
+
398
+ Remarks: Hallucination. The passage didn’t mention president of the senate.
399
+
400
+ Passage: Porcine deltacoronavirus (PDCoV) is an emerging swine coronavirus that causes severe diarrhea, resulting in high mortality in neonatal piglets. Despite widespread outbreaks in many countries, no effective PDCoV vaccines are currently available. Here, we generated, for the first time, a full-length infectious cDNA clone of PDCoV. We further manipulated the infectious clone by replacing the NS6 gene with a green fluorescent protein (GFP) to generate rPDCoV-NS6-GFP...
401
+
402
+ Query: What virus is the first one that we’ve been able to create a vaccine for?
403
+
404
+ Remarks: Hallucination. The passage didn’t mention that Porcine deltacoronavirus is the first virus one can create a vaccine.
405
+
406
+ Passage: Nacoleia rectistrialis is a moth in the Crambidae family. It was described by Hampson in 1912. It is found on the Key Islands.
407
+ Query: Who composed the music for the movie the ring?
408
+ Remarks: Hallucination. The passage is about moth and is unrelated to “music for the movie the ring”.
409
+
410
+ Figure 6: Examples of queries from few-shot PROMPTAGATOR’s prompt-based query generation that were removed by round-trip filtering.
md/dev/iMSjopcOn0p/iMSjopcOn0p.md ADDED
@@ -0,0 +1,414 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MT3: MULTI-TASK MULTITRACK MUSIC TRANSCRIPTION
2
+
3
+ Josh Gardner∗, Ian Simon, Ethan Manilow†, Curtis Hawthorne, Jesse Engel Google Research, Brain Team
4
+
5
+ # ABSTRACT
6
+
7
+ Automatic Music Transcription (AMT), inferring musical notes from raw audio, is a challenging task at the core of music understanding. Unlike Automatic Speech Recognition (ASR), which typically focuses on the words of a single speaker, AMT often requires transcribing multiple instruments simultaneously, all while preserving fine-scale pitch and timing information. Further, many AMT datasets are “low-resource”, as even expert musicians find music transcription difficult and time-consuming. Thus, prior work has focused on task-specific architectures, tailored to the individual instruments of each task. In this work, motivated by the promising results of sequence-to-sequence transfer learning for low-resource Natural Language Processing (NLP), we demonstrate that a general-purpose Transformer model can perform multi-task AMT, jointly transcribing arbitrary combinations of musical instruments across several transcription datasets. We show this unified training framework achieves high-quality transcription results across a range of datasets, dramatically improving performance for low-resource instruments (such as guitar), while preserving strong performance for abundant instruments (such as piano). Finally, by expanding the scope of AMT, we expose the need for more consistent evaluation metrics and better dataset alignment, and provide a strong baseline for this new direction of multi-task AMT.1
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Recorded music often contains multiple instruments playing together; these multiple “tracks” of a song make music transcription challenging for both algorithms and human experts. A transcriber must pick each note out of the audio mixture, estimate its pitch and timing, and identify the instrument on which the note was performed. An AMT system should be capable of transcribing multiple instruments at once (Multitrack) for a diverse range of styles and combinations of musical instruments (Multi-Task). Despite the importance of Multi-Task Multitrack Music Transcription (MT3), several barriers have prevented researchers from addressing it. First, no model has yet proven capable of transcribing arbitrary combinations of instruments across a variety of datasets. Second, even if such models existed, no unified collection of AMT datasets has been gathered that spans a variety of AMT tasks. Finally, even within current AMT datasets, evaluation is inconsistent, with different research efforts using different metrics and test splits for each dataset.
12
+
13
+ Compounding this challenge, many music datasets are relatively small in comparison to the datasets used to train large-scale sequence models in other domains such as NLP or ASR. Existing opensource music transcription datasets contain between one and a few hundred hours of audio (see Table 1), while standard ASR datasets LibriSpeech (Panayotov et al., 2015) and CommonVoice (Ardila et al., 2020) contain 1k and $9 \mathrm { k } +$ hours of audio, respectively. LibriSpeech alone contains more hours of audio than all of the AMT datasets we use in this paper, combined. Taken as a whole, AMT fits the general description of a “low-resource” task, where data is scarce.
14
+
15
+ In this work, we provide a strong empirical contribution to the field by overcoming each of these barriers and enabling Multi-Task Multitrack Music Transcription (MT3). Our contributions include:
16
+
17
+ ![](images/104b79b91e561283cb7bb1e4ddfaa7bae679d5ca9de049156102a780d284eec5.jpg)
18
+ Figure 1: MT3 is capable of transcribing an arbitrary number of instruments from raw audio spectrograms. Shown here are real 4-second audio clips, pianorolls reconstructed from the model’s tokenized output, and the corresponding instrument labels (additional Slakh2100 instruments omitted due to space). Note that in some cases, multiple notes predicted from a monophonic instrument (such as clarinet or French horn) reflects an ensemble containing multiple players of that instrument.
19
+
20
+ Unified framework for training: We define a tokenization scheme with a compact and flexible vocabulary to convert between model output tokens and multitrack MIDI files, enabling a sequence-tosequence approach inspired by Raffel et al. (2019) and Xue et al. (2020) that supports datasets with different combinations of instruments. This allows us to simultaneously leverage several datasets which were previously only used in isolation due to differences in instrumentation.
21
+
22
+ Benchmark collection of diverse datasets: We assemble six multitrack AMT datasets, spanning a variety of dataset sizes, styles, and instrumentations. Together they form the largest known collection publicly available for multi-task AMT training.
23
+
24
+ Consistent evaluation: We define standard test set splits and apply a consistent set of note-based metrics across all six datasets. We also introduce a new instrument-sensitive transcription metric to jointly evaluate note and instrument accuracy.
25
+
26
+ SOTA Baseline: Training an off-the-shelf T5 architecture with our framework, we realize strong baseline models that achieve SOTA transcription performance on each individual multitrack dataset, outperforming prior dataset-specific transcription models as well as professional-quality DSP-based transcription software. Our model, which we refer to as MT3, demonstrates very high instrument labeling accuracy across all six datasets, even when many instruments are simultaneously present, and is robust to the grouping of instruments.
27
+
28
+ Improving low-resource AMT: By training a single model across a mixture of all six datasets, we find that MT3 performance dramatically improves for low-resource datasets over the baseline models (up to $260 \%$ relative gain), while preserving strong performance on high-resource datasets.
29
+
30
+ # 2 RELATED WORK
31
+
32
+ # 2.1 TRANSFORMERS FOR SEQUENCE MODELING
33
+
34
+ The Transformer architecture, originally proposed in Vaswani et al. (2017), has recently demonstrated strong performance across many sequence modeling tasks in several domains. For example, T5 (Raffel et al., 2019) demonstrated that many language tasks previously addressed with separate models could be addressed using a single text-to-text encoder-decoder Transformer model. Extending this approach, mT5 (Xue et al., 2020) used a single Transformer to model multiple languages, demonstrating that a unified architecture could also serve as a general multilingual model, leveraging high-resource language datasets to improve model performance on lower-resource datasets. Other prominent examples of Transformer-based architectures for sequence modeling include BERT (Devlin et al., 2018) and the GPT family of models, most prominently GPT-3 (Brown et al., 2020).
35
+
36
+ Transformers have also been applied to some audio modeling tasks. For example, Transformerbased models have been used for audio classification (Gong et al., 2021; Verma & Berger, 2021), captioning (Mei et al., 2021), compression (Dieleman et al., 2021), speech recognition (Gulati et al., 2020), speaker separation (Subakan et al., 2021), and enhancement (Koizumi et al., 2021). Transformers have also been used for generative audio models (Dhariwal et al., 2020; Verma & Chafe, 2021), which in turn have enabled further tasks in music understanding (Castellon et al., 2021).
37
+
38
+ # 2.2 MUSIC TRANSCRIPTION
39
+
40
+ Historically, music transcription research has focused on transcribing recordings of solo piano (Poliner & Ellis, 2006; Bock & Schedl, 2012; Kelz et al., 2016). As a result, there are a large number ¨ of transcription models whose success relies on hand-designed representations for piano transcription. For instance, the Onsets & Frames model (Hawthorne et al., 2017) uses dedicated outputs for detecting piano onsets and the note being played; Kelz et al. (2019) represents the entire amplitude envelope of a piano note; and Kong et al. (2020) additionally models piano foot pedal events (a piano-specific way of controlling a note’s sustain). Single-instrument transcription models have also been developed for other instruments such as guitar (Xi et al., 2018) and drums (Cartwright & Bello, 2018; Callender et al., 2020), though these instruments have received less attention than piano.
41
+
42
+ Although not as widespread, some multi-instrument transcription systems have been developed. For example, Manilow et al. (2020) presents the Cerberus model, which simultaneously performs source separation and transcription for a fixed and predefined set of instruments. Lin et al. (2021) also perform both separation and transcription, albeit based on an audio query input and with the addition of synthesis. ReconVAT (Cheuk et al., 2021) uses an approach based on U-Net and unsupervised learning techniques to perform transcription on low-resource datasets; however, the model does not predict instrument labels, instead outputting a single pianoroll that combines all instruments into a single “track”. A similar limitation applies to the early transcription system introduced alongside the MusicNet dataset by Thickstun et al. (2016). Tanaka et al. (2020) uses a clustering approach to separate transcribed instruments, but the model output does not include explicit instrument labels. In contrast, our model outputs a stream of events representing notes from an arbitrary number of instruments with each note explicitly assigned to an instrument; it learns to detect the presence (or absence) of instruments directly from audio spectrograms (see Figure 1).
43
+
44
+ The work most closely related to ours is Hawthorne et al. (2021), which uses an encoder-decoder Transformer architecture to transcribe solo piano recordings. Here, we extend their approach to transcribe polyphonic music with an arbitrary number of instruments. We adhere to their philosophy of using components as close to “off-the-shelf” as possible: spectrogram inputs, a standard Transformer configuration from T5, and MIDI-like output events.
45
+
46
+ # 3 TRANSCRIPTION MODEL
47
+
48
+ At its core, music transcription can be posed as a sequence-to-sequence task, where the input is a sequence of audio frames, and the output is a sequence of symbolic tokens representing the notes being played. A key contribution of this work is to frame multi-instrument transcription, where different source instruments are present in a single input audio stream, within this paradigm and allow the model to learn which instruments are present in the source audio using Transformer model paired with a novel vocabulary designed to support this general task.
49
+
50
+ # 3.1 TRANSFORMER ARCHITECTURE
51
+
52
+ A key contribution of our work is the use of a single generic architecture — Transformers via T5 (Raffel et al., 2019) — to address a variety of tasks previously tackled using complex, handcrafted, dataset-specific architectures. The T5 architecture is an encoder-decoder Transformer model which closely follows the original form in Vaswani et al. (2017).
53
+
54
+ ![](images/baf0f94a057dc5fa89a3866be12fbbe080e457dbbf848af02f3d01fda78e95a7.jpg)
55
+ Figure 2: Tokenization/detokenization, as described in Section 3.2. MIDI data (left, represented here as a multitrack “pianoroll”) can be tokenized into MIDI-like target tokens for training (right). Output tokens using the same vocabulary can be deterministically decoded back into MIDI data.
56
+
57
+ In the T5 architecture, a sequence of inputs is mapped to a sequence of learned embeddings plus fixed positional embeddings; we use absolute positional embeddings instead of the bucketed “relative” embeddings used in Raffel et al. (2019) to ensure that all positions can be attended to with equal resolution. The model uses a series of standard Transformer self-attention “blocks” in both the encoder and decoder. In order to produce a sequence of output tokens, the model uses greedy autoregressive decoding: an input sequence is fed in, the output token with the highest predicted probability of occurring next is appended to the sequence, and the process is repeated until an endof-sequence (EOS) token is produced. We use the T5 “small” model, which contains approximately 60 million parameters. While much larger models are commonly used in language modeling tasks, we found that increasing model size tended to exacerbate overfitting. Full details on the Transformer architecture used in this work are given in Appendix A. Additionally, we make our code available along with the release of this paper at https://github.com/magenta/mt3.
58
+
59
+ # 3.2 MODEL INPUTS AND OUTPUTS
60
+
61
+ As shown in Figure 1, MT3 uses log Mel spectrograms as inputs. For the outputs, we construct a token vocabulary inspired by the MIDI specification, which we refer to as “MIDI-like” because it contains a subset of the original $\mathrm { { \bf M I D I } } ^ { 2 }$ specification (1996) (e.g. our vocabulary does not represent “control change” MIDI events). This output is a modification of the vocabulary of Hawthorne et al. (2021) with the following differences: (1) addition of instrument change tokens, which allow for multiple instruments to be represented in a single event stream; (2) removal of velocity, as most of our training datasets do not contain velocity annotations (and there is no standardized method for coding velocity across datasets); (3) “ties” to better handle notes that span multiple segments. The vocabulary, illustrated in Figure 2, consists of the following token types:
62
+
63
+ Instrument (128 values): Indicates which instrument the following messages should be directed to. The specified instrument will be used for all subsequent events until the next Instrument event. The choice of 128 distinct values is selected to match the original General MIDI specification, which contains 128 “programs” used to designate specific instruments. We further discuss the challenges of representing instruments using program numbers below.
64
+
65
+ Note (128 values): Represents a note-on or note-off event for one of the 128 MIDI pitches.
66
+
67
+ On/Off (2 values): Changes whether subsequent Note events are interpreted as note-on or note-off.
68
+
69
+ Time (205 values): Indicates the absolute time location of one or more events within a segment, quantized to $1 0 ~ \mathrm { m s }$ intervals. This time applies to all subsequent events until the next Time event, which allows for an arbitrary number of notes to occur at a given time point. Time events must occur in chronological order. (The number of possible Time values depends on the Transformer’s input sequence length, which is 2.048 seconds for all of our experiments.)
70
+
71
+ Drum (128 values): Represents a drum onset from one of 128 drum types in the General MIDI standard. Drums are not a focus of this work, but we include them for completeness.
72
+
73
+ End Tie Section (1 value): Ends the “tie” section at the beginning of a segment (see below).
74
+
75
+ EOS (1 value): Used to indicate the end of a sequence.
76
+
77
+ A key contribution of this work is the demonstration that this highly general and flexible output vocabulary can be used to learn a single transcription model that works well across different instruments, datasets, and orchestrations, without manual tuning of the model or vocabulary. In contrast, prior works have been limited to models which transcribe only a single instrument (Hawthorne et al., 2021), contain separate transcription “heads” for a fixed set of instruments (Manilow et al., 2020), or ignore the instrument dimension entirely and only transcribe the notes (Cheuk et al., 2021).
78
+
79
+ One limitation of sequence models applied to audio is that most audio sequences are too large to fit in memory when modeling using a Transformer architecture, which requires $\mathcal { O } ( n ^ { 2 } )$ memory with respect to sequence length for the self-attention blocks. In order to address these constraints, we use the procedure described by Hawthorne et al. (2021): audio is split into smaller, non-overlapping segments, with input spectrograms and event tokens extracted from each segment. The model processes each segment independently. The same procedure is used for both training and inference; however, at inference time we take the additional step of concatenating the decoded events from all segments into a single sequence to reconstruct the full example.
80
+
81
+ One issue with transcribing cropped audio segments independently is that a note may span multiple segments. While our basic approach is often able to handle such cases, we find that occasionally the model will forget to “turn off” a note. To ameliorate this problem, we introduce a “tie” section at the beginning of each segment where the model must declare which notes are already active; that is, the model is trained to emit Program and Pitch tokens for already-active notes, followed by the End Tie Section token, followed by the events of the segment. When concatenating segments to reconstruct an entire transcribed example, we end any notes not explicitly declared in the tie section. This allows the model to fail gracefully when it detects a note-on in one segment but not the corresponding note-off in a subsequent segment.
82
+
83
+ # 3.3 MULTI-TASK MIXTURE
84
+
85
+ In addition to removing the cumbersome task of constructing specialized architectures and loss functions for different instrumentations and datasets, our general output vocabulary also allows our model to be trained on a mixture of several datasets simultaneously, similar to how multilingual translation models such as mT5 are trained on several languages (Xue et al., 2020). This approach not only simplifies model design and training, but also increases the amount and diversity of training data available to the model. As noted previously, scarcity of training data has been a major challenge for prior AMT modeling efforts. This mixture approach has not previously been demonstrated in the music transcription literature; instead, prior works have often focused on training separate models for individual datasets (i.e. Cheuk et al. (2021)). We note that “mixing” here refers to including data from multiple datasets within a single training batch.
86
+
87
+ In order to balance model performance on low- and high-resource datasets, we use a temperature sampling strategy for the mixing as follows: if dataset $i$ has $n _ { i }$ examples, we sample an example from that dataset with probability $( \bar { n _ { i } } / \sum _ { j } n _ { j } ) ^ { 0 . 3 }$ , similar to mT5 (Xue et al., 2020). This has the effect of increasing the frequency with which the model observes examples from low-resource datasets during training, while observing examples from high-resource datasets with lower frequency.
88
+
89
+ # 4 EXPERIMENTS
90
+
91
+ We conduct a series of experiments to test our approach. In particular, we evaluate the overall transcription quality of our model across six datasets including both high- and low-resource datasets, evaluate the effect of instrument groupings, and use our results to identify labeling issues with certain
92
+
93
+ Table 1: Datasets used in this paper.
94
+
95
+ <table><tr><td>Dataset</td><td>Hrs.Audio</td><td>Num. Songs</td><td>Num. Instr.</td><td>Instr. Per Song</td><td>Align</td><td>Low-Resource</td><td>Synthetic</td><td>Drums</td></tr><tr><td>Slakh2100</td><td>969</td><td>1405</td><td>35</td><td>4-48</td><td>Good</td><td></td><td>√</td><td>√</td></tr><tr><td>Cerberus4</td><td>543</td><td>1327</td><td>4</td><td>4</td><td>Good</td><td></td><td>√</td><td>√</td></tr><tr><td>MAESTROv3</td><td>199</td><td>1276</td><td>1</td><td>1</td><td>Good</td><td></td><td></td><td></td></tr><tr><td>MusicNet</td><td>34</td><td>330</td><td>11</td><td>1-8</td><td>Poor</td><td>√</td><td></td><td></td></tr><tr><td>GuitarSet</td><td>3</td><td>360</td><td>1</td><td>1</td><td>Good</td><td>√</td><td></td><td></td></tr><tr><td>URMP</td><td>1</td><td>44</td><td>14</td><td>2-5</td><td>Fair</td><td>√</td><td></td><td></td></tr></table>
96
+
97
+ datasets. We also assess our models’ generalization to out-of-domain data with a series of leave-onedataset-out experiments and use our results to identify label quality issues in Section D.
98
+
99
+ # 4.1 DATASETS
100
+
101
+ Our experiments use six datasets of varying size, recording process, instrumentation, and genre. In addition to demonstrating the flexibility of our approach, this also allows us to compare to a number of different baseline models, each of which can only be fairly applied to specific datasets, and to offer a single SOTA baseline across all datasets using MT3. The six datasets are described briefly below; we provide further information about these datasets in Table 1 and Appendix B.
102
+
103
+ MAESTROv3: MAESTROv3 (Hawthorne et al., 2018) is collected from a virtual classical piano competition, where audio and detailed MIDI data are collected from performers playing on Disklavier pianos that electronically capture the performance of each note in real time.
104
+
105
+ Slakh2100: Slakh2100 consists of audio generated by rendering MIDI files using professionalgrade, sample-based synthesis software. Its construction is detailed in Manilow et al. (2019). During training, we use a form of data augmentation to combine together different subsets of the individualinstrument mixes, which we describe in Appendix B.
106
+
107
+ Cerberus4: Cerberus4 is derived from the Slakh2100 dataset, obtained by mixing all combinations of the four instruments (guitar, bass, drums, piano) in tracks where those instruments are active. These are also the instruments used by the 4-instrument Cerberus model of Manilow et al. (2020).
108
+
109
+ GuitarSet: GuitarSet (Xi et al., 2018) is composed of live guitar performances of varied genre, tempo, and style, recorded using a high-precision hexaphonic pickup that individually captures the sound of each guitar string. MIDI labels for each track are derived from these recordings.
110
+
111
+ MusicNet: MusicNet (Thickstun et al., 2016) consists of freely-licensed classical music recordings from a variety of instruments and ensemble types paired with human-generated transcriptions crowdsourced from expert human transcribers. Since labels are primarily aligned with dynamic time warping, they are less accurate than other datasets.
112
+
113
+ URMP: The University of Rochester Multi-Modal Music Performance (URMP) Dataset (Li et al., 2018) is composed of multi-instrument classical pieces with diverse instrumentation. The individual instruments are recorded separately and mixed, and the aligned MIDI labels come from human annotators who corrected $f _ { 0 }$ curves derived from the pYIN (Mauch & Dixon, 2014) algorithm.
114
+
115
+ We discuss the label alignment quality of MusicNet and URMP in Appendix D.2. In the phrasing of the NLP literature, we will refer to GuitarSet, MusicNet, and URMP as “low-resource” datasets, as they contain only 3, 34, and 1.3 hours of total audio, respectively. This makes these datasets challenging to learn from — particularly MusicNet and URMP, which contain many distinct instruments with several instruments per track, as shown in Table 1.
116
+
117
+ # 4.2 EVALUATION
118
+
119
+ The metrics used to evaluate multi-instrument transcription models in the literature are inconsistent, even when ignoring the multi-instrument vs. single-instrument distinction. For example, several variants of “F1 score” can be computed using the standard library for music transcription evaluation mir eval (Raffel et al., 2014), which differ based on whether note offsets (the time at which a note ends) should be considered in addition to pitch values and note onsets (the time at which a note begins) in evaluating whether a prediction is correct.
120
+
121
+ To provide the fairest and most complete comparison to existing work, we evaluate models on each dataset using three standard measures of transcription performance: Frame F1, Onset F1, and OnsetOffset F1. We use the standard implementation of these metrics from the mir eval Python toolkit. For each metric, mir eval uses bipartite graph matching to find the optimal pairing of reference and estimated notes, then computes precision, recall, and F1 score using the following criteria:
122
+
123
+ Frame F1 score uses a binary measure of whether a pianoroll-like representation of the predictions and targets match. Each second is divided into a fixed number of “frames” (we use 62.5 frames per second), and a sequence of notes is represented as a binary matrix of size [frames $\times 1 2 8 ]$ indicating the presence or absence of an active note at a given pitch and time.
124
+
125
+ Onset F1 score considers a prediction to be correct if it has the same pitch and is within $\pm 5 0 \mathrm { m s }$ of a reference onset. This metric ignores note offsets.
126
+
127
+ Onset-Offset F1 score is the strictest metric commonly used in the transcription literature. In addition to matching onsets and pitch as above, notes must also have matching offsets. The criterion for matching offsets is that offsets must be within $0 . 2 \cdot$ reference duration or $5 0 \mathrm { m s }$ from each other, whichever is greater: |offset diff| $\leq \mathrm { m a x } ( 0 . 2$ · reference duration, $5 0 \mathrm { m s }$ ) (Raffel et al., 2014).
128
+
129
+ While these three metrics are standard for music transcription models, they offer only a limited view of the performance of a multi-instrument model, as none consider which instrument is predicted to play which notes in a sequence. This is due to the facts that (1) most prior music transcription models were limited to single-instrument transcription, and (2) even most multi-instrument transcription models did not assign specific instruments to predicted notes; we also believe the lack of a true multi-instrument metric has led to this gap in prior work. Thus, we also propose and evaluate our models’ performance using a novel metric which we call multi-instrument $F l$ .
130
+
131
+ Multi-instrument F1 adds to the Onset-Offset F1 score the additional requirement that the instrument predicted to play a note must match the instrument of the reference note. This is a stricter metric than the MV2H metric proposed in McLeod & Steedman (2018), as MV2H ignores offsets and also eliminates notes from ground-truth during evaluation of the instrument labels when the pitch is not correctly detected; multi-instrument F1 is also more directly related to the existing transcription metrics widely used in prior works.
132
+
133
+ Due to the limitations of previous models, it is often not possible to compute a multi-instrument F1 score for previous works; as a result, we only provide this metric for our model (shown in Table 3).
134
+
135
+ We also evaluate our models’ ability to transfer to unseen datasets by conducting “leave-one-datasetout” (LODO) training experiments. These results demonstrate the generality of our approach in transferring to entirely new datasets, and are also useful in evaluating the impact of the various datasets used on the final model performance.
136
+
137
+ Two of our datasets (Slakh2100, Cerberus4) contain drums. When evaluating our model, we match reference and estimated drum hits using onset time and General MIDI drum type (as the concept of a “drum offset” is not meaningful); a more rigorous evaluation methodology focused specifically on drums can be found in Callender et al. (2020).
138
+
139
+ # 4.2.1 BASELINES
140
+
141
+ For each dataset, we compare to one or more baseline models. In addition to comparing to previous works which developed machine learning models for multi-instrument transcription on one or more of our datasets, we also compare our results to a professional-quality DSP software for polyphonic pitch transcription, Melodyne3. Details on our usage of Melodyne are provided in Section C.
142
+
143
+ As a consequence of the dataset-specific training and architectures mentioned above, not all models are appropriate for all datasets. As a result, we only provide results for baseline models on datasets containing the instruments for which the original model was designed: for example, we evaluate the Cerberus model (Manilow et al., 2020) only on the Cerberus4 dataset, which contains the four instruments for which the model contains specific transcription heads, and GuitarSet, where we only use the output of the model’s “guitar” head. (While Cerberus was not originally trained on GuitarSet, Manilow et al. (2020) uses GuitarSet as an evaluation dataset; we compare to Cerberus due to the lack of an alternative baseline for GuitarSet.) On MAESTRO and MusicNet, we compare to Hawthorne et al. (2021) and Cheuk et al. (2021), which were trained on those respective datasets.
144
+
145
+ Table 2: Transcription F1 scores for Frame, Onset, and Onset+Offset metrics defined in Section 4.2. Across all metrics and all datasets, MT3 consistently outperforms the baseline systems we compare against. Dataset mixing during training (“mixture”), specifically, shows a large performance increase over single dataset training, especially for “low-resource” datasets like GuitarSet, MusicNet, and URMP. Percent increase over single-dataset training for Onset+Offset F1 is shown in the last row.
146
+
147
+ <table><tr><td>Model</td><td>MAESTRO</td><td>Cerberus4</td><td>GuitarSet</td><td>MusicNet</td><td>Slakh2100</td><td>URMP</td></tr><tr><td colspan="7">Frame F1</td></tr><tr><td>Hawthorne et al. (2021)</td><td>0.66</td><td>1</td><td></td><td>1</td><td></td><td></td></tr><tr><td>Manilow et al. (2020)</td><td>1</td><td>0.63</td><td>0.54</td><td>1</td><td></td><td></td></tr><tr><td>Cheuk et al. (2021)</td><td>1</td><td>1</td><td>1</td><td>0.48</td><td>一</td><td>1</td></tr><tr><td>Melodyne</td><td>0.41</td><td>0.39</td><td>0.62</td><td>0.13</td><td>0.47</td><td>0.30</td></tr><tr><td>MT3 (single dataset)</td><td>0.88</td><td>0.85</td><td>0.82</td><td>0.60</td><td>0.78</td><td>0.49</td></tr><tr><td>MT3 (mixture)</td><td>0.86</td><td>0.87</td><td>0.89</td><td>0.68</td><td>0.79</td><td>0.83</td></tr><tr><td colspan="7">Onset F1</td></tr><tr><td>Hawthorne et al. (2021)</td><td>0.96</td><td>1</td><td>1</td><td></td><td></td><td></td></tr><tr><td>Manilow et al. (2020)</td><td>1</td><td>0.67</td><td>0.16</td><td>1</td><td></td><td>二</td></tr><tr><td>Cheuk et al. (2021)</td><td>1</td><td>1</td><td>1</td><td>0.29</td><td>1</td><td>1</td></tr><tr><td>Melodyne</td><td>0.52</td><td>0.24</td><td>0.28</td><td>0.04</td><td>0.30</td><td>0.09</td></tr><tr><td>MT3 (single dataset)</td><td>0.96</td><td>0.89</td><td>0.83</td><td>0.39</td><td>0.76</td><td>0.40</td></tr><tr><td>MT3 (mixture)</td><td>0.95</td><td>0.92</td><td>0.90</td><td>0.50</td><td>0.76</td><td>0.77</td></tr><tr><td colspan="7">Onset+Offset F1</td></tr><tr><td>Hawthorne et al. (2021)</td><td>0.84</td><td>1</td><td>1</td><td>1</td><td>1</td><td></td></tr><tr><td>Manilow et al. (2020)</td><td>1</td><td>0.37</td><td>0.08</td><td>1</td><td></td><td></td></tr><tr><td>Cheuk et al. (2021)</td><td>1</td><td>1</td><td>1</td><td>0.11</td><td>一</td><td>一</td></tr><tr><td>Melodyne</td><td>0.06</td><td>0.07</td><td>0.13</td><td>0.01</td><td>0.10</td><td>0.04</td></tr><tr><td>MT3 (single dataset)</td><td>0.84</td><td>0.76</td><td>0.65</td><td>0.21</td><td>0.57</td><td>0.16</td></tr><tr><td>MT3 (mixture)</td><td>0.80</td><td>0.80</td><td>0.78</td><td>0.33</td><td>0.57</td><td>0.58</td></tr><tr><td>Mixture (△%)</td><td>-5.3</td><td>+5.2</td><td>+19.5</td><td>+54.0</td><td>+0.1</td><td>+263</td></tr></table>
148
+
149
+ Wherever possible, we provide results from baseline models computed on the same test split used to evaluate MT3. This may overestimate the performance of some baselines if tracks or track segments in our validation/test sets may have been included in the training sets of the baseline models (due to the lack of a consistent train/test/validation split for some of these datasets). In an effort to address this issue for future work, we provide exact details to reproduce our train/test/validation splits in Appendix B and give further details on the baselines used, including information on reproducing our results, in Section C. For each model, we compute the reported metrics using pretrained models provided by the original authors. The ability to provide evaluation results for a single model across several datasets is an additional benefit of our approach and a contribution of the current work.
150
+
151
+ # 4.3 RESULTS
152
+
153
+ Our main results are shown in Table 2, which compares our models’ performance on the six datasets described above. Our model achieves transcription performance exceeding the current state of the art for each of the six datasets evaluated across all three standard transcription metrics (Frame, Onset, and Onset $^ +$ Offset F1), as shown in Table 2. This is particularly notable due to the fact, mentioned above, that each baseline model was specifically designed (in terms of architecture and loss function), trained, and tuned on the individual datasets listed. Additionally, our model is able to significantly advance the state of the art on the three resource-limited datasets discussed above, GuitarSet, MusicNet, and URMP. Table 2 also demonstrates a large gain in performance on the
154
+
155
+ <table><tr><td>MIDI Grouping</td><td>MAESTRO</td><td>Cerberus4</td><td>GuitarSet</td><td>MusicNet</td><td>Slakh2100</td><td>URMP</td></tr><tr><td>Flat</td><td>0.81</td><td>0.74</td><td>0.78</td><td>0.33</td><td>0.48</td><td>0.62</td></tr><tr><td>MIDI Class</td><td>0.80</td><td>0.81</td><td>0.78</td><td>0.31</td><td>0.62</td><td>0.59</td></tr><tr><td>Full</td><td>0.82</td><td>0.76</td><td>0.78</td><td>0.34</td><td>0.55</td><td>0.50</td></tr></table>
156
+
157
+ Table 3: Multi-instrument F1 score for MT3 (mixture) trained and evaluated at different levels of instrument granularity. The Flat grouping treats all non-drum instruments as a single instrument. This resembles the setup of many prior “multi-instrument” transcription works which transcribe notes played by all instruments, without respect to their source. The MIDI Class grouping maps instruments to their MIDI class (Table 8). This creates groupings of eight program numbers each, with general classes for piano, guitar, bass, strings, brass, etc. The Full grouping retains instruments’ program numbers as annotated in the source dataset. This requires the model to distinguish notes played by e.g. violin, viola, cello, all of which are grouped in the “strings” MIDI Class.
158
+
159
+ resource-limited datasets when using the mixture formulation of our task, particularly for the multiinstrument datasets MusicNet and URMP; the mixture performance leads to an Onset-Offset F1 gain of $5 4 \%$ on MusicNet and $2 6 3 \%$ on URMP. Our model outperforms other baselines specifically optimized for low-resource datasets, such as Cheuk et al. (2021), while also remaining competitive with or outperforming models tuned for large single-instrument datasets, i.e. Hawthorne et al. (2021).
160
+
161
+ Instruments “in the wild” come in many different forms, and labeling exactly which sound sources contain the same instrument is a necessary but nontrivial task. While the original General MIDI 1.0 specification (1996) provides a 1:1 mapping of program numbers to 128 instruments4 and a coarser grouping of these instruments into “classes” of eight program numbers (Table 8), these mappings are necessarily reductive: not all instruments are represented in the original 128 instruments mapped to program numbers (e.g. ukulele), and other instruments (piano, organ, guitar) include multiple program numbers which may be desirable to treat as a single instrument for the purposes of transcription (e.g. transcribing program numbers 32-39 as a single “bass” class). To explore the effect of instrument label granularity, we train and evaluate models with three levels of instrument groupings: Flat, MIDI Class, and Full, shown in Table 3. We evaluate models at these three grouping levels according to the multi-instrument transcription metric defined in Section 4.2.
162
+
163
+ Table 3 demonstrates that our model makes few instrument label errors when it predicts onsets and offsets correctly, even at the highest level of granularity (“Full”), as the multi-instrument F1 scores are close to the onset-offset F1 scores in Table 2. We also provide an example transcription in Figure 3, which shows the distinct instrument tracks for an input from the Slakh2100 dataset. In addition to our transcription results, we provide further experimental results in Appendix D. There, we assess the ability of our approach to generalize to unseen datasets by conducting a set of leave-one-datasetout (LODO) experiments; we also provide evidence regarding the label quality of our datasets by varying the onset and offset tolerance threshold used to compute F1 scores.
164
+
165
+ # 5 CONCLUSION AND FUTURE WORK
166
+
167
+ In this work we have shown that posing multi-instrument music transcription as a sequence-tosequence task and training a generic Transformer architecture simultaneously on a variety of datasets advances the state of the art in multi-instrument transcription, most notably in the lowresource scenario. We also introduced and applied a consistent evaluation method using note onset+offset+instrument F1 scores, using a standard instrument taxonomy.
168
+
169
+ Our work suggests several future research directions. As labeled data for multi-instrument transcription with realistic audio is very expensive, transcription models may benefit from training on unlabeled data, in a self- or semi-supervised fashion. There may also be value in a variety of data augmentation strategies, e.g. mixing together unrelated examples to generate new training data. Finally, high-quality AMT models such as ours present new frontiers for other musical modeling tasks, such as generative music modeling (i.e. Dhariwal et al. (2020); Huang et al. (2018)); the transcriptions from our model could be used as training data for a symbolic music generation model.
170
+
171
+ # 6 REPRODUCIBILITY STATEMENT
172
+
173
+ In conjunction with the release of this work, we will make our model code, along with the code we used to replicate prior baseline models, available at https://github.com/magenta/mt3.
174
+
175
+ # 7 ETHICAL CONSIDERATIONS
176
+
177
+ One limitation of our system (and the baseline systems against which we compare) is that it is trained on and applicable only to music from the “Western tradition”. The characteristic of Western music most relevant to this work is that it is typically composed of discrete notes belonging to one of 12 pitch classes i.e. “C”, “C#”, “D”, etc. As such, music that does not have a well-defined mapping onto these 12 pitch classes is outside the scope of this work. This excludes many non-Western musical traditions such as Indian ragas and Arabic maqams, and Western genres like the blues that rely on microtonality. These types of music would be better suited to alternate representations e.g. single or multiple non-discretized pitch tracks. We note that such data should also be considered “low-resource” given the low availability of transcription datasets representing such traditions, and represent an important area for future work. See Holzapfel et al. (2019) for a user study on existing AMT systems in this context), and Viraraghavan et al. (2020) for an approach to transcription in one non-Western domain.
178
+
179
+ # REFERENCES
180
+
181
+ Rosana Ardila, Megan Branson, Kelly Davis, Michael Kohler, Josh Meyer, Michael Henretty, Reuben Morais, Lindsay Saunders, Francis Tyers, and Gregor Weber. Common Voice: A massively-multilingual speech corpus. In Proceedings of the 12th Language Resources and Evaluation Conference, pp. 4218–4222, Marseille, France, May 2020. European Language Resources Association. ISBN 979-10-95546-34-4. URL https://aclanthology.org/ 2020.lrec-1.520.
182
+ MIDI Manufacturers Association. The complete MIDI 1.0 detailed specification. Los Angeles, CA, The MIDI Manufacturers Association, 1996.
183
+ Sebastian Bock and Markus Schedl. Polyphonic piano note transcription with recurrent neural ¨ networks. In 2012 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 121–124. IEEE, 2012.
184
+ James Bradbury, Roy Frostig, Peter Hawkins, Matthew James Johnson, Chris Leary, Dougal Maclaurin, and Skye Wanderman-Milne. JAX: composable transformations of Python $^ +$ NumPy programs, 2018. http://github.com/google/jax, 4:16, 2020.
185
+ 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.
186
+ Lee Callender, Curtis Hawthorne, and Jesse Engel. Improving perceptual quality of drum transcription with the expanded Groove MIDI Dataset. arXiv preprint arXiv:2004.00188, 2020.
187
+ Mark Cartwright and Juan Pablo Bello. Increasing drum transcription vocabulary using data synthesis. In Proc. International Conference on Digital Audio Effects (DAFx), pp. 72–79, 2018.
188
+ Rodrigo Castellon, Chris Donahue, and Percy Liang. Codified audio language modeling learns useful representations for music information retrieval. arXiv preprint arXiv:2107.05677, 2021.
189
+ Kin Wai Cheuk, Dorien Herremans, and Li Su. ReconVAT: A semi-supervised automatic music transcription framework for low-resource real-world data. arXiv preprint arXiv:2107.04954, 2021.
190
+ 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.
191
+ Prafulla Dhariwal, Heewoo Jun, Christine Payne, Jong Wook Kim, Alec Radford, and Ilya Sutskever. Jukebox: A generative model for music. arXiv preprint arXiv:2005.00341, 2020.
192
+
193
+ Sander Dieleman, Charlie Nash, Jesse Engel, and Karen Simonyan. Variable-rate discrete representation learning. arXiv preprint arXiv:2103.06089, 2021.
194
+
195
+ Yuan Gong, Yu-An Chung, and James Glass. AST: Audio Spectrogram Transformer. arXiv preprint arXiv:2104.01778, 2021.
196
+
197
+ Anmol Gulati, James Qin, Chung-Cheng Chiu, Niki Parmar, Yu Zhang, Jiahui Yu, Wei Han, Shibo Wang, Zhengdong Zhang, Yonghui Wu, et al. Conformer: Convolution-augmented Transformer for speech recognition. arXiv preprint arXiv:2005.08100, 2020.
198
+
199
+ Curtis Hawthorne, Erich Elsen, Jialin Song, Adam Roberts, Ian Simon, Colin Raffel, Jesse Engel, Sageev Oore, and Douglas Eck. Onsets and Frames: Dual-objective piano transcription. arXiv preprint arXiv:1710.11153, 2017.
200
+
201
+ Curtis Hawthorne, Andriy Stasyuk, Adam Roberts, Ian Simon, Cheng-Zhi Anna Huang, Sander Dieleman, Erich Elsen, Jesse Engel, and Douglas Eck. Enabling factorized piano music modeling and generation with the MAESTRO dataset. arXiv preprint arXiv:1810.12247, 2018.
202
+
203
+ Curtis Hawthorne, Ian Simon, Rigel Swavely, Ethan Manilow, and Jesse Engel. Sequence-tosequence piano transcription with Transformers. arXiv preprint arXiv:2107.09142, 2021.
204
+
205
+ Jonathan Heek, Anselm Levskaya, Avital Oliver, Marvin Ritter, Bertrand Rondepierre, Andreas Steiner, and Marc van Zee. Flax: A neural network library and ecosystem for JAX. Version 0.3, 3, 2020.
206
+
207
+ Andre Holzapfel, Emmanouil Benetos, et al. Automatic music transcription and ethnomusicology: A user study. In In Proceedings of the 20th International Society for Music Information Retrieval Conference, ISMIR, 2019.
208
+
209
+ Cheng-Zhi Anna Huang, Ashish Vaswani, Jakob Uszkoreit, Noam Shazeer, Ian Simon, Curtis Hawthorne, Andrew M Dai, Matthew D Hoffman, Monica Dinculescu, and Douglas Eck. Music Transformer. arXiv preprint arXiv:1809.04281, 2018.
210
+
211
+ Eric J Humphrey, Justin Salamon, Oriol Nieto, Jon Forsyth, Rachel M Bittner, and Juan Pablo Bello. JAMS: A JSON annotated music specification for reproducible MIR research. In ISMIR, pp. 591– 596, 2014.
212
+
213
+ Rainer Kelz, Matthias Dorfer, Filip Korzeniowski, Sebastian Bock, Andreas Arzt, and Gerhard Wid- ¨ mer. On the potential of simple framewise approaches to piano transcription. arXiv preprint arXiv:1612.05153, 2016.
214
+
215
+ Rainer Kelz, Sebastian Bock, and Gerhard Widmer. Deep polyphonic ADSR piano note transcrip- ¨ tion. In ICASSP 2019-2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 246–250. IEEE, 2019.
216
+
217
+ Yuma Koizumi, Shigeki Karita, Scott Wisdom, Hakan Erdogan, John R Hershey, Llion Jones, and Michiel Bacchiani. DF-Conformer: Integrated architecture of Conv-TasNet and Conformer using linear complexity self-attention for speech enhancement. arXiv preprint arXiv:2106.15813, 2021.
218
+
219
+ Qiuqiang Kong, Bochen Li, Xuchen Song, Yuan Wan, and Yuxuan Wang. High-resolution piano transcription with pedals by regressing onsets and offsets times. arXiv preprint arXiv:2010.01815, 2020.
220
+
221
+ Bochen Li, Xinzhao Liu, Karthik Dinesh, Zhiyao Duan, and Gaurav Sharma. Creating a multitrack classical music performance dataset for multimodal music analysis: Challenges, insights, and applications. IEEE Transactions on Multimedia, 21(2):522–535, 2018.
222
+
223
+ Liwei Lin, Qiuqiang Kong, Junyan Jiang, and Gus Xia. A unified model for zero-shot music source separation, transcription and synthesis. arXiv preprint arXiv:2108.03456, 2021.
224
+
225
+ Ethan Manilow, Gordon Wichern, Prem Seetharaman, and Jonathan Le Roux. Cutting music source separation some Slakh: A dataset to study the impact of training data quality and quantity. In 2019 IEEE Workshop on Applications of Signal Processing to Audio and Acoustics (WASPAA), pp. 45–49. IEEE, 2019.
226
+
227
+ Ethan Manilow, Prem Seetharaman, and Bryan Pardo. Simultaneous separation and transcription of mixtures with multiple polyphonic and percussive instruments. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 771–775. IEEE, 2020.
228
+
229
+ Matthias Mauch and Simon Dixon. pYIN: A fundamental frequency estimator using probabilistic threshold distributions. In 2014 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 659–663. IEEE, 2014.
230
+
231
+ Andrew McLeod and Mark Steedman. Evaluating automatic polyphonic music transcription. In ISMIR, pp. 42–49, 2018.
232
+
233
+ Xinhao Mei, Xubo Liu, Qiushi Huang, Mark D Plumbley, and Wenwu Wang. Audio Captioning Transformer. arXiv preprint arXiv:2107.09817, 2021.
234
+
235
+ Vassil Panayotov, Guoguo Chen, Daniel Povey, and Sanjeev Khudanpur. LibriSpeech: an ASR corpus based on public domain audio books. In 2015 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 5206–5210. IEEE, 2015.
236
+
237
+ Graham E Poliner and Daniel PW Ellis. A discriminative model for polyphonic piano transcription. EURASIP Journal on Advances in Signal Processing, 2007:1–9, 2006.
238
+
239
+ Colin Raffel. Learning-based methods for comparing sequences, with applications to audio-toMIDI alignment and matching. Columbia University, 2016.
240
+
241
+ Colin Raffel, Brian McFee, Eric J Humphrey, Justin Salamon, Oriol Nieto, Dawen Liang, Daniel PW Ellis, and C Colin Raffel. mir eval: A transparent implementation of common MIR metrics. In In Proceedings of the 15th International Society for Music Information Retrieval Conference, ISMIR, 2014.
242
+
243
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text Transformer. arXiv preprint arXiv:1910.10683, 2019.
244
+
245
+ Cem Subakan, Mirco Ravanelli, Samuele Cornell, Mirko Bronzi, and Jianyuan Zhong. Attention is all you need in speech separation. In ICASSP 2021-2021 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 21–25. IEEE, 2021.
246
+
247
+ Keitaro Tanaka, Takayuki Nakatsuka, Ryo Nishikimi, Kazuyoshi Yoshii, and Shigeo Morishima. Multi-instrument music transcription based on deep spherical clustering of spectrograms and pitchgrams. In International Society for Music Information Retrieval Conference (ISMIR), pp. 327–334, 2020.
248
+
249
+ John Thickstun, Zaid Harchaoui, and Sham Kakade. Learning features of music from scratch. arXiv preprint arXiv:1611.09827, 2016.
250
+
251
+ 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.
252
+
253
+ Prateek Verma and Jonathan Berger. Audio Transformers: Transformer architectures for large scale audio understanding. Adieu convolutions. arXiv preprint arXiv:2105.00335, 2021.
254
+
255
+ Prateek Verma and Chris Chafe. A generative model for raw audio using Transformer architectures. arXiv preprint arXiv:2106.16036, 2021.
256
+
257
+ Venkata Subramanian Viraraghavan, Arpan Pal, Hema Murthy, and Rangarajan Aravind. Statebased transcription of components of carnatic music. In ICASSP 2020-2020 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), pp. 811–815. IEEE, 2020.
258
+
259
+ Qingyang Xi, Rachel M Bittner, Johan Pauwels, Xuzhou Ye, and Juan Pablo Bello. GuitarSet: A dataset for guitar transcription. In ISMIR, pp. 453–460, 2018.
260
+
261
+ Linting Xue, Noah Constant, Adam Roberts, Mihir Kale, Rami Al-Rfou, Aditya Siddhant, Aditya Barua, and Colin Raffel. mT5: A massively multilingual pre-trained text-to-text transformer. arXiv preprint arXiv:2010.11934, 2020.
262
+
263
+ ![](images/791a2638f0c3212e5c7476f26754fac3cbfce8b2a0f3a65893f24c9e252e4c74.jpg)
264
+
265
+ ![](images/a44ba9dce94aa9cc8c04672541478628e3dfb1f355ec0b66d5a7b9072dcd1a58.jpg)
266
+ Predicted Piano Roll for Instrument: Piano
267
+
268
+ ![](images/5544f6f047062a62a9ca8edf44d53dcec26748c202069cd5c6dac51546d2872c.jpg)
269
+ Predicted Piano Roll for Instrument: Drawbar Organ
270
+
271
+ ![](images/55b0ecc83015452422ab133fdc2003697fd25dcd74e1f8374115dd082c3dd82d.jpg)
272
+ Predicted Piano Roll for Instrument:Acoustic Guitar
273
+
274
+ ![](images/bc4083c58e38864e4b5e17536cd98fe480f34a52dc6f12e1e4dc41b67a8f1d6c.jpg)
275
+ Predicted Piano Roll for Instrument: Finger Bass
276
+
277
+ ![](images/2133c0dfa096f172231d4838d151f50e11a9d83eb787ec133f0cfea51fe81e10.jpg)
278
+ Predicted Piano Roll for Instrument: Drums
279
+ Figure 3: 15-second excerpt of MT3 transcriptions from a mix from the Slakh2100 dataset. Black lines indicate model input frames. Blue notes indicate “True Positive” notes with correct predicted onset, offset, pitch, and instrument. In this segment, the model achieves an Onset-Offset F1 of 0.665. More extensive results from MT3 can be found on the companion website at https:// storage.googleapis.com/mt3/index.html.
280
+
281
+ Table 4: Details of model architecture used.
282
+
283
+ <table><tr><td>Model</td><td>MLP Dim</td><td>Num. HeadsNum. Layers</td><td></td><td>Embed. Dim.</td><td>LR</td><td>Params</td></tr><tr><td>T5 Small</td><td>1024</td><td>6</td><td>8</td><td>512</td><td>1e-3</td><td>93.7M</td></tr></table>
284
+
285
+ # A MODEL AND TRAINING DETAILS
286
+
287
+ We use the T5 “small” model architecture described in Raffel et al. (2019), with the modifications defined in the T5.1.1 recipe5. This is a standard Transformer architecture, and we use the implementation available in $\pm 5 \mathrm { { \dot { x } } ^ { 6 } }$ , which is built on FLAX (Heek et al., 2020) and JAX (Bradbury et al., 2020).
288
+
289
+ All mixture models are trained for 1M steps using a fixed learning rate of 0.001. The dataset-specific models are trained for $2 ^ { 1 9 }$ steps, as these models tended to converge much faster, particularly on the smaller datasets. Due to computational constraints we also train the LODO models for $2 ^ { 1 9 }$ steps.
290
+
291
+ # B DATASET DETAILS
292
+
293
+ This section describes the datasets used in the experiments throughout this work. Descriptive statistics for each dataset are provided in Table 1. However, because not all datasets provide an official train-test split, and because we perform preprocessing and filtering to extract suitable multiinstrument transcription datasets from the unprocessed versions of some datasets, we provide further details for reproducibility here.
294
+
295
+ # B.1 MAESTROV3
296
+
297
+ The MAESTRO (MIDI and Audio Edited for Synchronous TRacks and Organization) v3 dataset7 (Hawthorne et al., 2018) contains 198.7 hours of piano performances captured via a Disklavier piano equipped with a MIDI capture device which ensures fine alignment $( \approx 3 \mathrm { m s } )$ between note labels and audio waveforms. The MAESTRO dataset contains mostly classical music and only includes piano performances (no other instruments).
298
+
299
+ MAESTRO includes a standard train/validation/test split, which ensures that the same composition does not appear in multiple subsets. 962 performances are in the train set, 137 are in the validation set, and 177 are in the test set. More detailed statistics on the MAESTRO dataset are available at https://magenta.tensorflow.org/datasets/maestro.
300
+
301
+ # B.2 SLAKH2100
302
+
303
+ The Lakh MIDI Dataset (Raffel, 2016) is a collection of 176,581 unique MIDI files scraped from publicly-available sources on the Internet, spanning multiple genres. The Synthesized Lakh Dataset (Slakh, or Slakh2100) (Manilow et al., 2019), is a dataset constructed by creating high-quality renderings of 2100 files from Lakh MIDI using professional-quality virtual instruments. The 2100 files selected all contain at least piano, bass, guitar, and drums, where each of these four instruments plays at least 50 notes.
304
+
305
+ When training on Slakh2100, we choose 10 random subsets of at least 4 instruments from each of the 2100 MIDI files as a form of data augmentation, expanding the number of training examples by a factor of 10 (though individual stems will in general appear in more than one example).
306
+
307
+ We use the standard Slakh2100 train/validation/test splits for all experiments.
308
+
309
+ # B.3 CERBERUS4
310
+
311
+ We refer to as Cerberus4 another slice of the Slakh2100 dataset; in this case for each MIDI file we extract all subsets of instruments containing (exactly) one of each of piano, guitar, bass, and drums. This is intended to reflect the dataset construction in Manilow et al. (2020), but using entire tracks instead of shorter segments and with no additional criteria on instrument “activity”.
312
+
313
+ Cerberus4 contains 1327 tracks representing 542.6 hours of audio. We use the Slakh2100 train/test/validation split to separate Cerberus4 tracks. The training set contains 960 tracks with 418.13 hours of audio, the test set contains 132 tracks with 46.1 hours of audio, and the validation set contains 235 tracks with 78.4 hours of audio.
314
+
315
+ # B.4 GUITARSET
316
+
317
+ GuitarSet8 is a dataset consisting of high-quality guitar recordings and time-aligned annotations. GuitarSet contains 360 excerpts, which are the result of 6 guitarists each playing 30 lead sheets (songs) in two versions (“comping” and “soloing”). Those 30 lead sheets are a combination of five styles (Rock, Singer-Songwriter, Bossa Nova, Jazz, and Funk), three progressions (12 Bar Blues, Autumn Leaves, and Pachelbel Canon), and two tempi (slow and fast). The original GuitarSet annotations are provided in the JAMS format (Humphrey et al., 2014), which we convert to MIDI for use with standard evaluation libraries.
318
+
319
+ There is no official train-test split for GuitarSet. We establish the following split: for every style, we use the first two progressions for train and the final for validation. For convenience, we provide the exact train/validation split for tracks as part of the open-source release for this paper. This split produces 478 tracks for training, and 238 for validation.
320
+
321
+ # B.5 MUSICNET
322
+
323
+ MusicNet9 (Thickstun et al., 2016) consists of 330 recordings of classical music with MIDI annotations. The annotations were aligned to recordings via dynamic time warping, and were then verified by trained musicians.
324
+
325
+ The standard train/test split for MusicNet Thickstun et al. (2016) only contains 10 test tracks and no validation set. We perform our own random split of the dataset into train/validation/test sets, and we provide the exact track IDs in each split in our open-source code release for this paper.
326
+
327
+ We discuss potential label quality issues with MusicNet in Appendix D.
328
+
329
+ # B.6 URMP
330
+
331
+ The University of Rochester Multi-Modal Music Performance (URMP) dataset (Li et al., 2018)10 consists of audio, video, and MIDI annotation of multi-instrument musical pieces assembled from coordinated but separately recorded performances of individual tracks. That is, each part of each piece is recorded in isolation by an individual performer in coordination with the other performers (to ensure complete isolation of audio). The resulting mix is produced by combining the individual instrument tracks.
332
+
333
+ The dataset includes 11 duets, 12 trios, 14 quartets, and 7 quintets. In total, there are 14 different instruments in the dataset, including strings (violin, viola, cello, double bass), woodwinds (flute, oboe, clarinet, bassoon, soprano saxophone, tenor saxophone), and brass (trumpet, horn, trombone, tuba).
334
+
335
+ The dataset also includes videos and sheet music, which are not used in this paper.
336
+
337
+ We use the following pieces for validation: 1, 2, 12, 13, 24, 25, 31, 38, 39. The remaining pieces are used for training. This validation split reserves two duets; two trios; three quartets; and two quintets for the validation set, ensuring a diverse instrumentation in the validation split.
338
+
339
+ We discuss potential label quality issues with URMP in Appendix D.
340
+
341
+ # C BASELINE DETAILS
342
+
343
+ Manilow et al. (2020): For this baseline, we used a model trained with the authors’ original code for the Cerberus 4-instrument model (guitar, piano, bass, drums) on the slakh-redux dataset, which omits duplicate tracks included in the original release of Slakh2100. We use the same procedure for randomly cropping audio and filtering for active instruments described above and in the original Cerberus paper (Manilow et al., 2020), using the public train/validation/test splits for Slakh.
344
+
345
+ Cheuk et al. (2021): We use the authors’ pretrained models and inference script provided at https://github.com/KinWaiCheuk/ReconVAT. Due to resource limitations, following correspondence with the authors, we divide the audio tracks from MusicNet into 20-second segments for inference, and conduct evaluation on these segments directly. We discard any segments without any active notes in the ground-truth annotations, because the mir eval metrics are undefined without any notes in the reference track.
346
+
347
+ Melodyne: Melodyne11 is a professional-quality audio software tool designed to provide note-based analysis and editing of audio recordings. Melodyne contains multiple algorithms for polyphonic pitch tracking, including algorithms for “polyphonic sustain” (designed for instruments with a slow decay, such as strings) and “polyphonic decay” (designed for instruments with a fast decay. For all results in this paper, we used Melodyne Studio version 5.1.1.003. The raw .wav files for each dataset were imported into Melodyne, and the default pitch-tracking settings were used to transcribe the audio (which allows Melodyne to automatically select the algorithm most suited to a given audio file). Melodyne exports MIDI files directly, which were used for our downstream analysis.
348
+
349
+ Melodyne does not provide a programmatic interface. Due to the large amount of manual effort required to perform large-scale transcription with Melodyne, for MAESTRO, Slakh10, Cerberus4, and GuitarSet, our analysis of Melodyne is performed on a random subset of 30 tracks from the test set for each of these datasets. For URMP and MusicNet we evaluate Melodyne on the entire test set.
350
+
351
+ Because Melodyne is a proprietary third-party software tool, we are not available to provide further details on the exact algorithms used to transcribe audio.
352
+
353
+ # D ADDITIONAL RESULTS
354
+
355
+ # D.1 EVALUATING ZERO-SHOT GENERALIZATION WITH LEAVE-ONE-DATASET-OUT
356
+
357
+ In order to evaluate the generalizability of our proposed model, we evaluate our model on a challenging zero-shot generalization task. The procedure in these ‘leave-one-dataset-out’ (LODO) experiments is as follows: Let the $\mathcal { D } _ { \mathrm { t r } , i }$ represent an individual transcription dataset (e.g. MAESTRO), such that the full training set is $\begin{array} { r } { \mathcal { D } _ { \mathrm { t r } } : = \bigcup _ { i } \mathcal { D } _ { \mathrm { t r } , i } } \end{array}$ For each dataset $\mathcal { D } _ { j }$ , we train an MT3 model using the same mixture procedure described above, but with training set $\tilde { \mathcal { D } } _ { \mathrm { t r } } = \mathcal { D } _ { \mathrm { t r } } \backslash \mathcal { D } _ { \mathrm { t r } , j }$ . Then, we evaluate on each dataset $\mathcal { D } _ { \mathrm { t r } , i } \in \mathcal { D } _ { \mathrm { t r } }$ .
358
+
359
+ Since Slakh2100 and Cerberus4 are generated using the same subset of track stems and the same synthesis software, we jointly either include or exclude those datasets in our LODO experiments.
360
+
361
+ The results of this study are shown in Tables 5 and 6. Table 5 shows that our model is able to achieve nontrivial note prediction performance for most datasets, attaining multi-instrument F1 and onset-offset F1 scores which outperform the baseline models on each of the low-resource datasets (GuitarSet, URMP). For all of the datasets, our model achieves LODO onset F1 scores between 0.14 and 0.78. For the much more challenging multi-instrument F1 score, our model’s performance on the LODO task varies by dataset.
362
+
363
+ In general, these results show that our model can obtain non-trivial transcription performance even for datasets it has never seen during training, despite large differences in the sonic qualities, compositional styles, and instrumentation of the zero-shot evaluation datasets. However, the LODO experiments also point to the sensitivity of the model to the absence of particular datasets, highlighting the resource-constrained nature of the available music transcription datasets even when combined. For example, the $\mathrm { S l a k h } 2 1 0 0 +$ Cerberus4 combination is the only dataset in our LODO experiments that contains bass and synthesizer; without training on those datasets, the model is unable to learn to identify these instruments.
364
+
365
+ Table 5: Leave-one-dataset-out transcription scores.
366
+
367
+ <table><tr><td></td><td colspan="5">Evaluation Dataset</td></tr><tr><td>Left-Out Dataset</td><td>MAESTRO Cerberus4</td><td>GuitarSet</td><td>MusicNet</td><td></td><td>Slakh2100 URMP</td></tr><tr><td colspan="6">Frame F1 0.87</td></tr><tr><td>None</td><td>0.86</td><td>0.89</td><td>0.68</td><td>0.79</td><td>0.83</td></tr><tr><td>MAESTRO</td><td>0.60</td><td>0.89</td><td>0.69</td><td>0.75</td><td>0.82</td></tr><tr><td>Cerberus4 + Slakh2100</td><td>0.87</td><td>0.87</td><td>0.67</td><td>0.55</td><td>0.78</td></tr><tr><td>GuitarSet</td><td>0.86</td><td>0.58</td><td>0.71</td><td>0.76</td><td>0.82</td></tr><tr><td>MusicNet</td><td>0.86</td><td>0.89</td><td>0.53</td><td>0.76</td><td>0.79</td></tr><tr><td>URMP</td><td>0.86</td><td>0.89</td><td>0.71</td><td>0.76</td><td>0.76</td></tr><tr><td colspan="6">Onset F1</td></tr><tr><td>None</td><td>0.95 0.92</td><td>0.90</td><td>0.50</td><td>0.76</td><td>0.77</td></tr><tr><td>MAESTRO</td><td>0.28</td><td>0.78</td><td>0.35</td><td>0.52</td><td>0.57</td></tr><tr><td>Cerberus4 + Slakh2100</td><td>0.82</td><td>0.75</td><td>0.30</td><td>0.14</td><td>0.49</td></tr><tr><td>GuitarSet</td><td>0.81</td><td>0.32</td><td>0.36</td><td>0.53</td><td>0.59</td></tr><tr><td>MusicNet</td><td>0.80</td><td>0.78</td><td>0.18</td><td>0.53</td><td>0.54</td></tr><tr><td>URMP</td><td>0.81</td><td>0.79</td><td>0.36</td><td>0.53</td><td>0.23</td></tr><tr><td colspan="6">Onset+Offset+Program F1</td></tr><tr><td>None</td><td>0.80 0.80 0.76</td><td>0.78</td><td>0.33</td><td>0.57</td><td>0.58</td></tr><tr><td>MAESTRO</td><td>0.28</td><td>0.78</td><td>0.33</td><td>0.52</td><td>0.50</td></tr><tr><td>Cerberus4+ Slakh2100</td><td>0.82</td><td>0.75</td><td>0.29</td><td>0.02</td><td>0.42</td></tr><tr><td>GuitarSet</td><td>0.81</td><td>0.19</td><td>0.35</td><td>0.53</td><td>0.53</td></tr><tr><td>MusicNet</td><td>0.80</td><td>0.78</td><td>0.14</td><td>0.53</td><td>0.47</td></tr><tr><td>URMP</td><td>0.81</td><td>0.79</td><td>0.35</td><td>0.53</td><td>0.17</td></tr></table>
368
+
369
+ Table 6: Zero-shot transcription scores.
370
+
371
+ <table><tr><td>Training</td><td></td><td colspan="3">Eval Dataset</td><td></td><td></td></tr><tr><td></td><td>MAESTRO</td><td>Cerberus4</td><td>GuitarSet</td><td>MusicNet</td><td>Slakh2100</td><td>URMP</td></tr><tr><td colspan="7">Frame F1</td></tr><tr><td>Full mixture</td><td>0.86</td><td>0.87</td><td>0.89</td><td>0.68</td><td>0.79</td><td>0.83</td></tr><tr><td>Zero-shot</td><td>0.60</td><td>0.55</td><td>0.58</td><td>0.53</td><td>0.55</td><td>0.76</td></tr><tr><td colspan="7">Onset F1</td></tr><tr><td>Full mixture</td><td>0.95</td><td>0.92</td><td>0.90</td><td>0.50</td><td>0.76</td><td>0.77</td></tr><tr><td>Zero-shot</td><td>0.28</td><td>0.21</td><td>0.78</td><td>0.18</td><td>0.14</td><td>0.23</td></tr><tr><td colspan="7">Onset+Offset+Program F1</td></tr><tr><td>Full mixture</td><td>0.80</td><td>0.80</td><td>0.78</td><td>0.33</td><td>0.57</td><td>0.58</td></tr><tr><td>Zero-shot</td><td>0.28</td><td>0.07</td><td>0.19</td><td>0.14</td><td>0.02</td><td>0.17</td></tr></table>
372
+
373
+ # D.2 ONSET-OFFSET THRESHOLD SENSITIVITY ANALYSIS
374
+
375
+ There are many reasons that one transcription dataset may be more difficult than another. In the course of our experiments, we observed potential errors in labeling for some of our datasets, including incorrect onset/offset times, particularly in MusicNet and URMP. The original MusicNet paper estimated an error rate of around $4 \%$ Thickstun et al. (2016); the error rate of URMP annotations has not been investigated, to our knowledge.
376
+
377
+ ![](images/0e17830d223005d73d7cbbac9b62c73addbfa4d49bd559f5c43f6554021f2abe.jpg)
378
+ Figure 4: Onset-Offset F1 performance of our model over varying thresholds for the Onset-Offset F1 metric described in Section 4.2. The default threshold of $5 0 \mathrm { m s }$ is indicated by a dashed line.
379
+
380
+ While a direct investigation of labeling errors is beyond the scope of this work, we present some initial evidence regarding label timing errors in Figure 4. Here, we systematically increase the tolerance $t$ used for the Onset-Offset F1 metric (described in Section 4.2) over a grid of values for $t \in [ 1 0 \mathrm { m s } , 5 0 0 \mathrm { m s } ]$ , and compute the Onset-Offset F1 for MT3 using threshold $t$ for both onset and offset. Our results are consistent with the presence of label timing errors in both URMP and MusicNet: As the threshold increases, performance on datasets with high-quality timing labels tends to level off to a baseline value. However, performance on URMP and MusicNet continues to increase as the threshold increases, which is suggestive of large timing errors beyond the standard $5 0 ~ \mathrm { m s }$ threshold used to evaluate the performance of all models in the experiments in our work.
381
+
382
+ These results suggest that MusicNet and also potentially URMP may be affected by label timing issues which could affect the learning, quality, and generalizability of models trained on these datasets (particularly considering that the default threshold for a correct prediction is only $5 0 \mathrm { m s }$ , small timing errors can significantly increase the difficulty of properly modeling a dataset with noisy timing labels). While there is visible evidence of labeling errors12 in the MusicNet dataset upon inspection, i.e. using the MusicNet inspector tool13, we are not aware of scholarly work which has formally investigated this important issue to date. We encourage further investigation into labeling issues on these datasets.
383
+
384
+ # E MIDI CLASS GROUPINGS
385
+
386
+ Program numbers for the “MIDI Class” grouping results described in Table 3 match the original MIDI classes from the original specification, where MIDI group for program $p$ corresponds to floor $( p / 8 )$ ; we give a complete listing of the MIDI program number to MIDI class mappings in Table 8. However, for the Cerberus4 and SLAKH2100 datasets, instruments are grouped by “class”, which is a categorization of groups of patches used to synthesize those instruments. We construct a mapping of SLAKH “class” to MIDI program numbers, given in Table 7. These program numbers are applied to each “class” in the Cerberus4 and SLAKH2100 datasets as a simple lookup, and the associated program numbers are used.
387
+
388
+ # F OPEN-SOURCE IMAGE ATTRIBUTION
389
+
390
+ The instrument icons used in Figure 1 are used under the Creative Commons license via the Noun Project. We gratefully acknowledge the following creators of these images:
391
+
392
+ Table 7: Mapping of Slakh2100 “classes” to MT3 Instrument Token numbers used for all experiments using the Slakh2100 dataset (i.e., all columns labeled Slakh2100 in experiments throughout this paper). Slakh2100 classes have slightly more granularity than the 16 MIDI Classes (see Table 8 and our MT3 Instrument tokens are designed to roughly correspond MIDI program numbers.
393
+
394
+ <table><tr><td rowspan=1 colspan=1>Slakh2100 Class</td><td rowspan=1 colspan=1>MT3 Instrument Token Number</td></tr><tr><td rowspan=1 colspan=1>Acoustic Piano</td><td rowspan=1 colspan=1>0</td></tr><tr><td rowspan=1 colspan=1> Electric Piano</td><td rowspan=1 colspan=1>4</td></tr><tr><td rowspan=1 colspan=1>Chromatic Percussion</td><td rowspan=1 colspan=1>8</td></tr><tr><td rowspan=1 colspan=1>Organ</td><td rowspan=1 colspan=1>16</td></tr><tr><td rowspan=1 colspan=1>Acoustic Guitar</td><td rowspan=1 colspan=1>24</td></tr><tr><td rowspan=1 colspan=1>Clean Electric Guitar</td><td rowspan=1 colspan=1>26</td></tr><tr><td rowspan=1 colspan=1>Distorted Electric Guitar</td><td rowspan=1 colspan=1>29</td></tr><tr><td rowspan=1 colspan=1>Acoustic Bass</td><td rowspan=1 colspan=1>32</td></tr><tr><td rowspan=1 colspan=1>Electric Bass</td><td rowspan=1 colspan=1>33</td></tr><tr><td rowspan=1 colspan=1>Violin</td><td rowspan=1 colspan=1>40</td></tr><tr><td rowspan=1 colspan=1>Viola</td><td rowspan=1 colspan=1>41</td></tr><tr><td rowspan=1 colspan=1>Cello</td><td rowspan=1 colspan=1>42</td></tr><tr><td rowspan=1 colspan=1>Contrabass</td><td rowspan=1 colspan=1>43</td></tr><tr><td rowspan=1 colspan=1>Orchestral Harp</td><td rowspan=1 colspan=1>46</td></tr><tr><td rowspan=1 colspan=1>Timpani</td><td rowspan=1 colspan=1>47</td></tr><tr><td rowspan=1 colspan=1>String Ensemble</td><td rowspan=1 colspan=1>48</td></tr><tr><td rowspan=1 colspan=1> Synth Strings</td><td rowspan=1 colspan=1>50</td></tr><tr><td rowspan=1 colspan=1>Choir and Voice</td><td rowspan=1 colspan=1>52</td></tr><tr><td rowspan=1 colspan=1>Orchestral Hit</td><td rowspan=1 colspan=1>55</td></tr><tr><td rowspan=1 colspan=1> Trumpet</td><td rowspan=1 colspan=1>56</td></tr><tr><td rowspan=1 colspan=1>Trombone</td><td rowspan=1 colspan=1>57</td></tr><tr><td rowspan=1 colspan=1>Tuba</td><td rowspan=1 colspan=1>58</td></tr><tr><td rowspan=1 colspan=1>French Horn</td><td rowspan=1 colspan=1>60</td></tr><tr><td rowspan=1 colspan=1>Brass Section</td><td rowspan=1 colspan=1>61</td></tr><tr><td rowspan=1 colspan=1> Soprano/Alto Sax</td><td rowspan=1 colspan=1>64</td></tr><tr><td rowspan=1 colspan=1>Tenor Sax</td><td rowspan=1 colspan=1>66</td></tr><tr><td rowspan=1 colspan=1>Baritone Sax</td><td rowspan=1 colspan=1>67</td></tr><tr><td rowspan=1 colspan=1>Oboe</td><td rowspan=1 colspan=1>68</td></tr><tr><td rowspan=1 colspan=1>English Horn</td><td rowspan=1 colspan=1>69</td></tr><tr><td rowspan=1 colspan=1>Bassoon</td><td rowspan=1 colspan=1>70</td></tr><tr><td rowspan=1 colspan=1> Clarinet</td><td rowspan=1 colspan=1>71</td></tr><tr><td rowspan=1 colspan=1>Pipe</td><td rowspan=1 colspan=1>73</td></tr><tr><td rowspan=1 colspan=1> Synth Lead</td><td rowspan=1 colspan=1>80</td></tr><tr><td rowspan=1 colspan=1> Synth Pad</td><td rowspan=1 colspan=1>88</td></tr></table>
395
+
396
+ Table 8: All instruments as defined by the MIDI specification Association (1996), grouped by MIDI Class (rows with grey background), program numbers, and their associated instrument names.
397
+
398
+ <table><tr><td rowspan=1 colspan=3>MIDlProgramNumbers</td><td rowspan=1 colspan=1>Instruments</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1>PianoAcoustic Grand Piano,Bright Acoustic Piano,Electric Grand Piano,Honky-tonk Piano,Electric Piano 1,Electric Piano 2,Harpsichord,Clavinet</td></tr><tr><td rowspan=1 colspan=3>1-8</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1>Chromatic Percussion Celesta, Glockenspiel, Music Box, Vibraphone, Marimba, Xylophone,Tubular Bells, Dulcimer</td></tr><tr><td rowspan=1 colspan=3>9-16</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1>Organ Drawbar Organ, Percussive Organ, Rock Organ, Church Organ, Reed Organ, Accordion, Harmonica, Tango Accordion</td></tr><tr><td rowspan=1 colspan=3>17-24</td></tr><tr><td rowspan=1 colspan=3>25-32</td><td rowspan=2 colspan=1>Guitar Acoustic Guitar (nylon), Acoustic Guitar (steel), Electric Guitar (jazz),Electric Guitar (clean), Electric Guitar (muted),Electric Guitar (over-driven), Electric Guitar (distortion),Electric Guitar (harmonics)</td></tr><tr><td rowspan=1 colspan=3>25-32</td><td rowspan=1 colspan=1></td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1>Bass Acoustic Bass, Electric Bass (finger),Electric Bass (picked) , FretlessBass, Slap Bass 1, Slap Bass 2, Synth Bass 1, Synth Bass 2</td></tr><tr><td rowspan=1 colspan=3>33-40</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1> Strings Violin, Viola, Cello, Contrabass, Tremolo Strings, Pizzicato Strings, Or-chestral Harp, Timpani</td></tr><tr><td rowspan=1 colspan=3>41-48</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1>Ensemble String Ensemble 1, String Ensemble 2, Synth Strings 1, Synth Strings 2,Choir Aahs,Voice Oohs, Synth Voice or Solo Vox, Orchestra Hit</td></tr><tr><td rowspan=1 colspan=3>49-56</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1>Brass Trumpet, Trombone, Tuba, Muted Trumpet, French Horn, Brass Section,Synth Brass 1, Synth Brass 2</td></tr><tr><td rowspan=1 colspan=3>57-64</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1>ReedSoprano Sax, Alto Sax, Tenor Sax, Baritone Sax, Oboe, English Horn,Bassoon, Clarinet</td></tr><tr><td rowspan=1 colspan=3>65-72</td></tr><tr><td rowspan=2 colspan=3>73-80</td><td rowspan=2 colspan=1>Pipe Piccolo, Flute, Recorder, Pan Flute, Blown botte, Shakuhachi, Whistle,Ocarina</td></tr><tr><td rowspan=1 colspan=1>73</td></tr><tr><td rowspan=1 colspan=3></td><td rowspan=2 colspan=1>Synth LeadLead 1 (square), Lead 2 (sawtooth), Lead 3 (calliope) , Lead 4 (chiff),Lead 5 (charang),Lead 6 (space voice),Lead 7 (fifths),Lead 8 (bass andlead)</td></tr><tr><td rowspan=1 colspan=3>81-88</td></tr><tr><td rowspan=1 colspan=3>89-96</td><td rowspan=1 colspan=1>Synth PadPad 1 (new age or fantasia), Pad 2 (warm), Pad 3 (polysynth or poly, Pad4 (choir),Pad 5 (bowed glass or bowed),Pad 6 (metallic),Pad7 (halo),Pad 8 (sweep)</td></tr><tr><td rowspan=1 colspan=3>97-111</td><td rowspan=1 colspan=1>Synth EffectsFX 1 (rain), FX 2 (soundtrack), FX 3 (crystal), FX 4 (atmosphere), FX5 (brightness),FX 6 (goblins),FX 7 (echoes or echo drops),FX 8 (sci-fior star theme)</td></tr><tr><td rowspan=1 colspan=3>105-112</td><td rowspan=3 colspan=1>Other Sitar, Banjo, Shamisen, Koto, Kalimba, Bag pipe, Fiddle, ShanaiPercussiveTinkle Bell, Agogó, Steel Drums, Woodblock, Taiko Drum, MelodicTom or 808 Toms, Synth Drum, Reverse Cymbal</td></tr><tr><td rowspan=1 colspan=3></td></tr><tr><td rowspan=1 colspan=3>113-120</td></tr><tr><td rowspan=1 colspan=3>121-128</td><td rowspan=1 colspan=1>Sound EffectsGuitar Fret Noise, Breath Noise, Seashore, Bird Tweet, Telephone Ring,Helicopter, Applause, Gunshot</td></tr></table>
399
+
400
+ • Piano by Juan Pablo Bravo from the Noun Project.
401
+ • Guitar by varvarvarvarra from the Noun Project.
402
+ • Bass by Josue Calle from the Noun Project.
403
+ • Drum Set by Sumyati from the Noun Project.
404
+ • Oboe by Rank Sol from the Noun Project.
405
+ • Clarinet by Pham Thanh Loc from the Noun Project.ˆ • French Horn by Creative Stall from the Noun Project.
406
+ • Bassoon by Lars Meiertoberens from the Noun Project.
407
+ • Flute by Symbolon from the Noun Project.
408
+ • Violin by Benedikt Dietrich from the Noun Project.
409
+ • (Electric) Piano by b farias from the Noun Project.
410
+ • Viola by Vasily Gedzun from the Noun Project.
411
+ • Violin by Francesco Cesqo Stefanini from the Noun Project.
412
+ • Cello by Valter Bispo from the Noun Project.
413
+ • (String) bass by Soremba from the Noun Project.
414
+ • Acoustic guitar by farra nugraha from the Noun Project.
md/dev/jowVZoitZYu/jowVZoitZYu.md ADDED
@@ -0,0 +1,552 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # On Trace of PGD-Like Adversarial Attacks
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ 1 Adversarial attacks pose safety and security concerns for deep learning applications.
11
+ 2 Yet largely imperceptible, a strong PGD-like attack may leave strong trace in the
12
+ 3 adversarial example. Since attack triggers the local linearity of a network, we
13
+ 4 speculate network behaves in different extents of linearity for benign examples and
14
+ 5 adversarial examples. Thus, we construct Adversarial Response Characteristics
15
+ 6 (ARC) features to reflect the model’s gradient consistency around the input to indi
16
+ 7 cate the extent of linearity. Under certain conditions, it shows a gradually varying
17
+ 8 pattern from benign example to adversarial example, as the later leads to Sequel
18
+ 9 Attack Effect (SAE). ARC feature can be used for informed attack detection (pertur
19
+ 10 bation magnitude is known) with binary classifier, or uninformed attack detection
20
+ 11 (perturbation magnitude is unknown) with ordinal regression. Due to the unique
21
+ 12 ness of SAE to PGD-like attacks, ARC is also capable of inferring other attack
22
+ 13 details such as loss function, or the ground-truth label as a post-processing defense.
23
+ 14 Qualitative and quantitative evaluations manifest the effectiveness of ARC feature
24
+ 15 on CIFAR-10 w/ ResNet-18 and ImageNet w/ ResNet-152 and SwinT-B-IN1K
25
+ 16 with considerable generalization among PGD-like attacks despite domain shift.
26
+ 17 Our method is intuitive, light-weighted, non-intrusive, and data-undemanding.
27
+
28
+ # 18 1 Introduction
29
+
30
+ 19 Recent studies have revealed the vulnerabilities of deep neural networks by adversarial attacks [1, 2],
31
+ 20 where undesired output (e.g. misclassification) could be incurred by an imperceptible perturbation
32
+ 21 added to network input, posing safety and security concerns for respective applications. In the
33
+ 22 literature, PGD-like attacks, including BIM [1], PGD [2], MIM [3], and APGD [4], are strong and
34
+ 23 widely used. Yet, such strong attack may also leave strong trace in its result, as does in the feature
35
+ 24 maps [5]. Consider an extremely limited setting – given an already trained deep neural network and
36
+ 25 merely a tiny set (e.g., 50) of training data, without any change in architecture or weights, nor any
37
+ 26 auxiliary deep networks, can we still identify any trace of adversarial attack?
38
+ 27 Recall that FGSM [6], the foundation of PGD-like attacks, attributes network vulnerability to “local
39
+ 28 linearity” being easily triggered by adversarial perturbations. Thus, we conjecture that a network
40
+ 29 behaves in a higher extent of linearity to adversarial examples than to benign (i.e., unperturbed) ones.
41
+ 30 With the first-order Taylor expansion of a network, “local linearity” implies high gradient proximity
42
+ 31 in the respective local area. Thus, we can select a series of data points with stable pattern near the
43
+ 32 input as exploitation vectors using BIM [1] attack, and then compute the model’s Jacobian matrices
44
+ 33 with respect to them. Next, the Adversarial Response Characteristics (ARC) matrix is constructed
45
+ 34 from these Jacobian matrices reflecting the gradient direction consistency across all exploitation
46
+ 35 vectors. Different from benign examples, PGD-like attacks will trigger Sequel Attack Effect (SAE),
47
+ 36 leaving higher values in the ARC matrix and hence reflecting higher gradient consistency among
48
+ 37 exploitation vectors around the input. Visualization results suggest SAE is a gradually varying pattern
49
+ 38 with perturbation magnitude increasing, indicating feasibility of attack detection.
50
+ 39 The ARC matrix can be simplified into the 2-D ARC vector by fitting a Laplacian function due to
51
+ 40 their resemblance, in order to make subsequent procedure simple to interpret. The ARC vector can
52
+ 41 be used for informed attack detection (the perturbation magnitude $\varepsilon$ is known) with an SVM-based
53
+ 42 binary classifier; or for uninformed attack detection (the perturbation magnitude $\varepsilon$ is unknown) with
54
+ 43 an SVM-based ordinal regression model. The SAE is the unique trace of PGD-like attacks. Due
55
+ 44 to the uniqueness of SAE to PGD-like attacks, once the attack is detected, we can also infer some
56
+ 45 attack details including the attack loss function, or the ground-truth label used during the attack as a
57
+ 46 post-processing defense method.
58
+ 47 We evaluate our method on CIFAR-10 [7] with ResNet-18 [8], and ImageNet [9] with ResNet-152 [8]
59
+ 48 and SwinT-B-IN1K [10]. Qualitative and quantitative experimental results manifest the effectiveness
60
+ 49 of our method in identifying SAE, the unique trace of PGD-like attacks for attack detection, which
61
+ 50 also possess considerable generalization capability (despite domain shift among PGD-like attacks)
62
+ 51 even if training data only involves few benign and adversarial examples from BIM attack.
63
+ 52 Contributions. We present the ARC features to identify the unique trace, i.e., SAE of PGD-like
64
+ 53 attacks from adversarially perturbed inputs. It can be used for informed/uninformed attack detection
65
+ 54 and inferring attack details (including correcting prediction). Through the lens of ARC feature
66
+ 55 (reflecting network’s gradient behavior), we also obtain insights on why networks are vulnerable,
67
+ 56 as well as why adversarial training works well as a defense. Although our method is only sensitive
68
+ 57 to PGD-like attacks, it is (1) light-weighted (requires no auxiliary deep model); (2) non-intrusive
69
+ 58 (requires no change to the network architecture or weights); (3) data-undemanding (can generalize
70
+ 59 with very few samples). Such a problem setting is extremely limited, requiring strong cues to solve.
71
+
72
+ ![](images/7653b725a8ea4aa999c4132809deb39b628cfd096d792592962982667bb3a07d.jpg)
73
+ Figure 1: Diagram for computing the ARC matrix and the ARC vector. They reflect the model’s gradient consistency within a local linear area around the input to indicate the extent of linearity. Shallow network like ResNet-18 shows higher linearity to benign examples, while deeper networks like ResNet-152 and SwinT-B-IN1K show lower linearity.
74
+
75
+ # 60 2 Adversarial Response Characteristics & Sequel Attack Effect
76
+
77
+ 61 A neural network $f ( \cdot )$ maps the input $\pmb { x } \in \mathbb { R } ^ { M }$ into a pre-softmax output $\boldsymbol { y } \in \mathbb { R } ^ { N }$ , where the
78
+ 62 maximum element after softmax corresponds to the class prediction $\hat { c } ( { \pmb x } )$ , which is expected to match
79
+ 63 with the ground truth $c ( { \pmb x } )$ . Then, a typical adversarial attack [1, 2] aims to find an imperceptible
80
+ 64 adversarial perturbation $\pmb { r } \in \mathbb { R } ^ { M }$ that induces misclassification, i.e., arg $\mathrm { m a x } _ { n } f _ { n } ( { \pmb x } + { \bar { \pmb r } } ) \bar { \neq } c ( { \pmb x } )$
81
+ 65 where $\| r \| _ { p } \leq \varepsilon , \pmb { x } + \pmb { r } \in [ 0 , 1 ] ^ { M }$ , and $f _ { n } ( \cdot )$ is the $n$ -th element of vector function $f ( \cdot )$ .
82
+ 66 According to FGSM [6], the neural network is vulnerable because the “locally linear” property being
83
+ 67 triggered by the attack. Thus, we assume that the neural network $f ( \cdot )$ behaves relatively non-linear
84
+ 68 against benign examples, while relatively linear against adversarial examples. Then, $f ( \cdot )$ can be
85
+ 69 approximated by the first-order Taylor expansion around an either benign or adversarial sample $\tilde { \pmb x }$ :
86
+
87
+ $$
88
+ \tilde { \mathbf { \boldsymbol { x } } } \triangleq \mathbf { \boldsymbol { x } } + \mathbf { \boldsymbol { r } } , \quad f _ { n } ( \tilde { \mathbf { \boldsymbol { x } } } + \delta ) \approx f _ { n } ( \tilde { \mathbf { \boldsymbol { x } } } ) + \delta ^ { T } \nabla f _ { n } ( \tilde { \mathbf { \boldsymbol { x } } } ) , \quad \forall n \in \{ 1 , 2 , \dots , N \} ,
89
+ $$
90
+
91
+ 70 where $\delta$ is a small vector exploiting the local area around the point $\tilde { \pmb x }$ , and the gradient vector
92
+ 71 $\nabla f _ { n } ( \cdot )$ is the $n$ -th row of the Jacobian $\nabla f ( \cdot )$ of size $N { \times } M$ . We name the twice-perturbed $\tilde { \pmb { x } } + \delta$
93
+ 72 as “exploitation vector”. This equation means in order to reflect linear behaviour, the first-order
94
+ 73 gradient $\nabla f _ { n } ( \cdot )$ is expected to remain in high consistency (or similarity) in the local area regardless
95
+ 74 of $\delta$ . In contrast, when the input $\tilde { \pmb x }$ is not adversarial $( r = 0$ ), neither Taylor approximation nor the
96
+ 75 gradient consistency is expected to hold. Next, the gradient consistency will be quantized to verify
97
+ 76 our conjecture, and reveal difference between benign and adversarial inputs.
98
+ 77 Adversarial Response Characteristics (ARC). Using random noise as $\delta$ does not lead to a stable
99
+ 78 pattern of change in a series of exploitation vectors $\{ \tilde { \pmb { x } } + \bar { \pmb { \delta } } _ { t } \} _ { t = 0 , 1 , . . . , T } .$ . Instead, we use Basic Iterative
100
+ 79 Method (BIM) [1] to make $f ( \cdot )$ more linear starting from $\tilde { \pmb x }$ , which means to “continue” the attack if
101
+ 80 $\tilde { \pmb { x } }$ is already adversarial, or “restart” otherwise. However, the ground-truth label for an arbitrary $\tilde { \pmb x }$ is
102
+ 81 unknown. Since PGD-like attacks tend to make the ground-truth least-likely based on our observation,
103
+ 82 we treat the least-likely prediction $\check { c } ( { \pmb x } )$ as the label. Then, the BIM iteratively maximizes the cross
104
+ 83 entropy loss $\ b { L } _ { \mathrm { C E } } ( \tilde { \ b { x } } + \tilde { \ b { \delta } } , \tilde { c } ( \pmb { x } ) )$ via projected gradient ascent as
105
+
106
+ ![](images/5a8c58d3a72196495f47a0c503ed3700338cccd1800dbae751ec3a30e7f3e321.jpg)
107
+ Figure 2: The ARC features (i.e. ARC matrix/vector) of adversarial examples created by the BIM attack. $1 ^ { \mathrm { s t } }$ row: ResNet-18 on CIFAR-10; $2 ^ { \mathrm { n d } }$ row: ResNet-152 on ImageNet; $3 ^ { \mathrm { r d } }$ row: SwinT-B-IN1K on ImageNet. Blue and red dots in the scatter plots correspond to the benign and adversarial examples, respectively. The cluster centers of the ARC vector correlates with the perturbation magnitude $\varepsilon$ .
108
+
109
+ $$
110
+ \begin{array} { r } { \delta _ { t + 1 } \gets \mathrm { C l i p } _ { \Omega } \Big ( \delta _ { t } + \alpha \mathrm { s i g n } [ \nabla L _ { \mathrm { C E } } ( \tilde { \boldsymbol { x } } + \delta _ { t } , \check { c } ( \boldsymbol { x } ) ) ] \Big ) , \quad t = 1 , 2 , \dots , T , } \end{array}
111
+ $$
112
+
113
+ 84 where $\mathrm { C l i p } _ { \Omega } ( \cdot )$ clips the perturbation to the $L _ { p }$ bound centered at $\tilde { \pmb x }$ , and ${ \pmb \delta } _ { 0 } = { \bf 0 }$ . If the input $\tilde { \pmb x }$ is
114
+ 85 benign, then the network behaviour is expected to changed from “very non-linear“ to “somewhat
115
+ 86 linear” during the process; if the input $\tilde { \pmb x }$ is already adversarially perturbed, then the process will
116
+ 87 “continue” the attack, making the model even more “linear” – we call this Sequel Attack Effect (SAE).
117
+ 88 To quantize the extent of “linearity”, we measure the model’s gradient consistency across exploitation
118
+ 89 vectors with cosine similarity. For each $f _ { n } ( \cdot )$ , we construct a matrix $S _ { n }$ of shape $( T { + } 1 , T { + } 1 )$ :
119
+
120
+ $$
121
+ \begin{array} { r } { s _ { n } ^ { ( i , j ) } = \cos \big [ \nabla f _ { n } ( \tilde { \mathbf { x } } + \delta _ { i } ) , \nabla f _ { n } ( \tilde { \mathbf { x } } + \delta _ { j } ) \big ] , \quad \forall i , j = 0 , 1 , \dots , T . } \end{array}
122
+ $$
123
+
124
+ 90 As the model $f ( \cdot )$ becoming more “linear” to the input (higher gradient consistency), the off-diagonal
125
+ 91 values in $S _ { n }$ is expected to gradually increase from the top-left to the bottom-right corner. Note that
126
+ 92 the attack may not necessarily make all $f _ { n } ( \cdot )$ behave linear, so we select the most representative cosine
127
+ 93 matrix with the highest mean as the ARC matrix: $\boldsymbol { S } _ { * } \triangleq \boldsymbol { S } _ { n ^ { * } }$ , where $\begin{array} { r } { n ^ { * } = \arg \operatorname* { m a x } _ { n } \sum _ { i , j } s _ { n } ^ { ( i , j ) } } \end{array}$ .
128
+ 94 Due to the resemblance of the ARC matrix to the Laplacian function with matrix diagonal being
129
+ 95 the center, we simplify it into a two-dimensional $A R C$ vector $( A , \sigma )$ by fitting $\begin{array} { r l } { \small } & { { } \mathcal { L } ( i , j ; A , \sigma ) = } \end{array}$
130
+ 96 $A \exp ( - | i - j | / \sigma )$ with Levenberg-Marquardt algorithm [11], where $i , j$ are matrix row and column
131
+ 97 indexes, while $A$ and $\sigma$ are function parameters. For brevity, we abbreviate the ARC matrix as
132
+ 98 $\mathrm { ^ { 6 6 } A R C m ^ { 3 } }$ , and the ARC vector as “ARCv”. The process for computing them is summarized in Fig. 1.
133
+ 99 Visualizing Sequel Attack Effect (SAE). We compute ARCm based on some benign examples using
134
+ 100 $T { = } 4 8$ , as shown in Fig. 1. The trend of being gradually “linear” (higher cosine similarity) along the
135
+ 101 diagonal is found across architectures. Thus, SAE is similar to “continue” attack from halfway on
136
+ 102 the diagonal in such a large ARCm. As illustrated in Fig. 2, already adversarially perturbed input
137
+ 103 (using BIM) leads to larger cosine similarity at the very first exploitation vectors as perturbation
138
+ 104 magnitude $\varepsilon$ increases from 0 to 16/255. Meanwhile, the cluster separation for ARCv is more and
139
+ 105 more clear. Thus, a clear and gradually changing pattern can be seen in ARCm and ARCv. This
140
+ 106 pattern is even valid and clear for the state-of-the-art ImageNet models. In brief, SAE is reflected by
141
+ 107 higher gradient consistency in ARCm, or greater $\sigma$ and smaller $A$ in ARCv. Similar visualization
142
+ 108 from other PGD-like attacks, including PGD [2], MIM [3] and APGD [4] in Fig. 3, indicates the
143
+ 109 possibility of generalization for all PGD-like attacks with only training samples from the BIM attack
144
+ 110 despite domain shift. We adopt SVM afterwards to retain explainability and simplicity.
145
+ 111 Uniqueness of SAE to PGD-Like Attack. Whether SAE can be consistently triggered depends
146
+ 112 on whether the following conditions are simultaneously true: (I) whether the input is adversarially
147
+ 113 perturbed by an iterative projected gradient update method; (II) whether the attack leverages first
148
+ 114 order gradient of the model; (III) whether the $L _ { p }$ boundary types are the same for the two stages, i.e.,
149
+ 115 attack and exploitation vectors; (IV) whether the loss functions for the two stages are the same; (V)
150
+ 116 whether the labels used (if any) for the two stages are relevant. Namely, only when the attack and
151
+ 117 exploitation vectors “match”, SAE can be uniquely triggered as the exploitation vectors “continue”
152
+ 118 an attack, or they will ��restart” an attack. Thus, in Fig. 1, Fig. 2 and Fig. 3, all the conditions are
153
+ 119 true as they involve PGD-like attacks. We acknowledge the ARC being insensitive to non-PGD-like
154
+ 120 attacks (such as C&W [12]) is a limitation in practice. However, the unique SAE meanwhile shows
155
+ 121 possibility of inferring the attack details mentioned in the above conditions once triggered. SAE is
156
+ 122 the trace of PGD-like attacks. Ablations for these five conditions are presented in Sec. 5.
157
+ 123 Adaptive Attack against ARC. Adaptive attacks can be designed against defense [13] or detec
158
+ 124 tion [14]. Likewise, they can be designed against ARC feature. To avoid SAE in ARCm, the adaptive
159
+ 125 attack must reach a point where the corresponding ARCm has a mean value as small as that for benign
160
+ 126 examples. Intuitively, an adaptive attack has to simultaneously solve $\operatorname* { m i n } _ { r }$ $\| S _ { * } ( { \pmb x } + { \pmb r } ) \| _ { F }$ (Frobenius
161
+ 127 norm) alongside its original attack goal. It however requires gradient of the Jacobians, namely at
162
+ 128 least $T + 1$ Hessian matrices, i.e., $\bar { \nabla } ^ { 2 } f _ { n } ( \cdot )$ of size $M \times M$ to perform gradient descent. This is
163
+ 129 computationally prohibitive as in the typical ImageNet setting (i.e., $M { = } 3 { \times } 2 2 4 { \times } 2 2 4 )$ , a Hessian in
164
+ 130 float32 precision needs 84.4GiB memory. At this point, the cost of adaptive attack is much higher
165
+ 131 than computing ARC. We conclude that it is impractical to hide SAE from ARC at an acceptable
166
+ 132 cost without significant algorithm modification. The viable ways for attacker to avoid SAE is to use
167
+ 133 non-PGD-like attacks or break the SAE uniqueness conditions. Being resistant to adaptive attacks
168
+ 134 while surviving our extremely limited problem setting is left for future study.
169
+
170
+ ![](images/60bd194ac4e3c1751ef2de4f52dec975bb199ed358e4fa30f45427b39a11989c.jpg)
171
+ Figure 3: ARCm with adversarial examples created by PGD (left), MIM (middle), and APGD (right) attacks. The three rows correspond to ResNet-18, ResNet-152, and SwinT-B-IN1K, respectively. It is clear that PGD-like attacks qualitatively manifest similar SAE through ARCm.
172
+
173
+ # 135 3 Attack Detection and Inferring Attack Details
174
+
175
+ 136 Attack detection aims to identify the attempt to adversarially perturb an image even $i f$ it fails to
176
+ 137 change the prediction (but meanwhile left the trace). 1 As demonstrated in the previous section, the
177
+ 138 SAE indicates the feasibility of attack detection specifically against PGD-like attacks.
178
+
179
+ Informed Attack Detection is to determine whether an arbitrary input $\tilde { \pmb x }$ is adversarially perturbed, while the perturbation magnitude $\varepsilon$ is known. It can be viewed a binary classification problem, where the input is ARCv of $\tilde { \pmb x }$ , and the output 1 indicates “adversarially perturbed”, while 0 indicates “unperturbed”. Thus, for a given $\varepsilon = 2 ^ { \cdot } / 2 5 5$ where $k \in \{ 1 , 2 , 3 , 4 \}$ , a corresponding Support Vector Machine (SVM) [15] classifier $h _ { k } ( \tilde { \pmb { x } } ) \in \{ 0 , 1 \}$ can be trained using some benign $( \varepsilon { = } 0 )$ ) samples and their adversarial counterparts $( \varepsilon { = } 2 ^ { k } / 2 5 5 )$ . Even if the training data only involves the BIM attack, from visualization results, we expect generalization for other PGD-like attacks despite domain shift.
180
+
181
+ Uninformed Attack Detection is to determine whether an arbitrary input $\tilde { \pmb x }$ is adversarially perturbed, while the perturbation magnitude $\varepsilon$ is unknown. It can be viewed as an ordinal regression [16] problem, where the input is ARCv, and the output is the estimation of $k$ , namely $\hat { k } \in \{ 0 , 1 , 2 , 3 , 4 \}$ . The corresponding estimate of $\varepsilon$ is $\hat { \varepsilon } = \mathbf { 1 } \{ \hat { k } > 0 \} 2 ^ { \hat { k } } / 2 5 5$ , where $\mathbf { 1 } \{ \cdot \}$ is the indicator function.
182
+
183
+ ![](images/15a944c3e33ef77a7bbfcd4a64390e00ab2f9c5bbe5d35880973fc57fc8c2b2e.jpg)
184
+ Figure 4: Ablation on SAE uniqueness by adjusting exploitation vectors for ARC. Each subfigure of ARCm pair has two annotations: (1) attack and its settings, where empty brackets means default setting unless overriden: $[ L _ { p }$ is $L _ { \infty }$ ; Loss is $L _ { \mathrm { C E } }$ ; $\checkmark$ (is) iterative; $\checkmark$ (can access) gradient $\nabla f ( \cdot ) ]$ ; (2) expoitation vector settings, e.g. “ARC[]” with the default setting $[ L _ { p }$ is $L _ { \infty }$ ; Loss is $L _ { \mathrm { C E } }$ ; Label is $\check { c } ( \cdot ) ]$ . The “ $\cdot _ { c }$ ?” means random guess. This figure is supplementary to Tab. 2.
185
+
186
+ 150 Specifically, this is implemented as a series of binary classifiers (SVM), where the $k$ -th $( k { \neq } 0 )$
187
+ 151 classifier predicts whether the level of perturbation is greater or equal to $k$ , i.e., whether $\hat { k } \geqslant k$ . Note,
188
+ 152 based on our visualization, the ARCv cluster of adversarial examples is moving away from that of
189
+ 153 benign examples as $\varepsilon$ (or $k$ ) increases. This means the ARCv of an adversarial example with $\hat { k } \geqslant k$
190
+ 154 will also cross the decision boundary of the $k$ -th SVM $h _ { k } ( \cdot )$ . Namely the SVM $h _ { k } ( \cdot )$ can also tell
191
+ 155 whether $\hat { k } \geqslant k$ , and thus can be reused. Finally, the ordinal regression model can be expressed
192
+ 156 as the sum of prediction over the SVMs: $\begin{array} { r } { \hat { k } = \sum _ { k \in \{ 1 , 2 , 3 , 4 \} } h _ { k } ( \tilde { \pmb { x } } ) } \end{array}$ . A perturbation is detected as
193
+ 157 long as $\hat { k } > 0$ . Estimating $k$ (or $\varepsilon$ ) for $\tilde { \pmb { x } }$ is similar to matching its ARCm position inside a much
194
+ 158 larger ARCm calculated starting from benign example. But, the estimate does not have to be precise,
195
+ 159 because the detection is already successful once any of the SVMs correctly raises an alert.
196
+ 160 Although a detector in practice knows completely nothing about a potential attack including the attack
197
+ 161 type, evaluation of uninformed attack detection with known attack type is enough. Regarding the
198
+ 162 performance for uninformed attack detection given a specific attack type of attack as a conditional
199
+ 163 performance, the expected performance in the wild can be calculated as the sum of conditional
200
+ 164 performance weighted by the prior probabilities that the corresponding attack happens.
201
+ 165 Inferring Attack Details. Due to the SAE uniqueness in Sec. 2, once attack is detected, we can
202
+ 166 also predict that the attack: (I) is an iterative method performing projected gradient updates; (II) can
203
+ 167 access the first-order gradient of $f ( \cdot )$ ; (III) uses the same type of $L _ { p }$ bound as that in creation of
204
+ 168 exploitation vectors $L _ { \infty }$ by default); (IV) uses the same function as that in creation of exploitation
205
+ 169 vectors $( L _ { \mathrm { C E } } ( \cdots )$ by default); (V) uses a ground-truth label which is relevant to the least-likely class
206
+ 170 $\check { c } ( \tilde { \pmb x } )$ used for exploitation vectors (in many cases $\check { c } ( \tilde { \pmb x } )$ is exactly the ground-truth). In other words, a
207
+ 171 feasible post-processing defense is to correct prediction into the least-likely class $\check { c } ( \tilde { \pmb x } )$ upon detection.
208
+ 172 Namely, the disadvantage of ARC being insensitive to non-PGD-like attacks is meanwhile advantage
209
+ 173 of being able to infer attack details of PGD-like attacks.
210
+
211
+ # 174 4 Experiments
212
+
213
+ 175 In this section, we quantitatively verify the effectiveness of the ARC features in attack detection, and
214
+ 176 the performance of the post-processing defense under an extremely limited setting. Unlike related
215
+ 177 works, the MNIST evaluation is omitted, as the corresponding conclusions may not hold [14] on
216
+ 178 CIFAR-10, let alone ImageNet. We evaluate ResNet-18 [8] on CIFAR-10 [7]; ResNet-152 [8] and
217
+ 179 SwinT-B-IN1K [10] on ImageNet [9] with their official pre-trained weights (advantage of being
218
+ 180 non-intrusive). Our code is implemented based on PyTorch [17], TorchAttacks [18] and Foolbox [19].
219
+ 181 ARC Feature Parameter. For the BIM attack for exploitation vectors, we set step number $T = 6$ ,
220
+ 182 and step size $\alpha = { } ^ { 2 } / 2 5 5$ under the $L _ { \infty }$ bound with $\varepsilon = 8 / 2 5 5$ . Note, the mean value of ARCm will
221
+ 183 tend to 1 with a larger $T$ , making ARCv less separatable. We choose $T = 6$ to clearly visualize the
222
+ 184 value changes within ARCm, but this does not necessarily lead to the best performance.
223
+ 185 Training. To train SVMs $h _ { k } ( \cdot )$ with RBF kernel, we randomly select 50 training samples from
224
+ 186 CIFAR-10, and perturb them using only BIM [1] with magnitude $\varepsilon = 2 / 2 5 5 , 4 / 2 5 5 , 8 / 2 5 5 , 1 6 / 2 5 5 ,$
225
+ 187 respectively. Then each of the four $h _ { k } ( \cdot )$ is trained with ARCv of the benign $\varepsilon = 0$ ) samples and
226
+ 188 perturbed $( \varepsilon = 2 ^ { k } / 2 5 5 )$ samples. Likewise, for ImageNet we randomly select 50 training samples
227
+ 189 and train SVM in a similar setting separately for ResNet-152 and SwinT-B-IN1K. The weight for
228
+ 190 benign sample can be adjusted for training in order to control False Positive Rate (FPR).
229
+ 91 Testing. For CIFAR-10, all 10000 testing data and their perturbed versions with different $\varepsilon$ are
230
+ 92 used to test our SVM. For ImageNet, we randomly choose 512 testing samples to test our SVM
231
+ 93 due to computation cost of Jacobian matrices. A wide range of adversarial attacks are involved,
232
+ 94 including (1) PGD-like attacks: include BIM [1], PGD [2], MIM [3], APGD [4], AutoAttack
233
+ 95 (AA) [4]; (2) Non-PGD-like attacks: (2.1) other white-box attacks: FGSM [6], C&W [12] (we
234
+ 96 use $\varepsilon \in \{ 0 . 5 , 1 . 0 , 2 . 0 , 3 . 0 \}$ in $L _ { 2 }$ case), FAB [20], FMN [21]; (2.2) transferability-based attacks:
235
+ 97 DI-FGSM [22], TI-FGSM [23] (using ResNet-50 as proxy); (2.3) score-based black-box methods:
236
+ 98 NES [24], SPSA [25], Square [26]. Existing attack detection methods seldom evaluate on many types
237
+ 99 of attacks. AutoAttack is regarded as PGD-like because APGD is its most significant component for
238
+ 00 attack success rate. Details of all attacks can be found in the supplementary code.
239
+ 01 Metrics. We evaluate the SVMs using Detection Rate (DR, a.k.a., True Positive Rate), as well as False
240
+ 02 Positive Rate (FPR). For the post-processing defense method, we report the original classification
241
+ 03 accuracy for perturbed examples (denoted as “Acc”) as well as accuracy after correction (denoted as
242
+ 04 “Acc\*”). For ordinal regression, we also report Mean Average Error (MAE) for reference.
243
+
244
+ Table 1: Informed and Uninformed (the “ $\cdot _ { \varepsilon = ? } ,$ column) Attack Detection. All numbers are percentage with the $\ast \%$ ” sign omitted, except for MAE. Numbers greater than $50 \%$ are highlighted in bold font.
245
+
246
+ <table><tr><td rowspan="2">Dataset Model</td><td rowspan="2">Attack</td><td colspan="4">e=2/255 DR FPR Acc Acc*</td><td colspan="4">e=4/255</td><td colspan="4">e=8/255</td><td colspan="4">e=16/255</td><td colspan="4">e=?</td></tr><tr><td></td><td></td><td></td><td></td><td>DR</td><td>FPR Acc Acc*</td><td></td><td></td><td>DR</td><td></td><td>FPR Acc Acc*</td><td></td><td>DR</td><td></td><td>FPR Acc Acc*</td><td></td><td>MAE DR</td><td></td><td>FPR Acc</td><td>Acc*</td></tr><tr><td rowspan="5">CIFAR-10 ResNet-18</td><td>BIM</td><td>0.0</td><td>0.0</td><td>33.5</td><td>33.5</td><td>0.0</td><td>0.0</td><td>6.4 6.4</td><td>32.3</td><td>1.5</td><td>0.4</td><td>17.8</td><td>79.2</td><td>1.1</td><td>0.0</td><td>62.4</td><td></td><td>1.55</td><td>30.9</td><td>1.5 10.1</td><td>30.7</td></tr><tr><td>PGD</td><td>0.0</td><td>0.0</td><td>33.7</td><td>33.7</td><td>0.0</td><td>0.0 6.4</td><td>6.4</td><td>33.0</td><td>1.5</td><td>0.4</td><td>18.6</td><td>81.2</td><td>1.1</td><td>0.0</td><td>64.8</td><td>1.54</td><td>31.5</td><td>1.5</td><td>10.1</td><td>31.5</td></tr><tr><td>MIM</td><td>0.0</td><td>0.0</td><td>30.4</td><td>30.4</td><td>0.0</td><td>0.0</td><td>6.5</td><td>6.5</td><td>37.5</td><td>1.5 0.4</td><td>22.3</td><td>84.5</td><td>1.1</td><td>0.0</td><td>67.4</td><td>1.50</td><td>33.6</td><td>1.5</td><td>9.3</td><td>32.4</td></tr><tr><td>APGD</td><td>0.0</td><td>0.0</td><td>29.3</td><td>29.3</td><td>0.0</td><td>0.0</td><td>5.1</td><td>36.9</td><td>1.5</td><td>0.2</td><td>20.7</td><td>78.8</td><td>1.1</td><td>0.0</td><td>55.8</td><td>1.53</td><td>31.5</td><td>1.5</td><td>8.7</td><td>28.0</td></tr><tr><td>AA</td><td>0.0</td><td>0.0</td><td>27.4</td><td>27.4</td><td>0.0</td><td>0.0 2.1</td><td>5.1 2.1</td><td>37.3</td><td>1.5</td><td>0.0</td><td>20.6</td><td>78.4</td><td>1.1</td><td>0.0</td><td>55.6</td><td>1.53</td><td>31.6</td><td>1.5</td><td>7.4</td><td></td><td>26.8</td></tr><tr><td rowspan="5">ImageNet</td><td>?</td><td>0.0</td><td>0.0</td><td>30.9</td><td>30.9</td><td>0.0</td><td>0.0</td><td>5.3</td><td>5.3</td><td>35.4</td><td>1.5 0.3</td><td></td><td>20.0</td><td>80.4</td><td>1.1</td><td>0.0</td><td>61.2</td><td>1.53</td><td>31.8</td><td>1.5</td><td>9.1</td><td>29.9</td></tr><tr><td>BIM</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>4.7</td><td>1.4</td><td>0.0</td><td>0.0</td><td>20.5</td><td>1.4</td><td>0.0</td><td>0.0</td><td>91.6</td><td>1.4</td><td>0.0</td><td>0.4</td><td>1.36</td><td>30.6</td><td>1.6</td><td>0.0</td><td>0.1</td></tr><tr><td>PGD</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>4.7</td><td>1.4</td><td>0.0</td><td>0.0</td><td>18.8</td><td>1.4</td><td>0.0</td><td>0.0</td><td>85.9</td><td>1.4</td><td>0.0</td><td>0.0</td><td>1.44</td><td>28.9</td><td>1.6</td><td>0.0</td><td>0.0</td></tr><tr><td>MIM</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>2.3</td><td>1.4</td><td>0.0</td><td>0.0</td><td>4.7</td><td>1.4</td><td>0.0</td><td>0.0</td><td>81.2</td><td>1.4</td><td>0.0</td><td>0.0</td><td>1.52</td><td>23.8</td><td>1.6</td><td>0.0</td><td>0.2</td></tr><tr><td>APGD</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>2.0</td><td>1.4</td><td>0.0</td><td>0.0</td><td>11.3</td><td>1.4</td><td>0.0</td><td>0.0</td><td>61.7</td><td>1.4</td><td>0.0</td><td>0.4</td><td>1.59</td><td>19.7</td><td>1.6</td><td>0.0</td><td>0.1</td></tr><tr><td rowspan="2"></td><td>AA</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.0</td><td>2.5</td><td>1.4</td><td>0.0</td><td>0.0</td><td>10.7</td><td>1.4</td><td>0.0</td><td>0.0</td><td>61.5</td><td>1.4</td><td>0.0</td><td>0.0</td><td>1.59</td><td>19.9</td><td>1.6</td><td>0.0</td><td>0.0</td></tr><tr><td>? 0.0</td><td></td><td>0.0</td><td>0.0</td><td>0.0</td><td>3.2</td><td>1.4</td><td>0.0</td><td>0.0</td><td>13.2</td><td>1.4</td><td>0.0</td><td>0.0</td><td>76.3</td><td>1.4</td><td>0.0</td><td>0.2</td><td>1.50</td><td>24.6</td><td>1.6</td><td>0.0</td><td>0.1</td></tr><tr><td rowspan="5">ImageNet SwinT-B-IN1K</td><td>BIM</td><td>4.1</td><td>1.6</td><td>6.1</td><td>6.2</td><td>13.7</td><td>2.0</td><td>0.0</td><td>8.4</td><td>77.3</td><td>2.0</td><td>0.0</td><td>74.0</td><td>97.9</td><td>0.2</td><td>0.0</td><td>97.9</td><td>0.96</td><td>49.1</td><td>2.0</td><td>1.5</td><td>47.3</td></tr><tr><td>PGD</td><td>3.9</td><td>1.6</td><td>2.3</td><td>3.1</td><td></td><td>16.42.0</td><td>0.0</td><td>10.9</td><td>72.7</td><td>2.0</td><td>0.0</td><td>68.8</td><td>98.4</td><td>0.2</td><td>0.0</td><td>98.4</td><td>1.01</td><td>48.6</td><td>2.0</td><td>0.6</td><td>45.9</td></tr><tr><td>MIM</td><td>1.61.6</td><td></td><td>0.0</td><td>1.6</td><td></td><td>10.22.0</td><td>0.0</td><td>10.2</td><td>63.3</td><td>2.0</td><td>0.0</td><td>63.3</td><td>93.8</td><td>0.2</td><td>0.0</td><td>93.8</td><td>1.09</td><td>)43.8</td><td>2.0</td><td>0.0</td><td>43.8</td></tr><tr><td>APGD</td><td>1.41.6</td><td></td><td>0.0</td><td>1.0</td><td>5.3</td><td>2.0</td><td>0.0</td><td>4.5</td><td>32.62.0</td><td></td><td>0.0</td><td>25.2</td><td></td><td>65.00.2</td><td>0.0</td><td>51.0</td><td>1.37</td><td>29.4</td><td>2.0</td><td>0.0</td><td>23.2</td></tr><tr><td>AA</td><td></td><td></td><td>0.0</td><td>1.0</td><td>5.7</td><td>2.0</td><td>0.0</td><td>4.3</td><td>31.62.0</td><td></td><td>0.0</td><td>25.0</td><td>68.40.2</td><td></td><td>0.0</td><td>54.1</td><td>1.37</td><td>29.5</td><td>2.0</td><td>0.0</td><td>23.2</td></tr><tr><td></td><td>?</td><td>1.81.6 2.61.6</td><td></td><td>1.7</td><td>2.6</td><td></td><td></td><td>10.2 2.00.0</td><td>7.7</td><td></td><td></td><td>55.52.00.0</td><td>51.2</td><td></td><td></td><td>84.7 0.20.0</td><td>79.0</td><td>1.16 40.1</td><td></td><td>2.0</td><td>0.4</td><td>36.7</td></tr></table>
247
+
248
+ # 05 4.1 Informed and Uninformed Attack Detection for PGD-like Attacks
249
+
250
+ For each network, the corresponding SVMs are trained and evaluated as shown in Tab. 1. Columns with a concrete $\varepsilon$ value are informed attack detection, while the $\cdot _ { \varepsilon = }$ ?“ column is uninformed attack detection. As can be expected from visualization results, the ARCv clusters are gradually becoming separatable with $\varepsilon$ increasing, and hence the increase of DR. Notably, the large perturbations (i.e., $\varepsilon = 1 6 / 2 5 5 )$ are very
251
+
252
+ ![](images/0bc99394fc619dd0981dda44f2a976249a9690aba59058e649a64f069ad3c3c8.jpg)
253
+ Figure 5: ROC of SVMs in Tab. 1 & Tab. 3.
254
+
255
+ 215 hard to defend [27], but can be consistently and accurately detected across architectures. The ARC
256
+ 216 feature is especially effective for Swin-Transformer, because this model transitions faster from being
257
+ 217 non-linear to being linear than other architectures. Such characteristics are beneficial for ARC.
258
+ 218 Upon detection of attack, our method corrects the prediction into the least-likely class as a post
259
+ 219 processing defense. Success of such method depends on whether the attack is efficient to make
260
+ 220 ground-truth class least-likely, and whether the network is easy for the attack to make a class least
261
+ 221 likely. From Tab. 1, both ResNet-18 and SwinTransformer have such property and lead to high
262
+
263
+ Table 2: Ablation on SAE uniquenss by varying attacks. The row (t1) is regarded as a baseline, and notation “..” means “same as baseline” in order to ease comparison. SAE will only show consistent effectiveness across architectures when the four conditions in Sec. 2 are satisfied.
264
+
265
+ <table><tr><td rowspan="2">#</td><td colspan="4">Attack</td><td colspan="4"></td><td rowspan="2"></td><td colspan="5">ResNet-18 w/ e=?</td><td colspan="5">ResNet-152 w/e=?</td><td colspan="5">SwinT-B-IN1K w/ ε=?</td></tr><tr><td>Name</td><td>Lp</td><td>Loss</td><td>Iter.Vf()</td><td></td><td>Lp</td><td></td><td>LossLabel</td><td>MAE</td><td>DR</td><td></td><td>FPR Acc Acc*</td><td></td><td></td><td>MAE</td><td>DR</td><td></td><td>FPR Acc Acc*</td><td></td><td>MAE</td><td>DR</td><td>FPR</td><td>AccAcc*</td><td></td></tr><tr><td>t1</td><td>BIM</td><td>8</td><td>Yes</td><td>Yes</td><td>8</td><td>CE</td><td></td><td>c(x)</td><td>1.55</td><td>30.9</td><td>1.5</td><td>10.1</td><td>30.7</td><td>1.36</td><td>30.6</td><td></td><td>1.6</td><td>0.0</td><td>0.1</td><td>0.96</td><td>49.1</td><td>2.0</td><td>1.5</td><td>47.3</td></tr><tr><td>t2</td><td>BIM</td><td>2</td><td></td><td>:</td><td></td><td>:</td><td></td><td></td><td>1.27</td><td>49.9</td><td>1.5</td><td>2.6</td><td>39.0</td><td>1.98</td><td>3.5</td><td>1.6</td><td>0.2</td><td>0.2</td><td></td><td>2.02</td><td>1.0</td><td>2.0</td><td>1.4</td><td>1.8</td></tr><tr><td>t3</td><td>BIM</td><td>:</td><td>: DLR</td><td></td><td></td><td></td><td></td><td>:</td><td>1.98</td><td>2.1</td><td>1.5</td><td>10.5</td><td>10.6</td><td>1.63</td><td>18.9</td><td>1.6</td><td>0.0</td><td>0.6</td><td></td><td>1.44</td><td>27.5</td><td>2.0</td><td>1.8</td><td>6.6</td></tr><tr><td>t4</td><td>FGSM</td><td>:</td><td>No</td><td></td><td></td><td></td><td></td><td></td><td>1.96</td><td>3.4</td><td>1.5</td><td>30.3</td><td>29.5</td><td>1.63</td><td>18.6</td><td>1.6</td><td>8.4</td><td>6.8</td><td></td><td>1.44</td><td>27.1</td><td>2.0</td><td>44.932.4</td><td></td></tr><tr><td>t5</td><td>C&amp;W</td><td>2</td><td>C&amp;W</td><td></td><td></td><td></td><td></td><td>:</td><td>1.99</td><td>1.2</td><td>1.5</td><td>0.0</td><td>0.0</td><td>2.02</td><td>2.3</td><td>1.6</td><td>0.0</td><td>0.0</td><td></td><td>2.03</td><td>1.6</td><td>2.0</td><td>0.0</td><td>0.0</td></tr><tr><td>t6</td><td>FAB</td><td>:</td><td>FAB</td><td></td><td></td><td>:</td><td></td><td>“ :</td><td>1.99</td><td>1.0</td><td>1.5</td><td>10.6</td><td>10.5</td><td>2.00</td><td>2.5</td><td>1.6</td><td>9.2</td><td>9.2</td><td></td><td>2.03</td><td>0.8</td><td>2.0</td><td>9.4</td><td>9.4</td></tr><tr><td>t7</td><td>FMN</td><td>:</td><td>FMN</td><td>: :</td><td>: “</td><td>: :</td><td>: :</td><td>“</td><td>1.99</td><td>1.4</td><td>1.5</td><td>8.8</td><td>8.6</td><td>2.02</td><td>2.1</td><td>1.6</td><td>0.0</td><td>0.0</td><td></td><td>2.03</td><td>0.8</td><td>2.0</td><td>0.0</td><td>0.0</td></tr><tr><td></td><td>t8DI-FGSM</td><td>:</td><td>DI-FGSM</td><td>:</td><td>No</td><td>:</td><td>:</td><td>:</td><td>1.98</td><td>2.2</td><td>1.5</td><td>42.9</td><td>42.0</td><td>1.98</td><td>3.5</td><td>1.6</td><td>27.9</td><td>27.5</td><td></td><td>1.87</td><td>8.2</td><td>2.0</td><td>67.2</td><td>62.1</td></tr><tr><td>t9</td><td>TI-FGSM</td><td>:</td><td>TI-FGSM</td><td></td><td>No</td><td>“</td><td></td><td>:</td><td>1.98</td><td>1.9</td><td>1.5</td><td>59.4</td><td>58.3</td><td>2.00</td><td>2.9</td><td>1.64</td><td>40.0</td><td>39.1</td><td></td><td>2.02</td><td>1.6</td><td>2.0</td><td>72.3</td><td>70.9</td></tr><tr><td>t10</td><td>NES</td><td>:</td><td></td><td></td><td>No</td><td>:</td><td>: :</td><td>:</td><td>1.94</td><td>4.7</td><td>1.5</td><td>38.6</td><td>39.4</td><td>1.98</td><td>3.1</td><td>1.6</td><td>28.3</td><td>27.3</td><td></td><td>2.02</td><td>1.6</td><td>2.0</td><td>50.6</td><td>49.4</td></tr><tr><td>t11</td><td>SPSA</td><td>:</td><td></td><td>:</td><td>No</td><td>:</td><td>:</td><td>:</td><td>1.97</td><td>3.0</td><td>1.5</td><td>39.2</td><td>39.1</td><td>2.00</td><td>3.1</td><td>1.6</td><td>29.9</td><td>28.9</td><td></td><td>2.00</td><td>2.7</td><td>2.0</td><td>52.7</td><td>50.6</td></tr><tr><td>t12</td><td>Square</td><td>:</td><td>Square</td><td></td><td>No</td><td>:</td><td>:</td><td>:</td><td>1.99</td><td>1.6</td><td>1.5</td><td>85.7</td><td>84.3</td><td>2.02</td><td>2.1</td><td>1.6</td><td>68.6</td><td>67.4</td><td></td><td>1.84</td><td>10.2</td><td>2.0</td><td>77.9</td><td>70.1</td></tr><tr><td>t13</td><td>3Gaussian</td><td>:</td><td>N/A</td><td>No</td><td>No</td><td>:</td><td>“</td><td>“</td><td>1.99</td><td>1.7</td><td>1.5</td><td>87.0</td><td>85.6</td><td>2.00</td><td>2.7</td><td>1.6</td><td>75.2</td><td>73.2</td><td></td><td>2.00</td><td>3.1</td><td>2.0</td><td></td><td>82.4 79.7</td></tr><tr><td>t14</td><td>Uniform</td><td>:</td><td>N/A</td><td>No</td><td>No</td><td>:</td><td>:</td><td>:</td><td>1.99</td><td>1.8</td><td></td><td></td><td>1.586.6 85.0</td><td>1.97</td><td>4.1</td><td></td><td>1.673.6 70.9</td><td></td><td></td><td></td><td></td><td>1.84 10.2 2.0</td><td></td><td>81.8 73.2</td></tr></table>
266
+
267
+ classification accuracy after correction. For ResNet-152, the least-likely label is merely relevant (not identical) to the ground-truth due to network property during attack, and hence leads to effective detection but not correction (this will be explained in next subsection). In contrast, the correction method performs best on Swin-Transformer, as it can restore classification accuracy from $0 . 4 \%$ to $3 6 . 7 \%$ even if both concrete type of PGD-like attack and $\varepsilon$ are unknown (“Attack $= ? ^ { \prime }$ row and $\cdot _ { \varepsilon = ? } ,$ column in Tab. 1), assuming flat prior. By adjusting the weights assigned to benign examples, the decision boundary of SVMs can be moved and hence influence the FPR, as shown in in Fig. 5.
268
+
269
+ # 4.2 Sequel Attack Effect as Unique Trace of PGD-like Attacks
270
+
271
+ 30 The SAE is unique to PGD-like attacks, as it requires five conditions listed in Sec. 2 to hold for consistent effectiveness. To clarify this, we change the attack settings (quantitatively in Tab. 2), or the exploitation vector for ARCm (qualitatively on CIFAR10 in Fig. 4), and then review these conditions:
272
+
273
+ (I). Iterative attack (Iter.). The single-step version of PGD, i.e., FGSM (t4, f4) does not effectively exploit the search space within the $L _ { p }$ bound, and hence will not easily trigger linearity and SAE. Only Swin Transformer slightly reacts against FGSM due to its own characteristics of being easy to be turned linear. Thus, SAE requires the attack to be iterative;
274
+ (II). Gradient access $( \nabla f ( \cdot ) )$ . Transferability-based attacks (t8, t9) uses proxy model gradients to create adversarial examples, and hence could not trigger SAE. NES (t10, f14) and SPSA (t11, f15) can be seen as PGD using gradients estimated from only network logits, but can still not trigger SAE as it cannot efficiently trigger linearity. Neither does Square attack (t12). Thus, SAE requires that the attacks use the target model gradient;
275
+ (III). Same $L _ { p }$ bound. When the attack is BIM in $L _ { 2 }$ bound (t2, f6), SAE will no longer be triggered for ImageNet models, because the change of $L _ { p }$ influences perturbation search process. However, SAE is still triggered for CIFAR-10 possibly due to relatively low-dimensional search space. This means CIFAR-10 property does not necessarily generalize to ImageNet. When ARC is changed accordingly (f7, f8), the feature clusters are still separatable. Thus, SAE requires the same type of $L _ { p }$ bound for consistent effectiveness;
276
+ (IV). Same loss. When the loss for the BIM attack is switched from $L _ { \mathrm { C E } }$ to DLR [4] (t3, f11), the SAE is significantly reduced. However, if exploitation vectors are also created using DLR loss (f12, f13), SAE will be triggered again. Thus, SAE requires a consistent loss function;
277
+ (V). Relevant label. When the most-likely label $\hat { c } ( \tilde { \pmb x } )$ is used for exploitation vectors, it leads to the least significant SAE (f9). Besides, even a random label $( c ? )$ leads to moderate SAE (f10), while the least-likely label $\check { c } ( \tilde { \pmb x } )$ (which is ground-truth label in many cases) leads to distinct SAE (f1). The most significant SAE correspond to $\check { c } ( \tilde { \pmb { x } } ) = c ( \pmb { x } )$ . This means in order to maximize cross-entropy, a large portion of output functions $f _ { n } ( \cdot )$ has been triggered local linearity during attack. Thus, SAE requires a relevant label (if any) for exploitation vectors.
278
+
279
+ When the exploitation vectors are created using random noise (f2, f3), SAE is not triggered. Neither does random noise as attack trigger SAE (t13, t14, f5). Other non-PGD-like attacks (t5, t6, t7) do not trigger SAE as well. A special case is targeted PGD-like attack, where the creation of exploitation vector needs to be use negative cross-entropy loss on the most-likely label to reach a similar level of effectiveness (this paper focuses on the default untargeted attack to avoid complication).
280
+
281
+ Table 3: Comparison with existing methods that are compatible with our problem setting.
282
+
283
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">Metric</td><td colspan="2">2/255|4/255|8/25516/255</td><td colspan="2">BIM</td><td colspan="2"></td><td colspan="2">PGD 2/255|4/255|8/255|16/255</td><td colspan="2"></td><td colspan="2">MIM</td><td colspan="2"></td><td colspan="2">APGD 2/255|4/255|8/255|16/255</td><td colspan="2"></td><td colspan="2">2/255|4/255|8/255|16/255</td><td colspan="2">AA ?</td></tr><tr><td></td><td></td><td></td><td></td><td>?</td><td></td><td></td><td></td><td>?</td><td>2/255|4/255|8/255|16/255</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></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td>CIFAR10 ResNet-18</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>NSS [29]</td><td>DR</td><td>0.0</td><td>0.0</td><td>0.0</td><td>0.1</td><td>0.5</td><td>0.0 0.0</td><td>0.0</td><td>0.1</td><td>0.5</td><td>0.0</td><td>0.0 0.0</td><td>0.1</td><td>4.7</td><td>0.0</td><td>0.0</td><td>0.3</td><td>0.2</td><td>0.8</td><td>0.0</td><td>0.0</td><td>0.3 0.2</td><td>0.8</td></tr><tr><td></td><td>FPR</td><td>0.0</td><td>0.0</td><td>1.8</td><td>1.5</td><td>2.5</td><td>0.0</td><td>1.8</td><td>1.5</td><td>2.5</td><td>0.0 0.0</td><td>1.8</td><td>1.5</td><td>2.5</td><td>0.0</td><td>0.0</td><td>1.8</td><td>1.5</td><td>2.5</td><td>0.0</td><td>0.0</td><td>1.8 1.5</td><td>2.5</td></tr><tr><td>ARC</td><td>DR</td><td>0.0</td><td>0.0</td><td>32.3</td><td>79.2</td><td>30.9 0.0</td><td>0.0</td><td>33.0</td><td>81.2</td><td>31.5</td><td>0.0 0.0</td><td>37.5</td><td>84.5</td><td>33.6</td><td>0.0</td><td>0.0</td><td>36.9</td><td>78.8</td><td>31.5</td><td>0.0</td><td>0.0</td><td>37.3</td><td>78.4 31.6</td></tr><tr><td></td><td>FPR</td><td>0.0</td><td>0.0</td><td>1.5</td><td>1.1</td><td>1.5 0.0</td><td>0.0</td><td>1.5</td><td>1.1</td><td>1.5</td><td>0.0 0.0</td><td>1.5</td><td>1.1</td><td>1.5</td><td>0.0</td><td>0.0</td><td>1.5</td><td>1.1</td><td>1.5</td><td>0.0</td><td>0.0</td><td>1.5</td><td>1.1 1.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>ImageNet ResNet-152</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>NSS [29]</td><td>DR</td><td>2.9</td><td>19.1</td><td>39.6</td><td>47.2</td><td>41.6</td><td>2.9 19.9</td><td>39.6</td><td>46.5</td><td>41.1</td><td>4.2</td><td>31.2 41.4</td><td>9.1</td><td>32.9</td><td>1.1</td><td>12.6</td><td>28.3</td><td>35.7</td><td>29.1</td><td>1.0</td><td>11.9</td><td>29.8</td><td>33.3 28.7</td></tr><tr><td></td><td>FPR</td><td>0.4</td><td>1.4</td><td>1.2</td><td>1.4</td><td>2.0</td><td>0.4 1.4</td><td>1.2</td><td>1.4</td><td>2.0</td><td>0.4 1.4</td><td>1.2</td><td>1.4</td><td>2.0</td><td>0.6</td><td>1.4</td><td>1.2</td><td>1.4</td><td>2.0</td><td>0.4</td><td>1.4</td><td>1.2 1.4</td><td>2.0</td></tr><tr><td>ARC</td><td>DR</td><td>0.0</td><td>4.7</td><td>20.5</td><td>91.6</td><td>30.6 0.0</td><td>4.7</td><td>18.8</td><td>85.9</td><td>28.9 0.0</td><td>2.3</td><td>4.7</td><td>81.2</td><td>23.8</td><td>0.0</td><td>2.0</td><td>11.3</td><td>61.7</td><td>19.7</td><td>0.0</td><td>2.5 10.7</td><td>61.5</td><td>19.9</td></tr><tr><td></td><td>FPR</td><td>0.0</td><td>1.4</td><td>1.4</td><td>1.4</td><td>1.6 0.0</td><td>1.4</td><td>1.4</td><td>1.4</td><td>1.6 0.0</td><td>1.4</td><td>1.4</td><td>1.4</td><td>1.6</td><td>0.0</td><td>1.4</td><td>1.4</td><td>1.4</td><td>1.6</td><td>0.0</td><td>1.4</td><td>1.4 1.4</td><td>1.6</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><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td rowspan="3">NSS [29]</td><td>DR</td><td>4.5</td><td>16.2</td><td>42.4</td><td>47.5</td><td>44.2</td><td>4.9</td><td>15.8</td><td></td><td></td><td>ImageNetSwinT-B-IN1K</td><td></td><td></td><td>28.9</td><td></td><td></td><td></td><td></td><td></td><td>1.4</td><td></td><td></td><td></td></tr><tr><td></td><td>FPR</td><td>1.0</td><td></td><td></td><td></td><td></td><td>41.8</td><td>47.1</td><td>44.1</td><td>12.3 28.7</td><td>29.3</td><td>4.5</td><td>2.3</td><td>1.6 0.6</td><td>11.0</td><td>31.3</td><td>35.5</td><td>31.1</td><td></td><td>10.4 31.8</td><td>35.1 1.6</td><td>30.8</td></tr><tr><td></td><td>0.6</td><td></td><td>1.2</td><td>1.6</td><td>2.3</td><td>0.6 3.9</td><td>1.0 1.2</td><td>1.6</td><td>2.3</td><td>0.6</td><td>1.0 1.2</td><td>1.5 93.8</td><td>43.8</td><td>1.4</td><td>1.0 5.3</td><td>1.2 32.6</td><td>1.6</td><td>2.3</td><td>0.6</td><td>1.0</td><td>1.2</td><td>2.3</td></tr><tr><td>ARC</td><td>DR FPR</td><td>4.1 1.6</td><td>13.7 2.0</td><td>77.3 2.0</td><td>97.9 0.2</td><td>49.1 2.0</td><td>16.4 1.6 2.0</td><td>72.7 2.0</td><td>98.4 0.2</td><td>48.6 2.0</td><td>1.6 1.6</td><td>10.2 63.3 2.0 2.0</td><td>0.2</td><td>2.0</td><td>1.6</td><td>2.0</td><td>2.0</td><td>65.0 0.2</td><td>29.4 2.0</td><td>1.8 1.6</td><td>5.7 2.0</td><td>31.6 2.0</td><td>68.42 29.5 0.2 2.0</td></tr></table>
284
+
285
+ The non-PGD attacks, or PGD attacks do not meed all conditions cannot consistently trigger SAE across architectures because they provide a less “matching” starting point for exploitation vectors, and hence make the BIM for exploitation vectors “restart” an attack, where the network behaves non-linear again. Only when all the conditions are satisfied will SAE be consistently triggered across different architectures, especially for ImageNet models. As for label correction, PGD-like attacks can effectively leak the ground-truth labels in the adversarial example, as long as the network allows the attack to easily reduce the corresponding logit value to lowest among all.
286
+
287
+ In summary, SAE is the unique trace of PGD-like attacks. Although insensitive to non-PGD-like attacks for general attack detection, SAE is a specific signature [28], indicating the feasibility of correcting prediction upon detection of PGD-like attacks.
288
+
289
+ # 4.3 Comparison with Previous Attack Detection Methods
290
+
291
+ As discussed in Sec. 6, due to our extremely limited problem setting – (1) no auxiliary deep model; (2) non-intrusive; (3) data-undemanding, the most relevant methods that do not lack of ImageNet evaluation are [29, 30, 31, 32, 33]. But [30, 31, 32, 33] still require a considerable amount of data to build accurate (relatively) high-dimensional statistics. The remaining NSS [29] method craft 18- dimensional features from Natural Scene Statistics, which are fed into SVM for binary classification. We adapt the trained SVMs in our ordinal regression framework as well, with a reduced training set size to 100 (50 benign $\div 5 0$ BIM adversarial) for each SVM for fair comparison. All SVMs are tuned to control FPR. The results and ROC curves for $\mathbf { \dot { \dot { \varepsilon } } } { \mathbf 6 } = ? \mathbf { \overrightarrow { \rho } }$ task can be found Tab. 3 and Fig. 5. It is noted that (1) SVM with the 18-D NSS feature may fail to generalize due to insufficient sampling (hence the below-diagonal ROC); (2) NSS performs better for small $\varepsilon$ , but performance saturates with larger ε, because NSS does not incorporate any cue from network gradient behavior; (3) small $\varepsilon$ is difficult for ARC, but its performance soars with larger $\varepsilon$ towards $\bar { 1 0 0 \% }$ , which is consistent and expected from our visualization; (4) SVM with ARCv can generalize against all PGD-like attacks, while NSS failed for MIM; (5) SVM with NSS may generalize against some non-PGD-like attacks [29], while ARC could not due to SAE uniqueness; (6) SVM with the 2-D NSS feature (“Method $2 ^ { \circ }$ in [29]) fails to generalize. Thus, ARC achieves competitive performance consistently across different settings despite the extreme limits, because the ARC feature is low-dimensional, and incorporates cue from network gradient behavior. Apart from these, ARC also provides a new perspective to understanding attack and defense from model’s gradient behavior, as discussed in Sec. 5.
292
+
293
+ # 5 Discussions and Justifications
294
+
295
+ Ordinal Regression. Intuitively, the uninformed attack detection can be formulated as standard regression to estimate a continuous $k$ value. However, this introduces an undesired additional threshold hyper-parameter for deciding whether an input with e.g., 0.5 estimation is adversarial. Ordinal regression produces discrete $k$ values and avoids such ambiguity and unnecessary parameter.
296
+
297
+ Training Set Size. Each of our SVMs has only 100 training data (i.e., 50 benign $+ 5 0$ adversarial). The simple 2-D ARCv distribution (Fig. 2) can be reflected by few data points, which even allows an SVM to generalize with less than 100 data points (but may suffer from insufficient sampling with too few, e.g., $1 0 { + } 1 0 $ samples). In contrast, the performance gain will be marginal starting from roughly 200 training samples, because the ARCv feature distribution is already well represented.
298
+
299
+ 302 Combination with Adversarial Training. From our experiment
300
+ 303 and recent defenses [2, 34, 27], its noted that (1) small perturba
301
+ 304 tions are hard to detect, but easy to defend; while (2) large pertur
302
+ 305 bations are hard to defend, but easy to detect. However, combining
303
+ 306 defense and our detection is not effective on ImageNet. As shown
304
+ 307 in Fig. 6, we compute ARCm based on regular ResNet-50 (from
305
+ 308 PyTorch [17]) and adversarially trained ResNet-50 on ImageNet
306
+ 309 (from [34]). Unlike the regular ResNet-50, adversarially trained
307
+ 310 one has much higher mean value in ARCm, and the resulting ARC
308
+ 311 vectors are almost non-separatable. This means adversarial train
309
+ 312 ing makes the model very linear around the data [35]. As a new
310
+ 313 perspective on why adversarial training works, the networks are
311
+ 314 trained to generalize while being already very linear to the input,
312
+ 315 and thus it will be hard for attack to make the model behave even
313
+ 316 more linear to significantly manipulate the output.
314
+
315
+ ![](images/5e164775adefd82c4258308135c372d3c2c851f1beeb6810e955fa1aefc75681.jpg)
316
+ Figure 6: ARCm from regular $1 ^ { \mathrm { s t } }$ row), and adversarially trained ResNet-50 ( $2 ^ { \mathrm { n d } }$ row w/ $\varepsilon { = } 4 / 2 5 5 , 3 ^ { \mathrm { r d } }$ row w/ $\varepsilon { = } 8 / 2 5 5$ .
317
+
318
+ Limitations. (1) The ARC Feature is only sensitive to the PGD-like attacks, and relies on the leastlikely assumption for effectiveness of prediction correction. But such selective sensitivity meanwhile leads to the uniqueness of SAE. (2) Jacobian computation is slow for ImageNet models because it requires 1000 iterations of backward pass. A single Jacobian of ResNet-152 takes $1 6 1 { \pm } 0 . 5 $ seconds on Nvidia Titan Xp. Thus we are unable evaluate our method on all ImageNet data with 2 GPUs.
319
+
320
+ Future Recommendations. (1) Include ImageNet evaluation, as CIFAR-10 property may not hold on ImageNet; (2) Check detector sensitivity w.r.t. attack algorithm parameter, as it may be significant.
321
+
322
+ # 6 Related Works
323
+
324
+ Adversarial Attack and Defense. Neural networks are vulnerable to attacks [36, 6, 12]. To exploit such vulnerability, attacks under different threat models are designed, including but not limited to white-box attacks [1, 2, 3, 4], transferability-based attacks [37, 38, 22, 23], score-based black-box attacks [39, 24, 25, 26], and decision-based black-box attacks [40]. Different from these run-time attacks, backdoor attack [41] happens during the training. To counter the attacks, adversarial training [2, 27, 42] is the most promising defense to make networks resistant to the adversarial perturbations, but is meanwhile intrusive (i.e. requires retraining), and suffering from a notable generalization gap. Certified defense [43] and perturbation reverse engineering are also proposed [44]. A defense may be invalidated by adaptive attacks [45, 13]. Our method to correct the prediction upon detection can be seen as a post-processing defense.
325
+
326
+ 335 Adversarial Example Detection [46, 14] aims to predict whether a given image is adversarial or not,
327
+ 336 so that adversarial ones can be rejected. This can be achieved through adversarial training [47, 48],
328
+ 337 customized subnet [49] or customized loss [50], but will be costly for ImageNet. Generative
329
+ 338 model-based detection methods check adversarial example reconstruction error [51] or probability
330
+ 339 density [52], but are data-demanding in order to learn accurate distributions. Auxiliary deep model [53,
331
+ 340 54] for attack detection not only require large amount of data, but are also susceptible to adaptive
332
+ 341 attack [14]. Dropout can be used for detection when combined with Bayesian uncertainty [55].
333
+ 342 Feature statistics-based methods [31, 30, 29, 32, 33] leverage (high-dimensional) features, which
334
+ 343 is the most compatible group of method to our problem setting, but most of them are still data
335
+ 344 demanding for an accurate statistics. Whilst MNIST property may not hold on CIFAR-10 [14], let
336
+ 345 alone ImageNet, many related works lack the evaluation on ImageNet. Whilst detection difficulty
337
+ 346 varies with attack parameters, a very large portion of related works have neglected the respective
338
+ 347 sensitivity analysis. Additionally, we point out conditions under which our method will be invalidated.
339
+
340
+ # 348 7 Conclusions
341
+
342
+ In this paper, we design an Adversarial Response Characteristic (ARC) feature with an intuition that the model being attacked behaves more “linear” against adversarial examples than does to benign ones, which is valid for PGD-like attacks in terms of attack detection and prediction correction. Our method is light-weighted, non-intrusive, data-undemanding and simple to interpret.
343
+
344
+ References [1] Alexey Kurakin, Ian Goodfellow, Samy Bengio, et al. Adversarial examples in the physical world. The International Conference on Learning Representations Workshop Track, 2016. [2] Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. The International Conference on Learning Representations, 2018. [3] Yinpeng Dong, Fangzhou Liao, Tianyu Pang, Hang Su, Jun Zhu, Xiaolin Hu, and Jianguo Li. Boosting adversarial attacks with momentum. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2018. [4] Francesco Croce and Matthias Hein. Reliable evaluation of adversarial robustness with an ensemble of diverse parameter-free attacks. In International Conference on Machine Learning, 2020. [5] Cihang Xie, Yuxin Wu, Laurens van der Maaten, Alan L. Yuille, and Kaiming He. Feature denoising for improving adversarial robustness. In The IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2019. [6] Ian J Goodfellow, Jonathon Shlens, and Christian Szegedy. Explaining and harnessing adversarial examples. The International Conference on Learning Representations, 2015. [7] Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009. [8] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. arXiv preprint arXiv:1512.03385, 2015. [9] 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. [10] 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), 2021. [11] Pauli Virtanen, Ralf Gommers, Travis E. Oliphant, Matt Haberland, Tyler Reddy, David Cournapeau, Evgeni Burovski, Pearu Peterson, Warren Weckesser, Jonathan Bright, Stéfan J. van der Walt, Matthew Brett, Joshua Wilson, K. Jarrod Millman, Nikolay Mayorov, Andrew R. J. Nelson, Eric Jones, Robert Kern, Eric Larson, C J Carey, ˙ Ilhan Polat, Yu Feng, Eric W. Moore, Jake VanderPlas, Denis Laxalde, Josef Perktold, Robert Cimrman, Ian Henriksen, E. A. Quintero, Charles R. Harris, Anne M. Archibald, Antônio H. Ribeiro, Fabian Pedregosa, Paul van Mulbregt, and SciPy 1.0 Contributors. SciPy 1.0: Fundamental Algorithms for Scientific Computing in Python. Nature Methods, 17:261–272, 2020. [12] Nicholas Carlini and David Wagner. Towards evaluating the robustness of neural networks. In 2017 ieee symposium on security and privacy (sp), pages 39–57. IEEE, 2017. [13] Florian Tramer, Nicholas Carlini, Wieland Brendel, and Aleksander Madry. On adaptive attacks to adversarial example defenses. Advances in Neural Information Processing Systems, 33:1633–1645, 2020. [14] Nicholas Carlini and David Wagner. Adversarial Examples Are Not Easily Detected: Bypassing Ten Detection Methods, page 3–14. Association for Computing Machinery, New York, NY, USA, 2017. [15] F. Pedregosa, G. Varoquaux, A. Gramfort, V. Michel, B. Thirion, O. Grisel, M. Blondel, P. Prettenhofer, R. Weiss, V. Dubourg, J. Vanderplas, A. Passos, D. Cournapeau, M. Brucher, M. Perrot, and E. Duchesnay. Scikit-learn: Machine learning in Python. Journal of Machine Learning Research, 12:2825–2830, 2011.
345
+ 394 [16] Zhenxing Niu, Mo Zhou, Le Wang, Xinbo Gao, and Gang Hua. Ordinal regression with multiple output cnn for age estimation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition (CVPR), June 2016.
346
+ 397 [17] Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems 32, pages 8024–8035. 2019. [18] Hoki Kim. Torchattacks: A pytorch repository for adversarial attacks. arXiv preprint arXiv:2010.01950, 2020.
347
+ [19] Jonas Rauber, Roland Zimmermann, Matthias Bethge, and Wieland Brendel. Foolbox native: Fast adversarial attacks to benchmark the robustness of machine learning models in pytorch, tensorflow, and jax. Journal of Open Source Software, 5(53):2607, 2020.
348
+ [20] Francesco Croce and Matthias Hein. Minimally distorted adversarial examples with a fast adaptive boundary attack. In International Conference on Machine Learning, pages 2196–2205. PMLR, 2020.
349
+ [21] Maura Pintor, Fabio Roli, Wieland Brendel, and Battista Biggio. Fast minimum-norm adversarial attacks through adaptive norm constraints. In Advances in Neural Information Processing Systems, volume 34, pages 20052–20062, 2021.
350
+ [22] Cihang Xie, Zhishuai Zhang, Yuyin Zhou, Song Bai, Jianyu Wang, Zhou Ren, and Alan Yuille. Improving transferability of adversarial examples with input diversity. In Computer Vision and Pattern Recognition. IEEE, 2019.
351
+ [23] Yinpeng Dong, Tianyu Pang, Hang Su, and Jun Zhu. Evading defenses to transferable adversarial examples by translation-invariant attacks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 4312–4321, 2019.
352
+ [24] Andrew Ilyas, Logan Engstrom, Anish Athalye, and Jessy Lin. Black-box adversarial attacks with limited queries and information. In ICML, pages 2137–2146. PMLR, 2018.
353
+ [25] Jonathan Uesato, Brendan O’donoghue, Pushmeet Kohli, and Aaron Oord. Adversarial risk and the dangers of evaluating against weak attacks. In ICML, pages 5025–5034. PMLR, 2018.
354
+ [26] Maksym Andriushchenko, Francesco Croce, Nicolas Flammarion, and Matthias Hein. Square attack: a query-efficient black-box adversarial attack via random search. 2020.
355
+ [27] Chongli Qin, James Martens, Sven Gowal, Dilip Krishnan, Krishnamurthy (Dj) Dvijotham, Alhussein Fawzi, Soham De, Robert Stanforth, and Pushmeet Kohli. Adversarial robustness through local linearization. In Proceedings of the 33rd International Conference on Neural Information Processing Systems, 2019.
356
+ [28] Hossein Souri, Pirazh Khorramshahi, Chun Pong Lau, Micah Goldblum, and Rama Chellappa. Identification of attack-specific signatures in adversarial examples. CoRR, abs/2110.06802, 2021.
357
+ [29] Anouar Kherchouche, Sid Ahmed Fezza, Wassim Hamidouche, and Olivier Déforges. Detection of adversarial examples in deep neural networks with natural scene statistics. In 2020 International Joint Conference on Neural Networks (IJCNN), pages 1–7, 2020.
358
+ [30] Kevin Roth, Yannic Kilcher, and Thomas Hofmann. The odds are odd: A statistical test for detecting adversarial examples. In Proceedings of the 36th International Conference on Machine Learning, volume 97, pages 5498–5507, 09–15 Jun 2019.
359
+ [31] Xin Li and Fuxin Li. Adversarial examples detection in deep networks with convolutional filter statistics. In 2017 IEEE International Conference on Computer Vision (ICCV), pages 5775–5783, 2017.
360
+ [32] Jiajun Lu, Theerasit Issaranon, and David A. Forsyth. Safetynet: Detecting and rejecting adversarial examples robustly. CoRR, abs/1704.00103, 2017.
361
+ [33] Shiqing Ma and Yingqi Liu. Nic: Detecting adversarial samples with neural network invariant checking. In Proceedings of the 26th network and distributed system security symposium (NDSS 2019), 2019.
362
+ [34] Logan Engstrom, Andrew Ilyas, Hadi Salman, Shibani Santurkar, and Dimitris Tsipras. Robustness (python library), 2019. https://github.com/MadryLab/robustness.
363
+ [35] Kevin Roth, Yannic Kilcher, and Thomas Hofmann. Adversarial training is a form of data-dependent operator norm regularization. In Advances in Neural Information Processing Systems, volume 33, pages 14973–14985, 2020.
364
+ [36] 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.
365
+ [37] Nicolas Papernot, Patrick McDaniel, and Ian Goodfellow. Transferability in machine learning: from phenomena to black-box attacks using adversarial samples. arXiv preprint arXiv:1605.07277, 2016.
366
+ [38] Seyed-Mohsen Moosavi-Dezfooli, Alhussein Fawzi, Omar Fawzi, and Pascal Frossard. Universal adversarial perturbations. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1765–1773, 2017.
367
+ [39] Pin-Yu Chen, Huan Zhang, Yash Sharma, Jinfeng Yi, and Cho-Jui Hsieh. Zoo: Zeroth order optimization based black-box attacks to deep neural networks without training substitute models. In Proceedings of the 10th ACM workshop on artificial intelligence and security, pages 15–26, 2017.
368
+ [40] Wieland Brendel, Jonas Rauber, and Matthias Bethge. Decision-based adversarial attacks: Reliable attacks against black-box machine learning models. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings. OpenReview.net, 2018.
369
+ [41] Nicholas Carlini and Andreas Terzis. Poisoning and backdooring contrastive learning. In International Conference on Learning Representations, 2022.
370
+ [42] Dongxian Wu, Shu-Tao Xia, and Yisen Wang. Adversarial weight perturbation helps robust generalization. In NeurIPS, 2020.
371
+ [43] Mathias Lecuyer, Vaggelis Atlidakis, Roxana Geambasu, Daniel Hsu, and Suman Jana. Certified robustness to adversarial examples with differential privacy. In 2019 IEEE Symposium on Security and Privacy $( S P )$ , pages 656–672. IEEE, 2019.
372
+ [44] Yifan Gong, Yuguang Yao, Yize Li, Yimeng Zhang, Xiaoming Liu, Xue Lin, and Sijia Liu. Reverse engineering of imperceptible adversarial image perturbations. In International Conference on Learning Representations, 2022.
373
+ [45] Anish Athalye, Nicholas Carlini, and David Wagner. Obfuscated gradients give a false sense of security: Circumventing defenses to adversarial examples. In International conference on machine learning, pages 274–283. PMLR, 2018.
374
+ [46] Ahmed Aldahdooh, Wassim Hamidouche, Sid Ahmed Fezza, and Olivier Déforges. Adversarial example detection for dnn models: a review and experimental comparison. Artificial Intelligence Review, Jan 2022.
375
+ [47] Xuwang Yin, Soheil Kolouri, and Gustavo K Rohde. Gat: Generative adversarial training for adversarial example detection and robust classification. In International Conference on Learning Representations, 2020.
376
+ [48] Xuwang Yin, Soheil Kolouri, and Gustavo K. Rohde. Divide-and-conquer adversarial detection. CoRR, abs/1905.11475, 2019.
377
+ [49] Jan Hendrik Metzen, Tim Genewein, Volker Fischer, and Bastian Bischoff. On detecting adversarial perturbations. arXiv preprint arXiv:1702.04267, 2017.
378
+ [50] Tianyu Pang, Chao Du, Yinpeng Dong, and Jun Zhu. Towards robust detection of adversarial examples. In Proceedings of the 32nd International Conference on Neural Information Processing Systems, NIPS’18, page 4584–4594, Red Hook, NY, USA, 2018. Curran Associates Inc.
379
+ [51] Dongyu Meng and Hao Chen. Magnet: A two-pronged defense against adversarial examples. In Proceedings of the 2017 ACM SIGSAC Conference on Computer and Communications Security, CCS ’17, page 135–147, New York, NY, USA, 2017. Association for Computing Machinery.
380
+ [52] Yang Song, Taesup Kim, Sebastian Nowozin, Stefano Ermon, and Nate Kushman. Pixeldefend: Leveraging generative models to understand and defend against adversarial examples. In International Conference on Learning Representations, 2018.
381
+ [53] Gaurav Kumar Nayak, Ruchit Rawal, and Anirban Chakraborty. Dad: Data-free adversarial defense at test time. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pages 3562–3571, 2022.
382
+ [54] Fangzhou Liao, Ming Liang, Yinpeng Dong, Tianyu Pang, Jun Zhu, and Xiaolin Hu. Defense against adversarial attacks using high-level representation guided denoiser. CoRR, abs/1712.02976, 2017.
383
+ [55] Reuben Feinman, Ryan R Curtin, Saurabh Shintre, and Andrew B Gardner. Detecting adversarial samples from artifacts. arXiv preprint arXiv:1703.00410, 2017.
384
+ [56] Shengyuan Hu, Tao Yu, Chuan Guo, Wei-Lun Chao, and Kilian Q Weinberger. A new defense against adversarial images: Turning a weakness into a strength. Advances in Neural Information Processing Systems, 32, 2019.
385
+ [57] Maksym Andriushchenko and Nicolas Flammarion. Understanding and improving fast adversarial training. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 16048–16059. Curran Associates, Inc., 2020.
386
+ [58] Soorya Gopalakrishnan, Zhinus Marzi, Upamanyu Madhow, and Ramtin Pedarsani. Combating adversarial attacks using sparse representations. Sixth International Conference on Learning Representations, Workshop Track, 2018.
387
+ [59] Ambar Pal and Rene Vidal. A game theoretic analysis of additive adversarial attacks and defenses. In H. Larochelle, M. Ranzato, R. Hadsell, M.F. Balcan, and H. Lin, editors, Advances in Neural Information Processing Systems, volume 33, pages 1345–1355. Curran Associates, Inc., 2020.
388
+ [60] Peter Bartlett, Sebastien Bubeck, and Yeshwanth Cherapanamjeri. Adversarial examples in multi-layer random relu networks. In M. Ranzato, A. Beygelzimer, Y. Dauphin, P.S. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, volume 34, pages 9241–9252. Curran Associates, Inc., 2021.
389
+
390
+ # 14 A Additional Discussions
391
+
392
+ # A.1 Summary of Pros & Cons of the Proposed Method
393
+
394
+ # Pros:
395
+
396
+ • Relies on strong assumptions and hence is specifically effective for PGD-like attacks. Namely, the unique trace of PGD-like attacks can be used in specific (instead of generic) defense scenarios with knowledge about the attacker, or forensics scenarios to tell whether an adversarial example is created by PGD-like methods by identifying the unique trace.
397
+ • Can infer other attack algorithm details such as loss function and the ground-truth labels, while the other attack detection methods cannot do the same.
398
+ • Easy and straightforward to interpret for human, since the meaning of the ARC features is clearly defined, and the feature dimensionality is low.
399
+ • Light-weighted in terms of algorithm components. No any additional deep neural networks is required.
400
+ • Non-intrusive. Does not require any change in neural network architecture or parameters. The proposed method analyzes the Jacobian matrices calculated from the neural network of interest.
401
+ • Data-undemanding. Does not require a large number of training data. We use merely 50 training samples in our experiments.
402
+ • The stronger the attack is, the stronger the trace is (and hence the higher detection rate). Previous methods compatible to our extremely-limited setting do not have such property and may even perform worse with large perturbations in some cases (See Table 3).
403
+ • Reveals a new perspective to understand why Adversarial Training works. (See "Combination with Adversarial Training" in Section 5).
404
+
405
+ # Cons:
406
+
407
+ • Relies on strong assumptions (See "Uniqueness of SAE to PGD-Like Attack" in Section 2), and hence is not effective under non-PGD scenarios since assumptions are broken. Ablation studies are carefully carried out in Section 4.2 to examine and justify these assumptions.
408
+ • Suffers from high time complexity due to Jacobian matrix calculation. In practice, this is reflected by time consumption of calculation of the ARC feature (See "Limitations" in Section 5). Experiments on ImageNet are extremely slow and hence we are unable to evaluate the method on all ImageNet data.
409
+ • Performs worse than previous NSS method against small perturbations (i.e., $\varepsilon = 2 / 2 5 5$ or $\varepsilon = 4 / 2 5 5 )$ ). (But significantly better against large perturbations).
410
+ • Incompatible with Adversarial Training. (But meanwhile provides a new perspective to understand why adversarial training works. See "Combination with Adversarial Training" in Section 5).
411
+
412
+ # A.2 Iterations of PGD-like Attacks
413
+
414
+ It is known that the number of iterations (fixed at 100 in our experiments) also impacts the attack 52 strength besides perturbation magnitude $\varepsilon$ . As increasing number of iterations will also lead to a 53 more linear response from the model given an fixed and appropriate $\varepsilon$ and achieve SAE similarly, we 54 stick to one controlled variable $\varepsilon$ for simplicity.
415
+
416
+ 555 On the contrary, reducing the number of iterations of a PGD-like attack will also lead to small
417
+ 556 perturbations that are hard to detect (as demonstrated in Section 4), and hence increase the possibility
418
+ 557 that the attack will not trigger clear SAE and hence bypass the proposed detection method. As an
419
+ 558 extreme case, FGSM, namely the single-step version of PGD does not effectively trigger SAE (as
420
+ 559 discussed in Section 4.2).
421
+ 560 The related works usually fix at a single set of attack parameters, and hence miss the observation that
422
+ 561 smaller perturbations are harder to detect.
423
+
424
+ An extremely limited problem setting (Paragraph 1 in Section 1) makes the proposed method flexible and applicable in a wider range of defense and forensics scenarios compared to existing methods. Namely, a method can be used in more flexible scenarios if it requires less from the adopter.
425
+
426
+ Limited number of data samples. Data-demanding methods is only applicable for models using publicly available datasets, or is only applicable by the first-party who trained the neural network. This limits the use cases of these methods. In contrast, we do not assume collecting a large amount of data is easy for potential adopters of the proposed method. Due to the low demand on data, the proposed method enables a wider range of defense or forensics scenarios, especially when there is no access to the whole training dataset. For instance, the "Third-party Attack Detection or Forensics" and "Attack Detection for Federated Learning" scenarios.
427
+
428
+ • Third-party Attack Detection (identify whether the model is attacked) or Forensics (identify attack type and infer the attack detail). Being data-undemanding means the proposed method can be applied to any pre-trained neural network randomly downloaded from the internet, or purchased from an commercial entity. For pre-trained neural networks using proprietary training datasets with commercial secret or ethic/privacy concerns (such as commercial face datasets and CT scans from patients), the proposed method is still valid as long as there are are a few training samples for reference, or it is possible to request a few reference training samples.
429
+
430
+ • Attack Detection for Federated Learning. In federated learning, raw training data (such as face images) is forbidden to be transmitted to the central server. And hence even the neural network trainer cannot access the full training dataset (will violate user privacy), and it is impossible to use any data-demanding methods to detect attack against a trained model (e.g., face recognition model). In contrast, the proposed method is still valid in this scenario as long as a few training samples can be collected from several volunteers for reference.
431
+
432
+ No change to network architecture or weights. Many models deployed in production are unaware of adversarial attack. Re-training and replacing these models will induce cost, and will even introduce the risk of reducing benign example performance.
433
+
434
+ No auxiliary deep networks. Since a large amount of data is assumed to be not easy to obtain due to commercial or ethic reasons, training auxiliary deep networks are not always feasible. Pre-trained auxiliary deep networks are not always available for any classification task.
435
+
436
+ # A.4 More on Adaptive Attack
437
+
438
+ According to [13], some similar attack detection methods are broken by adaptive attacks. Here we discuss more about the existing adaptive attacks and report the quantitative experimental results. We also further elaborate on the adaptive attack mentioned in Section 2.
439
+
440
+ Logit Matching. (from Section 5.2 "The Odds are Odd" of [13]) Instead of maximizing the default entropy loss, we switch to minimize the MSE loss between the clean logits from another class and that of the adversarial example. We conduct experiment with all testing data from CIFAR-10, and 128 random testing samples from ImageNet (due to limited time frame of rebuttal). The experimental results can be found in the following table. Note, switching loss function to MSE loss (Logit Matching) breaks our assumption (IV). However, the attack still triggers SAE through the least-likely class, and hence our method is still effective, but is (expectedly) weaker compared to the BIM with the original cross-entropy loss.
441
+
442
+ <table><tr><td rowspan="2">Dataset Model</td><td rowspan="2">Attack</td><td colspan="4">e=2/255 FPR</td><td colspan="4">=4/255</td><td colspan="4">∈=8/255</td><td colspan="4">∈=16/255</td><td colspan="4"></td></tr><tr><td>DR</td><td></td><td>Acc</td><td>Acc*</td><td>DR</td><td>FPR</td><td>Acc</td><td>Acc*</td><td>DR</td><td>FPR</td><td>Acc</td><td>Acc*</td><td>DR</td><td>FPR</td><td>Acc</td><td>Acc*</td><td>DR</td><td>e=? FPR</td><td>Acc</td><td>Acc*</td></tr><tr><td>CIFAR-10 ResNet-18</td><td>BIM(Logit Matching)</td><td>0.0</td><td>0.0</td><td>80.6</td><td>80.6</td><td>0.0</td><td>0.0</td><td>63.2</td><td>63.2</td><td>23.8</td><td>1.5</td><td>46.3</td><td>35.5</td><td>48.0</td><td>1.1</td><td>38.0</td><td>20.2</td><td>22.8</td><td>1.5</td><td>57.1</td><td>46.9</td></tr><tr><td>ImageNet ResNet-152</td><td>BIM (Logit Matching)</td><td>0.0</td><td>0.0</td><td>46.1</td><td>46.1</td><td>7.0</td><td>1.4</td><td>18.8</td><td>17.2</td><td>17.2</td><td>1.4</td><td>9.4</td><td>7.0</td><td>91.4</td><td>1.4</td><td>3.1</td><td>0.0</td><td>30.3</td><td>1.6</td><td>19.3</td><td>17.6</td></tr><tr><td>ImageNet SwinT-B-IN1K</td><td>BIM(Logit Matching)</td><td>0.8</td><td>1.6</td><td>46.1</td><td>45.3</td><td>7.0</td><td>2.0</td><td>7.0</td><td>7.0</td><td>55.5</td><td>2.0</td><td>0.8</td><td>0.8</td><td>90.6</td><td>0.2</td><td>0.0</td><td>0.0</td><td>41.2</td><td>2.0</td><td>13.5</td><td>13.1</td></tr></table>
443
+
444
+ Table 4: Results of Logit Matching as adaptive attack against our method.
445
+
446
+ 605 Interpolation with Binary Search. (from Section 5.13 "Turning a Weakness into a Strength" of
447
+ 606 [13]) This methods find interpolated adversarial examples that are close to the decision boundary
448
+ 607 with binary search. We conduct experiment with all testing data from CIFAR-10, and 128 random
449
+ 608 testing samples from ImageNet (due to limited time frame of rebuttal). The experimental results can
450
+ 609 be found in the following table. Compared to the baseline results, the results show that our method is
451
+ 610 still effective against the adversarial examples close to the decision boundary.
452
+ 611 Adaptive Attack discussed in Section 2. To avoid triggering SAE, the goal of the PGD attack can
453
+ 612 include an additional term to minimize $\| S _ { * } ( { \pmb x } + { \pmb r } ) \| _ { F }$ . Namely, the corresponding adaptive attack is:
454
+
455
+ <table><tr><td rowspan="2">Dataset Model</td><td rowspan="2">Attack</td><td colspan="4">e=2/255</td><td colspan="4">e=4/255</td><td colspan="4">e=8/255</td><td colspan="4">=16/255</td><td colspan="4">e=?</td></tr><tr><td>DR</td><td>FPR</td><td>Acc</td><td>Acc*</td><td>DR</td><td>FPR</td><td>Acc</td><td>Acc*</td><td>DR</td><td>FPR</td><td>Acc</td><td>Acc*</td><td>DR</td><td>FPR</td><td>Acc</td><td>Acc*</td><td>DR</td><td>FPR</td><td>Acc</td><td>Acc*</td></tr><tr><td>CIFAR-10 ResNet-18</td><td>BIM (Interpolation)</td><td>0.0</td><td>0.0</td><td>65.7</td><td>65.7</td><td>0.0</td><td>0.0</td><td>44.6</td><td>44.6</td><td>28.0</td><td>1.5</td><td>21.9</td><td>28.0</td><td>74.4</td><td>1.1</td><td>6.0</td><td>56.4</td><td>28.0</td><td>1.5</td><td>34.6</td><td>48.8</td></tr><tr><td>ImageNet</td><td>BIM (Interpolation)</td><td>0.0</td><td>0.0</td><td>18.8</td><td>18.8</td><td>4.7</td><td>1.4</td><td>6.2</td><td>5.5</td><td>25.0</td><td>1.4</td><td>0.8</td><td>0.8</td><td>90.6</td><td>1.4</td><td>0.0</td><td>0.8</td><td>31.4</td><td>1.6</td><td>6.4</td><td>6.2</td></tr><tr><td>ResNet-152 ImageNet SwinT-B-IN1K</td><td>BIM (Interpolation)</td><td>1.6</td><td>1.6</td><td>44.5</td><td>45.3</td><td>3.9</td><td>2.0</td><td>37.5</td><td>35.9</td><td>66.4</td><td>2.0</td><td>14.1</td><td>64.8</td><td>97.7</td><td>0.2</td><td>0.0</td><td>97.7</td><td>42.8</td><td>2.0</td><td>24.0</td><td>61.3</td></tr></table>
456
+
457
+ Table 5: Results of Interpolation with Binary Search as adaptive attack against our method.
458
+
459
+ $$
460
+ \begin{array} { r l } { { \arg \operatorname* { m a x } _ { r } L _ { \mathrm { C E } } ( { \boldsymbol x } + { \boldsymbol r } , { \boldsymbol c } ( { \boldsymbol x } ) ) - \| { \boldsymbol S } _ { * } ( { \boldsymbol x } + { \boldsymbol r } ) \| _ { F } } } \\ & { = \arg \operatorname* { m a x } _ { r } L _ { \mathrm { C E } } ( { \boldsymbol x } + { \boldsymbol r } , { \boldsymbol c } ( { \boldsymbol x } ) ) - \bigl [ \sum _ { i } \sum _ { j } | { \boldsymbol s } _ { n ^ { * } } ^ { ( i , j ) } | ^ { 2 } \bigr ] ^ { 1 / 2 } } \\ & { = \arg \operatorname* { m a x } _ { r } L _ { \mathrm { C E } } ( { \boldsymbol x } + { \boldsymbol r } , { \boldsymbol c } ( { \boldsymbol x } ) ) - \bigl [ \sum _ { i = 1 } ^ { T + 1 } \sum _ { j = 1 } ^ { 2 } \cos [ \nabla f _ { n ^ { * } } ( { \boldsymbol x } + { \boldsymbol r } + { \boldsymbol \delta } _ { i } ) , \nabla f _ { n ^ { * } } ( { \boldsymbol x } + { \boldsymbol r } + { \boldsymbol \delta } _ { j } ) ] ^ { 2 } \bigr ] ^ { 1 / 2 } } \end{array}
461
+ $$
462
+
463
+ 613 To solve this adaptive attack problem, the straightforward solution is to conduct $Z$ -step PGD updates
464
+ 614 with the modified loss function. Each step includes but is not limited to these computations: (1) $T + 1$
465
+ 615 Jacobian matrices to calculate $n ^ { * }$ and $\nabla f _ { n ^ { * } } ( \cdot )$ ; (2) $T + 1$ Hessian matrices to calculate $\nabla ^ { 2 } f _ { n ^ { * } } ( \cdot )$
466
+ 616 Let $\psi _ { J }$ and $\psi _ { H }$ be the time consumption for Jacobian and Hessian matrices respectively. Then the
467
+ 617 time consumption of the $Z$ steps of optimization in total is greater than $Z ( T + \bar { 1 } ) ( \psi _ { J } + \dot { \psi } _ { H } )$ .
468
+ 618 For reference, for Nvidia Titan $\mathrm { X p }$ GPU and CIFAR-10/ResNet-18, the $\psi _ { J } = 0 . 1 8 7 \pm 0 . 0 1 2$ seconds,
469
+ 619 and $\psi _ { H } = 2 0 . 9 5 9 \pm 0 . 6 7 9$ seconds (Python code for this benchmark can be found in Appendix). If
470
+ 620 we use $Z = 1 0 0$ steps of PGD attack, and $T = 6$ for calculating ARC, each adversarial example of a
471
+ 621 CIFAR-10 image takes more than $Z ( T + 1 ) ( \psi _ { J } + \psi _ { H } ) \approx 1 4 8 0 2$ seconds (i.e., 4.1 hours).
472
+ 622 Note, we acknowledge that other alternative adaptive attack designs are possible, but as long as the
473
+ 623 alternative design involves optimizing any loss term calculated from gradients, second-order gradients
474
+ 624 (Hessian) will be required to finish the optimization process, which again makes the alternative attack
475
+ 625 computationally prohibitive.
476
+
477
+ # A.5 More on Related Works
478
+
479
+ We discuss the related works in more details, as an extension to Section 6.
480
+
481
+ # Similar Defenses.
482
+
483
+ • “The Odds are Odd” [30] is an attack detection method based on feature statistical test. This method is categorized in Section 6 as feature statistics-based methods. In particular, it detects adversarial examples based on the difference between the logits of clean image and image with random noise. This method assumes that a random noise may break the adversarial perturbation and hence lead to notable changes in the logits, and is is capable of correcting test time predictions. Meanwhile, it can be broken by adaptive attack to match the logits with an image from another example [13]. Similarly, our method can be seen as a statistical test for gradient consistency as reflected by ARC feature. Our method is motivated by the assumption that neural networks will manifest “local linearity” with respect to adversarial examples, which will not happen for benign examples. Meanwhile the SAE is consistent across different architectures, and the corresponding 2-D ARCv feature shows very simple cluster structure for both benign and adversarial examples. The adaptive attack against [30] can merely slightly reduce the effectiveness of our attack, as shown in the additional adaptive attack experiments in this Appendix.
484
+
485
+ • “Turning a Weakness into a Strength” [56] is an attack detection method which is conceptually similar to [30]. This method involves two criterion for detection: (1) low density of adversarial perturbations – random perturbations applied to natural images should not lead to changes in the predicted label. The input will be rejected if the change in predicted probability vector is significant after adding a Gaussian noise. (2) close proximity to the decision boundary – this leads to a method that rejects an input if it requires too many steps to successfully perturb with an iterative attack algorithm. Hence, this method can be seen as an detector with two-dimensional manually crafted feature. This method can be broken by an adaptive attack [13] that searches for an interpolation between the benign and adversarial example. Similarly, our method leverages BIM, an iterative attack to calculate the ARC feature. However, differently, our method use the iterative attack to explore the local area around the input, in order to calculate the extent of “local linearity” around the point as the ARC feature, while [56] leverages an iterative attack to count the number of required steps. The ARC feature shows clear difference between benign and adversarial examples, and hence does not need to combine with other manually crafted feature. [56] points out that solely using one criterion is insufficient, because the criterion (1) may be easily bypassed. The adaptive attack against [56] can merely slightly reduce the effectiveness of our attack, as shown in the additional adaptive attack experiments in this Appendix.
486
+
487
+ Local Linearity. Local linearity is an important characteristics for the community to understand the adversarial attack as well as design defense methods.
488
+
489
+ • FGSM [6] is designed based on the intuition that neural networks are vulnerable because their “local linear” property has been triggered by the attack. This is the first work that propose the concept of “local linearity” about adversarial attack. Many follow-up works about “local linearity” are adversarial training methods.
490
+ • In LLS [27] (adversarial training), a regularizer is proposed that encourages the loss to behave linearly in the vicinity of the training data, thereby penalizing gradient obfuscation while encouraging robustness. This is relevant to our interpretation on adversarial training in Section 5.
491
+ • In GradAlign [57] (adversarial training), it is noted that the network being highly non-linear locally is the main reason why FGSM training fails.
492
+ • Sparsifying front end [58] points out that a “locally linear” model can be used to develop a theoretical foundation for crafting attacks and defenses.
493
+ • In [59], it is proved that the Fast Gradient Method attack and a Randomized Smoothing defense form a Nash Equilibrium, under a locally linear decision boundary model for the underlying binary classifier.
494
+ • [60] shows that local linearity arises naturally at initialization.
495
+
496
+ # 79 A.6 Python Code for Evaluating Time Consumption of Jacobian / Hessian Calculation
497
+
498
+ The python code for measuring the time consumption for Jacobian and Hessian matrices calculation is shown below. The code is based on CIFAR-10 settings with $M = 3 \times 3 2 \times 3 2$ and $N = 1 0$ , and the neural network used is ResNet-18. For reference, the result on Nvidia Titan $\mathrm { X p }$ GPU is $0 . 1 8 7 \pm 0 . 0 1 2$ seconds for Jacobian, and $2 0 . 9 5 9 \pm 0 . 6 7 9$ seconds for Hessian.
499
+
500
+ 684 Note, for the ImageNet/ResNet-152 case, the Jacobian and Hessian calculation cost is much higher.
501
+
502
+ import time, torch as th, torchvision as $\mathtt { V }$ , numpy as np
503
+ device $=$ ’cuda’
504
+ resnet18 $\mathit { \Pi } = \mathit { \Pi } \mathtt { V }$ .models.resnet18(False).to(device) # standard resnet18
505
+ resnet18.eval()
506
+ resnet18.fc $=$ th.nn.Linear(512, 10).to(device) # fit for 10 classes
507
+ $\texttt { X } =$ th.rand(1, 3, 32, 32).to(device) # random input
508
+ # compute a jacobian
509
+ time_start $=$ time.time()
510
+ ${ \textbf { J } } =$ th.autograd.functional.jacobian(resnet18, X)
511
+ time_end $=$ time.time()
512
+
513
+ The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
514
+
515
+ • Did you include the license to the code and datasets? [Yes] See Section ??.
516
+ • Did you include the license to the code and datasets? [No] The code and the data are proprietary.
517
+ • Did you include the license to the code and datasets? [N/A]
518
+
519
+ Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
520
+
521
+ 1. For all authors...
522
+
523
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] Contributions are summarized at the end of Section 1.
524
+ (b) Did you describe the limitations of your work? [Yes] Limitations are summarized at the end of Section 5.
525
+ (c) Did you discuss any potential negative societal impacts of your work? [No] Attack detection is expected to build safer and more secure applications. Positive societal impacts are expected.
526
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
527
+
528
+ 2. If you are including theoretical results...
529
+
530
+ (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]
531
+
532
+ 3. If you ran experiments...
533
+
534
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Code is included in supplementary material.
535
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] All training details are included in Section 4
536
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [N/A] SVM converges to a reproducible result.
537
+ (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 mentioned the computer resource at the end of Section 5. Our experiments are carried out with two Nvidia Titan Xp experiments.
538
+
539
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
540
+
541
+ (a) If your work uses existing assets, did you cite the creators? [Yes] Dataset papers are cited. Compared methods are cited.
542
+ (b) Did you mention the license of the assets? [N/A] The CIFAR-10 dataset webpage https://www.cs.toronto.edu/\~kriz/cifar.html does not specify license. ImageNet dataset license can be found at https://www.image-net.org/download. php. The pretrained models available for public download, including ResNet-152 from PyTorch, and SwinT-B-IN1K are not specified with a license. The authors of code of compared method do not specify their license.
543
+ (c) Did you include any new assets either in the supplemental material or as a URL? [N/A] There is no new assets in this paper.
544
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
545
+
546
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
547
+
548
+ 5. If you used crowdsourcing or conducted research with human subjects...
549
+
550
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
551
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
552
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/kDEL91Dufpa/kDEL91Dufpa.md ADDED
The diff for this file is too large to render. See raw diff
 
md/dev/ktrw68Cmu9c/ktrw68Cmu9c.md ADDED
@@ -0,0 +1,296 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CODET: CODE GENERATION WITH GENERATED TESTS
2
+
3
+ Bei Chen∗, Fengji Zhang∗, Anh Nguyen∗, Daoguang Zan, Zeqi Lin, Jian-Guang Lou, Weizhu Chen Microsoft Corporation {beichen, v-fengjzhang, anhnguyen, v-dazan, zeqi.lin, jlou, wzchen}@microsoft.com
4
+
5
+ # ABSTRACT
6
+
7
+ The task of generating code solutions for a given programming problem can benefit from the use of pre-trained language models such as Codex, which can produce multiple diverse samples. However, a major challenge for this task is to select the most appropriate solution from the multiple samples generated by the pretrained language models. A natural way to evaluate the quality and correctness of a code solution is to run it against a set of test cases, but the manual creation of such test cases is often costly and time-consuming. In this paper, we propose a novel method, CODET, that leverages the same pre-trained language models to automatically generate test cases for the code samples, thus reducing the human effort and increasing the coverage of the test scenarios. CODET then executes the code samples using the generated test cases and performs a dual execution agreement, which considers both the consistency of the outputs against the generated test cases and the agreement of the outputs with other code samples. We conduct comprehensive experiments on four benchmarks, HumanEval, MBPP, APPS, and CodeContests, using five different pre-trained language models with varying sizes and capabilities. Our results show that CODET can significantly improve the performance of code solution selection over previous methods, achieving remarkable and consistent gains across different models and benchmarks. For instance, CODET improves the pass $@ 1$ metric on HumanEval to $6 5 . 8 \%$ , which represents an absolute improvement of $1 8 . 8 \%$ over the code-davinci-002 model, and an absolute improvement of more than $2 0 \%$ over the previous state-of-the-art results.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Despite the remarkable progress in pre-training techniques for code generation, selecting a single correct solution from multiple candidates generated by large language models remains a hard problem. For instance, Codex (Chen et al., 2021), a state-of-the-art pre-trained language model for code generation, can achieve a pass $@ 1 0 0$ (pass if one or more among 100 generated solutions for a given problem can pass the corresponding test cases) of $7 7 . 4 \%$ , but a pass $@ 1$ (correct rate of a single solution) of only $3 3 . 5 \%$ on the HumanEval benchmark (Chen et al., 2021)1. This huge gap limits the practical usefulness of code generation models and motivates us to explore how to pick the correct or best solution from multiple candidates.
12
+
13
+ A straightforward way to verify the correctness of a solution is to execute it and check if it passes all corresponding test cases. This execution-guided approach has been widely adopted in various code-related tasks, such as code generation (Chen et al., 2021; Li et al., 2022b; Shi et al., 2022), code translation (Roziere et al., 2021), and program synthesis (Chen et al., 2018; Ellis et al., 2019). However, this approach relies heavily on the quality and quantity of test cases, which are often costly and time-consuming to create and maintain. Moreover, in real-world applications like Copilot2, a code generation tool that assists developers in writing code, it is unrealistic to expect users to provide test cases for every problem they want to solve. Therefore, we propose to automatically generate test cases for arbitrary programming problems and use them to quickly verify any solution.
14
+
15
+ ![](images/0868e99bf4ccc4e4b1a47502378111fdc3fad0ac27adaf0e7b10e77d02fe21ef.jpg)
16
+ Figure 1: The illustration of CODET. Both the code solutions and the test cases are generated by the pre-trained language model. The best code solution is then selected by a dual execution agreement.
17
+
18
+ In this paper, we propose CODET: CODE generation with generated Test-driven dual execution agreement, as illustrated in Figure 1. First, we leverage the same pre-trained language model that generates code solutions, such as Codex, to generate a large number of test cases for each programming problem by providing an elaborate instruction as prompt. Next, we use a dual execution agreement approach inspired by the classical RANSAC algorithm (Fischler & Bolles, 1981). We execute each generated code solution on each generated test case, and iteratively find multiple groups of code solution and test case pairs. Each group, or consensus set, has solutions that pass the same test cases, indicating that they have the same functionality, even if they are different in implementation. We expect that a solution that passes more test cases is more correct, and that a solution that has more similar solutions, i.e., solutions in the same consensus set, is more consistent with the problem specification. So, we rank each consensus set by both the number of test cases and solutions in it, and choose the best solution from the highest-ranked consensus set.
19
+
20
+ Our method is simple and efficient, as it does not require any labelled data or additional rankers, but it achieves surprisingly exceptional performance. We evaluate our method on five different pre-trained language models for code generation: three OpenAI Codex models (Chen et al., 2021), INCODER (Fried et al., 2022), and CODEGEN (Nijkamp et al., 2022), as well as four established benchmarks for code generation: HumanEval (Chen et al., 2021), MBPP (Austin et al., 2021), APPS (Hendrycks et al., 2021), and CodeContests (Li et al., 2022b). The experimental results show that our method can effectively select the correct solution from multiple candidates, improving the pass $@ 1$ score significantly on all benchmarks in the zero-shot setting. For instance, CODET achieves improvements using code-davinci-002: HumanEval $( 4 7 . 0 \% \to 6 5 . 8 \%$ ), MBPP $( 5 8 . 1 \% 6 7 . 7 \% )$ , APPS INTRODUCTORY $( 2 7 . 2 \% \to 3 4 . 6 \% )$ , and CodeContests $( 0 . 7 \% 2 . 1 \%$ ). Moreover, when we combine code-davinci-002, the most powerful pre-trained model, and CODET, we outperform previous state-of-the-art methods by a large margin, e.g., HumanEval: $4 2 . 7 \%$ (Inala et al., 2022) $ 6 5 . 8 \%$ . We also conduct a thorough analysis to provide more insights. Our work is publicly available at https://github.com/microsoft/CodeT.
21
+
22
+ # 2 METHODOLOGY
23
+
24
+ The task of code generation is to solve a programming problem: generate code solution $x$ based on context c. As shown in Figure 2, context $c$ contains natural language problem description in the form of code comment, and a code snippet that includes statements such as imports and the function header. A code solution is a code snippet that solves the programming problem described in the context. Generally, we sample a set of code solutions, denoted as $\mathbf { X } = \left\{ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { N } \right\}$ , based on the context $c$ using a pre-trained language model $\mathcal { M }$ , which can be formulated as $\mathbf { X } \doteq \mathcal { M } ( c )$ . Our goal is to select the best code solution $\hat { x }$ from the set of generated code solutions $\mathbf { X }$ , where $\hat { x }$ is the most likely solution to correctly solve the given programming problem. To this end, we propose CODET in the hope of unleashing the inherent power of the pre-trained language model $\mathcal { M }$ . Specifically, we use $\mathcal { M }$ to generate test cases for the programming problem (Section 2.1), and then select the best code solution $\hat { x }$ based on a dual execution agreement (Section 2.2).
25
+
26
+ # 2.1 TEST CASE GENERATION
27
+
28
+ Besides generating code solutions, we also need to generate test cases to evaluate the correctness of the code solutions. A test case is a pair of input and expected output for the function defined in the context. For example, in Figure 2, a test case for the programming problem of checking whether there exist close elements in a list less than a threshold. To generate test cases, we use the same pre-trained language model $\mathcal { M }$ that we use for generating code solutions, but we add an instruction $p$ to the context $c$ as a prompt to indicate that we want test cases instead of code solutions. As shown in Figure 2, the instruction $p$ consists of three parts: (1) a “pass” statement as a placeholder of the function body, which signals that we do not need to generate code for the function, (2) a comment “check the correctness of [entry point]” to clarify the intention of generating test cases, where “[entry point]” is the name of the function, and (3) an “assert” statement to start the test case generation, which specifies the format of the test cases as input-output pairs.
29
+
30
+ ![](images/58516fd8091b1e18b86d717662b978866fb916511a5dac53c8b9f989cfa312bf.jpg)
31
+ Figure 2: Code generation and test case generation: an example from the HumanEval benchmark. Example input-output cases are removed from the context.
32
+
33
+ We then feed the concatenated context and instruction, $\mathrm { c o n c a t } ( c , p )$ , to the language model $\mathcal { M }$ , and sample a set of test cases, denoted as $\mathbf { Y } = \{ y _ { 1 } , y _ { 2 } , \cdot \cdot \cdot , y _ { M } \}$ , from the model output. The process of test case generation can be formulated as $\mathbf { Y } = { \mathcal { M } } ( \mathrm { c o n c a t } ( c , p ) )$ . The language model will try to complete the instruction by generating plausible input-output pairs for the function. Note that we remove all example input-output cases from the context $c$ before generating code solutions and test cases, to avoid exposing real test cases to the language model.
34
+
35
+ # 2.2 DUAL EXECUTION AGREEMENT
36
+
37
+ In this subsection, we explain how we select the best code solution $\hat { x }$ from the set of generated code solutions $\textbf { X } = \{ x _ { 1 } , x _ { 2 } , \cdot \cdot \cdot , x _ { N } \}$ , using the set of generated test cases $\mathbf { Y } = \{ y _ { 1 } , y _ { 2 } , \cdot \cdot \cdot , y _ { M } \}$ as a criterion. We can execute a code solution $x$ on a test case $y$ , which means running the function defined by $x$ on the input part of $y$ and comparing the output with the output part of $y$ . If the code solution $x$ can be executed without errors and the output matches the expected output, then we say the code solution $x$ can pass the test case $y$ . Furthermore, we say there is a functionality agreement between two code solutions $x _ { i }$ and $x _ { j }$ if they can pass the same set of test cases in $\mathbf { Y }$ . Our approach is based on the following assumptions: (1) the code solutions and the test cases are independently and randomly sampled from the pre-trained language model $\mathcal { M }$ given a certain programming problem, and (2) incorrect code solutions are often diverse, and the probability of having a functionality agreement between two incorrect code solutions by chance is very low. These assumptions are similar to those of the classical RANSAC algorithm (Fischler & Bolles, 1981), which is a robust method for finding consensus among noisy data. Inspired by RANSAC, we propose our approach CODET to perform dual execution agreement, which is an iterative approach as follows:
38
+
39
+ • We randomly select a pair $( x , y )$ from the set of all possible pairs $\mathcal { D } = \{ ( x , y ) | x \in \mathbf { X } , y \in$ $\mathbf { Y } \}$ . We then try to execute the code solution $x$ on the test case $y$ . If $x$ can pass $y$ , then we say that the pair $( x , y )$ is a hypothetical inlier, because it hypothetically describes the correct functionality for the programming problem. Otherwise, we say that $( x , y )$ is an outlier, because it fails to describe the correct functionality. Figure 3 shows a simple example of the programming problem “return the square of a number”. $( x _ { 1 } , y _ { 1 } )$ and $( x _ { 3 } , y _ { 2 } )$ are two of the hypothetical inliers, while $( x _ { 1 } , y _ { 4 } )$ and $( x _ { 3 } , y _ { 1 } )$ are two of the outliers. • If $( x , y )$ is a hypothetical inlier, we collect all other pairs from $\mathcal { D }$ that agree with this hypothetical inlier, forming a set $s$ called consensus set. To find the pairs that agree with $\bar { ( } x , y )$ , we first find all test cases that $x$ can pass, denoted as $\mathcal { S } _ { y }$ . Then, we find all code solutions that can pass exactly the same test cases as $x$ , denoted as $S _ { x }$ . Finally, the consensus set is the set of all pairs that consist of a code solution from $S _ { x }$ and a test case from $\mathcal { S } _ { y }$ , i.e., $\mathcal { S } \ = \ \{ ( x , y ) | x \ \in \ S _ { x } , y \ \in \ S _ { y } \}$ . For example in Figure 3, we can get ${ \mathcal { S } } _ { x } = \{ x _ { 1 } , x _ { 2 } \} , S _ { y } = \{ y _ { 1 } , y _ { 2 } , y _ { 3 } \}$ from the hypothetical inlier $( x _ { 1 } , y _ { 1 } )$ (shown in green box), and $S _ { x } = \{ x _ { 3 } \} , S _ { y } = \{ y _ { 2 } , y _ { 3 } , y _ { 4 } , y _ { 5 } \}$ from $( x _ { 3 } , y _ { 2 } )$ (shown in purple box).
40
+
41
+ ![](images/568c851dc5dc07e41864715034b50f129a9ee8ccd4d1d01078284e985c082c3b.jpg)
42
+ Figure 3: A simple example of the programming problem “return the square of a number”. The gray line between $x$ and $y$ indicates that $x$ can pass $y$ , i.e., $( x , y )$ is a hypothetical inlier. The green or purple box indicates a consensus set.
43
+
44
+ Table 1: Statistics of benchmarks: the total number of problems in the benchmark (Problems), the average number of ground-truth test cases per problem (GT Tests), and the number of sampling code solutions for each problem $( n )$ .
45
+
46
+ <table><tr><td>Benchmark</td><td>Problems</td><td>GTTests</td><td>n</td></tr><tr><td>HumanEval</td><td>164</td><td>7.77</td><td>100</td></tr><tr><td>MBPP</td><td>427</td><td>3.1</td><td>100</td></tr><tr><td rowspan="4">INTRODUCTORY APPS INTERVIEW</td><td>1,000</td><td rowspan="4">20.99</td><td rowspan="4">50</td></tr><tr><td>3,000</td></tr><tr><td>1,000</td></tr><tr><td>165</td></tr></table>
47
+
48
+ • We score the consensus set as $f ( S ) = | S _ { x } | | S _ { y } |$ , where $| S _ { x } |$ is the number of code solutions in $S _ { x }$ and $| S _ { y } |$ is the number of test cases in $\mathcal { S } _ { y }$ . This score is equal to the number of pairs in the consensus set. The intuition is that the more pairs that agree with the hypothetical functionality, the more likely this functionality is correct, according to our assumptions. Following the example in Figure 3, the consensus set scores are 6 and 4 for the hypothetical inliers $( x _ { 1 } , y _ { 1 } )$ and $( x _ { 3 } , y _ { 2 } )$ , respectively.
49
+
50
+ We repeat the above procedure for a fixed number of times, each time producing a consensus set with its score. Finally, we get the best code solution $\hat { x }$ by selecting any code solution from the consensus set with the highest score. If we want to obtain $k$ code solutions, we can select the top $k$ consensus sets with the highest scores, and one code solution is picked up from each of the $k$ consensus sets.
51
+
52
+ In practice, when the number of code solutions in $\mathcal { D }$ is not large, we can simplify the above method by examining all possible pairs in $\mathcal { D }$ , instead of sampling pairs from $\mathcal { D }$ . Specially, for each code solution $x \in \mathbf { X }$ , we run it with every test case in $\mathbf { Y }$ and keep track of which test cases it passes. We group together code solutions that pass the same test cases, because they have the same functionality. This way, we divide all code solutions in $\mathbf { X }$ into groups based on their functionality, which we write as $\mathbf { X } = \left\{ \mathcal { S } _ { x } ^ { 1 } , \mathcal { S } _ { x } ^ { 2 } , \cdot \cdot \cdot , \mathcal { S } _ { x } ^ { K } \right\}$ , where $K$ is the number of code solution groups. Each group $S _ { x }$ has a set of test cases that it passes, which we write as $\mathcal { S } _ { y }$ . Then, we get $K$ consensus sets, each of which has the form $\mathcal { S } = \{ ( \bar { x , y } ) | x \in \mathcal { S } _ { x } , y \in \mathcal { S } _ { y } \}$ . We can score each consensus set by $f ( S ) = | S _ { x } | | S _ { y } |$ , as before. This naive version captures the same underline intuition, but it finds all consensus sets right away, without sampling pairs repeatedly.
53
+
54
+ # 3 EXPERIMENTAL SETUP
55
+
56
+ Models Our experiments are based on Codex (Chen et al., 2021), INCODER (Fried et al., 2022) and CODEGEN (Nijkamp et al., 2022). Codex is a descendant of GPT-3 (Brown et al., 2020) and proficient in understanding the provided context and generating functional programs. We use three Codex models with different capabilities provided by OpenAI: code-cushman-001, code-davinci001, and code-davinci-002. INCODER is a unified generative model that can perform left-to-right code generation and code infilling, while CODEGEN is a family of large-scale language models to perform conversational program synthesis. We take use of the INCODER 6.7B version (INCODER6B) and the CODEGEN 16B Python mono-lingual version (CODEGEN-MONO-16B).
57
+
58
+ Metrics and Baseline We use the metric pass $@ k$ (with $n$ samples) for performance evaluation and take advantage of ground truth test cases to determine the functional correctness of code solutions. For each problem, we sample $n$ code solutions and then select $k$ of them for evaluation. If any of the $k$ code solutions passes all ground truth test cases, the problem is considered solved. Then pass $@ k$ is the percentage of solved problems. We use the unbiased definition of pass $@ k$ as our baseline (Chen et al., 2021), where $k$ solutions are randomly picked from $n$ samples. Our CodeT uses a dual execution agreement mechanism to select $k$ solutions from $n$ samples, as mentioned in 2.2. In addition, we include a clustering method from Li et al. (2022b) for comparison, denoted as AlphaCode-C. Our replication is to use the test inputs generated by CODET, run the solutions on the test inputs, group the solutions by test outputs, and rank the clusters by size (details in Appendix I).
59
+
60
+ Table 2: Pass $@ k$ $( \% )$ on the HumanEval and MBPP benchmarks. AlphaCode-C is our replication of the clustering method in Li et al. (2022b). The numbers in red indicate the absolute improvements of CODET over baseline on pass $@ 1$ and pass $@ 1 0$ . We also list the baseline results from Fried et al. (2022) and Nijkamp et al. (2022) for reference in gray, where the settings of context are not exactly the same as ours. For CODET, temperature is set to 0.8 and sampling number is set to 100. We do not show CODET pass $@ 1 0 0$ , since it is the same as the baseline pass $@ 1 0 0$ .
61
+
62
+ <table><tr><td>Methods</td><td colspan="3">Baseline</td><td colspan="3">AlphaCode-C</td><td colspan="3">CODET</td></tr><tr><td>k</td><td>1</td><td>10</td><td>100</td><td>1</td><td>2</td><td>10</td><td>1</td><td>2</td><td>10</td></tr><tr><td colspan="10">HumanEval</td></tr><tr><td>code-cushman-001</td><td>33.5</td><td>54.3</td><td>77.4</td><td>39.6</td><td>46.4</td><td>63.8</td><td> 44.5 11.0</td><td>50.1</td><td> 65.7 11.4</td></tr><tr><td>code-davinci-001</td><td>39.0</td><td>60.6</td><td>84.1</td><td>41.6</td><td>50.7</td><td>75.6</td><td>50.2 11.2</td><td>58.9</td><td>75.8 15.2</td></tr><tr><td>code-davinci-002</td><td>47.0</td><td>74.9</td><td>92.1</td><td>55.1</td><td>64.1</td><td>84.4</td><td>65.8 18.8</td><td>75.1</td><td>86.6 11.7</td></tr><tr><td>INCODER-6B</td><td>16.4 15.2</td><td>28.3 27.8</td><td>47.5 47.0</td><td>17.7</td><td>23.8</td><td>34.8</td><td>20.6 4.2</td><td>27.6</td><td>37.1 8.8</td></tr><tr><td>CODEGEN-MONO-16B</td><td>29.7 29.3</td><td>50.349.9</td><td>73.7 75.0</td><td>27.3</td><td>38.5</td><td>64.4</td><td>36.7 7.0</td><td>44.7</td><td>59.3 9.0</td></tr><tr><td colspan="10">MBPP</td></tr><tr><td>code-cushman-001</td><td>45.9</td><td>66.9</td><td>79.9</td><td>51.5</td><td>59.0</td><td>73.3</td><td> 55.4 9.5</td><td>61.7</td><td>72.7 5.8</td></tr><tr><td>code-davinci-001</td><td>51.8</td><td>72.8</td><td>84.1</td><td>56.2</td><td>64.7</td><td>78.8</td><td>61.9 10.1</td><td>69.1</td><td>79.3 6.5</td></tr><tr><td>code-davinci-002</td><td>58.1</td><td>76.7</td><td>84.5</td><td>62.0</td><td>70.7</td><td>79.9</td><td>67.7 9.6</td><td>74.6</td><td>81.5 4.8</td></tr><tr><td>INCODER-6B</td><td>21.3 19.4</td><td>46.5</td><td>66.2</td><td>26.7</td><td>35.3</td><td>56.2</td><td>34.4 13.1</td><td>43.9</td><td>58.2 11.7</td></tr><tr><td>CODEGEN-MONO-16B</td><td>42.4</td><td>65.8</td><td>79.1</td><td>41.0</td><td>55.9</td><td>73.6</td><td>49.5 7.1</td><td>56.6</td><td>68.5 2.7</td></tr></table>
63
+
64
+ Benchmarks We conduct experiments on four public code generation benchmarks in the zeroshot setting. The statistics of benchmarks are shown in Table 1. (1) HumanEval (Chen et al., 2021) consists of hand-written Python programming problems. The original contexts include example input-output cases, which are removed in our experiments to avoid exposing real test cases. The experiment in Appendix B shows that this removal operation is reasonable and indispensable. (2) MBPP (Austin et al., 2021) (sanitized version) contains crowd-sourced Python programming problems, and we follow HumanEval to construct the context for it. (3) APPS (Hendrycks et al., 2021) consists of coding problems collected from open-access coding websites, which have different difficulty levels. (4) CodeContests (Li et al., 2022b) includes competitive programming problems scraped from the Codeforces platform. To enable zero-shot inference, we construct the context for APPS and CodeContests as follows: the original problem description is treated as a comment where input-output examples are removed, and a simple function header “def solution(stdin : str) str :” is placed after the comment to accommodate the input/output data format. More implementation details can be found in Appendix A.
65
+
66
+ # 4 EXPERIMENTAL RESULTS
67
+
68
+ In this section, we evaluate CODET on five different pre-trained models and four benchmarks to verify its effectiveness, followed by test case analysis and case studies to provide more insights.
69
+
70
+ # 4.1 RESULTS ON HUMANEVAL AND MBPP
71
+
72
+ The experimental results of various models on the HumanEval and MBPP benchmarks are summarized in Table 2. If we compare the pass $@ 1 0 0$ to pass $@ 1$ on the Baseline column, it is clear that the former is significantly better than the latter, indicating the potential to select the best code solution from the 100 generated samples.
73
+
74
+ For three Codex models, when we compare the CODET column with the Baseline column, CODET pass $@ 1$ achieves an absolute improvement of about $1 0 \%$ over the baseline pass $@ 1$ . The improvements are consistently above $1 0 \%$ on HumanEval. Surprisingly, even for the strongest baseline, code-davinci-002, the improvement is $1 8 . 8 \%$ , boosting the pass $@ 1$ to $6 5 . 8 \%$ , which is a $2 0 + \%$ absolute improvement over the best previously reported results (Inala et al., 2022). We attribute this larger improvement to the higher quality of test cases generated by code-davinci-002, providing a deeper analysis in Section 4.3. CODET also achieves exceptional performance on the MBPP benchmark, although the magnitude of the improvements is slightly less than that of HumanEval. Using the code-davinci-002 as an example, the pass $@ 1$ improves by $9 . 6 \%$ . We also report pass $@ 2$ and pass $@ 1 0$ of CODET to further show its superiority. The pass $@ 2$ results of CODET are close to the baseline pass $@ 1 0$ results. Meanwhile, the improvements on pass $@ 1 0$ are also consistently over $1 0 \%$ on the HumanEval benchmark.
75
+
76
+ Table 3: Pass $@ k$ $( \% )$ results on the APPS and CodeContests benchmarks using code-davinci-002 in the zero-shot setting. The numbers in red indicate the absolute improvements of CODET over baseline on pass $@ 1$ , pass $@ 1 0$ and pass $@ 1 0 0$ . For CODET, temperature is set to 0.8 and sampling number is set to 50 for APPS and 1, 000 for CodeContests.
77
+
78
+ <table><tr><td colspan="2">Methods</td><td colspan="5">Baseline</td><td colspan="4">CODET</td></tr><tr><td colspan="2">k</td><td></td><td>10</td><td>50</td><td>100</td><td>1000</td><td>1</td><td>2</td><td>10</td><td>100</td></tr><tr><td rowspan="3">APPS</td><td>INTRODUCTORY</td><td>27.2</td><td>46.6</td><td>59.4</td><td>-</td><td>1</td><td>34.6 7.4</td><td>41.2</td><td>53.2 6.6</td><td></td></tr><tr><td>INTERVIEW</td><td>5.1</td><td>12.8</td><td>23.0</td><td>1</td><td>=</td><td>8.1 3.0</td><td>11.2</td><td>18.1 5.3</td><td></td></tr><tr><td>COMPETITION</td><td>1.8</td><td>4.9</td><td>12.1</td><td>-</td><td>-</td><td>2.2 0.4</td><td>4.1</td><td>8.6 3.7</td><td></td></tr><tr><td colspan="2">CodeContests</td><td>0.7</td><td>3.0</td><td>5.7</td><td>7.5</td><td>13.9</td><td>2.1 1.4</td><td>2.3</td><td>5.3 2.3</td><td>9.9 2.4</td></tr></table>
79
+
80
+ The experimental results of INCODER-6B and CODEGEN-MONO-16B further verify the effectiveness of CODET. It is obvious CODET can significantly improve the pass $@ 1$ , with absolute improvements in the range of $4 . 2 \%$ to $1 3 . 1 \%$ . INCODER-6B achieves the greatest improvement with a gain of $1 3 . 1 \%$ on the MBPP benchmark. Similar to the experimental results of Codex, the pass $@ 2$ results are close to the baseline pass $@ 1 0$ . All the results demonstrate that CODET can boost the performance of various pre-trained language models consistently.
81
+
82
+ As for AlphaCode-C, it is consistently inferior to CODET on both benchmarks using different models, demonstrating the superiority of our dual execution agreement that takes test case information into consideration. In addition, we notice that duplication exists in the generated code solutions and test cases. We perform an ablation study in Appendix $\mathbf { D }$ to show that de-duplication has little influence on the results of CODET. Moreover, we discuss the sensitivity of CODET to the temperature in Appendix E, showing the rationality of choosing a rather high temperature at 0.8.
83
+
84
+ # 4.2 RESULTS ON APPS AND CODECONTESTS
85
+
86
+ We also conduct experiments on two more challenging benchmarks, APPS and CodeContests. We build the zero-shot versions of APPS and CodeContests to be in line with our setting of HumanEval and MBPP by removing the example input-output cases in the problem descriptions. We employ code-davinci-002 for code solution and test case generation. The sampling number is set to 50 for APPS to save computation cost on the 5, 000 testing problems, while for CodeContests, following Li et al. (2022b), the sampling number is set to $1 , 0 0 0$ to solve especially hard problems. From the results summarized in Table 3, we can clearly observe the consistent performance improvements on both benchmarks using CODET. The absolute pass $@ 1$ improvement is $7 . 4 \%$ for introductory problems in APPS, while the improvements are not significant for competition level problems in APPS and CodeContest, indicating their difficulties. In addition, we notice that code-davinci-002 may generate many trivial code solutions for the problems in APPS and CodeContests due to the superior difficulty of these two benchmarks. We perform a comprehensive study in Appendix F to demonstrate the robustness of CODET to this issue. Inspired by Chen et al. (2021) and Li et al. (2022b), we also conduct experiments in the one-shot setting, which is detailed in Appendix G.
87
+
88
+ # 4.3 ANALYSIS ON TEST CASES
89
+
90
+ The test cases are vital to CODET since the core idea is based on test-driven execution agreement.
91
+ Hence, in this subsection, we analyze the test cases by answering the following research questions.
92
+
93
+ ![](images/b5de0eecc1a3848f0afea0faeeeb7eff6f8f3112f24b50f697a7e4149d8699ca.jpg)
94
+ Figure 4: The distributions of (a) test case accuracy and (b) toxicity rate for each problem on HumanEval. Test cases are of better quality if they have higher accuracy and lower toxicity rate.
95
+
96
+ <table><tr><td>Benchmarks</td><td colspan="3">HumanEval</td><td colspan="3">MBPP</td></tr><tr><td>k</td><td>1</td><td>2</td><td>10</td><td>1</td><td>2</td><td>10</td></tr><tr><td>code-cushman-001</td><td>47.1 2.6</td><td>58.6 8.5</td><td>71.2 5.5</td><td>59.7 4.3</td><td>64.8 3.1</td><td>75.5 2.8</td></tr><tr><td>code-davinci-001</td><td>52.0 1.8</td><td>62.9 4.0</td><td>78.1 2.3</td><td>64.3 2.4</td><td>71.7 2.6</td><td>80.5 1.2</td></tr><tr><td>INCODER-6B</td><td>26.8 6.2</td><td>30.4 2.8</td><td>40.8 3.7</td><td>50.3 15.9</td><td>55.4 11.5</td><td>64.5 6.3</td></tr><tr><td>CODEGEN-MONO-16B</td><td>47.7 11.0</td><td>54.9 10.2</td><td>71.0 11.7</td><td>60.0 10.5</td><td>67.6 11.0</td><td>76.5 8.0</td></tr></table>
97
+
98
+ Table 4: Pass $@ k$ $( \% )$ on the HumanEval and MBPP benchmarks with code-cushman-001, codedavinci-001, INCODER, and CODEGEN using the test cases generated by code-davinci-002. The numbers in orange indicate the absolute improvements of pass $@ k$ using code-davinci-002 test cases over that using their own generated test cases.
99
+
100
+ # Q1. What is the quality of the generated test cases?
101
+
102
+ We evaluate the correctness of the generated test cases using the canonical solutions. A test case is considered correct if the canonical solution can pass it. Figure 4a summarizes the distributions of test case accuracy on HumanEval, where the horizontal axis represents the accuracy value for each problem and the vertical axis represents the probability density of problems with the corresponding accuracy value. We can see that the test cases generated by Codex models are of much higher accuracy than CODEGEN/INCODER. Besides accuracy, we also introduce the test case toxicity rate as a measurement of quality. We consider a test case to be “toxic” if any generated code solution can pass it while the canonical solution cannot. Toxic test cases may hinder the scoring of consensus sets and lead to the failure of CODET. As shown in Figure 4b, we can find that the toxicity rate highly correlates to the test case accuracy with respect to different models, where the proportions of toxic test cases for Codex models are smaller than CODEGEN/INCODER. We also evaluate the code coverage of generated test cases using two coverage criteria in Appendix H.2, where Codex models still outperform CODEGEN/INCODER with an average coverage of over $9 5 \%$ . Comparing the test case quality and the performance of CODET shown in Table 2, we can find that the quality of test cases strongly correlates to the performance gain using CODET concerning different models.
103
+
104
+ # Q2. Can better test cases further boost the performance of mediocre models?
105
+
106
+ From the above discussion with Figure 4, we can find that code-davinci-002 is the most capable model for generating high-quality test cases. Hence, we conduct an experiment to boost the performance of the other four models (code-cushman-001, code-davinci-001, INCODER, and CODEGEN) using test cases generated by code-davinci-002. Table 4 summarizes the performance gain with respect to different models on the HumanEval and MBPP benchmarks. In general, using the test cases generated by code-davinci-002 has significantly better performance than using the test cases generated by the less capable models themselves. For code-cushman-001 and code-davinci-001, the absolute improvements are in the range of $1 . 8 \%$ to $4 . 3 \%$ on pass $@ 1$ , while for INCODER and CODEGEN, the range is from $6 . 2 \%$ to $1 5 . { \bar { 9 } } \%$ . The above results indicate that the correct code solutions generated by mediocre models can be further exploited by adopting better test cases.
107
+
108
+ ![](images/1f31b545ce4f2642631e82e399d746203eb7f4a90e46354cc0c8419af48779c9.jpg)
109
+ Figure 5: Two real cases from the HumanEval benchmark with CODET and code-cushman-001.
110
+
111
+ Q3. How effective is CODET when there are fewer test cases?
112
+ Table 5: Pass $@ 1$ $( \% )$ on HumanEval using CODET and code-davinci-002 with different numbers of test cases. Sampling Number denotes the number of samples generated by model, and Limit denotes the test cases extracted per sample.
113
+
114
+ <table><tr><td rowspan="2">Limit</td><td colspan="4">Sampling Number</td></tr><tr><td>10</td><td>20</td><td>50</td><td>100</td></tr><tr><td>1</td><td>56.5</td><td>57.5</td><td>60.7</td><td>62.4</td></tr><tr><td>2</td><td>62.2</td><td>62.8</td><td>63.2</td><td>63.6</td></tr><tr><td>3</td><td>62.9</td><td>63.2</td><td>65.5</td><td>65.0</td></tr><tr><td>4</td><td>64.1</td><td>64.5</td><td>65.7</td><td>65.0</td></tr><tr><td>5</td><td>63.9</td><td>64.2</td><td>65.2</td><td>65.8</td></tr></table>
115
+
116
+ When generating test cases for the HumanEval benchmark, we sample 100 times for each problem and each sample may include multiple assertion statements (i.e., test cases), denoted as Sampling Number $= 1 0 0$ . Then we extract the first 5 syntactically correct test cases from each sample, denoted as $L i m i t = 5$ . This means each problem is equipped with 500 test cases at most. The actual numbers of extracted test cases are summarized in Appendix H.1. We perform an ablation study on the number of test cases by decreasing Sampling Number and Limit. As shown in Table 5, we can conclude that using more test cases in CODET could generally lead to better performance, while the performance gap narrows when Sampling Number $\geq 5 0$ and $L i m i t \ge 3$ . Moreover, CODET improves the pass $@ 1$ by $9 . 5 \%$ with only 10 test cases using code-davinci-002, suggesting the high test case efficiency. We can use a smaller Sampling Number in real-world application to balance the performance and computation cost. More results can be found in Appendix H.3.
117
+
118
+ # 4.4 CASE STUDY
119
+
120
+ In CODET, we design the dual execution agreement based on the idea that a good code solution can pass the most test cases and agree with the most solutions of the same functionality. We use “dual” because both the code solutions and the test cases are critical. Figure 5a shows a case from the HumanEval benchmark using code-cushman-001. The highest scoring consensus set has the correct functionality that returns true if all numbers in the list are below threshold $t$ , while the consensus set ranked 2 does not understand the boundary condition exactly. The solutions in the second consensus set can pass more test cases (i.e., 226) than that in the first consensus set (i.e., 218). However, considering both code solutions and test cases, CODET can successfully rank the consensus sets and find the correct solutions. Such cases are not rare, suggesting that our design of the dual execution agreement is reasonable. For further statistical demonstration, we conduct an ablation study to score the consensus set by considering only the number of code solutions or test cases. The results again support our claim, as detailed in Appendix I.
121
+
122
+ CODET is empowered by the pre-trained language models, but is also limited by them. Therefore, the second assumption made in Section 2.2 does not always hold, leading to error cases where the correct code solution is generated, but not in the top 1 consensus set. For CODET with codecushman-001 on the HumanEval benchmark, we find 53 out of 164 programming problems that belong to this situation. We manually investigated these problems and found that $2 0 \%$ of them can be blamed on issues such as ambiguous problem descriptions, uncovered corner cases, and lack of import statements, while the remaining problems are attributed to the failure of the model to understand the problem descriptions. Figure 5b shows an error case caused by ambiguity. The correct understanding of the description “sum(first index value, last index value)” is to add the first and last values, while the code solutions that sum all values from the first to the last are ranked top 1. More real cases can be found in Appendix J. And hope the error analysis can provide inspiration for future studies on improving code generation for more difficult programming problems.
123
+
124
+ # 5 RELATED WORK
125
+
126
+ Code Generation with Large Models Recently, a number of large pre-trained language models have been proposed for code generation. Benefiting from billions of trainable parameters and massive publicly available source code, models could achieve surprisingly good performance. For instance, AlphaCode (Li et al., 2022b) claimed to have outperformed half of the human competitors in real-world programming competitions, and Codex (Chen et al., 2021) is empowering Copilot to provide real-time coding suggestions. Other open-source code generation models include GPTNeo (Black et al., 2021), GPT-J (Wang & Komatsuzaki, 2021), CodeParrot (Tunstall et al., 2022), PolyCoder (Xu et al., 2022), CODEGEN (Nijkamp et al., 2022), and INCODER (Fried et al., 2022). In our study, we take advantage of the Codex inference API provided by OpenAI as well as the two competitive open-source models CODEGEN and INCODER to perform zero-shot code generation.
127
+
128
+ Automatic Test Case Generation Automated test case generation for programming problems can reduce the effort of writing test cases manually by developers. Early works including Randoop (Pacheco et al., 2007), EvoSuite (Fraser & Arcuri, 2011), MOSA (Panichella et al., 2015), DynaMOSA (Panichella et al., 2017), and MIO (Arcuri, 2017), were proposed to automatically generate test cases for statically typed programming languages like Java. The later proposed Pynguin (Lukasczyk & Fraser, 2022) could handle dynamically typed language like Python. Nevertheless, they are all search-based heuristics methods, which have limitations to the diversity and quantity of generated test cases. To combat these limitations, recently proposed approaches (Tufano et al., 2020; Li et al., 2022b) leveraged pre-trained language models like BART (Lewis et al., 2019) and T5 (Raffel et al., 2020) fine-tuned on labelled data for test case generation. Unlike previous works that require heuristic rules or model training, we directly sample test cases from powerful code generation models like Codex in the zero-shot setting with elaborate prompts.
129
+
130
+ Code Selection from Multiple Samples Despite large models have achieved great performance in code generation, the models need to sample many times to find the correct answer. Recently, several approaches were proposed to tackle this issue. In the domain of solving math word problems, Cobbe et al. (2021) chose the one with highest rank by a trained verifier, and Shen et al. (2021) proposed to jointly train the generator and ranker through a multi-task framework. In the domain of general purpose code generation, Inala et al. (2022) trained a fault-aware ranker. Moreover, some work has been proposed to leverage the execution information (Shi et al., 2022; Li et al., 2022b; Le et al., 2022; Lahiri et al., 2022). Unlike previous works that require model training or pre-existing test cases or user interactions, we let the large models generate test cases for themselves and automatically rank the solutions based on the test-driven dual execution agreement. The idea of ranking based on agreement also appears in the domain of reasoning (Wang et al., 2022; Li et al., 2022a).
131
+
132
+ # 6 CONCLUSION AND FUTURE WORK
133
+
134
+ In this paper, we propose a simple yet effective approach, called CODET, leveraging pre-trained language models to generate both the code solutions and the test cases. CODET executes the code solutions using the test cases and chooses the best solution based on the dual execution agreement. We demonstrate the dual agreement with both the test cases and other solutions is critical to the success of CODET, perform a thorough analysis on the quality of generated test cases and their impact on CODET, and study cases to provide more insights. Experimental results clearly demonstrate the superiority of CODET, improving the pass $@ 1$ numbers significantly on various benchmarks. While there remain challenges that CODET only works for executable code generation and it introduces extra computation cost for test case generation. In future work, we will explore the ways to tackle these challenges and improve CODET to solve more difficult programming problems.
135
+
136
+ # ACKNOWLEDGEMENT
137
+
138
+ We would like to thank Davis Mueller and Jade Huang for proofreading the paper and providing valuable comments. We also sincerely thank all the anonymous reviewers for their constructive feedback and insightful comments.
139
+
140
+ # REFERENCES
141
+
142
+ Andrea Arcuri. Many independent objective (MIO) algorithm for test suite generation. In International symposium on search based software engineering, pp. 3–17. Springer, 2017.
143
+
144
+ Jacob Austin, Augustus Odena, Maxwell Nye, Maarten Bosma, Henryk Michalewski, David Dohan, Ellen Jiang, Carrie Cai, Michael Terry, Quoc Le, et al. Program synthesis with large language models. arXiv preprint arXiv:2108.07732, 2021.
145
+
146
+ Sid Black, Leo Gao, Phil Wang, Connor Leahy, and Stella Biderman. GPT-Neo: Large scale autoregressive language modeling with mesh-tensorflow. 2021.
147
+
148
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
149
+
150
+ Mark Chen, Jerry Tworek, Heewoo Jun, Qiming Yuan, Henrique Ponde de Oliveira Pinto, Jared Kaplan, Harri Edwards, Yuri Burda, Nicholas Joseph, Greg Brockman, et al. Evaluating large language models trained on code. arXiv preprint arXiv:2107.03374, 2021.
151
+
152
+ Xinyun Chen, Chang Liu, and Dawn Song. Execution-guided neural program synthesis. In International Conference on Learning Representations, 2018.
153
+
154
+ Karl Cobbe, Vineet Kosaraju, Mohammad Bavarian, Jacob Hilton, Reiichiro Nakano, Christopher Hesse, and John Schulman. Training verifiers to solve math word problems. arXiv preprint arXiv:2110.14168, 2021.
155
+
156
+ Kevin Ellis, Maxwell Nye, Yewen Pu, Felix Sosa, Josh Tenenbaum, and Armando Solar-Lezama. Write, execute, assess: Program synthesis with a repl. Advances in Neural Information Processing Systems, 32, 2019.
157
+
158
+ Martin A Fischler and Robert C Bolles. Random sample consensus: a paradigm for model fitting with applications to image analysis and automated cartography. Communications of the ACM, 24 (6):381–395, 1981.
159
+
160
+ Gordon Fraser and Andrea Arcuri. EvoSuite: automatic test suite generation for object-oriented software. In Proceedings of the 19th ACM SIGSOFT symposium and the 13th European conference on Foundations of software engineering, pp. 416–419, 2011.
161
+
162
+ Daniel Fried, Armen Aghajanyan, Jessy Lin, Sida Wang, Eric Wallace, Freda Shi, Ruiqi Zhong, Wen-tau Yih, Luke Zettlemoyer, and Mike Lewis. Incoder: A generative model for code infilling and synthesis. arXiv preprint arXiv:2204.05999, 2022.
163
+
164
+ Dan Hendrycks, Steven Basart, Saurav Kadavath, Mantas Mazeika, Akul Arora, Ethan Guo, Collin Burns, Samir Puranik, Horace He, Dawn Song, et al. Measuring coding challenge competence with apps. arXiv preprint arXiv:2105.09938, 2021.
165
+
166
+ Jeevana Priya Inala, Chenglong Wang, Mei Yang, Andres Codas, Mark Encarnacion, Shuvendu K ´ Lahiri, Madanlal Musuvathi, and Jianfeng Gao. Fault-aware neural code rankers. arXiv preprint arXiv:2206.03865, 2022.
167
+
168
+ Shuvendu K. Lahiri, Aaditya Naik, Georgios Sakkas, Piali Choudhury, Curtis von Veh, Madanlal Musuvathi, Jeevana Priya Inala, Chenglong Wang, and Jianfeng Gao. Interactive code generation via test-driven user-intent formalization, 2022.
169
+
170
+ Hung Le, Yue Wang, Akhilesh Deepak Gotmare, Silvio Savarese, and Steven CH Hoi. CodeRL: Mastering code generation through pretrained models and deep reinforcement learning. arXiv preprint arXiv:2207.01780, 2022.
171
+ Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. Bart: Denoising sequence-to-sequence pretraining for natural language generation, translation, and comprehension. arXiv preprint arXiv:1910.13461, 2019.
172
+ Yifei Li, Zeqi Lin, Shizhuo Zhang, Qiang Fu, Bei Chen, Jian-Guang Lou, and Weizhu Chen. On the advance of making language models better reasoners. arXiv preprint arXiv:2206.02336, 2022a.
173
+ Yujia Li, David Choi, Junyoung Chung, Nate Kushman, Julian Schrittwieser, Remi Leblond, Tom ´ Eccles, James Keeling, Felix Gimeno, Agustin Dal Lago, et al. Competition-level code generation with alphacode. arXiv preprint arXiv:2203.07814, 2022b.
174
+ Stephan Lukasczyk and Gordon Fraser. Pynguin: Automated unit test generation for python. arXiv preprint arXiv:2202.05218, 2022.
175
+ Erik Nijkamp, Bo Pang, Hiroaki Hayashi, Lifu Tu, Huan Wang, Yingbo Zhou, Silvio Savarese, and Caiming Xiong. Codegen: An open large language model for code with multi-turn program synthesis. arXiv preprint arXiv:2203.13474, 2022.
176
+ Carlos Pacheco, Shuvendu K Lahiri, Michael D Ernst, and Thomas Ball. Feedback-directed random test generation. In 29th International Conference on Software Engineering (ICSE’07), pp. 75–84. IEEE, 2007.
177
+ Annibale Panichella, Fitsum Meshesha Kifetew, and Paolo Tonella. Reformulating branch coverage as a many-objective optimization problem. In 2015 IEEE 8th international conference on software testing, verification and validation (ICST), pp. 1–10. IEEE, 2015.
178
+ Annibale Panichella, Fitsum Meshesha Kifetew, and Paolo Tonella. Automated test case generation as a many-objective optimisation problem with dynamic selection of the targets. IEEE Transactions on Software Engineering, 44(2):122–158, 2017.
179
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, Peter J Liu, et al. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21(140):1–67, 2020.
180
+ Baptiste Roziere, Jie M Zhang, Francois Charton, Mark Harman, Gabriel Synnaeve, and Guillaume Lample. Leveraging automated unit tests for unsupervised code translation. arXiv preprint arXiv:2110.06773, 2021.
181
+ Jianhao Shen, Yichun Yin, Lin Li, Lifeng Shang, Xin Jiang, Ming Zhang, and Qun Liu. Generate & rank: A multi-task framework for math word problems. arXiv preprint arXiv:2109.03034, 2021.
182
+ Freda Shi, Daniel Fried, Marjan Ghazvininejad, Luke Zettlemoyer, and Sida I Wang. Natural language to code translation with execution. arXiv preprint arXiv:2204.11454, 2022.
183
+ Michele Tufano, Dawn Drain, Alexey Svyatkovskiy, Shao Kun Deng, and Neel Sundaresan. Unit test case generation with transformers and focal context. arXiv preprint arXiv:2009.05617, 2020.
184
+ Lewis Tunstall, Leandro von Werra, and Thomas Wolf. Natural language processing with transformers. ” O’Reilly Media, Inc.”, 2022.
185
+ Ben Wang and Aran Komatsuzaki. GPT-J-6B: A 6 Billion Parameter Autoregressive Language Model. https://github.com/kingoflolz/mesh-transformer-jax, May 2021.
186
+ Xuezhi Wang, Jason Wei, Dale Schuurmans, Quoc Le, Ed Chi, and Denny Zhou. Self-consistency improves chain of thought reasoning in language models. arXiv preprint arXiv:2203.11171, 2022.
187
+ Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Remi Louf, Morgan Funtowicz, and Jamie Brew. Huggingface’s transformers: State-of-the-art natural language processing. ArXiv, 2019.
188
+ Frank F Xu, Uri Alon, Graham Neubig, and Vincent Josua Hellendoorn. A systematic evaluation of large language models of code. In Deep Learning for Code Workshop, 2022.
189
+
190
+ Table 6: Pass $@ k$ $( \% )$ on the original HumanEval benchmark with Codex models. The numbers in orange indicate the absolute improvements of pass $@ k$ on the original benchmark over our modified benchmark in Table 2.
191
+
192
+ <table><tr><td>Methods</td><td colspan="3">Baseline</td><td colspan="3">CODET</td></tr><tr><td>k</td><td>1</td><td>10</td><td>100</td><td>1</td><td>2</td><td>10</td></tr><tr><td>code-cushman-001</td><td>31.7-1.8</td><td>56.4 2.1</td><td>84.1 6.7</td><td>58.6 14.1</td><td>65.7 15.6</td><td>80.1 14.4</td></tr><tr><td>code-davinci-001</td><td>34.8 -4.2</td><td>63.0 2.4</td><td>87.2 3.1</td><td>60.4 10.2</td><td>69.1 10.2</td><td>82.4 6.6</td></tr><tr><td>code-davinci-002</td><td>47.6 0.6</td><td>78.8 3.9</td><td>92.7 0.6</td><td>74.8 9.0</td><td>82.9 7.8</td><td>89.0 2.4</td></tr></table>
193
+
194
+ # A MORE IMPLEMENTATION DETAILS
195
+
196
+ We set the temperature to 0.8, the top $p$ to 0.95, the max generation length to 300, and the timeout of executing a test case to 0.1 seconds. Specially, for baseline pass $@ 1$ , we use the greedy search setting with temperature 0. The number of sampling test cases for each problem is set to 100 for the HumanEval and MBPP benchmarks, and 50 for the APPS and CodeContests benchmarks. When scoring consensus sets in CODET, we use the square root of $| S _ { x } |$ to reduce the impact caused by code solutions. A supporting experiment can be found in Appendix C. For code solution post-processing, we follow Chen et al. (2021) to truncate the generated content by five stop sequences: “\nclass”, “\ndef”, “\n#”, “\nif”, and “\nprint”. For the implementation of INCODER and CODEGEN, we use the HuggingFace transformers library (Wolf et al., 2019) and run both models with half precision. In addition, when the number of consensus sets in CODET is smaller than $k$ , the selection is done from the highest scoring consensus set to the lowest. When reaching the set with the lowest score, it repeats from the highest scoring consensus set. In most cases, the number of consensus sets is larger than $k$ , as shown in Figure 6.
197
+
198
+ # B RESULTS ON ORIGINAL HUMANEVAL
199
+
200
+ As mentioned in Section 3, for all benchmarks, we remove the example input-output cases from the original contexts to avoid exposing real test cases. To study the influence of such modification, we take HumanEval as an example and perform an additional experiment with its original contexts. The results are summarized in Table 6. On the one hand, the baseline pass $@ 1 0$ and pass $@ 1 0 0$ results on the original HumanEval benchmark outperform the modified version, which is reasonable because the example input-output cases may provide useful information for code generation. Nevertheless, the pass $@ 1$ results on the original benchmark are basically the same or even worse than the modified version, suggesting that the Codex models have not fully understood the semantics of the example input-output cases provided in the contexts. On the other hand, the performance of CODET is significantly improved using the original benchmark. This is as expected because the original contexts used for test case generation include real test cases, which could be borrowed by the models during the generation. Such real test cases will greatly empower CODET to distinguish correct code solutions. Hence, in our experiments, it is indispensable to remove the example input-output cases to avoid exposing the real test cases. In this way, the effectiveness of CODET can be fairly verified.
201
+
202
+ # C ANALYSIS ON CODE SOLUTIONS
203
+
204
+ In CODET, code solutions that can pass exactly the same test cases are considered consistent in functionality and are grouped into the same consensus set. Since we employ top $p$ sampling with a rather high temperature of 0.8, the functionality of the code solutions may vary significantly, which results in more consensus sets. We draw a histogram in Figure 6 to show the number of consensus sets produced by code-cushman-001 and CODET for each problem on the HumanEval benchmark. The average and median numbers are 26.8 and 25.5, respectively. We can find that most problems have less than 50 consensus sets, but the numbers have a high variance among different problems. We also draw the distribution of the numbers of code solutions for the top-ranked consensus sets in Figure 7. The consensus sets ranked top 1 tend to have more code solutions with an average value of 9.8, and the numbers also have a high variance.
205
+
206
+ ![](images/dc2268f95e88a612e28ee2a71dbd45c4b0e0ae5a6ed8790665545f9fed8d7277.jpg)
207
+ Figure 6: The numbers of consensus sets that are produced by code-cushman-001 and CODET on the HumanEval benchmark.
208
+
209
+ ![](images/f64ce847e6ac91bd753f16ee8db8df7b2b0e6ed2ea0f68755975c4f12499e6be.jpg)
210
+ Figure 7: The distribution of the code solution numbers for the top 5 consensus sets. The long tail distribution with number $\geq 2 0$ is truncated.
211
+
212
+ ![](images/fc6f3f208f1a6b3bdaf2b5b07dc673c1a80a171b44807a8c571b3a2aa4699318.jpg)
213
+ Figure 8: The CODET results of three Codex models with and without constraint on the number of code solutions.
214
+
215
+ ![](images/ccc96826c485f823120d9744c833f3ea10cda900a2a9a459841a713845d34161.jpg)
216
+ Figure 9: The baseline pass $@ 1 0 0$ and CODET pass $@ 1$ with code-cushman-001 at different temperature settings.
217
+
218
+ As mentioned in Appendix A, we use the square root of $| S _ { x } |$ to reduce the impact caused by code solutions, because we believe passing more test cases is more important than having more code solutions with the same functionality. For example, there may be one code solution that can pass five test cases, whereas another five code solutions in a consensus set can pass only one test case. We intuitively consider that the former may be more likely correct. For validation, we perform an experiment by comparing the performance of CODET with the “sqrt”, “log” functions, and without any constraint (i.e., “linear”) on the number of code solutions. Figure 8 shows the results of three Codex models on the HumanEval benchmark. We can find that reducing the importance of code solutions can consistently improve the performance of CODET. Similar observations have been found in other models and benchmarks, where the performance of employing “sqrt” is always better than or competitive to “linear”, indicating the rationality of our design.
219
+
220
+ # D INFLUENCE OF DE-DUPLICATION
221
+
222
+ Since we sample multiple times during generation, there is the chance that many of the generated code solutions and test cases are exactly the same. On the one hand, the number of duplicates may indicate the importance of a sample. On the other hand, duplicates may hinder the scoring of consensus sets in CODET when the quality of generation is unsatisfactory. Hence, we perform an ablation study to investigate the effects of removing duplicate code solutions and test cases. Specifically, we first format the generated Python code to conform to the PEP 8 style guide3, and then remove duplicate code solutions and test cases before performing CODET. The de-duplication results on the HumanEval and MBPP benchmarks using CODET and code-cushman-001 are shown in Table 7, where we can choose to de-duplicate the code solutions, or the test cases, or both. We can find that de-duplication has slight and inconsistent influence on the performance of CODET. For the HumanEval benchmark, the pass $@ 1$ results using code solution de-duplication alone are better than other settings. Nonetheless, for the MBPP benchmark, the best pass $@ 1$ results are achieved without de-duplication. Therefore, in our main experiments, we reserve all the generated code solutions and test cases when performing CODET and leave the study of more advanced de-duplication methods for future work.
223
+
224
+ Table $\tilde { \mathbf { \Lambda } } : \operatorname* { P a s s } \textcircled { a } k$ $( \% )$ on the HumanEval and MBPP benchmarks using CODET and code-cushman001 with different de-duplication settings. The setting “No No” in the first line means that neither the code solutions nor the test cases are de-duplicated, which is used in our main experiments.
225
+
226
+ <table><tr><td colspan="2">De-duplication</td><td colspan="3">HumanEval</td><td colspan="3">MBPP</td></tr><tr><td>Solution</td><td>Test</td><td>1</td><td>2</td><td>10</td><td>1</td><td>2</td><td>10</td></tr><tr><td>No</td><td>No</td><td>44.5</td><td>50.1</td><td>65.7</td><td>55.4</td><td>61.7</td><td>72.7</td></tr><tr><td>No</td><td>Yes</td><td>42.2</td><td>48.8</td><td>66.7</td><td>54.5</td><td>62.3</td><td>73.4</td></tr><tr><td>Yes</td><td>No</td><td>46.9</td><td>52.5</td><td>65.6</td><td>54.7</td><td>61.7</td><td>73.2</td></tr><tr><td>Yes</td><td>Yes</td><td>42.7</td><td>51.2</td><td>66.4</td><td>54.7</td><td>62.1</td><td>73.2</td></tr></table>
227
+
228
+ Table 8: $\mathrm { P a s s } @ k$ $( \% )$ results on the zero-shot APPS and CodeContests benchmarks using codedavinci-002 and CODET with/without the trivial code solutions filtered. The numbers in red indicate the absolute improvements after filtering the trivial solutions.
229
+
230
+ <table><tr><td colspan="2">Methods</td><td colspan="3">CODET</td><td colspan="3">CODET(Remove Trivial)</td></tr><tr><td colspan="2">k</td><td>1</td><td>10</td><td>100</td><td>1</td><td>10</td><td>100</td></tr><tr><td rowspan="3">APPS</td><td>INTRODUCTORY</td><td>34.6</td><td>53.2</td><td>1</td><td>34.9 0.3</td><td> 53.4 0.2</td><td>=</td></tr><tr><td>INTERVIEW</td><td>8.1</td><td>18.1</td><td>=</td><td>8.3 0.2</td><td>18.2 0.1</td><td>1</td></tr><tr><td>COMPETITION</td><td>2.2</td><td>8.6</td><td>1</td><td>2.5 0.3</td><td>8.7 0.1</td><td>=</td></tr><tr><td colspan="2">CodeContests</td><td>2.1</td><td> 5.3</td><td>9.9</td><td> 2.7 0.6</td><td>5.3 0.0</td><td>10.0 0.1</td></tr></table>
231
+
232
+ # E SENSITIVITY TO THE TEMPERATURE
233
+
234
+ The hyper-parameter temperature has a great impact on the quality of generated code solutions and test cases when using top $p$ sampling. We use a high temperature of 0.8 in our main experiments since CODET could benefit from a larger number of diverse samples. To investigate the sensitivity of CODET to the temperature, we perform an ablation study by using a range of temperatures to report the results of baseline pass $@ 1 0 0$ and CODET pass $@ 1$ . Figure 9 shows the results of codecushman-001 on the HumanEval benchmark at different temperature settings. We can find that a higher temperature does improve the baseline pass $@ 1 0 0$ and CODET pass $@ 1$ , and CODET achieves a good performance when temperature is set to 0.8.
235
+
236
+ # F REMOVING TRIVIAL CODE SOLUTIONS
237
+
238
+ The problems in the APPS COMPETITION and CodeContests benchmarks are of great difficulty compared to HumanEval and MBPP, leading to the poor performance of the most capable codedavinci-002 model. After checking the incorrect code solutions generated by code-davinci-002, we identify many trivial solutions that just return the input argument or a constant value. Such solutions may hinder the ranking process of CODET if they can pass any generated test case. A trivial solution can be easily identified by its input arguments and returned values. If a solution always returns the same output value for different inputs, or its returned values are always the same as the inputs, it must be a trivial solution. To investigate the impact of trivial code solutions, we use code-davinci002 on the zero-shot APPS and CodeContests benchmarks, and perform CODET after filtering out all the trivial solutions. As a result, we can remove an average of 4.5 (91.6) trivial solutions from the $5 0 \ ( 1 , 0 0 0 )$ generated solutions per problem for the APPS (CodeContests) benchmark. However, as shown in Table 8, after removing a prominent percentage of trivial solutions, there is little performance gain, which could exactly demonstrate the robustness of CODET.
239
+
240
+ Table 9: Pass $@ k$ $( \% )$ results on the APPS and CodeContests benchmarks using code-davinci-002 and the one-shot setting. The numbers in red indicate the absolute improvements of CODET (Filter) over Baseline (Filter) on pass $@ 1$ , pass $@ 1 0$ and pass $@ 1 0 0$ . For CODET (Filter), temperature is set to 0.8 and sampling number is set to 50 for APPS and 1, 000 for CodeContests. We do not report pass $@ 1 0 0 0$ for “Baseline Filter” because the numbers of code solutions after filtering are less than the sampling numbers.
241
+
242
+ <table><tr><td colspan="2">k</td><td>1</td><td>10</td><td>50</td><td>100</td><td>1000</td><td>1</td><td>2</td><td>10</td><td>100</td></tr><tr><td rowspan="5"></td><td colspan="5"></td><td colspan="5"></td></tr><tr><td>INTRODUCTORY</td><td>29.3</td><td>48.5</td><td>60.9</td><td></td><td></td><td> 47.3 18.0</td><td>52.7</td><td> 58.4 9.9</td><td></td></tr><tr><td>INTERVIEW</td><td>6.4</td><td>14.6</td><td>25.4</td><td></td><td></td><td>14.3 7.9</td><td>18.2</td><td>23.3 8.7</td><td></td></tr><tr><td>COMPETITION</td><td>2.5</td><td>6.3</td><td>14.5</td><td></td><td></td><td>6.2 3.7</td><td>9.8</td><td>13.6 7.3</td><td></td></tr><tr><td colspan="2">CodeContests</td><td>1.0</td><td>4.1 7.1</td><td>8.8</td><td>15.2</td><td> 3.2 2.2</td><td>5.6</td><td>9.3 5.2</td><td>12.3 3.5</td></tr><tr><td rowspan="5">APPS</td><td colspan="5"></td><td colspan="5">CODET Filter</td></tr><tr><td>INTRODUCTORY</td><td>43.6</td><td>58.6</td><td></td><td></td><td></td><td>49.6 6.0</td><td>54.3</td><td> 59.4 0.8</td><td></td></tr><tr><td>INTERVIEW</td><td>13.3</td><td>22.8</td><td></td><td></td><td></td><td>16.1 2.8</td><td>19.5</td><td>24.0 1.2</td><td></td></tr><tr><td>COMPETITION</td><td>7.0</td><td>13.3</td><td></td><td></td><td></td><td>7.9 0.9</td><td>10.5</td><td>14.1 0.8</td><td></td></tr><tr><td>CodeContests</td><td>9.9</td><td>14.5</td><td>15.1</td><td>15.2</td><td></td><td>9.6 -0.3</td><td>11.5</td><td>13.7 -0.8</td><td>14.5 -0.7</td></tr></table>
243
+
244
+ # G RESULTS ON APPS AND CODECONTESTS IN THE ONE-SHOT SETTING
245
+
246
+ Inspired by Chen et al. (2021) and Li et al. (2022b), we build one-shot versions of APPS and CodeContests by appending a single input-output example to the problem description as a formatting hint. After generation, we filter out the generated solutions that cannot pass the given example input-output cases, which we call the “Baseline Filter” method. After filtering, we can still perform CODET using the rest of code solutions, called the “CODET Filter” method. Following the zeroshot experiments on APPS and CodeContests, we employ code-davinci-002 for generation and set the sampling number to 50 for APPS and 1, 000 for CodeContests.
247
+
248
+ We summarize the experimental results in Table 9, where we can find the one-shot performance using CODET is much better than that reported in Table 3 in the zero-shot setting. The performance of the baselines can be significantly improved by filtering the solutions with the given example test cases. Moreover, “CODET Filter” can further outperform “Baseline Filter” on the APPS benchmark, especially for the introductory and interview problems. Nonetheless, for CodeContests and the competition level problems in APPS, “CODET Filter” has little performance improvement or even performs slightly worse than “Baseline Filter”. After manual investigation, we blame such issue to the generated low-quality test cases, which hinder the scoring of consensus sets. This suggests the interest of future study on test case generation for more challenging programming problems.
249
+
250
+ # H MORE ANALYSIS ON TEST CASES
251
+
252
+ # H.1 STATISTICS ON TEST CASES
253
+
254
+ How many valid test cases do the models generate for CODET? Taking the HumanEval benchmark as an example, we sample 100 times for each problem when generating test cases. As illustrated in Figure 2, at each time of sampling, we feed the context $c$ along with an instruction $p$ to the model and get the generated content that may contain multiple test cases. Then, as mentioned in Section 4.3, we further post-process the generated samples to get individual test cases that are syntactically correct. Finally, we only keep the first five valid test cases for each sample, which means a problem can be equipped with 500 test cases at most. Table 10 summarizes the average and median numbers of the extracted test cases for each problem. We can find that almost all the models could generate a considerable number of syntactically correct test cases, while CODEGEN generates plenty of unexpected noise.
255
+
256
+ Table 10: The numbers of extracted test cases for each problem generated by five models on the HumanEval benchmark.
257
+
258
+ <table><tr><td rowspan="2">Methods</td><td colspan="2">Test Case Number</td></tr><tr><td>Average</td><td>Median</td></tr><tr><td>code-cushman-001</td><td>410.7</td><td>429.0</td></tr><tr><td>code-davinci-001</td><td>381.9</td><td>388.0</td></tr><tr><td>code-davinci-002</td><td>391.1</td><td>402.0</td></tr><tr><td>INCODER</td><td>390.1</td><td>400.0</td></tr><tr><td>CODEGEN</td><td>55.6</td><td>42.0</td></tr></table>
259
+
260
+ <table><tr><td rowspan="2">Methods</td><td colspan="2">Code Coverage</td></tr><tr><td>Statement</td><td>Branch</td></tr><tr><td>code-cushman-001</td><td>95.3</td><td>98.1</td></tr><tr><td>code-davinci-001</td><td>94.9</td><td>97.6</td></tr><tr><td>code-davinci-002</td><td>95.7</td><td>98.5</td></tr><tr><td>INCODER</td><td>94.0</td><td>96.3</td></tr><tr><td>CODEGEN</td><td>78.2</td><td>78.6</td></tr></table>
261
+
262
+ Table 11: The Code Coverage $( \% )$ statistics of test cases generated by five models on the HumanEval benchmark.
263
+
264
+ <table><tr><td rowspan="2">Limit</td><td colspan="4">Sampling Number</td><td rowspan="2">Limit</td><td colspan="4">Sampling Number</td><td rowspan="2">Limit</td><td colspan="4">Sampling Number</td></tr><tr><td>10</td><td>20</td><td>50</td><td>100</td><td>10</td><td>20</td><td>50</td><td>100</td><td>10</td><td>20</td><td>50</td><td>100</td></tr><tr><td></td><td colspan="4"> code-cushman-001</td><td colspan="4"> code-cushman-001</td><td></td><td colspan="4">code-cushman-001</td></tr><tr><td>1</td><td>37.8</td><td>40.0</td><td>40.8</td><td>38.7</td><td>1</td><td>43.3</td><td>48.1</td><td>48.2</td><td>49.1</td><td>1</td><td>55.1</td><td>56.6</td><td>61.9</td><td>62.9</td></tr><tr><td>2</td><td>42.1</td><td>41.8</td><td>43.4</td><td>41.8</td><td></td><td>48.1</td><td>48.1</td><td>49.5</td><td>49.8</td><td>2</td><td>58.7</td><td>61.4</td><td>64.5</td><td>65.8</td></tr><tr><td>3</td><td>41.6</td><td>41.9</td><td>43.8</td><td>42.5</td><td>123</td><td>49.0</td><td>47.7</td><td>48.7</td><td>48.7</td><td>3</td><td>60.9</td><td>62.5</td><td>63.4</td><td>65.3</td></tr><tr><td>4</td><td>41.2</td><td>41.2</td><td>43.8</td><td>43.3</td><td>4</td><td>49.2</td><td>47.9</td><td>49.4</td><td>49.1</td><td>4</td><td>61.4</td><td>63.3</td><td>63.3</td><td>65.8</td></tr><tr><td>5</td><td>41.0</td><td>41.9</td><td>45.4</td><td>44.5</td><td>5</td><td>48.3</td><td>48.5</td><td>48.9</td><td>50.1</td><td>5</td><td>63.1</td><td>62.6</td><td>63.8</td><td>65.7</td></tr><tr><td></td><td colspan="4"> code-davinci-002</td><td colspan="4"> code-davinci-002</td><td></td><td colspan="4"> code-davinci-002</td><td></td></tr><tr><td>1</td><td>56.5</td><td>57.5</td><td>60.7</td><td>62.4</td><td></td><td>65.1</td><td>67.8</td><td>71.9</td><td>71.5</td><td>1</td><td>77.9</td><td>79.6</td><td>82.8</td><td>84.3</td></tr><tr><td></td><td>62.2</td><td>62.8</td><td>63.2</td><td>63.6</td><td></td><td>71.7</td><td>73.2</td><td>74.2</td><td>74.1</td><td>2</td><td>80.8</td><td>81.8</td><td>84.3</td><td>86.5</td></tr><tr><td>23</td><td>62.9</td><td>63.2</td><td>65.5</td><td>65.0</td><td>123</td><td>73.2</td><td>73.5</td><td>75.1</td><td>75.0</td><td>3</td><td>82.3</td><td>83.2</td><td>85.5</td><td>87.1</td></tr><tr><td>4</td><td>64.1</td><td>64.5</td><td>65.7</td><td>65.0</td><td>4</td><td>73.3</td><td>74.1</td><td>75.5</td><td>74.3</td><td>4</td><td>82.9</td><td>84.4</td><td>85.4</td><td>86.9</td></tr><tr><td>5</td><td>63.9</td><td>64.2</td><td>65.2</td><td>65.8</td><td>5</td><td>73.5</td><td>74.3</td><td>74.5</td><td>75.1</td><td>5</td><td>83.8</td><td>84.1</td><td>85.2</td><td>86.6</td></tr><tr><td colspan="5">(a) pass@1</td><td colspan="4">(b) pass@2</td><td></td><td colspan="4">(c) pass@10</td></tr></table>
265
+
266
+ Table 12: $\mathrm { P a s s } @ k ( \% )$ on the HumanEval benchmark using CODET with different test case numbers. Sampling Number is the number of test case samples we generate for each problem. Each sample may contain multiple assertion statements. These assertion statements are potential test cases, but we do not use all of them. Instead, we extract a Limit number of syntactically correct assertion statements from each sample, and discard the rest.
267
+
268
+ # H.2 CODE COVERAGE OF TEST CASES
269
+
270
+ To further inspect the quality of generated test cases, we utilize the code coverage measurement and report two coverage criteria — the statement coverage and the branch coverage. The statement coverage can be calculated as the percentage of statements in a code solution that are executed by test cases. The branch coverage is the percentage of executed branches for the control structure (e.g. the if statement). We execute the canonical solution for each HumanEval problem on the test cases generated by five models, then collect the coverage results using Coverage.py4. As a result, the average numbers of statements and branches in the canonical solution of a problem are 6.30 and 4.42, respectively. As shown in Table 11, all the models except CODEGEN have good performance on both statement and branch coverage, reaching an average of over $9 4 \%$ coverage. Such results may be attributed to the relatively short canonical solutions and the massive sampling number of test cases. Nevertheless, there are still corner cases that the models cannot cover, which calls for future improvements.
271
+
272
+ # H.3 RESULTS OF REDUCING THE NUMBER OF TEST CASES
273
+
274
+ To investigate the performance of CODET using fewer test cases, we perform an ablation study on the number of test cases that participate in the dual execution agreement. As shown in Table 12, we report the results on the HumanEval benchmark using code-cushman-001 and code-davinci-002 with a range of test case numbers. The number of test cases is related to two hyper-parameters. One is the number of test case samples, which is set to 100 for HumanEval in our main experiments. The other one is Limit that controls the amount of syntactically correct test cases we extract from each sample, which is set to 5 for all benchmarks in our main experiments. Note that Limit multiplied by the Sampling Number is the maximum number of test cases for a problem, not the exact number, because not every sample contains the Limit number of valid test cases. A valid test case (i.e., assertion statement) should start with “assert” and contain the name of the corresponding entry point function. We can conclude from the results that using more test cases in CODET could generally lead to better performance. While the performance gap narrows when Limit $\geq 3$ and the sampling number $\geq 5 0$ . Moreover, using only 10 test cases per problem for CODET can still improve the baseline pass $@ 1$ performance of code-cushman-001 by absolute $4 . 3 \%$ and code-davinci-002 by absolute ${ \bar { 9 } } . 5 \%$ . It demonstrates that CODET has high test case efficiency and we can use a smaller Sampling Number in real-world application to balance the performance and computation cost.
275
+
276
+ Table 13: Pass $@ k$ $( \% )$ on the HumanEval benchmark with ranking only on the number of code solutions $( f ^ { \prime } ( S ) = | S _ { x } | )$ or test cases $( f ^ { \prime \prime } ( S ) = | S _ { y } | )$ in a consensus set. The numbers in red and green indicate the absolute improvements over baseline and CODET, respectively.
277
+
278
+ <table><tr><td>Methods</td><td colspan="3">Code Solution Only f&#x27;</td><td colspan="3">Test Case Only f&quot;</td></tr><tr><td>k</td><td>1</td><td>2</td><td>10</td><td>1</td><td>2</td><td>10</td></tr><tr><td>code-cushman-001</td><td>41.2 -3.3</td><td>-0.9 49.2</td><td>61.9 -3.8 +7.6</td><td>29.9 -14.6 -3.6</td><td>36.6-13.5</td><td>59.5+.2 -6.2</td></tr><tr><td>code-davinci-001</td><td>2+5. 44.4+5.4</td><td>54.7 -4.2</td><td>69.0 6.8 +8.4</td><td>35.0 15.2 -4.0</td><td>46.0 -12.9</td><td>70.2+96 5.6</td></tr><tr><td>code-davinci-002</td><td>55.9+8.9 -9:9</td><td>67.0 -8.1</td><td>82.7 3.9 7+7.8</td><td>58.4711.4</td><td>65.1-10.0</td><td>86.1 .5 +11.2</td></tr></table>
279
+
280
+ # I ABLATION STUDY ON THE SCORE OF CONSENSUS SET
281
+
282
+ In CODET, the score of a consensus set is calculated as $f ( S ) = | S _ { x } | | S _ { y } |$ , where $S _ { x }$ and $\mathcal { S } _ { y }$ are the code solutions and test cases in the consensus set, respectively. We can naturally derive two variants of scoring. One is $f ^ { \prime } ( S ) = | S _ { x } |$ , in line with the idea of self-consistency (Wang et al., 2022), which only considers the number of code solutions with the same functionality. The other one is $f ^ { \prime \prime } ( S ) = | \mathcal { S } _ { y } |$ , which corresponds to simply counting the test cases that each code solution can pass. To evaluate the performance of these two variants, we perform an ablation study on the HumanEval benchmark using three Codex models. The experimental results are summarized in Table 13, from which we can observe that only considering the number of code solutions or test cases for consensus set scoring performs consistently worse than CODET, and even worse than the baseline. Therefore, it is essential to consider the importance of both code solutions and test cases, suggesting the reasonable design of our dual execution agreement.
283
+
284
+ As mentioned in Section 3, AlphaCode (Li et al., 2022b) also includes a clustering method (denoted as AlphaCode-C) to select the generated code solutions, which shares a similar goal with our ablation method $f ^ { \prime }$ : clustering code solutions based on code functionality, and then scoring each cluster by size. AlphaCode-C requires a number of additional test inputs to produce outputs from code solutions, which are then used to determine the functional equivalence. AlphaCode-C relies on a separate test input generation model, which needs extra training and annotation. The model is unavailable and hard to replicate, as the paper does not provide sufficient details. We replicate AlphaCode-C by extracting test inputs from the test cases generated by CODET. We run all code solutions on the test inputs, and group them by outputs. The clusters are ranked by size and then we select the code solutions from each cluster in order. From Table 2 and Table 13, we can find that AlphaCode-C is inferior to $f ^ { \prime }$ , though they share the similar idea. The reason is that AlphaCode-C will group the trivial code solutions (e.g., solutions that always output “None”, “0“, or an empty string with whatever inputs) together, leading to a large cluster of incorrect solutions that significantly affects performance. While such trivial code solutions are hard to pass the generated test cases in CODET, thus having lower consensus scores for ranking. This confirms the effectiveness of considering test case information.
285
+
286
+ ![](images/6114169d71bfc54ab1032896ef70d8a5cde29ca3a07bdc8e44d3872c8bbed77a.jpg)
287
+ Figure 10: Two cases from the HumanEval benchmark, where CODET can find the correct consensus sets though they have (a) fewer code solutions, or (b) fewer test cases.
288
+
289
+ # J MORE EXAMPLES FOR CASE STUDY
290
+
291
+ Figure 10 illustrates two cases that CODET can successfully find the correct consensus sets. Specifically, the case in Figure 10a requires to remove the vowels in the input text. There are 41 incorrect solutions and 147 test cases in the consensus set ranked 2, which forget to remove the upper-case vowels. Though the correct solutions in the top 1 consensus set are fewer (i.e., 31), they can pass more test cases (i.e., 170) and thus have a higher score. The case in Figure 10b is to decide when the balance of account will fall below zero. The functionality of the incorrect solutions in the second consensus set is to tell whether there are withdrawing operations. Nevertheless, the incorrect solutions can pass more test cases (i.e., 255) than the correct solutions (i.e., 248) in the top 1 consensus set. Fortunately, there are 79 correct solutions and only 6 incorrect solutions, making it possible for CODET to rank the correct consensus ahead. Both cases demonstrate the plausibility of using the dual execution agreement instead of solely considering the functional agreement between code solutions or the number of passed test cases.
292
+
293
+ Figure 11 illustrates the cases that CODET fails to find the correct consensus sets. Specifically, Figure 11a demonstrates the situation that there are partially correct solutions that may fail at certain corner cases. In the example, there are 20 incorrect solutions in the top 1 consensus set that can pass 205 test cases, which will fail if the input is a string of length 1. The correct consensus set ranked 3 has more test cases (i.e., 222), while it has a lower consensus score due to the small number of code solutions (i.e., 9). The second example in Figure 11b shows the most common situation where CODET fails because the model cannot fully understand the problem. We can find that the incorrect solutions in the top 1 consensus set are totally missing the points of the given problem. While the model still tends to generate more incorrect solutions and test cases based on its wrong understanding. All the bad cases call for future improvements on the quality of generated code solutions and test cases.
294
+
295
+ ![](images/8909d6a89f97d190ccb4bcee545b6b6ddb9bfcee64f3849561eaa6d211402960.jpg)
296
+ Figure 11: Two incorrect cases from the HumanEval benchmark, where CODET cannot find the correct consensus sets due to (a) uncovered corner cases, or (b) failure of problem understanding.
md/dev/pd1P2eUBVfq/pd1P2eUBVfq.md ADDED
@@ -0,0 +1,711 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIFFUSION MODELS ALREADY HAVE A SEMANTIC LATENT SPACE
2
+
3
+ Mingi Kwon, Jaeseok Jeong, Youngjung Uh∗
4
+
5
+ Department of Artificial Intelligence
6
+ Yonsei University
7
+ Seoul, Republic of Korea
8
+ {kwonmingi,jete jeong,yj.uh}@yonsei.ac.kr
9
+
10
+ # ABSTRACT
11
+
12
+ Diffusion models achieve outstanding generative performance in various domains. Despite their great success, they lack semantic latent space which is essential for controlling the generative process. To address the problem, we propose asymmetric reverse process (Asyrp) which discovers the semantic latent space in frozen pretrained diffusion models. Our semantic latent space, named $h$ -space, has nice properties to accommodate semantic image manipulation: homogeneity, linearity, robustness, and consistency across timesteps. In addition, we introduce a principled design of the generative process for versatile editing and quality boosting by quantifiable measures: editing strength of an interval and quality deficiency at a timestep. Our method is applicable to various architectures $\mathrm { ( D D P M + + }$ , iDDPM, and ADM) and datasets (CelebA-HQ, AFHQ-dog, LSUN-church, LSUNbedroom, and METFACES). Project page: https://kwonminki.github.io/Asyrp/
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ In image synthesis, diffusion models have advanced to achieve state-of-the-art performance regarding quality and mode coverage since the introduction of denoising diffusion probabilistic models (Ho et al., 2020). They disrupt images by adding noise through multiple steps of forward process and generate samples by progressive denoising through multiple steps of reverse (i.e., generative) process. Since their deterministic version provides nearly perfect reconstruction of original images (Song et al., 2020a), they are suitable for image editing, which renders target attributes on the real images. However, simply editing the latent variables (i.e., intermediate noisy images) causes degraded results (Kim & Ye, 2021). Instead, they require complicated procedures: providing guidance in the reverse process or finetuning models for an attribute.
17
+
18
+ Figure 1(a-c) briefly illustrates the existing approaches. Image guidance mixes the latent variables of the guiding image with unconditional latent variables (Choi et al., 2021; Lugmayr et al., 2022; Meng et al., 2021). Though it provides some control, it is ambiguous to specify which attribute to reflect among the ones in the guide and the unconditional result, and it lacks intuitive control for the magnitude of change. Classifier guidance manipulates images by imposing gradients of a classifier on the latent variables in the reverse process to match the target class (Dhariwal & Nichol, 2021; Avrahami et al., 2022; Liu et al., 2021). It requires training an extra classifier for the latent variables, i.e., noisy images. Furthermore, computing gradients through the classifier during sampling is costly. Finetuning the whole model can steer the resulting images to the target attribute without the above problems (Kim & Ye, 2021). Still, it requires multiple models to reflect multiple descriptions.
19
+
20
+ On the other hand, generative adversarial networks (Goodfellow et al., 2020) inherently provide straightforward image editing in their latent space. Given a latent vector for an original image, we can find the direction in the latent space that maximizes the similarity of the resulting image with a target description in CLIP embedding (Patashnik et al., 2021). The latent direction found on one image leads to the same manipulation of other images. However, given a real image, finding its exact latent vector is often challenging and produces unexpected appearance changes.
21
+
22
+ ![](images/80648f78ecfc7ad5b9897cecadcaf4711f94bdafc585f1c639190f153bb4ad3d.jpg)
23
+ Figure 1: Manipulation approaches for diffusion models. (a) Image guidance suffers ambiguity while controlling the generative process. (b) Classifier guidance requires an extra classifier, is hardly editable, degrades quality, or alters the content. (c) DiffusionCLIP requires fine-tuning the whole model. (d) Our method discovers a semantic latent space of a frozen diffusion model.
24
+
25
+ It would allow admirable image editing if the diffusion models with the nearly perfect inversion property have such a semantic latent space. Preechakul et al. (2022) introduces an additional input to the reverse diffusion process: a latent vector from an original image embedded by an extra encoder. This latent vector contains the semantics to condition the process. However, it requires training from scratch and does not match with pretrained diffusion models.
26
+
27
+ In this paper, we propose an asymmetric reverse process (Asyrp) which discovers the semantic latent space of a frozen diffusion model such that modifications in the space edits attributes of the original images. Our semantic latent space, named $h$ -space, has the properties necessary for editing applications as follows. The same shift in this space results in the same attribute change in all images. Linear changes in this space lead to linear changes in attributes. The changes do not degrade the quality of the resulting images. The changes throughout the timesteps are almost identical to each other for a desired attribute change. Figure 1(d) illustrates some of these properties and $\ S 5 . 3$ provides detailed analyses. To the best of our knowledge, it is the first attempt to discover the semantic latent space in the frozen pretrained diffusion models. Spoiler alert: our semantic latent space is different from the intermediate latent variables in the diffusion process. Moreover, we introduce a principled design of the generative process for versatile editing and quality boosting by quantifiable measures: editing strength of an interval and quality deficiency at a timestep. Extensive experiments demonstrate that our method is generally applicable to various architectures $\mathrm { ( D D P M + + }$ , iDDPM, and ADM) and datasets (CelebA-HQ, AFHQ-dog, LSUN-church, LSUN-bedroom, and METFACES).
28
+
29
+ # 2 BACKGROUND
30
+
31
+ We briefly describe essential backgrounds. The rest of the related work is deferred to Appendix A.
32
+
33
+ # 2.1 DENOISING DIFFUSION PROBABILITY MODEL (DDPM)
34
+
35
+ DDPM is a latent variable model that learns a data distribution by denoising noisy images (Ho et al., 2020). The forward process diffuses the data samples through Gaussian transitions parameterized with a Markov process:
36
+
37
+ $$
38
+ q \left( \pmb { x } _ { t } \mid \pmb { \dot { x } } _ { t - 1 } \right) = \mathcal { N } \left( \pmb { x } _ { t } ; \sqrt { 1 - \beta _ { t } } \pmb { x } _ { t - 1 } , \beta _ { t } \mathbf { I } \right) = \mathcal { N } \left( \sqrt { \frac { \alpha _ { t } } { \alpha _ { t - 1 } } } \pmb { x } _ { t - 1 } , \left( 1 - \frac { \alpha _ { t } } { \alpha _ { t - 1 } } \right) \pmb { I } \right) ,
39
+ $$
40
+
41
+ where $\{ \beta _ { t } \} _ { t = 1 } ^ { T }$ is the variance schedule and $\begin{array} { r } { \alpha _ { t } = \prod _ { s = 1 } ^ { t } ( 1 - \beta _ { s } ) } \end{array}$ . Then the reverse process becomes $\begin{array} { r } { p _ { \theta } \left( \pmb { x } _ { 0 : T } \right) : = p \left( \pmb { x } _ { T } \right) \prod _ { t = 1 } ^ { T } p _ { \theta } \left( \pmb { x } _ { t - 1 } \mid \pmb { x } _ { t } \right) } \end{array}$ , starting from $\mathbf { \boldsymbol { x } } _ { T } \sim \mathcal { N } ( 0 , \mathbf { I } )$ with noise predictor $\epsilon _ { t } ^ { \theta }$ :
42
+
43
+ $$
44
+ { \pmb x } _ { t - 1 } = \frac { 1 } { \sqrt { 1 - \beta _ { t } } } \left( { \pmb x } _ { t } - \frac { \beta _ { t } } { \sqrt { 1 - \alpha _ { t } } } { \pmb \epsilon } _ { t } ^ { \theta } \left( { \pmb x } _ { t } \right) \right) + \sigma _ { t } { \pmb z } _ { t } ,
45
+ $$
46
+
47
+ where $\boldsymbol { z } _ { t } \sim \mathcal { N } ( 0 , \mathbf { I } )$ and $\sigma _ { t } ^ { 2 }$ is a variance of the reverse process which is set to $\sigma _ { t } ^ { 2 } = \beta _ { t }$ by DDPM.
48
+
49
+ # 2.2 DENOISING DIFFUSION IMPLICIT MODEL (DDIM)
50
+
51
+ DDIM redefines Eq. (1) as $\begin{array} { r } { q _ { \sigma } ( \pmb { x } _ { t - 1 } | \pmb { x } _ { t } , \pmb { x } _ { 0 } ) = \mathcal { N } ( \sqrt { \alpha _ { t - 1 } } \pmb { x } _ { 0 } + \sqrt { 1 - \alpha _ { t - 1 } - \sigma _ { t } ^ { 2 } } \cdot \frac { \pmb { x } _ { t } - \sqrt { \alpha _ { t } } \pmb { x } _ { 0 } } { \sqrt { 1 - \alpha _ { t } } } , \sigma _ { t } ^ { 2 } I ) } \end{array}$ which is a non-Markovian process (Song et al., 2020a). Accordingly, the reverse process becomes
52
+
53
+ $$
54
+ \begin{array} { r } { x _ { t - 1 } = \sqrt { \alpha _ { t - 1 } } \underbrace { \left( \frac { x _ { t } - \sqrt { 1 - \alpha _ { t } } \epsilon _ { t } ^ { \theta } \left( x _ { t } \right) } { \sqrt { \alpha _ { t } } } \right) } _ { \mathrm { \normalfont ~ \ " p r e d i c t e d ~ \ b { x } _ 0 ~ \ " ~ } } + \underbrace { \sqrt { 1 - \alpha _ { t - 1 } - \sigma _ { t } ^ { 2 } } \cdot \epsilon _ { t } ^ { \theta } \left( x _ { t } \right) } _ { \mathrm { \normalfont ~ \ " d i r e c t i o n ~ p o i n t i n g ~ t o ~ \ b { x } _ t \cdot \ } } + \underbrace { \sigma _ { t } z _ { t } } _ { \mathrm { \normalfont ~ \mathrm { r a n d o m ~ n o i s e } } } \ , } \end{array}
55
+ $$
56
+
57
+ where $\sigma _ { t } = \eta \sqrt { \left( 1 - \alpha _ { t - 1 } \right) / \left( 1 - \alpha _ { t } \right) } \sqrt { 1 - \alpha _ { t } / \alpha _ { t - 1 } }$ . When $\eta = 1$ for all $t$ , it becomes DDPM. As $\eta = 0$ , the process becomes deterministic and guarantees nearly perfect inversion.
58
+
59
+ # 2.3 IMAGE MANIPULATION WITH CLIP
60
+
61
+ CLIP learns multimodal embeddings with an image encoder $E _ { I }$ and a text encoder $E _ { T }$ whose similarity indicates semantic similarity between images and texts (Radford et al., 2021). Compared to directly minimizing the cosine distance between the edited image and the target description (Patashnik et al., 2021), directional loss with cosine distance achieves homogeneous editing without mode collapse (Gal et al., 2021):
62
+
63
+ $$
64
+ \mathcal { L } _ { \mathrm { d i r e c t i o n } } \left( { \boldsymbol { x } } ^ { \mathrm { e d i t } } , { \boldsymbol { y } } ^ { \mathrm { t a r g e t } } ; { \boldsymbol { x } } ^ { \mathrm { s o u r c e } } , { \boldsymbol { y } } ^ { \mathrm { s o u r c e } } \right) : = 1 - \frac { \Delta I \cdot \Delta T } { \| \Delta I \| \| \Delta T \| } ,
65
+ $$
66
+
67
+ where $\Delta T = E _ { T } \left( y ^ { \mathrm { t a r g e t } } \right) - E _ { T } \left( y ^ { \mathrm { s o u r c e } } \right)$ and $\Delta I = E _ { I } \left( { \pmb x } ^ { \mathrm { e d i t } } \right) - E _ { I } \left( { \pmb x } ^ { \mathrm { s o u r c e } } \right)$ for edited image $\pmb { x } ^ { \mathrm { e d i t } }$ , target description $y ^ { \mathrm { t a r g e t } }$ , original image $\pmb { x } ^ { \mathrm { s o u r c e } }$ , and source description $y ^ { \mathrm { s o u r c e } }$ . We use the prompts ‘smiling face’ and ‘face’ as the target and source descriptions for facial attribute smiling.
68
+
69
+ # 3 DISCOVERING SEMANTIC LATENT SPACE IN DIFFUSION MODELS
70
+
71
+ This section explains why naive approaches do not work and proposes a new controllable reverse process. Then we describe the techniques for controlling the generative process. Throughout this paper, we use an abbreviated version of Eq. (3):
72
+
73
+ $$
74
+ \pmb { x } _ { t - 1 } = \sqrt { \alpha _ { t - 1 } } \mathbf { P } _ { t } ( \epsilon _ { t } ^ { \theta } ( \pmb { x } _ { t } ) ) + \mathbf { D } _ { t } ( \epsilon _ { t } ^ { \theta } ( \pmb { x } _ { t } ) ) + \sigma _ { t } \boldsymbol { z } _ { t } ,
75
+ $$
76
+
77
+ where $\mathbf { P } _ { t } ( \epsilon _ { t } ^ { \theta } ( { \pmb x } _ { t } ) )$ denotes the predicted $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ and $\mathbf { D } _ { t } ( \epsilon _ { t } ^ { \theta } ( { \pmb x } _ { t } ) )$ denotes the direction pointing to $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ . We omit $\sigma _ { t } z _ { t }$ for brevity, except when $\eta \neq 0$ . We further abbreviate $\mathbf { P } _ { t } ( \epsilon _ { t } ^ { \theta } ( { \pmb x } _ { t } ) )$ as $\mathbf { P } _ { t }$ and $\mathbf { D } _ { t } ( \epsilon _ { t } ^ { \theta } ( { \pmb x } _ { t } ) )$ as $\mathbf { D } _ { t }$ when the context clearly specifies the arguments.
78
+
79
+ # 3.1 PROBLEM
80
+
81
+ We aim to allow semantic latent manipulation of images $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ generated from $\mathbf { \nabla } _ { \mathbf { x } _ { T } }$ given a pretrained and frozen diffusion model. The easiest idea to manipulate $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ is simply updating $\mathbf { \nabla } _ { \mathbf { \mathcal { X } } \mathcal { T } }$ to optimize the directional CLIP loss given text prompts with Eq. (4). However, it leads to distorted images or incorrect manipulation (Kim & Ye, 2021).
82
+
83
+ An alternative approach is to shift the noise $\epsilon _ { t } ^ { \theta }$ predicted by the network at each sampling step. However, it does not achieve manipulating $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ because the intermediate changes in $\mathbf { P } _ { t }$ and $\mathbf { D } _ { t }$ cancel out each other resulting in the same $p _ { \theta } ( { \pmb x } _ { 0 : T } )$ , similarly to destructive interference.
84
+
85
+ Theorem 1. Let $\epsilon _ { t } ^ { \theta }$ be a predicted noise during the original reverse process at $t$ and $\tilde { \epsilon } _ { t } ^ { \theta }$ be its shifted counterpart. Then, $\Delta \pmb { x } _ { t } = \tilde { \pmb { x } } _ { t - 1 } - \pmb { x } _ { t - 1 }$ is negligible where $\begin{array} { r } { \tilde { { \pmb { x } } } _ { t - 1 } = \sqrt { \alpha _ { t - 1 } } { \bf P } _ { t } ( \tilde { \epsilon } _ { t } ^ { \theta } ( { \pmb { x } } _ { t } ) ) + } \end{array}$ $\mathbf { D } _ { t } ( \tilde { \epsilon } _ { t } ^ { \theta } ( { \pmb x } _ { t } ) )$ . I.e., the shifted terms of $\tilde { \epsilon } _ { t } ^ { \theta }$ in $\mathbf { P } _ { t }$ and $\mathbf { D } _ { t }$ destruct each other in the reverse process.
86
+
87
+ Appendix C proves above theorem. Figure 13(a-b) shows that $\tilde { \mathbf { x } } _ { 0 }$ is almost identical to $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$
88
+
89
+ # 3.2 ASYMMETRIC REVERSE PROCESS
90
+
91
+ In order to break the interference, we propose a new controllable reverse process with asymmetry:
92
+
93
+ $$
94
+ \pmb { x } _ { t - 1 } = \sqrt { \alpha _ { t - 1 } } \mathbf { P } _ { t } \big ( \tilde { \epsilon } _ { t } ^ { \theta } ( \pmb { x } _ { t } ) \big ) + \mathbf { D } _ { t } \big ( \epsilon _ { t } ^ { \theta } ( \pmb { x } _ { t } ) \big ) ,
95
+ $$
96
+
97
+ ![](images/06ae64f291010710a1b60bf1d063bfc7c5ce461052c3aeb0dadeab995109361f.jpg)
98
+ Figure 2: Generative process of Asyrp. The green box on the left illustrates Asyrp which only alters $\mathbf { P } _ { t }$ while preserving $\mathbf { D } _ { t }$ shared by DDIM. The right describes that Asyrp modifies the original reverse process toward the target attribute reflecting the change in $h$ -space.
99
+
100
+ i.e., we modify only $\mathbf { P } _ { t }$ by shifting $\epsilon _ { t } ^ { \theta }$ to $\tilde { \epsilon } _ { t } ^ { \theta }$ while preserving $\mathbf { D } _ { t }$ . Intuitively, it modifies the original reverse process according to $\Delta \epsilon _ { t } = \widetilde { \epsilon } _ { t } ^ { \theta } - \widetilde { \epsilon } _ { t } ^ { \theta }$ while it does not alter the direction toward $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ so that ${ \mathbf { \mathcal { x } } } _ { t - 1 }$ follows the original flow $\mathbf { D } _ { t }$ at each sampling step. Figure 2 illustrates the above intuition.
101
+
102
+ As in Avrahami et al. (2022), we use the modified $\mathbf { P } _ { t } ^ { \mathrm { e d i t } }$ and the original $\mathbf { P } _ { t } ^ { \mathrm { s o u r c e } }$ as visual inputs for the directional CLIP loss in Eq. (4), and regularize the difference between the modified $\mathbf { P } _ { t } ^ { \mathrm { { e d i t } } }$ and the original $\mathbf { P } _ { t } ^ { \mathrm { s o u r c e } }$ . We find $\begin{array} { r } { \Delta \epsilon = \arg \operatorname* { m i n } _ { \Delta \epsilon } \mathbb { E } _ { t } \mathcal { L } ^ { ( t ) } } \end{array}$ where
103
+
104
+ $$
105
+ \begin{array} { r } { \mathcal { L } ^ { ( t ) } = \lambda _ { \mathrm { { C L I P } } } \mathcal { L } _ { \mathrm { d i r e c t i o n } } \left( \mathbf { P } _ { t } ^ { \mathrm { { e d i t } } } , y ^ { \mathrm { { r e f } } } ; \mathbf { P } _ { t } ^ { \mathrm { { s o u r c e } } } , y ^ { \mathrm { { s o u r c e } } } \right) + \lambda _ { \mathrm { { r e c o n } } } \left| \mathbf { P } _ { t } ^ { \mathrm { { e d i t } } } - \mathbf { P } _ { t } ^ { \mathrm { { s o u r c e } } } \right| } \end{array}
106
+ $$
107
+
108
+ Although $\Delta \epsilon$ indeed renders the attribute in the $\pmb { x } _ { 0 } ^ { \mathrm { e d i t } }$ , $\epsilon$ -space lacks the necessary properties of the semantic latent space in diffusion models that will be described in the following.
109
+
110
+ # 3.3 $h$ -space
111
+
112
+ Note that $\epsilon _ { t } ^ { \theta }$ is implemented as U-Net in all state-of-the-art diffusion models. We choose its bottleneck, the deepest feature maps $\boldsymbol { h } _ { t }$ , to control $\epsilon _ { t } ^ { \theta }$ . By design, $h _ { t }$ has smaller spatial resolutions and high-level semantics than $\epsilon _ { t } ^ { \theta }$ . Accordingly, the sampling equation becomes
113
+
114
+ $$
115
+ \pmb { x } _ { t - 1 } = \sqrt { \alpha _ { t - 1 } } \mathbf { P } _ { t } ( \epsilon _ { t } ^ { \theta } ( \pmb { x } _ { t } | \Delta \pmb { h } _ { t } ) ) + \mathbf { D } _ { t } ( \epsilon _ { t } ^ { \theta } ( \pmb { x } _ { t } ) ) + \sigma _ { t } \boldsymbol { z } _ { t } ,
116
+ $$
117
+
118
+ where $\epsilon _ { t } ^ { \theta } ( \boldsymbol { x } _ { t } | \Delta h _ { t } )$ adds $\Delta { h _ { t } }$ to the original feature maps $h _ { t }$ . The $\Delta \boldsymbol { h } _ { t }$ minimizing the same loss in Eq. (7) with $\dot { \mathbf { P } } _ { t } ( \epsilon _ { t } ^ { \theta } ( \pmb { x } _ { t } | \Delta \pmb { h } _ { t } ) )$ instead of $\mathbf { P } _ { t } ( \tilde { \epsilon } _ { t } ^ { \theta } ( x _ { t } ) )$ successfully manipulates the attributes.
119
+
120
+ We observe that $h$ -space in Asyrp has the following properties that others do not have.
121
+
122
+ • The same $\Delta h$ leads to the same effect on different samples.
123
+ • Linearly scaling $\Delta h$ controls the magnitude of attribute change, even with negative scales.
124
+ • Adding multiple $\Delta h$ manipulates the corresponding multiple attributes simultaneously.
125
+ • $\Delta h$ preserves the quality of the resulting images without degradation.
126
+ • $\Delta { h _ { t } }$ is roughly consistent across different timesteps $t$ .
127
+
128
+ The above properties are demonstrated thoroughly in $\ S 5 . 3$ . Appendix D.3 provides details of $h$ -space and suboptimal results from alternative choices.
129
+
130
+ # 3.4 IMPLICIT NEURAL DIRECTIONS
131
+
132
+ Although $\Delta h$ succeeds in manipulating images, directly optimizing $\Delta \boldsymbol { h } _ { t }$ on multiple timesteps requires many iterations of training with a carefully chosen learning rate and its scheduling. Instead, we define an implicit function $f _ { t } ( h _ { t } )$ which produces $\Delta { h _ { t } }$ for given $h _ { t }$ and $t$ . $\pmb { f } _ { t }$ is implemented as a small neural network with two $1 \times 1$ convolutions concatenating timestep $t$ . See Appendix $\mathrm { E }$ for the details. Accordingly, we optimize the same loss in Eq. (7) with $\mathbf { P } _ { t } ^ { \mathrm { e d i t } } = \mathbf { \bar { P } } _ { t } \bigl ( \epsilon _ { t } ^ { \theta } ( { \pmb x } _ { t } \mathbf { \bar { | } } \mathbf { \bar { \mathbf { f } } } _ { t } ) \bigr )$ .
133
+
134
+ Learning $f _ { t }$ is more robust to learning rate settings and converges faster than learning every $\Delta \boldsymbol { h } _ { t }$ . In addition, as $\pmb { f } _ { t }$ learns an implicit function for given timesteps and bottleneck features, it generalizes to unseen timesteps and bottleneck features. The generalization allows us to borrow the accelerated training scheme of DDIM defined on a subsequence $\{ \pmb { x } _ { \tau _ { i } } \} _ { \forall i \in [ 1 , S ] }$ where $\{ \tau _ { i } \}$ is a subsequence of $[ 1 , . . . , T ]$ and $S \textless T$ . Then, we can use the generative process with a custom subsequence $\{ \tilde { \tau } _ { i } \}$ with length $\tilde { S } < T$ through normalization: $\Delta \tilde { h } _ { \tilde { \tau } } = f _ { \tilde { \tau } } ( h _ { \tilde { \tau } } ) { S } / { \tilde { S } }$ . It preserves the amount of $\sum \Delta { { h } _ { t } }$ , $\Delta \tilde { h } _ { \tilde { \tau } } \tilde { S } = \Delta h _ { t } S$ . Therefore, we can use $f _ { t }$ trained on any subsequence for any length of the generative process. See Appendix F for details. We use $\pmb { f } _ { t }$ to get $\Delta \boldsymbol { h } _ { t }$ for all experiments except Figure 6.
135
+
136
+ ![](images/47dbd6b534787f72c5d6825a64bc954aec392ef479c4aed91b47b808b2fa38d3.jpg)
137
+ Figure 3: Intuition for choosing the intervals for editing and quality boosting. We choose the intervals by quantifying two measures (top left inset). The editing strength of an interval $[ T , t ]$ measures its perceptual difference from $T$ until $t$ . We set $[ T , t ]$ to the interval with the smallest editing strength that synthesizes $\mathbf { P } _ { t }$ close to $_ { \textbf { \em x } }$ , i.e., $\mathrm { L P I P S } ( { \pmb x } , { \bf P } _ { t } ) = 0 . 3 3$ . Editing flexibility of an interval $[ t , 0 ]$ measures the potential amount of changes after $t$ . Quality deficiency at $t$ measures the amount of noise in $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ . We set $[ t , 0 ]$ to handle large quality deficiency (i.e., $\mathrm { L P I P S } ( \pmb { x } , \pmb { x } _ { t } ) = 1 . 2 )$ with small editing flexibility.
138
+
139
+ # 4 GENERATIVE PROCESS DESIGN
140
+
141
+ This section describes the entire editing process, which consists of three phases: editing with Asyrp, traditional denoising, and quality boosting. We design formulas to determine the length of each phase with quantifiable measures.
142
+
143
+ # 4.1 EDITING PROCESS WITH ASYRP
144
+
145
+ Diffusion models generate the high-level context in the early stage and imperceptible fine details in the later stage (Choi et al., 2022). Likewise, we modify the generative process in the early stage to achieve semantic changes. We refer to the early stage as the editing interval $[ T , t _ { \mathrm { e d i t } } ]$ .
146
+
147
+ $\mathrm { L P I P S } ( { \pmb x } , { \pmb P } _ { T } )$ and $\mathrm { L P I P S } ( \pmb { x } , \mathbf { P } _ { t } )$ calculate the perceptual distance between the original image and the predicted image at time steps $T$ and $t$ , respectively. Intuitively, the high-level content is already determined by the predicted terms at the respective timesteps and LPIPS measures the remaining component to be edited through the remaining reverse process. Consequently, we define editing strength of an interval $[ T , t ]$ :
148
+
149
+ $$
150
+ \xi _ { t } = \mathrm { L P I P S } ( x , \mathbf { P } _ { T } ) - \mathrm { L P I P S } ( x , \mathbf { P } _ { t } )
151
+ $$
152
+
153
+ indicating the perceptual change from timestep $T$ to $t$ in the original generative process. Figure 3 illustrates $\mathrm { L P I P S } ( { \pmb x } , \cdot )$ for $\mathbf { P } _ { t }$ and $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ with examples and the inset depicts editing strength. The shorter editing interval has the lower $\xi _ { t }$ , and the longer editing interval brings more changes to the resulting images. We seek the shortest editing interval which will bring enough distinguishable changes in the images in general. We empirically find that $t _ { \mathrm { e d i t } }$ with $\mathrm { L P I P S } ( \mathbf { x } , \mathbf { P } _ { t _ { \mathrm { e d i t } } } ) = 0 . \dot { 3 } 3$ builds the shortest editing interval with enough editing strength as $\mathbf { P } _ { t _ { \mathrm { e d i t } } }$ has nearly all visual attributes in $_ { \textbf { \em x } }$ .
154
+
155
+ However, some attributes require more visual changes than others, e.g., pixar $>$ smile. For such attributes, we increase the editing strength $\xi _ { t }$ by $\delta = 0 . 3 3 d ( E _ { T } ( y _ { \mathrm { s o u r c e } } ) , E _ { T } ( y _ { \mathrm { t a r g e t } } ) )$ where
156
+
157
+ $E _ { T } ( \cdot )$ produces CLIP text embedding, $y _ { ( \cdot ) }$ denotes the descriptions, and $d ( \cdot , \cdot )$ computes the cosine distance between the arguments. Choosing $t _ { \mathrm { e d i t } }$ with $\mathrm { L P I P S } ( \pmb { x } , \mathbf { P } _ { t _ { \mathrm { e d i t } } } ) = 0 . 3 3 - \delta$ expands the editing interval to a suitable length. It consistently produces good results in various settings. The supporting experiments are shown in Appendix G.
158
+
159
+ # 4.2 QUALITY BOOSTING WITH STOCHASTIC NOISE INJECTION
160
+
161
+ Although DDIM achieves nearly perfect inversion by removing stochasticity $( \eta = 0$ ), Karras et al. (2022) demonstrate that stochasticity improves image quality. Likewise, we inject stochastic noise in the boosting interval $[ t _ { \mathrm { b o o s t } } , 0 ]$ .
162
+
163
+ Though the longer boosting interval would achieve higher quality, boosting over excessively long intervals would modify the content. Hence, we want to determine the shortest interval that shows enough quality boosting to guarantee minimal change in the content. We consider the noise in the image as the capacity for the quality boosting and define quality deficiency at $t$ $: \gamma _ { t } = \mathrm { L P I P S } ( \pmb { x } , \pmb { x } _ { t } )$ indicating the amount of noise in $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ compared to the original image. We use $\mathbf { \Delta } _ { \mathbf { \mathcal { X } } _ { t } }$ instead of $\mathbf { P } _ { t }$ because we consider the actual image rather than the semantics. Figure 3 inset depicts editing flexibility and quality deficiency. We empirically find that $t _ { \mathrm { b o o s t } }$ with $\gamma _ { t _ { \mathrm { b o o s t } } } ~ = ~ 1 . 2$ achieves quality boosting with minimal content change. We confirmed that the editing strength of the intervals $[ t _ { \mathrm { b o o s t } } , 0 ]$ is guaranteed to be less than 0.25. In Figure 3, after $t _ { \mathrm { b o o s t } }$ , $\mathrm { L P I P S } ( { \pmb x } , { \pmb x } _ { t } )$ sharply drops in the original generative process while $\mathrm { L P I P S } ( \pmb { x } , \mathbf { P } _ { t } )$ changes little. Note that most of the quality degradation of the resulting images is caused by DDIM reverse process, not by Asyrp. We use this quality boosting for all experiments except ablation in Appendix $_ \mathrm { H }$ .
164
+
165
+ # 4.3 OVERALL PROCESS OF IMAGE EDITING
166
+
167
+ Using $t _ { \mathrm { e d i t } }$ and $t _ { \mathrm { b o o s t } }$ determined by the above formulas, we modify the generative process of DDIM with
168
+
169
+ $$
170
+ p _ { \theta } ^ { ( t ) } \left( x _ { t - 1 } \mid x _ { t } \right) = \left\{ \begin{array} { l l } { \mathcal { N } \left( \sqrt { \alpha _ { t - 1 } } \mathbf { P } _ { t } ( \epsilon _ { t } ^ { \theta } ( x _ { t } | f _ { t } ) ) + \mathbf { D } _ { t } , \sigma _ { t } ^ { 2 } I \right) , \eta = 0 } & { \mathrm { ~ i f ~ } T \geq t \geq t _ { \mathrm { e d i t } } } \\ { \mathcal { N } \left( \sqrt { \alpha _ { t - 1 } } \mathbf { P } _ { t } ( \epsilon _ { t } ^ { \theta } ( x _ { t } ) ) + \mathbf { D } _ { t } , \sigma _ { t } ^ { 2 } I \right) , \eta = 0 } & { \mathrm { ~ i f ~ } t _ { \mathrm { e d i t } } > t \geq t _ { \mathrm { b o o s t } } } \\ { \mathcal { N } \left( \sqrt { \alpha _ { t - 1 } } \mathbf { P } _ { t } ( \epsilon _ { t } ^ { \theta } ( x _ { t } ) ) + \mathbf { D } _ { t } , \sigma _ { t } ^ { 2 } I \right) , \eta = 1 } & { \mathrm { ~ i f ~ } t _ { \mathrm { b o o s t } } > t } \end{array} \right.
171
+ $$
172
+
173
+ The visual overview and comprehensive algorithms of the entire process are in Appendix I.
174
+
175
+ # 5 EXPERIMENTS
176
+
177
+ In this section, we show the effectiveness of semantic latent editing in $h$ -space with Asyrp on various attributes, datasets and architectures in $\ S \ S . 1$ . Moreover, we provide quantitative results including user study in $\mathrm { ~ \normalfont ~ \ S ~ } 5 . 2$ . Lastly, we provide detailed analyses for the properties of the semantic latent space on $h$ -space and alternatives in $\ S 5 . 3$ .
178
+
179
+ Implementation details. We implement our method on various settings: CelebA-HQ (Karras et al., 2018) and LSUN-bedroom/-church (Yu et al., 2015) on $\mathrm { D D P M + + }$ (Song et al., 2020b) (Meng et al., 2021); AFHQ-dog (Choi et al., 2020) on iDDPM (Nichol & Dhariwal, 2021); and METFACES (Karras et al., 2020) on ADM with P2-weighting (Dhariwal & Nichol, 2021) (Choi et al., 2022). Please note that all models are official pretrained checkpoints and are kept frozen. Detailed settings including the coefficients for $\lambda _ { \mathrm { C L I P } }$ and $\lambda _ { \mathrm { { r e c o n } } }$ , and source/target descriptions can be found in Appendix J.1. We train $\pmb { f } _ { t }$ with $S ~ = ~ 4 0$ for 1 epoch using 1000 samples. The real samples are randomly chosen from each dataset for in-domain-like attributes. For out-of-domainlike attributes, we randomly draw 1,000 latent variables $\mathbf { \boldsymbol { x } } _ { T } \sim \mathcal { N } ( \mathbf { \boldsymbol { 0 } } , I )$ . Details are described in Appendix J.2. Training takes about 20 minutes with three RTX 3090 GPUs. All the images in the figures are not used for training. We set $\tilde { S } = 1 , 0 0 0$ for inference. The code is available at https://github.com/kwonminki/Asyrp official
180
+
181
+ # 5.1 VERSATILITY OF $h$ -space WITH ASYRP
182
+
183
+ Figure 4 shows the effectiveness of our method on various datasets and any existing U-Net based architectures. Our method can synthesize the attributes that are not even included in the training dataset, such as church $ \{ \begin{array} { r l } \end{array} $ department, factory, and temple}. Even for dogs, our method synthesizes smiling Poodle and Yorkshire, the species that barely smile in the dataset. Figure 5 provides results for changing human faces to different identities, painting styles, and ancient primates. More result can be found in Appendix N. Versatility of our method is surprising because we do not alter the models but only shift the bottleneck feature maps in $h$ -space with Asyrp during inference.
184
+
185
+ ![](images/306d377572a44f6224fe73778efba99d8a0dfab3966d278640038c75118326f5.jpg)
186
+ Figure 4: Editing results of Asyrp on various datasets. We conduct experiments on CelebA-HQ, LSUN-church, METFACES, AFHQ-dog, and LSUN-bedroom.
187
+
188
+ ![](images/a2ba33a9e5710b55fca14f10f93b7fa652ad4c1a82d2bbb67e10456214757d19.jpg)
189
+ Figure 5: Editing results of Asyrp for unseen domains in CelebA-HQ dataset.
190
+
191
+ Table 1: User study with 80 participants. The details are described in $\ S \ K . 1$
192
+
193
+ <table><tr><td rowspan="2"></td><td colspan="3">CelebA-HQ in-domain</td><td colspan="3">CelebA-HQ unseen-domain</td><td colspan="4">LSUN-church</td></tr><tr><td>quality</td><td>attribute</td><td>overall</td><td>quality</td><td>attribute</td><td>overall</td><td>quality</td><td>attribute</td><td>diversity</td><td>overall</td></tr><tr><td>Asyrp (ours)</td><td>98.36%</td><td>88.13%</td><td>94.92%</td><td>71.56%</td><td>59.84%</td><td>63.13%</td><td>73.19%</td><td>71.81%</td><td>87.50%</td><td>76.81%</td></tr><tr><td>DiffusionCLIP</td><td>1.64%</td><td>11.88%</td><td>5.08%</td><td>28.44%</td><td>40.16%</td><td>36.88%</td><td>26.81%</td><td>28.19%</td><td>12.50%</td><td>23.19%</td></tr></table>
194
+
195
+ ![](images/66fd5aab2ef8fa4bdecea189af2d5eb233396464cc901dad958ae0cc0424c117.jpg)
196
+ Figure 6: Optimization for smiling on $\pmb { h }$ -space and ϵ-space. (a) Optimizing $\Delta { h _ { t } }$ for a sample with smiling results in natural editing while the change due to optimizing $\Delta \epsilon _ { t }$ is relatively small. (b) Applying $\Delta { h _ { t } }$ from (a) to other samples yields the same attribute change while $\Delta \epsilon _ { t }$ distorts the images. The result of $\Delta \epsilon _ { t }$ is the best sample we could find.
197
+
198
+ ![](images/7bac52c03fecc44b4f929ac853df2555bd33134ce5593830fb81ee5e8c225924.jpg)
199
+ Figure 7: Linearity of $\pmb { h }$ -space. Linear interpolation and extrapolation on $h$ -space lead to gradual changes even to the unseen intensity and directions. Right side shows the interpolation results by positive scaling of $\Delta h _ { t } ^ { \mathrm { s m i l i n g } }$ . Left side shows the extrapolation results by negative scaling of $\Delta h _ { t } ^ { s m i l i n g }$ . Note that we did not train $\pmb { f } _ { t }$ for the negative direction.
200
+
201
+ # 5.2 QUANTITATIVE COMPARISON
202
+
203
+ Considering that our method can be combined with various diffusion models without finetuning, we do not find such a versatile competitor. Nonetheless, we compare Asyrp against DiffusionCLIP using the official code that edits the real images by finetuning the whole model. We asked 80 participants to choose the images with better quality, natural attribute change, and overall preference for given total of 40 sets of original images, ours, and DiffusionCLIP. Table 1 shows that Asyrp outperforms DiffusionCLIP in the all perspectives including the attributes unseen in the training dataset. We list the settings for fair comparison including the questions and example images in Appendix K.1. See $\textrm { \AA K } . 2$ for more evaluation metrics: segmentation consistency (SC) and directional CLIP similarity( $S _ { \mathrm { d i r } } )$ .
204
+
205
+ # 5.3 ANALYSIS ON $h$ -space
206
+
207
+ We provide detailed analyses to validate the properties of semantic latent space for diffusion models: homogeneity, linearity, robustness, and consistency across timesteps.
208
+
209
+ Homogeneity. Figure 6 illustrates homogeneity of $h$ -space compared to $\epsilon$ -space. One $\Delta { h _ { t } }$ optimized for an image results in the same attribute change to other input images. On the other hand, one $\Delta \epsilon _ { t }$ optimized for an image distorts other input images. In Figure 10, applying $\Delta h _ { t } ^ { \mathrm { m e a n } } =$ $\begin{array} { r } { \frac { 1 } { N } \sum \Delta h _ { t } ^ { i } } \end{array}$ produces almost identical results where $i$ indicates indices of $N = 2 0$ random samples.
210
+
211
+ Linearity. In Figure 7, we observe that linearly scaling a $\Delta h$ reflects the amount of change in the visual attributes. Surprisingly, it generalizes to negative scales that are not seen during training. Moreover, Figure 8 shows that combinations of different $\Delta h$ ’s yield their combined semantic changes in the resulting images. Appendix N.2 provides mixed interpolation between multiple attributes.
212
+
213
+ ![](images/ec4e0c1c15035d0be274617d3f54f6a61905cce32ac51db848c37eaa6738a5c4.jpg)
214
+ Figure 8: Linear combination. Combining multiple ∆hs leads to combined attribute changes.
215
+
216
+ ![](images/f16b3b6406f8475789e2643d74a9891b20a10d09c81ef00ec5fdfc72bd1f3e33.jpg)
217
+ Figure 9: Ramdom manipulation on $\pmb { h }$ -space and $\epsilon$ -space. (a) Adding random noise with magnitude of ∆hsmilingt and random direction in $h$ -space leads to realistic images with small changes. (b) Adding random noise with magnitude of $\Delta \epsilon _ { t } ^ { \mathrm { s m i l i n g } }$ and random direction in $\epsilon$ -space leads to severely distorted images. (c) Adding random noises with tripled magnitude produce diverse visual changes in realistic images.
218
+
219
+ ![](images/516dc2690d986f75d0a76feebed8568de3bb5e07882b27922278b8419f1f3e97.jpg)
220
+ Figure 10: Consistency on $\pmb { h }$ -space. Results of $\Delta { h _ { t } }$ , $\Delta h _ { t } ^ { \mathrm { m e a n } }$ and $\Delta h ^ { \mathrm { g l o b a l } }$ are almost identical for in-domain samples. However, we choose $\Delta { h _ { t } }$ over others to prevent unexpected small difference in the unseen domain. We provide more results in $\ S \mathrm { { L . 1 } }$ .
221
+
222
+ Robustness. Figure 9 compares the effect of adding random noise in $h$ -space and $\epsilon$ -space. The random noises are chosen to be the vectors with random directions and magnitude of the example $\Delta { h _ { t } }$ and $\Delta \epsilon _ { t }$ in Figure 6 on each space. Perturbation in $h$ -space leads to realistic images with a minimal difference or some semantic changes. On the contrary, perturbation in $\epsilon$ -space severely distorts the resulting images. See Appendix D.2 for more analyses.
223
+
224
+ Consistency across timesteps. Recall that $\Delta \boldsymbol { h } _ { t }$ for all samples are homogeneous and replacing them by their mea time-invariant $\Delta h _ { t } ^ { \mathrm { m e a n } }$ ults. Interesinstead of , in Figure 10, we observe that addalso yields similar results where $\Delta { h ^ { \mathrm { g l o b a l } } } ~ \dot { = } ~ \frac { 1 } { T _ { e } } \sum _ { t } \Delta { h _ { t } ^ { \mathrm { m e a n } } }$ $\Delta \boldsymbol { h } _ { t }$ $T _ { e }$ denotes the length of the editing interval $[ T , t _ { \mathrm { e d i t } } ]$ . Though we use $\Delta \boldsymbol { h } _ { t }$ to deliver the best quality and manipulation, using $\Delta h _ { t } ^ { \mathrm { m e a n } }$ or even $\Delta h ^ { \mathrm { g l o b a l } }$ with some compromise would be worth trying for simplicity. We report more detail about mean and global direction in Appendix L.1.
225
+
226
+ # 6 CONCLUSION
227
+
228
+ We proposed a new generative process, Asyrp, which facilitates image editing in a semantic latent space $h$ -space for pretrained diffusion models. $h$ -space has nice properties as in the latent space of GANs: homogeneity, linearity, robustness, and consistency across timesteps. The full editing process is designed to achieve versatile editing and high quality by measuring editing strength and quality deficiency at timesteps. We hope that our approach and detailed analyses help cultivate a new paradigm of image editing in the semantic latent space of diffusion models. Combining previous finetuning or guidance techniques would be an interesting research direction.
229
+
230
+ # ACKNOWLEDGMENTS
231
+
232
+ This work was supported by the National Research Foundation of Korea (NRF) grant funded by the Korea government (Ministry of Science and ICT) (No. 2021-0-00155)
233
+
234
+ # REFERENCES
235
+
236
+ 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.
237
+
238
+ Hila Chefer, Sagie Benaim, Roni Paiss, and Lior Wolf. Image-based clip-guided essence transfer. arXiv preprint arXiv:2110.12427, 2021.
239
+
240
+ Jooyoung Choi, Sungwon Kim, Yonghyun Jeong, Youngjune Gwon, and Sungroh Yoon. Ilvr: Conditioning method for denoising diffusion probabilistic models. arXiv preprint arXiv:2108.02938, 2021.
241
+
242
+ Jooyoung Choi, Jungbeom Lee, Chaehun Shin, Sungwon Kim, Hyunwoo Kim, and Sungroh Yoon. Perception prioritized training of diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11472–11481, 2022.
243
+
244
+ Yunjey Choi, Youngjung Uh, Jaejun Yoo, and Jung-Woo Ha. Stargan v2: Diverse image synthesis for multiple domains. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 8188–8197, 2020.
245
+
246
+ Ning Dai, Jianze Liang, Xipeng Qiu, and Xuanjing Huang. Style transformer: Unpaired text style transfer without disentangled latent representation. arXiv preprint arXiv:1905.05621, 2019.
247
+
248
+ Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021.
249
+
250
+ 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.
251
+
252
+ Ian Goodfellow, Jean Pouget-Abadie, Mehdi Mirza, Bing Xu, David Warde-Farley, Sherjil Ozair, Aaron Courville, and Yoshua Bengio. Generative adversarial networks. Communications of the ACM, 63(11):139–144, 2020.
253
+
254
+ Erik Hark ¨ onen, Aaron Hertzmann, Jaakko Lehtinen, and Sylvain Paris. Ganspace: Discovering ¨ interpretable gan controls. Advances in Neural Information Processing Systems, 33:9841–9850, 2020.
255
+
256
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020.
257
+
258
+ Tero Karras, Timo Aila, Samuli Laine, and Jaakko Lehtinen. Progressive growing of gans for improved quality, stability, and variation. In International Conference on Learning Representations, 2018.
259
+
260
+ Tero Karras, Miika Aittala, Janne Hellsten, Samuli Laine, Jaakko Lehtinen, and Timo Aila. Training generative adversarial networks with limited data. Advances in Neural Information Processing Systems, 33:12104–12114, 2020.
261
+
262
+ Tero Karras, Miika Aittala, Timo Aila, and Samuli Laine. Elucidating the design space of diffusionbased generative models. arXiv preprint arXiv:2206.00364, 2022.
263
+
264
+ Gwanghyun Kim and Jong Chul Ye. Diffusionclip: Text-guided image manipulation using diffusion models. 2021.
265
+
266
+ Diederik $\mathrm { \bf P }$ Kingma and Max Welling. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
267
+
268
+ Cheng-Han Lee, Ziwei Liu, Lingyun Wu, and Ping Luo. Maskgan: Towards diverse and interactive facial image manipulation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 5549–5558, 2020.
269
+
270
+ Huan Ling, Karsten Kreis, Daiqing Li, Seung Wook Kim, Antonio Torralba, and Sanja Fidler. Editgan: High-precision semantic image editing. Advances in Neural Information Processing Systems, 34:16331–16345, 2021.
271
+
272
+ Xihui Liu, Dong Huk Park, Samaneh Azadi, Gong Zhang, Arman Chopikyan, Yuxiao Hu, Humphrey Shi, Anna Rohrbach, and Trevor Darrell. More control for free! image synthesis with semantic diffusion guidance. arXiv preprint arXiv:2112.05744, 2021.
273
+
274
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015.
275
+
276
+ Andreas Lugmayr, Martin Danelljan, Andres Romero, Fisher Yu, Radu Timofte, and Luc Van Gool. Repaint: Inpainting using denoising diffusion probabilistic models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11461–11471, 2022.
277
+
278
+ Chenlin Meng, Yang Song, Jiaming Song, Jiajun Wu, Jun-Yan Zhu, and Stefano Ermon. Sdedit: Image synthesis and editing with stochastic differential equations. arXiv preprint arXiv:2108.01073, 2021.
279
+
280
+ 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.
281
+
282
+ Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, pp. 8162–8171. PMLR, 2021.
283
+
284
+ 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.
285
+
286
+ Konpat Preechakul, Nattanat Chatthee, Suttisak Wizadwongsa, and Supasorn Suwajanakorn. Diffusion autoencoders: Toward a meaningful and decodable representation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10619–10629, 2022.
287
+
288
+ Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International Conference on Machine Learning, pp. 8748–8763. PMLR, 2021.
289
+
290
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10684–10695, 2022.
291
+
292
+ David E Rumelhart, Geoffrey E Hinton, and Ronald J Williams. Learning internal representations by error propagation. Technical report, California Univ San Diego La Jolla Inst for Cognitive Science, 1985.
293
+
294
+ Vikash Sehwag, Caner Hazirbas, Albert Gordo, Firat Ozgenel, and Cristian Canton. Generating high fidelity data from low-density regions using diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 11492–11501, 2022.
295
+
296
+ Yujun Shen, Ceyuan Yang, Xiaoou Tang, and Bolei Zhou. Interfacegan: Interpreting the disentangled face representation learned by gans. IEEE transactions on pattern analysis and machine intelligence, 2020.
297
+
298
+ Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, pp. 2256–2265. PMLR, 2015.
299
+
300
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. arXiv preprint arXiv:2010.02502, 2020a.
301
+
302
+ 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.
303
+
304
+ Arash Vahdat, Karsten Kreis, and Jan Kautz. Score-based generative modeling in latent space. Advances in Neural Information Processing Systems, 34:11287–11302, 2021.
305
+
306
+ Daniel Watson, William Chan, Jonathan Ho, and Mohammad Norouzi. Learning fast samplers for diffusion models by differentiating through sample quality. In International Conference on Learning Representations, 2022. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ VFBjuF8HEp.
307
+
308
+ Zipeng Xu, Tianwei Lin, Hao Tang, Fu Li, Dongliang He, Nicu Sebe, Radu Timofte, Luc Van Gool, and Errui Ding. Predict, prevent, and evaluate: Disentangled text-driven image manipulation empowered by pre-trained vision-language model. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18229–18238, 2022.
309
+
310
+ Changqian Yu, Jingbo Wang, Chao Peng, Changxin Gao, Gang Yu, and Nong Sang. Bisenet: Bilateral segmentation network for real-time semantic segmentation. In Proceedings of the European conference on computer vision (ECCV), pp. 325–341, 2018.
311
+
312
+ Fisher Yu, Ari Seff, Yinda Zhang, Shuran Song, Thomas Funkhouser, and Jianxiong Xiao. Lsun: Construction of a large-scale image dataset using deep learning with humans in the loop. arXiv preprint arXiv:1506.03365, 2015.
313
+
314
+ Oguz Kaan Y ˘ uksel, Enis Simsar, Ezgi G ¨ ulperi Er, and Pinar Yanardag. Latentclr: A contrastive ¨ learning approach for unsupervised discovery of interpretable directions. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 14263–14272, 2021.
315
+
316
+ 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.
317
+
318
+ 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.
319
+
320
+ # Appendix
321
+
322
+ # Table of Contents
323
+
324
+ A Related work 14
325
+ B More discussion 1 5
326
+ C Proof of Theorem 1 1 5
327
+ D Additional supports for $\pmb { h }$ -space with Asyrp 17
328
+ D.1 Random perturbation on $\epsilon$ -space without Asyrp . 17
329
+ D.2 Robustness and semantics in $h$ -space and $\epsilon$ -space with Asyrp 17
330
+ D.3 Choice of $h$ -space in U-Net 17
331
+ E Implicit neural directions 17
332
+ $\mathbf { F }$ Quality improvements by non-accelerated sampling with scaled $\Delta h _ { t }$ 18
333
+ G Editing strength and editing flexibility 18
334
+ G.1 Editing strength and $t _ { e d i t }$ 18
335
+ G.2 Editing flexibility and $t _ { \mathrm { b o o s t } }$ . 18
336
+
337
+ H Quality boosting 1 9
338
+
339
+ # I Algorithm 2 3
340
+
341
+ # J Training details 2 3
342
+
343
+ J.1 Loss coefficients . 23
344
+ J.2 Training with random sampling instead of the training datasets . 24
345
+
346
+ # K Evaluation
347
+
348
+ # 2 4
349
+
350
+ K.1 User study . 24
351
+ K.2 Segmentation consistency and directional CLIP similarity 25
352
+
353
+ # L Directions
354
+
355
+ # 26
356
+
357
+ L.1 Global direction 26
358
+ L.2 Compare three methods 29
359
+
360
+ # M Random sampling
361
+
362
+ 3 0
363
+
364
+ # N More samples
365
+
366
+ #
367
+
368
+ N.1 ImageNet 32
369
+ N.2 Multi-interpolation 32
370
+ N.3 More results on all datasets 32
371
+
372
+ ![](images/ccb938a111ed5b23226f87f2c9601955a9f9a495d880770b80c3a6c0651db3e8.jpg)
373
+ Figure 11: Editing dog to smile. We provide high-resolution results of editing real images in the teaser and more.
374
+
375
+ # A RELATED WORK
376
+
377
+ After Sohl-Dickstein et al. (2015), denoising diffusion probabilistic models (DDPMs) provide a universal approach for generative modeling (Ho et al., 2020). On the other hand, Song et al. (2020b) suggests score-based model and unifies SDEs incorporating diffusion models with score-based models. Subsequent works renovate diffusion models by focusing on architectures, scheduling, weighting, and fast sampling (Nichol & Dhariwal (2021), Karras et al. (2022), Choi et al. (2022), Song et al. (2020a), Watson et al. (2022)). They mainly consider random generation rather than controlled generation.
378
+
379
+ In the meantime, Dhariwal & Nichol (2021) introduces classifier guidance not only improving the quality of images but also retrieving specific class of images. Since it can apply any guidance, its variants have emerged (Sehwag et al. (2022), Avrahami et al. (2022), Liu et al. (2021), Nichol et al. (2021)). However it requires a noise-dependent classifier (or any off-the-shelf models) and additional cost to compute gradients for the guidance during its sampling process. The other works try to control the generative process using image-space guidance (Choi et al. (2021), Meng et al. (2021), Lugmayr et al. (2022), Avrahami et al. (2022)). They manipulate resulting images by matching noisy images with target images during the reverse process. Still, it is hard to expect delicate control of the reverse process from the image guidance. Furthermore, Preechakul et al. (2022) introduces an extra encoder which encodes the semantic features of a real image in order to condition the generative process. Although the semantics allow one to control diffusion models, it requires additional training from scratch with the encoder and inherently can not use the other pretrained diffusion models.
380
+
381
+ For controllability, Rombach et al. (2022) and Vahdat et al. (2021) apply another approach which adapts VAE (Kingma & Welling, 2013) and autoencoder (Rumelhart et al., 1985) to diffusion models. In spite of their great success in editing, their diffusion models learn the distribution of the learned embeddings in VAE or autoencoder, not the images. Kim & Ye (2021) proposes another strategy: fine-tuning a whole diffusion model for image editing. It shows valid performance but it requires each fine-tuned model corresponding each attribute.
382
+
383
+ In comparison, Asyrp enables outstanding manipulation without high computation, specifically designed architectures, or fine-tuning whole models.
384
+
385
+ Meanwhile, generative adversarial network Goodfellow et al. (2020) address their latent space for image editing (Ling et al. (2021), Hark ¨ onen et al. (2020), Chefer et al. (2021), Shen et al. (2020), ¨
386
+
387
+ Yuksel et al. (2021), Patashnik et al. (2021), Gal et al. (2021), Dai et al. (2019), Xu et al. (2022)). ¨ However they have to conduct ‘inversion’ to their latent space for real image editing and ‘GAN inversion’ is often challenging and produces unexpected appearance changes.
388
+
389
+ On the contrary, Asyrp enables to use latent space of real images by nearly perfect easy inversion of DDIM.
390
+
391
+ # B MORE DISCUSSION
392
+
393
+ In this section, we discuss the pros and cons of diffusion-model-based and GAN-based methods.
394
+ And we provide guidelines for further improvements.
395
+
396
+ GAN-based latent manipulation methods Patashnik et al. (2021); Gal et al. (2021)require careful inversion from real images to latent codes for real image editing. On the contrary, our proposed method based on diffusion models has a powerful advantage; the sophisticated inversion method is not necessary. This means that we can obtain the latent code of an arbitrary real image even if the image is not in the trained domain. On the other hand, several inversion methods have been proposed for GANs to obtain the latent of the real image, and the corresponding latent manipulation method should be considered for each inversion method. For example, it is difficult to apply the method of editing in $w$ space to the method of inversion using $w ^ { + }$ space.
397
+
398
+ However, GANs have the advantage of fast sampling. In addition, diffusion models have a relatively slow sampling time. Additionally, we have to be aware of the time steps of diffusion models, which is still less well known.
399
+
400
+ The advantage of being free from Inversion provides the following milestones. The manipulation in the latent of the diffusion models is the same as the editing in real images. It can be expanded to segmentation, clustering, classification, etc. in $h$ -space for real-world images.
401
+
402
+ It would be an interesting research direction to employ previous techniques. Our method can be used in conjunction with gradient guidance methods. Although we do not focus on random sampling, ours works effectively for sampling with stochastic. (See $\ S \mathbf { M } .$ ) It may bring more diverse methods to steer diffusion models.
403
+
404
+ $h$ -space in the latent diffusion models such as stable diffusion, is another interesting research direction. The main contribution of our paper is only modifying $\mathbf { P } _ { t }$ while preserving $\mathbf { D } _ { t }$ , and can be adapted with latent diffusion models. However, since the latent meaning may be different due to structural differences, research on this is needed.
405
+
406
+ Furthermore, all of the properties of $h$ -space according to the time step has not been fully discussed so far. Research on them can be expected to expand further.
407
+
408
+ Limitations. Editing with Asyrp seldom yields changes in overall style or peripheral objects but edits attributes of the main object. Style transfer using frozen diffusion models is our future work.
409
+
410
+ Societal impact / Ethics statement. Techniques for high-quality image manipulation such as Asyrp should be accompanied by social and/or technical solutions to prevent abuse. We acknowledge the potential ethical implications that may arise from the use of our image manipulation technique, Asyrp. We advocate for the development and implementation of social and technical solutions to prevent potential abuses such as spreading disinformation or propaganda. We are committed to ensuring fairness and non-discrimination, legal compliance, and research integrity in our work.
411
+
412
+ # C PROOF OF THEOREM 1
413
+
414
+ Proof of Theorem 1. Let $\epsilon _ { t } ^ { \theta }$ be a predicted noise during the original reverse process at $t$ and $\tilde { \epsilon } _ { t } ^ { \theta }$ be its shifted counterpart. Then, $\Delta \pmb { x } _ { t } = \tilde { \pmb { x } } _ { t - 1 } - \pmb { x } _ { t - 1 }$ is negligible where $\tilde { \pmb { x } } _ { t - 1 } = \bar { \sqrt { \alpha _ { t - 1 } } } \mathbf { P } _ { t } ( \tilde { \epsilon } _ { t } ^ { \theta } ( \pmb { x } _ { t } \bar { \Big ) } ) +$ $\mathbf { D } _ { t } ( \tilde { \epsilon } _ { t } ^ { \theta } ( { \pmb x } _ { t } ) )$ .
415
+
416
+ ![](images/278cf3f351f5df6dbbb8f4ac91469563ba5dc86a95e75f069873149e24faa7f4.jpg)
417
+ Figure 12: Illustration of Theorem 1. Upper blue line describes applying noise $\tilde { \epsilon } _ { t } = \epsilon _ { t } + \Delta \epsilon _ { t }$ to produce $\mathbf { P } _ { t } ( \tilde { \epsilon } _ { t } ) =$ the shifted predicted $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ . However, the shift due to $\Delta \epsilon _ { t }$ is canceled out by the shift in $\mathbf { D } _ { t } ( \tilde { \epsilon } _ { t } )$ due to $\Delta \epsilon _ { t }$ . As a results, applying $\Delta \epsilon _ { t }$ both on $\mathbf { P } _ { t }$ and $\mathbf { D } _ { t }$ brings identical outputs to the original.
418
+
419
+ Define $\tilde { \epsilon } _ { t } ^ { \theta } ( { \bf { x } } _ { t } ) = \epsilon _ { t } ^ { \theta } ( { \bf { x } } _ { t } ) + \Delta \epsilon _ { t }$ , $\{ \beta _ { t } \} _ { t = 1 } ^ { T } = \{ \beta _ { 1 } = \beta _ { \operatorname* { m i n } } , . . . , \beta _ { T } = \beta _ { \operatorname* { m a x } } \}$ , and $\begin{array} { r } { \alpha _ { t } = \prod _ { s = 1 } ^ { t } ( 1 - } \end{array}$ $\beta _ { s , \ }$ ). Note that $\beta _ { \mathrm { m a x } }$ is defined as a small value (e.g., $\beta _ { \mathrm { m a x } } = 0 . 0 0 1 )$ and $\{ \beta _ { t } \} _ { t = 1 } ^ { T }$ are defined by a decreasing schedule from $\beta _ { T } = \beta _ { \mathrm { m a x } }$ to $\beta _ { 1 } = \beta _ { \mathrm { m i n } } \approx 0$ (e.g., $\beta _ { \mathrm { m i n } } = 0 . 0 0 0 0 1 \rangle$ . Then,
420
+
421
+ $$
422
+ \tilde { \pmb { x } } _ { t - 1 } = \sqrt { \alpha _ { t - 1 } } \mathbf { P } _ { t } \big ( \tilde { \epsilon } _ { t } ^ { \theta } ( \pmb { x } _ { t } ) \big ) + \mathbf { D } _ { t } \big ( \tilde { \epsilon } _ { t } ^ { \theta } ( \pmb { x } _ { t } ) \big )
423
+ $$
424
+
425
+ $$
426
+ = \sqrt { \alpha _ { t - 1 } } \left( \frac { x _ { t } - \sqrt { 1 - \alpha _ { t } } \left( \epsilon _ { t } ^ { \theta } ( x _ { t } ) + \Delta \epsilon _ { t } \right) } { \sqrt { \alpha _ { t } } } \right) + \sqrt { 1 - \alpha _ { t - 1 } } \cdot \left( \epsilon _ { t } ^ { ( \theta ) } \left( x _ { t } \right) + \Delta \epsilon _ { t } \right)
427
+ $$
428
+
429
+ $$
430
+ = \sqrt { \alpha _ { t - 1 } } \mathbf { P } _ { t } ( \epsilon _ { t } ^ { \theta } ( x _ { t } ) ) + \mathbf { D } _ { t } ( \epsilon _ { t } ^ { \theta } ( x _ { t } ) ) - \frac { \sqrt { \alpha _ { t - 1 } } \sqrt { 1 - \alpha _ { t } } } { \sqrt { \alpha _ { t } } } \cdot \Delta \epsilon _ { t } + \sqrt { 1 - \alpha _ { t - 1 } } \cdot \Delta \epsilon _ { t }
431
+ $$
432
+
433
+ $$
434
+ = x _ { t - 1 } + \left( - \frac { \sqrt { 1 - \alpha _ { t } } } { \sqrt { 1 - \beta _ { t } } } + \sqrt { 1 - \alpha _ { t - 1 } } \right) \cdot \Delta \epsilon _ { t }
435
+ $$
436
+
437
+ $$
438
+ = x _ { t - 1 } + \left( - \frac { \sqrt { 1 - \alpha _ { t } } } { \sqrt { 1 - \beta _ { t } } } + \frac { \sqrt { 1 - \prod _ { s = 1 } ^ { t - 1 } \left( 1 - \beta _ { s } \right) } \sqrt { 1 - \beta _ { t } } } { \sqrt { 1 - \beta _ { t } } } \right) \cdot \Delta \epsilon _ { t }
439
+ $$
440
+
441
+ $$
442
+ = x _ { t - 1 } + \left( \frac { \sqrt { 1 - \alpha _ { t } - \beta _ { t } } - \sqrt { 1 - \alpha _ { t } } } { \sqrt { 1 - \beta _ { t } } } \right) \cdot \Delta \epsilon _ { t } \quad \cdot : \alpha _ { t } = \prod _ { s = 1 } ^ { t } \left( 1 - \beta _ { s } \right)
443
+ $$
444
+
445
+ $$
446
+ \therefore \Delta x _ { t } = { \tilde { x } } _ { t - 1 } - x _ { t - 1 } = \left( { \frac { { \sqrt { 1 - \alpha _ { t } - \beta _ { t } } } - { \sqrt { 1 - \alpha _ { t } } } } { { \sqrt { 1 - \beta _ { t } } } } } \right) \cdot \Delta \epsilon _ { t } { \mathrm { ~ i s ~ n e g l i g i b l e ~ } } \quad \cdot \cdot \beta _ { t } < \beta _ { m a x }
447
+ $$
448
+
449
+ # D ADDITIONAL SUPPORTS FOR $h$ -space WITH ASYRP
450
+
451
+ D.1 RANDOM PERTURBATION ON $\epsilon$ -space WITHOUT ASYRP
452
+
453
+ In $\ S 3 . 1$ , we argue that if both $\mathbf { P } _ { t }$ and $\mathbf { D } _ { t }$ are shifted, we can not manipulate $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ . In Figure 13, we do not observe the noticeable difference between (a) and (b) which are the result of the original reverse process of DDIM and the one with shifting both terms, respectively.
454
+
455
+ # D.2 ROBUSTNESS AND SEMANTICS IN $h$ -space AND $\epsilon$ -space WITH ASYRP
456
+
457
+ In $\mathrm { ~ \ S ~ } 3 . 2$ , we also argue that $h$ -space is more robust than $\epsilon$ -space with Asyrp. In Figure 13, we observe that small random noise $z \sim \mathcal { N } ( 0 , \mathbf { I } )$ in $\epsilon$ -space degrades the resulting image without semantic changes (c) and much larger random noise in $h$ -space yields random semantic changes without severe artifacts (d).
458
+
459
+ Note that diffusion models are designed as latent variable models with learned Gaussian transitions and the reverse process should also be close to Gaussian. Based on the assumption, we manage $\epsilon _ { t } ^ { \theta }$ to follow the original Gaussian distribution as follows. Adding $z \sim \mathcal { N } ( 0 , \sigma \bar { \bf { I } } )$ to $\epsilon _ { t } ^ { \theta }$ expands the distribution of the predicted noise and may produce distorted images. To preserve the distribution,√ we scale $\tilde { \epsilon } _ { t } ^ { \theta } = ( \epsilon _ { t } ^ { \theta } + z ) / \sqrt { 1 ^ { 2 } + { \sigma } ^ { 2 } }$ . Still, the resulting images are almost identical compared to the original images where $\tilde { \epsilon } _ { t } ^ { \theta } = \epsilon _ { t } ^ { \theta } + z$ as shown in Figure 13. It is no wonder that the scaling does not improve the distorted results since the additive random noise disturbs the denoising operation of the predicted random noise.
460
+
461
+ ![](images/bb209ea4fa736576560335d535c5528804419b23be9234941f9e22111f467649.jpg)
462
+ Figure 13: (a) The reconstructed image by the original DDIM inversion process which is almost indistinguishable to the real image. (b) The result from adding random noise $z$ both on $\mathbf { P } _ { t }$ and $\mathbf { D } _ { t }$ . (a) looks identical to (b). The insets of (b, c) depict the full SSIM image from (a). It shows that simply shifting $\epsilon _ { t } ^ { \theta }$ without Asyrp does not affect the result. (c) Adding $z \sim \mathcal { N }$ to $\epsilon$ -space with Asyrp easily degrades image with little semantic change. (d) Adding $z \sim \mathcal { N }$ to $h$ -space with Asyrp yields random semantic change without image degradation. (e) Correlation between image degradation and noise strength in the two spaces.
463
+
464
+ # D.3 CHOICE OF $h$ -space IN U-NET
465
+
466
+ As shown in Figure 14, there are many other candidates for $h$ -space in the architecture. Among the layers, we choose the 8th layer, the bridge of the U-Net based architecture. The layer is not influenced by any skip connection, has the smallest spatial dimension with compressed information, and is located just before the upsampling blocks. Thus, we assume that it could possibly be considered as the most suitable latent embedding. To confirm the assumption, we train $\pmb { f } _ { t }$ on the other layers. The results are shown in Figure 15. We carefully tuned the training hyperparameters $\lambda _ { C L I P }$ and $\lambda _ { r e c o n } )$ ) for fair comparison. The 1st to the 6th layers hardly bring visible changes. The 7th and 9th layers bring not only the desired changes but also difficulty in finding optimal hyperparameters. After the 9th layer, the results bear severe artifacts.
467
+
468
+ # E IMPLICIT NEURAL DIRECTIONS
469
+
470
+ Figure 16 illustrates the neural implicit function $f _ { t }$ . It has only two 1x1 convolution layers with 512 channels. Note that we haven’t explored the network architecture much.
471
+
472
+ ![](images/3e8c45121a1bfb589a589081725c2d792d7bced359e7ac19f594c2ade31cda78.jpg)
473
+ Figure 14: Location of $\pmb { h }$ -space. The U-Net architecture of diffusion models outputs $2 5 6 \times 2 5 6$ images. Each layer is indexed with a number along the operating sequence of the model. The 8th layer is our $h$ -space which is not directly influenced by a skip connection.
474
+
475
+ # F QUALITY IMPROVEMENTS BY NON-ACCELERATED SAMPLING WITH SCALED $\Delta h _ { t }$
476
+
477
+ Figure 17 shows the quality improvements by non-accelerated sampling with scaled $\Delta { h _ { t } }$ described in $\ S \ S . 4$ . Even with different number of inference steps, we observe similar changes of an attribute if we preserve the sum of $\Delta \boldsymbol { h } _ { t }$ . This scaling technique allows non-accelerated sampling with 1000 steps for the models trained by accelerated training with 40 steps. Using non-accelerated sampling with scaled $\Delta { h _ { t } }$ leads to the same magnitude of manipulation and higher-quality images. In our experiments, it takes about 1.5 seconds to sample for 40 steps and 40 seconds for 1000 steps.
478
+
479
+ # G EDITING STRENGTH AND EDITING FLEXIBILITY
480
+
481
+ # G.1 EDITING STRENGTH AND $t _ { e d i t }$
482
+
483
+ Figure 18 shows the results according to $t _ { \mathrm { e d i t } }$ . If $t _ { \mathrm { e d i t } }$ is too high, the length of the editing process becomes too short resulting in insufficient changes. On the contrary, too low $t _ { \mathrm { e d i t } }$ causes excessively unnecessary manipulation from the long editing process.
484
+
485
+ We observe that $t _ { \mathrm { e d i t } }$ is one of the important hyperparameters. We argue that the formula for choosing $t _ { \mathrm { e d i t } }$ using editing strength is reasonable because it applies to all five different datasets despite its sensitivity, even though the choice of $\mathrm { L P I P S = 0 . 3 3 }$ is empirical. We provide ablation of thresholds in Figure 22.
486
+
487
+ Additionally, these results imply why we need to use sufficiently low $t _ { \mathrm { e d i t } }$ in the unseen domains.
488
+ Editing interval with insufficient editing strength struggles to escape from the training domain.
489
+
490
+ # G.2 EDITING FLEXIBILITY AND tboost
491
+
492
+ Table 2 shows the prompts, $t _ { \mathrm { e d i t } }$ , and $t _ { \mathrm { b o o s t } }$ . Intuitively, the attributes with larger visual changes have smaller cosine similarity and require longer editing interval. Figure 19 shows the average $\mathrm { L P I P S } ( \pmb { x } , \mathbf { P } _ { t } )$ and $\mathrm { L P I P S } ( { \pmb x } , { \pmb x } _ { t } )$ of 100 samples on all datasets. Note that $t _ { \mathrm { e d i t } }$ and $t _ { \mathrm { b o o s t } }$ dif
493
+
494
+ ![](images/20e18f4b6da57f683105204199ad21e00b13391adc9cd4bf0a95392c4e8d14c8.jpg)
495
+ Figure 15: Exhaustive enumeration over the choices for semantic latent space. We show the result of the training data. We observe that the eighth layer ( $h$ -space) of the U-net suits the best for the semantic latent space.
496
+
497
+ ![](images/174bbae683903d32c4469c85c1da04852c054dd195ebaf00a66e2a411d7df08d.jpg)
498
+ Figure 16: Illustration of $\pmb { f } _ { t }$ . We use group norm and swish following DDPM.
499
+
500
+ fer across datasets and attributes, and they are chosen by the formulas in $\ S 4 .$ . We provide ablation of $t _ { \mathrm { b o o s t } }$ in Figure 23.
501
+
502
+ # H QUALITY BOOSTING
503
+
504
+ We validate the effectiveness of our quality boosting (§ 4.2) in the original DDIM process and in Asyrp.
505
+
506
+ Smiling with
507
+
508
+ ![](images/e119805b4e47eb46571e4d9c938e16083540325efbc089de26542ba2e25cbc3d.jpg)
509
+ Figure 17: Quality improvements by non-accelerated sampling with scaled $\Delta \boldsymbol { h } _ { t }$ . We observe quality improvements by non-accelerated (1000-step) sampling with scaled $\Delta \boldsymbol { h } _ { t }$ from accelerated (40-step) training described in $\ S 3 . 4$ . Please zoom in for detailed comparison.
510
+
511
+ $$
512
+ t _ { e d i t } = 9 0 0 ~ t _ { e d i t } = 8 0 0 ~ t _ { e d i t } = 7 0 0 ~ t _ { e d i t } = 6 0 0 ~ t _ { e d i t } = 5 0 0 ~ t _ { e d i t } = 4 0 0 ~ t _ { e d i t } = 3 0 0 ~ t _ { e d i t } = 2 0 0 ~ t _ { e d i t } = 1 0 0
513
+ $$
514
+
515
+ ![](images/5e9f94c3b8ff254f0b1c246dba27d57fe4749c6b53d4da39b435229817caa682.jpg)
516
+ Figure 18: Importance of choosing proper $t _ { \mathrm { e d i t } }$ . We explore various $t _ { \mathrm { e d i t } }$ with smiling. Too short editing interval struggles to manipulate attributes. Excessive editing strength results in degraded images.
517
+
518
+ <table><tr><td>Dataset</td><td>src_txt</td><td>trg_txt</td><td>CLIP similarity</td><td>tedit</td><td>tboost</td></tr><tr><td rowspan="18">CelebA-HQ LSUN-church</td><td>Person Face</td><td>Young person</td><td>0.905</td><td>515</td><td>167</td></tr><tr><td></td><td>Smiling face</td><td>0.899</td><td>513</td><td>167</td></tr><tr><td>Face</td><td>Sad face</td><td>0.894</td><td>513</td><td>167</td></tr><tr><td>Face</td><td>Angry face</td><td>0.892</td><td>512</td><td>167</td></tr><tr><td>Face</td><td>Tanned face</td><td>0.886</td><td>512</td><td>167</td></tr><tr><td>Face</td><td>Disgusted face</td><td>0.880</td><td>511</td><td>167</td></tr><tr><td>Person Human</td><td>Person with makeup</td><td>0.875</td><td>509</td><td>167</td></tr><tr><td>Person</td><td>Zombie</td><td>0.868</td><td>506</td><td>167</td></tr><tr><td>Person</td><td>Person with bald head</td><td>0.861</td><td>505</td><td>167</td></tr><tr><td></td><td>Person with curly hair</td><td>0.835</td><td>499</td><td>167</td></tr><tr><td>Human Person</td><td>Neanderthal</td><td>0.802</td><td>490</td><td>167</td></tr><tr><td>Person</td><td>Mark Zuckerberg</td><td>0.797</td><td>489</td><td>167</td></tr><tr><td>Human</td><td>Nicolas Cage</td><td>0.710</td><td>461</td><td>167</td></tr><tr><td>Photo</td><td>Painting in the style of Pixar</td><td>0.667</td><td>446</td><td>167</td></tr><tr><td>Photo</td><td>Painting in Modigliani style Self-portrait by Frida Kahlo</td><td>0.565</td><td>403</td><td>167</td></tr><tr><td>Church</td><td>Gothic Church</td><td>0.443</td><td>321</td><td>167</td></tr><tr><td>Church</td><td>Temple</td><td>0.912 0.898</td><td>371</td><td>293</td></tr><tr><td>Church</td><td>Department store</td><td>0.841</td><td>367</td><td>293</td></tr><tr><td>Church</td><td>Wooden House</td><td></td><td>349</td><td>293</td></tr><tr><td>Church</td><td></td><td>0.793</td><td>333</td><td>293</td></tr><tr><td>Church</td><td>Ancient traditional Asian tower</td><td>0.784</td><td>330</td><td>293</td></tr><tr><td>Church</td><td>Red brick wall Church</td><td>0.774</td><td>326</td><td>293</td></tr><tr><td>Bedroom</td><td>Factory Princess Bedroom</td><td>0.702</td><td>301</td><td>293</td></tr><tr><td>LSUN-bedroom</td><td>Bedroom Hotel Bedroom</td><td>0.912</td><td>370</td><td>221</td></tr><tr><td rowspan="5">AFHQ</td><td>Dog</td><td></td><td>0.917</td><td>371</td><td>221</td></tr><tr><td>Dog</td><td>Happy Dog</td><td>0.883</td><td>430</td><td>167</td></tr><tr><td></td><td>Sleepy Dog</td><td>0.866</td><td>422</td><td>167</td></tr><tr><td>Dog</td><td>Angry Dog</td><td>0.860</td><td>419</td><td>167</td></tr><tr><td>Dog Dog</td><td>Wolf</td><td>0.850</td><td>412</td><td>167</td></tr><tr><td rowspan="3">METFACES</td><td>Painting of a person</td><td>Yorkshire Terrier</td><td>0.690</td><td>302</td><td>167</td></tr><tr><td>Painting of a person</td><td>Painting of a Sad person Painting of a Smiling person</td><td>0.921 0.908</td><td>330 320</td><td>180 180</td></tr><tr><td>Painting of a person</td><td>Painting of a Disgusted person</td><td>0.879</td><td>291</td><td>180</td></tr></table>
519
+
520
+ ![](images/d400055c06dce9745d0694a750ea708aaf62c69eec8d8f94c39559d4b4c1588e.jpg)
521
+ Table 2: Prompts, CLIP similarity, $t _ { \mathrm { e d i t } }$ , and $t _ { \mathrm { b o o s t } }$ for all attributes in the experiments.
522
+ Figure 19: Average LPIPS $( \boldsymbol { \mathbf { \mathit { x } } } , \boldsymbol { \mathbf { \mathit { P } } } _ { t } )$ and LPIPS $( \pmb { x } , \pmb { x } _ { t } )$ of 100 samples on all datasets.
523
+
524
+ Figure 20 shows the effect of quality boosting with the original DDIM reverse process. Although the reverse process of DDIM has a nearly-perfect inversion property, we observe some noise by zooming in. Our quality boosting improves the quality of a sample and concurrently keeps nearly
525
+
526
+ ![](images/1434d974f30676869508e856aafe42dbc606c49aa0ad3a871abe5831d5d8d9ad.jpg)
527
+ Figure 20: Ablation study of quality boosting on the original DDIM process without Asyrp. Our quality boosting enhances fine details and prevents images from being noisy in the original DDIM process. Please zoom in for detailed comparison.
528
+
529
+ ![](images/c3c2bcb78752a1c696fd47a0788206292074dab31e50f5bcc13a4530d4914cd3.jpg)
530
+ Figure 21: Ablation study of quality boosting with Asyrp. Our quality boosting enhances fine details and prevents images from being noisy. Note that the source of degradation is DDIM process, not Asyrp, confirmed in Figure 20. Please zoom in for detailed comparison.
531
+
532
+ ![](images/9105ae3ff594358c3dd1ad873a025ed2c74b6b492fe058518f574f1ebe0cc84f.jpg)
533
+ Figure 22: Analyzing the effect of the hyperparameters The figure shows that the calculated parameter works effectively as the maximum boundary of editing while maintaining the quality of the image.
534
+
535
+ ![](images/067bbe65a525c781959e6f88a9e6ed2322b6ae14dd2301e761c08b57fdce7806.jpg)
536
+ Figure 23: Analyzing the effect of the hyperparameters We observe that the quality of results has robustness to $\gamma _ { t _ { \mathrm { b o o s t } } }$ , except for too large $\gamma _ { t _ { \mathrm { b o o s t } } }$ .
537
+
538
+ perfect inversion property. We observe that $t _ { \mathrm { b o o s t } }$ is not sensitive, but the larger interval brings the less preservation.
539
+
540
+ Figure 21 shows quality improvements by our quality boosting in Asyrp.
541
+
542
+ # I ALGORITHM
543
+
544
+ Figure 24 illustrates generative process. Algorithm 1 and 2 describe training algorithm and inference algorithm of Asyrp, respectively.
545
+
546
+ # J TRAINING DETAILS
547
+
548
+ # J.1 LOSS COEFFICIENTS
549
+
550
+ Table 3 reports loss coefficients for each attribute. $\lambda _ { \mathrm { { C L I P } } } \mathrm { { s } }$ near 0.8 are suitable for most in-domain attributes. For unseen domains, higher coefficient leads to more noticeable changes. Note that we use $\lambda _ { \mathrm { r e c o n } } = \mathbf { C } \mathbf { L } \mathbf { I } \mathbf { P }$ similarity $^ \ast 3$ which reduces L1 loss when an attribute needs a lot of change.
551
+
552
+ ![](images/4a4dfe0ce3ef126a67f1e86d022d8d15a8d17d09cceb878b5663ee16091daf9b.jpg)
553
+ Figure 24: Overview of our generative process.
554
+
555
+ J.2 TRAINING WITH RANDOM SAMPLING INSTEAD OF THE TRAINING DATASETS
556
+
557
+ Apparently, for training, inverting real-images can be replaced by random sampling. It refers to using $\mathbf { \boldsymbol { x } } _ { T } \sim \mathcal { N } ( 0 , \mathbf { I } )$ instead of $\begin{array} { r } { \pmb { x } _ { T } = \bar { q } ( \pmb { x } _ { 0 } ) \cdot \bar { \prod } _ { t = 1 } ^ { T } q \left( \pmb { x } _ { t } \mid \bar { \pmb { x } } _ { t - 1 } \right) } \end{array}$ where $\pmb { x } _ { 0 } \sim p _ { d a t a } ( x )$ . It allows us to train Asyrp only with the pretrained network and without extra dataset. Using random samples has tradeoff between preservation of contents and possible amount in editing. It take advantages when a target attribute requires large amount changes. We assume that the inversion of real-image is in the long tail of a Gaussian distribution because of realistic background or detailed clothes. On the other hand, random noise is considered to be closer to the mean of the normal, so it is easier to find directions. It can easily bring larger changes but also easily alter the contents. On the contrary, training with inversion shows the opposite property.
558
+
559
+ We train $\pmb { f } _ { t }$ with random sampling for attributes whose identity preservation is not important to take advantage of these properties. The rightmost column in Table 3 shows the choices.
560
+
561
+ # K EVALUATION
562
+
563
+ # K.1 USER STUDY
564
+
565
+ We conduct user study to compare the performance of Asyrp and DiffusionCLIP (Kim & Ye, 2021) on Celeba-HQ (Liu et al., 2015) and LSUN-church (Yu et al., 2015). We use official checkpoints provided by DiffusionCLIP except for some facial attributes whose checkpoint do not exist. We tried our best to tune their hyperparameters following the manual for fair comparison. Example images are shown in Figure 25-27.
566
+
567
+ We use smiling and sad for in-domain CelebA-HQ attributes, Pixar and Neanderthal for unseen-domain CelebA-HQ attributes, and department store, ancient, and wooden for LSUN-church.
568
+
569
+ In unseen domain and Lsun-church, we use official checkpoints provided by DiffusionCLIP. We also randomly select 8 images for each CelebA-HQ attribute and 12 images for each LSUN-church attribute.
570
+
571
+ We observe that DiffusionCLIP works better in changing the holistic style of images. At the same time, it is short of the ability to bring semantic changes and suffers noisy results and a lack of diversity. The problems would be caused by fine-tuning the whole diffusion model.
572
+
573
+ We use the following questions for the survey. 1) Quality: Which image quality do you think is better? (clear and less noisy) 2) Attribute: Which image do you think is “Attribute(e.g., Smiling) naturally”? 3) Overall: Which image do you think is better considering the above evaluation criteria?
574
+
575
+ # Algorithm 1: Editing(Inference)
576
+
577
+ Input: $x _ { 0 }$ (Input image), $\{ f _ { t } ^ { i } \} _ { i = 1 } ^ { M }$ (M Neural implicit functions for M attributes), $\{ c _ { i } \} _ { i = 1 } ^ { M }$ (user defined M scaling coefficients for M attributes), $\epsilon _ { \theta }$ (frozen pretrained model), $S _ { f o r }$ (# of inversion steps), $S _ { g e n }$ (# of inference steps), $t _ { \mathrm { e d i t } }$ (computed from $\ S 4 . 1$ ), tboost (computed from $\ S 4 . 2$ ) 1 Function Editor $( x _ { 0 } , \epsilon _ { \theta } , \{ c _ { i } \} _ { i = 1 } ^ { M } , S _ { f o r } , S _ { g e n } , * )$ : // step 1: Semantic encoding 2 Define $\{ \tau _ { s } \} _ { s = 1 } ^ { S _ { f o r } }$ s.t $\tau _ { 1 } = 0$ , $\tau _ { S _ { f o r } } = T$ 3 for $s = 1 , 2 , . . . , S _ { f o r } - 1$ do 4 $\epsilon \epsilon _ { \theta } ( x _ { \tau _ { s } } , \tau _ { s } )$ 5 $x _ { \tau _ { s + 1 } } = \sqrt { \alpha _ { \tau _ { s } } } x _ { \tau _ { s } } + \sqrt { 1 - \alpha _ { \tau _ { s } } } \epsilon$ 6 $\{ \tilde { \tau } _ { s } \} _ { s = 1 } ^ { S _ { g e n } }$ Mas.t $\tilde { \tau } _ { 1 } = 0$ a, $\tilde { \tau } _ { S _ { e d i t } } = t _ { e d i t }$ , $\tilde { \tau } _ { S _ { n o i s e } } = t _ { \mathrm { b o o s t } }$ and $\tilde { \tau } _ { S _ { g e n } } = T$ 7 $\tilde { x } _ { \tilde { \tau } _ { S _ { g e n } } } = x _ { \tilde { \tau } _ { S _ { f o r } } }$ 8 for $s = S _ { g e n } , S _ { g e n } - 1 , . . . , 2$ do // phase 1: editing 9 if $s \geq S _ { e d i t }$ then 10 Extract feature map $h _ { \tilde { \tau } _ { s } }$ from $\epsilon _ { \theta } ( \tilde { x } _ { \tilde { \tau } _ { s } } )$ 11 $\begin{array} { r l } & { \Delta h _ { \tilde { \tau } _ { s } } = \frac { S _ { f o r } } { S _ { g e n } } ( \sum _ { i = 1 } ^ { M } c _ { i } f _ { \tilde { \tau } _ { s } } ^ { i } ( h _ { \tilde { \tau } _ { s } } ) ) } \\ & { \tilde { \epsilon } = \epsilon _ { \theta } ( \tilde { x } _ { \tilde { \tau } _ { s } } | \Delta h _ { \tilde { \tau } _ { s } } ) } \\ & { \epsilon = \epsilon _ { \theta } ( \tilde { x } _ { \tilde { \tau } _ { s } } ) } \\ & { \sigma _ { \tilde { \tau } _ { s } } = 0 } \end{array}$ 12 13 14 // phase 2: denoising 15 else if $s \geq S _ { n o i s e }$ then 16 ϵ˜ = ϵ = ϵθ(˜xτ˜s ) 17 στ˜ = 0 // phase 3: quality boosting 18 else 19 $\begin{array} { r l } & { \quad \Big \lfloor \tilde { \epsilon } = \epsilon = \epsilon _ { \theta } ( \tilde { x } _ { \tilde { \tau } _ { s } } ) } \\ & { \quad \Big \lfloor \sigma _ { \tilde { \tau } _ { s } } = \sqrt { \left( 1 - \alpha _ { \tilde { \tau } _ { s } - 1 } \right) / \left( 1 - \alpha _ { \tilde { \tau } _ { s } } \right) } \sqrt { 1 - \alpha _ { \tilde { \tau } _ { s } } / \alpha _ { \tilde { \tau } _ { s } - 1 } } } \\ & { \quad z \sim N ( 0 , 1 ) } \\ & { \quad \tilde { x } _ { \tilde { \tau } _ { s - 1 } } = \sqrt { \alpha _ { \tilde { \tau } _ { s - 1 } } } \big ( \frac { \tilde { x } _ { \tilde { \tau } _ { s } } - \sqrt { 1 - \alpha _ { \tilde { \tau } _ { s } } } \tilde { \epsilon } } { \sqrt { \alpha _ { \tilde { \tau } _ { s } } } } \big ) + \sqrt { 1 - \alpha _ { \tilde { \tau } _ { s - 1 } } - \sigma _ { \tilde { \tau } _ { s } } ^ { 2 } } \epsilon + \sigma _ { \tilde { \tau } _ { s } } z } \end{array}$ 20 21 22
578
+
579
+ return $\tilde { x } _ { 0 }$ (manipulated image)
580
+
581
+ As for LSUN-church, we provide a set of four images at once and add a question: 3) Diversity: Which group do you think has a more diverse style? 4) Overall: Which image do you think is better considering the above evaluation criteria?
582
+
583
+ # K.2 SEGMENTATION CONSISTENCY AND DIRECTIONAL CLIP SIMILARITY
584
+
585
+ We compare Asyrp and DiffusionCLIP using directional CLIP similarity $( S _ { \mathrm { d i r } } )$ and segmentationconsistency (SC) following the protocols in DiffusionCLIP in Table 4 and Table 5. A pretrained CLIP (Radford et al., 2021) and segmentation models (Yu et al. (2018); Zhou et al. (2019; 2017); Lee et al. (2020)) are used to compute $S _ { \mathrm { d i r } }$ and SC, respectively. We choose three attributes (smiling, sad, tanned) for CelebA-HQ-in-domain, two attributes (Pixar,Neaderthal) for CelebA-HQunseen-domain and three attributes (department store, ancient, red brick) for LSUNchurch.
586
+
587
+ For a fair comparison, we use official checkpoints of DiffusionCLIP and provide scores of the attributes (tanned, red brick) following Kim & Ye (2021). Regarding attributes without the official checkpoints (smiling,sad), we train DiffusionCLIP by ourselves with the official code.
588
+
589
+ # Algorithm 2: Training Neural implicit function $f _ { t }$
590
+
591
+ Input: $\epsilon _ { \theta }$ (pretrained attribute), el), (sou $\{ x _ { 0 } ^ { ( i ) } \} _ { i = 1 } ^ { N }$ ages to preco(target text), te), (# $f _ { t }$ (Neural implicitinversion steps), nction of(# of $y _ { s r c }$ $y _ { t a r }$ $S _ { f o r }$ $K$ training epochs), $t _ { \mathrm { e d i t } }$ (computed from $\ S 4 . 1 \}$ , $t _ { \mathrm { b o o s t } }$ (computed from $\ S 4 . 2 )$ )
592
+
593
+ // step 1: Precompute latents
594
+ 1 Define $\{ \tau _ { s } \} _ { s = 1 } ^ { S _ { f o r } }$ s.t $\tau _ { 1 } = 0 , \tau _ { S _ { f o r } } = T$
595
+ 2 for $i = 1 , 2 , . . . , N$ do
596
+ 3 for $s = 1 , 2 , . . . , S _ { f o r } - 1$ do
597
+ 4 $\epsilon \epsilon _ { \theta } ( x _ { \tau _ { s } } ^ { ( i ) } , \bar { \tau _ { s } } )$
598
+ 5 $\begin{array} { r } { x _ { \tau _ { s + 1 } } ^ { ( i ) } = \sqrt { \alpha _ { \tau _ { s } } } x _ { \tau _ { s } } ^ { ( i ) } + \sqrt { 1 - \alpha _ { \tau _ { s } } } \epsilon } \end{array}$ 6 Save the latent x(i)τSf or
599
+
600
+ 7 $\tau _ { S _ { e d i t } } = t _ { e d i t }$ // step 2: Update $\pmb { f } _ { t }$ 8 for ep ${ \varkappa } h { = 1 , 2 , . . . , K }$ do
601
+
602
+ $$
603
+ \begin{array} { r } { P = \frac { \tilde { x } _ { \tau _ { s } } ^ { ( i ) } - \sqrt { 1 - \alpha _ { \tau _ { s } } } \epsilon _ { \theta } \left( \tilde { x } _ { \tau _ { s } } ^ { ( i ) } | \Delta h _ { \tau _ { s } } \right) } { \sqrt { \alpha _ { \tau _ { s } } } } ; P _ { s r c } = \frac { x _ { \tau _ { s } } ^ { ( i ) } - \sqrt { 1 - \alpha _ { \tau _ { s } } } \epsilon _ { \theta } \left( x _ { \tau _ { s } } ^ { ( i ) } \right) } { \sqrt { \alpha _ { \tau _ { s } } } } } \end{array}
604
+ $$
605
+
606
+ $$
607
+ \begin{array} { r l } & { \tilde { x } _ { \tau _ { s - 1 } } ^ { ( i ) } = \sqrt { \alpha _ { \tau _ { s - 1 } } } P + \sqrt { 1 - \alpha _ { \tau _ { s - 1 } } } \epsilon _ { \theta } ( \tilde { x } _ { \tau _ { s } } ^ { ( i ) } ) } \\ & { x _ { \tau _ { s - 1 } } ^ { ( i ) } = \sqrt { \alpha _ { \tau _ { s - 1 } } } P _ { s r c } + \sqrt { 1 - \alpha _ { \tau _ { s - 1 } } } \epsilon _ { \theta } ( x _ { \tau _ { s } } ^ { ( i ) } ) } \end{array}
608
+ $$
609
+
610
+ $$
611
+ E _ { t o t a l } \lambda _ { C L I P } L _ { d i r e c t i o n } ( P , y _ { t a r } , P _ { s r c } , y _ { s r c } ) + \lambda _ { r e c o n } | P - P _ { s r c } |
612
+ $$
613
+
614
+ We use 100 samples per attribute. Asyrp outperforms DiffusionCLIP on $S _ { \mathrm { d i r } }$ for all attributes. On SC, DiffusionCLIP achieves better or competitive scores. Because DiffusionCLIP manipulates images mostly by focusing on texture or color while preserving structure and shape, it takes advantage of getting higher SC scores. However, in Figure 28, results of smiling show that it is not proper to edit attributes which require structural manipulation. Note that better SC scores do not guarantee better qualitative performance. Results of Pixar also show the similar tendency of each method. We allow more structural changes than DiffusionCLIP while editing. Lower SC of our method comes from desirable structural changes as shown in Figure 28.
615
+
616
+ $$
617
+ S _ { \mathrm { d i r } } \left( x _ { \mathrm { g e n } } , y _ { \mathrm { t a r } } ; x _ { \mathrm { r e f } } , y _ { \mathrm { r e f } } \right) : = \frac { \left. \Delta I , \Delta T \right. } { \left\| \Delta I \right\| \left\| \Delta T \right\| } ,
618
+ $$
619
+
620
+ # L DIRECTIONS
621
+
622
+ # L.1 GLOBAL DIRECTION
623
+
624
+ Figure 29 and Figure 30 show that the effects of mean direction and global direction are quite similar with $\Delta h _ { t }$ by $\mathbf { \Delta } f _ { t }$ in various attributes. We compute mean direction and global direction from 20 different images.
625
+
626
+ We argue that $h$ -space is roughly homogeneous across samples and timesteps. However, we observe that $h$ -space is not completely independent to the conditions especially on unseen-domain (See Figure 29). Note that unseen-domains require a longer editing interval with small $t _ { \mathrm { e d i t } }$ . Therefore, we conjecture that the consistency of $h$ -space decreases at the end of the generative process. It is supported by additional experiments that L2 distance between $\Delta h _ { t }$ and global direction gradually increases along with timesteps. We leave a more detailed analysis on $h$ -space at different timesteps as a future work.
627
+
628
+ Table 3: The coefficients range from 0.5 to 0.8 for in-domain attributes. Unseen domains need slightly stronger $\lambda _ { \mathrm { { C L I P } } } \mathrm { { s } }$ . We also report which attributes we train with random noise sampling. The criterion is which attributes require relatively less maintenance of identity. We use $\lambda _ { \mathrm { { r e c o n } } } =$ CLIP similarity $^ \ast 3$ which reduces L1 loss when an attribute needs a lot of change.
629
+
630
+ <table><tr><td>Dataset</td><td>src_txt</td><td>trg_txt</td><td>XCLIP</td><td>Xrecon</td><td>from random noise</td></tr><tr><td rowspan="18">CelebA-HQ</td><td>Person</td><td>Young person</td><td>0.8</td><td>0.905*3</td><td>X</td></tr><tr><td>Face</td><td>Smiling face</td><td>0.8</td><td>0.899*3</td><td>X</td></tr><tr><td>Face</td><td>Sad face</td><td>0.8</td><td>0.894*3</td><td>X</td></tr><tr><td>Face</td><td>Angry face</td><td>0.8</td><td>0.892*3</td><td>X</td></tr><tr><td>Face</td><td>Tanned face</td><td>0.8</td><td>0.886*3</td><td>X</td></tr><tr><td>Face</td><td>Disgusted face</td><td>0.8</td><td>0.880*3</td><td>X</td></tr><tr><td>Person</td><td>Person with makeup</td><td>0.8</td><td>0.875*3</td><td>X</td></tr><tr><td>Person Photo</td><td>Person with curly hair</td><td>0.8</td><td>0.835*3</td><td>X</td></tr><tr><td></td><td>Self-portrait by Frida Kahlo</td><td>0.5</td><td>0.4433</td><td>0</td></tr><tr><td>Human</td><td>Zombie</td><td>0.6</td><td>0.868*3</td><td>0</td></tr><tr><td>Person</td><td>Nicolas Cage</td><td>0.8</td><td>0.710*3</td><td>0</td></tr><tr><td>Human Photo</td><td>Painting in the style of Pixar</td><td>0.8</td><td>0.667*3</td><td>0</td></tr><tr><td>Human</td><td>Painting in Modigliani style</td><td>0.8</td><td>0.565*3</td><td>0</td></tr><tr><td rowspan="6">LSUN-church</td><td>Church</td><td>Neanderthal Gothic church</td><td>1.2</td><td>0.802*3</td><td>0</td></tr><tr><td>Church</td><td>Temple</td><td>0.8</td><td>0.912*3</td><td>0</td></tr><tr><td>Church</td><td>Department store</td><td>0.8</td><td>0.898*3</td><td>0</td></tr><tr><td>Church</td><td>Wooden house</td><td>0.8</td><td>0.841*3</td><td>0</td></tr><tr><td>Church</td><td>Ancient traditional Asian tower</td><td>0.8 0.8</td><td>0.793*3</td><td>0</td></tr><tr><td>Church</td><td>Red brick wall Church</td><td>0.8</td><td>0.784*3 0.774*3</td><td>0</td></tr><tr><td></td><td>Church</td><td>Factory</td><td>0.8</td><td>0.702*3</td><td>0</td></tr><tr><td rowspan="2">LSUN-bedroom</td><td>Bedroom</td><td>Princess bedroom</td><td>1.5</td><td>0.912*3</td><td>0 0</td></tr><tr><td>Bedroom</td><td>Hotel bedroom</td><td>1.5</td><td>0.917*3</td><td></td></tr><tr><td rowspan="4">AFHQ-dog</td><td>Dog</td><td>Happy dog</td><td></td><td></td><td>0</td></tr><tr><td>Dog</td><td>Sleepy dog</td><td>1.5</td><td>0.883*3</td><td>0</td></tr><tr><td>Dog</td><td></td><td>1.5</td><td>0.866*3</td><td>0</td></tr><tr><td>Dog</td><td>Wolf Yorkshire terrier</td><td>1.7</td><td>0.850*3</td><td>0</td></tr><tr><td rowspan="3">METFACES</td><td>Painting of a person</td><td>Painting of a Sad person</td><td>2 1.5</td><td>0.690*3 0.921*3</td><td>0 X</td></tr><tr><td>Painting of a person</td><td>Painting of a Smiling person</td><td>1.5</td><td>0.908*3</td><td>X</td></tr><tr><td>Painting of a person</td><td>Painting of a Disgusted person</td><td>1.5</td><td>0.879*3</td><td>X</td></tr></table>
631
+
632
+ Table 4: Quantitative evaluation on CelebA-HQ.
633
+
634
+ <table><tr><td rowspan="2"></td><td colspan="6">CelebA-HQ-in-domain</td><td colspan="4">CelebA-HQ-unseen-domain</td></tr><tr><td colspan="2">Smiling</td><td colspan="2">Sad</td><td colspan="2">Tanned</td><td colspan="2">Pixar</td><td colspan="2">Neanderthal</td></tr><tr><td></td><td>Sdir</td><td>SC</td><td>Sdir</td><td>SC</td><td>Sdir</td><td>SC</td><td>Sdir</td><td>SC</td><td>Sdir</td><td>SC</td></tr><tr><td>Asyrp (ours)</td><td>0.921</td><td>89.02%</td><td>0.964</td><td>88.90%</td><td>0.991</td><td>85.71%</td><td>0.956</td><td>76.51%</td><td>0.805</td><td>79.03</td></tr><tr><td>DiffusionCLIP</td><td>0.813</td><td>91.41%</td><td>0.760</td><td>89.93%</td><td>0.888</td><td>92.85%</td><td>0.811</td><td>89.91%</td><td>0.661</td><td>81.23%</td></tr></table>
635
+
636
+ ![](images/c2cf22d51b44b51faa69e1a51e8e027ba84a40344d50621d1a284856a9eb758c.jpg)
637
+ Figure 25: Asyrp vs. DiffusionCLIP on CelebA-HQ in-domain attributes. We observe that DiffusionCLIP struggles to change semantic facial attributes. Their official checkpoints do not exist and we ran careful hyperparameter tuning for training.
638
+
639
+ ![](images/06f561db0257bb962e8c406afb37da80494f09913966d224a12c97e0991f5899.jpg)
640
+ Figure 26: Asyrp vs. DiffusionCLIP on CelebA-HQ unseen-domain attributes. We use the official checkpoint provided by DiffusionCLIP. Asyrp works well even for the unseen-domains.
641
+
642
+ Table 5: Quantitative evaluation on LSUN-church.
643
+
644
+ <table><tr><td rowspan="2"></td><td colspan="5">LSUN_church</td></tr><tr><td>Department store</td><td></td><td>ancient</td><td></td><td>red brick</td></tr><tr><td></td><td>Sdir</td><td>SC</td><td>Sdir</td><td>SC</td><td>Sdir</td><td>SC</td></tr><tr><td>Asyrp (ours)</td><td>0.778</td><td>57.62%</td><td>0.943</td><td>62.65%</td><td>0.989</td><td>65.83%</td></tr><tr><td>DIffusionCLIP</td><td>0.661</td><td>54.50%</td><td>0.907</td><td>64.82%</td><td>0.964</td><td>65.02%</td></tr></table>
645
+
646
+ ![](images/e6959cd9188841bfcc00b46aeed46d7800c43970a4f909834f9efccdda44607a.jpg)
647
+ Figure 27: Asyrp vs. DiffusionCLIP on LSUN-church. Note that we use the official checkpoint provided by DiffusionCLIP. We observe DiffusionCLIP produces narrow range of styles while Asyrp produces diverse styles.
648
+
649
+ # L.2 COMPARE THREE METHODS
650
+
651
+ In this section, we compare three methods: implicit neural direction $f _ { t }$ , optimized $\Delta h _ { t }$ , and optimized ∆hglobal.
652
+
653
+ Training time $f _ { t } \approx \Delta h ^ { g l o b a l } < \Delta h _ { t }$
654
+
655
+ We have to optimize each $\Delta h _ { t }$ for each time step $t$ . Additionally, it needs specific hyperparameters for each $\Delta h _ { t }$ , e.g., higher learning rates for larger $t$ . On the contrary, time-consuming for $f _ { t }$ is similar to optimizing ∆hglobal.
656
+
657
+ # Quality
658
+
659
+ $f _ { t }$ and $\Delta h _ { t }$ , where directions can be obtained for each timestep, have the best quality. As can be shown in Figure 10, $\Delta h ^ { g l o b a l }$ is sometimes accompanied by slight differences in hair, etc.
660
+
661
+ Extensibility $f _ { t } > \Delta h _ { t } > \Delta h ^ { g l o b a l }$
662
+
663
+ ![](images/4bcaa6683a66fe5dc47e975b0ea521a3cef4e214da2c1f2d293b268e362cc228.jpg)
664
+ Figure 28: Example segmentations for computing segmentation-consistency (SC).
665
+
666
+ $\Delta h _ { t }$ can be obtained from $f _ { t }$ , and $\Delta h ^ { g l o b a l }$ can be obtained by aggregating $\Delta h _ { t }$ .
667
+ We opt to use $f _ { t }$ for above three advantages.
668
+
669
+ # M RANDOM SAMPLING
670
+
671
+ We conduct extra experiments: generating images with target attributes using Asyrp not from inversion but from random Gaussian noises. As a consequence, the generative process can be used for conditional random sampling. We provide the results in Figure 31. However, it is beyond the scope of this paper.
672
+
673
+ ![](images/03e1b521e960c51738ecc1ae3c6697bcf45be2371c9a8ab319c4542be8d594bf.jpg)
674
+ Figure 29: We compute mean direction and global direction from 20 other images on CelebAHQ. The effect of mean direction and global direction are quite similar with $\Delta h _ { t }$ by $f _ { t }$ at diverse attributes.
675
+
676
+ ![](images/94795dd3dafb5d37e50068f7124646c932ba91d53b723f68b82fcc14beab1bf8.jpg)
677
+ Figure 30: We obtain mean direction and global direction from 20 other images on LSUN-church. The effect of mean direction and global direction are quite similar with $\Delta h _ { t }$ by $f _ { t }$ at diverse attributes.
678
+
679
+ ![](images/6eb1c92e476116c392feb38047e039fb60ec3d76570c709ea5ec47a32b19d996.jpg)
680
+ Figure 31: Uncurated random sampling. We generate images from random noise with Asyrp. Although we do not focus on these results, Asyrp can be used for conditional sampling.
681
+
682
+ # N MORE SAMPLES
683
+
684
+ # N.1 IMAGENET
685
+
686
+ We conduct extra experiments: editing images with target class using Asyrp with ImageNet pretrained model. We verified that models trained on large datasets, such as ImageNet, can be edited using Asyrp. However, we also observed that in this case the latent space is not partitioned by classes. For an orange, we have different latents for a single orange, for many oranges, for a cross-section of cut orange, and for a single piece of orange. Therefore, we learned the implicit function by collecting similar images to find the direction.
687
+
688
+ ![](images/774272204ff4ad42b215ddad0f822037c3a70d6b9b02276bd89a0e47fea88d21.jpg)
689
+ Figure 32: Result of Asyrp in ImageNet. The result shows that Asyrp works even in ImageNet dataset.
690
+
691
+ # N.2 MULTI-INTERPOLATION
692
+
693
+ Figure 33 provides mixed interpolation between multiple attributes. We observe that any interpolation with any attribute is possible.
694
+
695
+ # N.3 MORE RESULTS ON ALL DATASETS
696
+
697
+ We provide more results on CelebA-HQ (Figure 34), LSUN-church (Figure 35), AFHQ, LSUNbedroom, METFACES (Figure 36).
698
+
699
+ ![](images/b9bf01755a1cba0600b8b0a808d391a7b78c8c875350410552a6a08c44d09b8a.jpg)
700
+ $\Delta h$ of smiling and young.
701
+
702
+ ![](images/e936bdacea2d549661e4189967aeb6d92e07c0baab9c7e9b2fce8aea9a2adbf3.jpg)
703
+
704
+ ![](images/377b9520a7229fe39d63b39397e4df0928ea29df4c7531e407e9ec506cc84359.jpg)
705
+ Figure 34: We provide more results on CelebA-HQ dataset.
706
+
707
+ ![](images/23c8ad00b208a9a83c86351a6572870e2502164c093437e52becf10d8cf7b5ae.jpg)
708
+ Figure 35: We provide more results on LSUN-church dataset.
709
+
710
+ ![](images/01bb6a5ce5257428dc08aae084bd10e960340eda2d2141d0c31b80453e60a4df.jpg)
711
+ Figure 36: We provide more results on AFHQ, LSUN-bedroom and METFACES datasets respectively.
md/dev/plKu2GByCNW/plKu2GByCNW.md ADDED
Binary file (80.3 kB). View file
 
md/dev/qHGCH75usg/qHGCH75usg.md ADDED
@@ -0,0 +1,348 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # BYOL-Explore: Exploration by Bootstrapped Prediction
2
+
3
+ Zhaohan Daniel Guo∗ DeepMind danielguo@deepmind.com
4
+
5
+ Shantanu Thakoor∗ DeepMind
6
+
7
+ Miruna Pîslar∗ DeepMind
8
+
9
+ Bernardo Avila Pires∗ DeepMind
10
+
11
+ Florent Altché∗ DeepMind
12
+
13
+ Corentin Tallec∗ DeepMind
14
+
15
+ Alaa Saade DeepMind
16
+
17
+ Daniele Calandriello DeepMind
18
+
19
+ Jean-Bastien Grill DeepMind
20
+
21
+ Yunhao Tang DeepMind
22
+
23
+ Michal Valko DeepMind
24
+
25
+ Rémi Munos DeepMind
26
+
27
+ Mohammad Gheshlaghi Azar∗ DeepMind mazar@deepmind.com
28
+
29
+ Bilal Piot∗
30
+ DeepMind
31
+ piot@deepmind.com
32
+
33
+ # Abstract
34
+
35
+ We present BYOL-Explore, a conceptually simple yet general approach for curiosity-driven exploration in visually-complex environments. BYOL-Explore learns a world representation, the world dynamics, and an exploration policy alltogether by optimizing a single prediction loss in the latent space with no additional auxiliary objective. We show that BYOL-Explore is effective in DM-HARD-8, a challenging partially-observable continuous-action hard-exploration benchmark with visually-rich 3-D environments. On this benchmark, we solve the majority of the tasks purely through augmenting the extrinsic reward with BYOL-Explore’s intrinsic reward, whereas prior work could only get off the ground with human demonstrations. As further evidence of the generality of BYOL-Explore, we show that it achieves superhuman performance on the ten hardest exploration games in Atari while having a much simpler design than other competitive agents.
36
+
37
+ # 1 Introduction
38
+
39
+ Exploration is essential to reinforcement learning (RL) [67], especially when extrinsic rewards are sparse or hard to reach. In rich environments, the variety of meaningful directions of exploration makes it impractical to visit everything. Thus, the question becomes: how can an agent determine which parts of the environment are interesting to explore? One promising paradigm to address this challenge is curiosity-driven exploration. It consists of (i) learning a predictive model of some information about the world, called a world model, and (ii) using discrepancies between predictions of the world model and real experience to build intrinsic rewards [59, 66, 60, 34, 51, 52, 2]. An RL agent optimizing these intrinsic rewards drives itself towards states where the world model is incorrect or imperfect, generating new trajectories on which the world model can be improved. In other words, the properties of the world model influence the quality of the exploration policy, which in turn gathers new data to shape the world model itself. Thus, it can be important not to treat learning the world model and learning the exploratory policy as two separate problems, but instead altogether as a single joint problem to solve.
40
+
41
+ In this paper, we present BYOL-Explore, a curiosity-driven exploration algorithm whose appeal resides in its conceptual simplicity, generality, and high performance. BYOL-Explore learns a world model with a self-supervised prediction loss, and uses the same loss to train a curiosity-driven policy, thus using a single learning objective to solve both the problem of building the world model’s representation and the curiosity-driven policy. Our approach builds upon Bootstrap Your Own Latent (BYOL), a latent-predictive self-supervised method which predicts an older copy of its own latent representation. This bootstrapping mechanism has already been successfully applied in computer vision [20, 56], graph representation learning [71], and representation learning in RL [24, 62]. However, the latter works focus primarily on using the world-model for representation learning in RL whereas BYOL-Explore takes this one step further, and not only learns a versatile world model but also uses the world model’s loss to drive exploration.
42
+
43
+ We evaluate BYOL-Explore on DM-HARD-8 [22], a suite of 8 complex first-person-view 3-D tasks with sparse rewards. These tasks demand efficient exploration since in order to reach the final goal and obtain the reward they require completing a sequence of precise, orderly interactions with the physical objects in the environment, unlikely to happen under a vanilla random exploration strategy (see Fig. 2 and the videos in supplementary materials). To show the generality of our method we also evaluate BYOL-Explore on the ten hardest exploration Atari games [5]. In all these domains, BYOL-Explore outperforms other prominent curiosity-driven exploration methods, such as Random Network Distillation (RND) [8] and Intrinsic Curiosity Module (ICM) [51]. In DM-HARD-8, BYOL-Explore achieves human-level performance in the majority of the tasks using only the extrinsic reward augmented with BYOL-Explore’s intrinsic reward, whereas previously significant progress required human demonstrations [22]. Remarkably, BYOL-Explore achieves this performance using only a single world model and a single policy network concurrently trained across all tasks. Finally, as further evidence of its generality, BYOL-Explore achieves superhuman performance in the ten hardest exploration Atari games [5] while having a simpler design than other competitive agents, such as Agent57 [3, 4] and Go-Explore [14, 15].2
44
+
45
+ # 2 Related Work
46
+
47
+ There is a large body of research in building world models either for planning [66, 63, 27, 26, 61], representation learning [62, 24, 41, 19] or curiosity-driven exploration [59, 68, 60, 34, 51, 52, 2, 63, 21, 65]. Most works consider world models that predict the entire observations [58, 48, 16, 19], which necessitates a loss in pixel space when observations are visually complex images. Some works have considered predicting latent representations, whether they are random projections [7, 8], or learned representations from a separate model, such as an inverse dynamics model [51] or an auto-encoder [25, 7]. Finally, some RL works [61] have focused on predicting lower-dimensional quantities such as the extrinsic reward, the action-selection policy, and the value function to build a world model.
48
+
49
+ Our BYOL-Explore’s world model operates in latent space and uses the same loss both for representation and intrinsic reward, simplifying and unifying representation learning and exploration. BYOL-Explore’s world model is derived from recent self-supervised representation learning methods [20, 56, 55, 71] and is similar to the ones in self-supervised RL [62, 24]. These previous works focused on the benefit of shaping representations for policy learning and have not looked into exploration. We build on this previous work to show that we can take the impact of a good representation technique further and use it to drive exploration.
50
+
51
+ While our approach belongs to the curiosity-driven exploration paradigm [50, 42, 49, 59, 5, 68, 60, 34, 51, 52, 2, 63], other exploration paradigms have also been proposed. The maximum entropy paradigms try to steer the agent to a desired distribution of states (or state-action pairs) that maximizes the entropy of visited states [29, 69, 70, 23]. The goal-conditioned paradigm has the agent set its own goal to drive exploration [57, 1, 17, 75, 47, 12, 82, 28, 15, 54, 80, 53]. The reward-free exploration paradigm consists of training an agent to explore the environment such that it would be able to produce a near-optimal policy for any possible reward function [37, 39, 45, 78, 74, 9, 79, 81].
52
+
53
+ # 3 Method
54
+
55
+ Our agent has three components: a self-supervised latent-predictive world-model called BYOL-Explore, a generic reward normalization and prioritization scheme, and an off-the-shelf RL agent that can optionally share its own representation with BYOL-Explore’s world model.
56
+
57
+ # 3.1 Background and Notation
58
+
59
+ We consider a discrete-time interaction process [44, 35, 36, 13] between an agent and its environment where, at each time step $t \in \mathbb { N }$ , the agent receives an observation $o _ { t } \in \mathcal { O }$ and generates an action $a _ { t } \in \mathcal A$ . We consider an environment with stochastic dynamics $p : \mathcal { H } \times \mathcal { A } \to \Delta _ { \mathcal { O } } { } ^ { 3 }$ that maps a history of past observations-actions and a current action to a probability distribution over future observations. More precisely, the space of past observations-actions is $\textstyle { \mathcal { H } } = \bigcup _ { t \in \mathbb { N } } { \mathcal { H } } _ { t }$ where $\mathcal { H } _ { 0 } = \mathcal { O }$ and $\forall t \in \mathbb { N } ^ { * }$ , $\mathcal { H } _ { t + 1 } = \mathcal { H } _ { t } \times \mathcal { A } \times \mathcal { O }$ . We consider policies $\pi : \mathcal { H } \to \Delta _ { \mathcal { A } }$ that maps a history of past observations-actions to a probability distribution over actions. Finally, an extrinsic reward function $r _ { e } : \mathcal { H } \times \mathcal { A } \to \mathbb { R }$ maps a history of past observations-actions to a real number.
60
+
61
+ # 3.2 Latent-Predictive World Model
62
+
63
+ BYOL-Explore world model is a multi-step predictive world model operating at the latent level. It is inspired by the self-supervised learning method BYOL in computer vision and adapted to interactive environments (see Section 3.1). Similar to BYOL, BYOL-Explore model trains an online network using targets generated by an exponential moving average (EMA) target network. However, BYOL obtains its targets by applying different augmentations to the same observation as the online representation, whereas BYOL-Explore model gets its targets from future observations processed by an EMA of the online network, with no hand-crafted augmentation. Also BYOL-Explore model, uses a recurrent neural network (RNN) [33, 11] to build the agent state, i.e., the state of RNN, from the history of observations, whereas the original BYOL only uses a feed-forward network for encoding the observations. In the remainder of this section, we will explain: (i) how the online network builds future predictions, (ii) how targets for our predictions are obtained through a target network, (iii) the loss used to train the online network, and (iv) how we compute the uncertainties of the world model.
64
+
65
+ ![](images/251b7a67c8e00dfa9444926ace11278eaed6048ccceb567ed3262c7d80eb775b.jpg)
66
+ Figure 1: BYOL-Explore’s Neural Architecture (see main text for details).
67
+
68
+ (i) Future Predictions. The online network is composed of an encoder $f _ { \theta }$ that transforms an observation $o _ { t }$ into an observation-representation $f _ { \theta } ( o _ { t } ) \in \mathbb { R } ^ { N }$ , where $N \in \mathbb { N } ^ { * }$ is the embedding size. The observation-representation $f _ { \theta } ( o _ { t } )$ is then fed alongside the previous action $a _ { t - 1 }$ to a RNN cell $h _ { \theta } ^ { c }$ that is referred as the close-loop RNN cell. It computes a representation $b _ { t } \in \mathbb { R } ^ { M }$ of the history $h _ { t } \in \mathcal { H } _ { t }$ seen so far as $b _ { t } = h _ { \theta } ^ { c } ( { \bar { b } } _ { t - 1 } , a _ { t - 1 } , f _ { \theta } ( o _ { t } ) )$ , where $M \in \mathbb { N } ^ { * }$ is the size of the history-representation. Then, the history-representation $b _ { t }$ is used to initialize an open-loop RNN cell $h _ { \theta } ^ { o }$ that outputs open-loop representations $( b _ { t , k } \in \mathbb { R } ^ { M } ) _ { k = 1 } ^ { K - 1 }$ as $b _ { t , k } = h _ { \theta } ^ { o } ( b _ { t , k - 1 } , a _ { t + k - 1 } )$ where $b _ { t , 0 } = b _ { t }$ and $K$ is the open-loop horizon. The role of the open-loop RNN cell is to simulate future history-representations while observing only the future actions. Finally, the open-loop representation $b _ { t , k }$ is fed to a predictor $g _ { \theta }$ to output the open-loop prediction $g _ { \theta } ( b _ { t , k } ) \dot { } \in \mathbb { R } ^ { N }$ at time $t + k$ that plays the role of our future prediction at time $t + k$ .
69
+
70
+ (ii) Targets and Target Network. The target network is an observation encoder $f _ { \phi }$ whose parameters are an EMA of the online network’s parameters $\theta$ . It outputs targets $f _ { \phi } ( o _ { t + k } ) \in \mathbb { R } ^ { N }$ that are used to train the online network. After each training step, the target network’s weights are updated via an EMA update $\phi \alpha \phi + ( 1 - \alpha ) \theta$ where $\alpha$ is the target network EMA parameter. A sketch of the neural architecture is provided in Fig. 1, with more details in App. A.
71
+
72
+ (iii) Online Network Loss Function. Suppose our RL agent collected a batch of trajectories $\left( ( o _ { t } ^ { j } , a _ { t } ^ { j } ) _ { t = 0 } ^ { T - 1 } \right) _ { j = 0 } ^ { B - 1 }$ , where $T \in \mathbb { N } ^ { * }$ is the trajectory length and $B \in \mathbb { N } ^ { * }$ is the batch size. Then, the loss $\mathcal { L } _ { \mathtt { B Y O L - E x p l o r e } } ( \theta )$ to minimize is defined as the average cosine distance between the open-loop future predictions $g _ { \theta } ( b _ { t , k } ^ { j } )$ and their respective targets $f _ { \phi } ( o _ { t + k } ^ { j } )$ at time $t + k$ :
73
+
74
+ $$
75
+ \begin{array} { r l } & { \mathcal { L } _ { \mathtt { B Y 0 L - E x p l o r e } } ( \theta , j , t , k ) = \bigg \| \frac { g _ { \theta } ( b _ { t , k } ^ { j } ) } { \| g _ { \theta } ( b _ { t , k } ^ { j } ) \| _ { 2 } } - \mathrm { s g } \left( \frac { f _ { \phi } ( o _ { t + k } ^ { j } ) } { \| f _ { \phi } ( o _ { t + k } ^ { j } ) \| _ { 2 } } \right) \bigg \| _ { 2 } ^ { 2 } , } \\ & { \mathcal { L } _ { \mathtt { B Y 0 L - E x p l o r e } } ( \theta ) = \frac { 1 } { B ( T - 1 ) } \displaystyle \sum _ { j = 0 } ^ { B - 1 } \sum _ { t = 0 } ^ { T - 2 } \frac { 1 } { K ( t ) } \sum _ { k = 1 } ^ { K ( t ) } \mathcal { L } _ { \mathtt { B Y 0 L - E x p l o r e } } ( \theta , j , t , k ) , } \end{array}
76
+ $$
77
+
78
+ where $K ( t ) = \operatorname* { m i n } ( K , T - 1 - t )$ is the valid open-loop horizon for a trajectory of length $T$ and sg is the stop-gradient operator.
79
+
80
+ (iv) World Model Uncertainties The uncertainty associated to the transition $( o _ { t } ^ { j } , a _ { t } ^ { j } , o _ { t + 1 } ^ { j } )$ is the sum of the corresponding prediction losses:
81
+
82
+ $$
83
+ \ell _ { t } ^ { j } = \sum _ { p + q = t + 1 } \mathcal { L } _ { \mathtt { B Y O L - E x p l o r e } } ( \theta , j , p , q ) ,
84
+ $$
85
+
86
+ where $0 \leq p \leq T - 2 , 1 \leq q \leq K$ and $0 \leq t \leq T - 2$ . This accumulates all the losses corresponding to the world-model uncertainties relative to the observation $o _ { t + 1 } ^ { j }$ . Thus, a timestep receives intrinsic reward based on how difficult its observation was to predict from past partial histories.
87
+
88
+ Intuition on why BYOL-Explore learns a meaningful representation. The intuition behind BYOL-Explore is similar in spirit to the one behind BYOL. In early training, the target network is initialized randomly, and so BYOL-Explore’s online network and the closed-loop RNN are trained to predict random features of the future. This encourages the online observation representation to capture information that is useful to predict the future. This information is then distilled into the target observation encoder network through the EMA slow copy mechanism. In turn, these features become targets for the online network and predicting them can further improve the quality of the online representation. For further theoretical and empirical insights on why the bootstrap latent methods learn non-trivial representations see, e.g., [72, 76].
89
+
90
+ # 3.3 Reward Normalization and Prioritization Scheme
91
+
92
+ Reward Normalization. We use the world model uncertainties $\ell _ { t } ^ { j }$ to generate an intrinsic reward. To counter the non-stationarity of the uncertainties duringnormalization scheme as RND [8] and divide the raw rewards $( ( \ell _ { t } ^ { j } ) _ { t = 0 } ^ { T - 2 } ) _ { j = 0 } ^ { B - 1 }$ adopt the same reward by an EMA estimate of their standard deviation $\sigma _ { r }$ . The normalized rewards are $\ell _ { t } ^ { j } / \sigma _ { r }$ . Details are provided in App. A.3.
93
+
94
+ Reward Prioritization. In addition to normalizing the rewards, we can optionally prioritize them by optimizing only the rewards with highest uncertainties and nullifying rewards with the lowest uncertainties. Because of the transient nature of the intrinsic rewards, this allows the agent to focus first on parts of the environment where the model is not accurate. Later on, if the previously nullified rewards remain, they will naturally become the ones with highest uncertainties and be optimized. This mechanism allows the agent to optimize only the source of high uncertainties and not optimize all ℓ/σrthe successive batch of normalized rewards ((ℓ jt /σr)T −2t=0 )B−1j=0 . We use µℓ/σr as a clipping threshold sources of uncertainties at once. To do so, let us denote by the adjusted EMA mean relative to role of intrinsic reward is: $r _ { i , t } ^ { j } = \mathrm { \ i n a x } ( \ell _ { t } ^ { j } / \sigma _ { r } - \mu _ { \ell / \sigma _ { r } } , 0 )$ ·
95
+
96
+ # 3.4 Generic RL Algorithm and Representation Sharing
97
+
98
+ BYOL-Explore can be used in conjunction with any RL algorithm for training the policy. In addition to providing an intrinsic reward, BYOL-Explore can further be used to shape the representation learnt by the RL agent by directly sharing some components of the BYOL-Explore world model with the RL model. For instance, consider a recurrent agent composed of an encoder $f _ { \psi }$ , an RNN cell $h _ { \psi } ^ { c }$ , a policy head $\pi _ { \psi }$ and a value head $v _ { \psi }$ that are shaped by an RL loss. Then, we can share the weights $\theta$ of the BYOL-Explore world model and the weights $\psi$ of the RL model at the level of the encoder and the RNN cell: $f _ { \psi } = f _ { \theta }$ and $h _ { \theta } ^ { c } = h _ { \psi } ^ { c }$ and let the joint representation be trained via both the RL loss and BYOL-Explore. In our experiments, we will show results for both the shared and unshared settings. Architectural details are provided in Appendix A.
99
+
100
+ # 4 Experiments
101
+
102
+ We evaluate the algorithms on benchmark task-suites known to contain hard exploration challenges. These benchmarks have different properties in terms of the complexity of the observations, partial observability, and procedural generation, allowing us to test the generality of our approach.
103
+
104
+ Atari Learning Environment [6]. This is a widely used RL benchmark, comprising approximately 50 Atari games. These are 2-D, fully-observable, (fairly) deterministic environments for most of the games but have a very long optimization horizon (episodes last for an average of 10000 steps) and complex observations (preprocessed greyscale images which are $8 4 \times 8 4$ byte arrays). We select the 10 hardest exploration games [5] to conduct our experiments: Alien, Freeway, Gravitar, Hero, Montezuma’s Revenge, Pitfall, Private Eye, Qbert, Solaris and Venture.
105
+
106
+ Hard-Eight Suite [22]. This benchmark comprises 8 hard exploration tasks, originally built to emphasize the difficulties encountered by an RL agent when learning from sparse rewards in a procedurally-generated 3-D world with partial observability, continuous control, and highly variable initial conditions. Each task requires the agent to interact with specific objects in its environment in order to reach a large apple that provides reward (see Fig. 2). Being procedurally-generated, properties such as object shapes, colors, and positions are different every episode. We provide videos in the supplementary materials to ground the difficulty of these tasks. Note that the current best RL agents that solve these tasks require a small (but non-zero) amount of human expert demonstrations. Without demonstrations or reward shaping, state-of-the-art deep RL algorithms, such as R2D2 [38], do not get positive reward signal on any of the tasks. In our case, we train a single RL agent and a single world model to tackle the 8 tasks all-together, making for a challenging multi-task setting.
107
+
108
+ # 4.1 Experimental Setup
109
+
110
+ At a high level, BYOL-Explore has 4 main hyper-parameters: the target network EMA parameter $\alpha$ , the open-loop horizon $K$ , choosing to clip rewards and to share the BYOL-Explore representation with the RL network. To better understand what part of BYOL-Explore is essential to perform well, we run 4 ablations. Each ablation corresponds to BYOL-Explore where only one hyper-parameter has been changed. The 4 ablations are namely Fixed-targets where the target network EMA parameter is set to $\alpha = 1$ , Horizon $= I$ where the horizon is set to $K = 1$ , No clipping where we do not use clipping for the intrinsic rewards and No sharing where we trained separately the RL network and the
111
+
112
+ ![](images/932deb368a2b969fb4332d7348a1d1834dd425e53f32d12d55cef6d41bae26e2.jpg)
113
+ Figure $2 \colon 1 ^ { \mathrm { s t } }$ -person-view snapshots of the human player solving Baseball task. They are ordered chronologically from left to right and top to bottom. Each image depicts a specific stage of the task.
114
+
115
+ BYOL-Explore’s world model. In addition to BYOL-Explore, we also run as prominent baselines RND, ICM (see App. B for details), and pure RL which is an RL agent only using extrinsic rewards.
116
+
117
+ Finally, we run experiments on two different evaluation regimes. The first regime uses a mixed reward function $\boldsymbol { r } _ { t } = \boldsymbol { r } _ { e , t } + \lambda \boldsymbol { r } _ { i , t }$ which is a linear combination of the normalized extrinsic rewards ${ r } _ { e , t }$ and intrinsic rewards computed by the agent ${ r } _ { i , t }$ with mixing parameter $\lambda$ . This may be the most important regime for a practitioner as we can see if our intrinsic rewards help improve performance, with respect to the extrinsic rewards, compared to the pure RL agent. The second regime is fully self-supervised where only the intrinsic reward ${ \boldsymbol { r } } _ { i , t }$ is optimized. This regime gives us a sense of how pure exploration methods perform in complex environments.
118
+
119
+ Choice of RL algorithm. We use VMPO [64] as our RL algorithm. VMPO is an efficient on-policy optimization method that has achieved strong results across both discrete and continuous control tasks, and is thus applicable to all of the domains we consider. Further details regarding the RL algorithm setup and hyperparameters are provided in Appendix C.
120
+
121
+ Performance Metrics. We evaluate performance in terms of the agent score at a number of observations/frames $t$ , $\mathtt { A g e n t } _ { \mathtt { s c o r e } } ( t )$ , as measured by undiscounted episode return. The number of frames $t$ corresponds to all the frames generated by all the actors by interacting with the environment, even the skipped ones. Frames/observations can be skipped if there is an action repeat which is the case in Atari where the action repeat is of 4.
122
+
123
+ We define the highest agent score through training as Agentscore $\begin{array} { r } { \mathsf { A g e n t } _ { \mathsf { s c o r e } } = \operatorname* { m a x } _ { t } \mathsf { A g e n t } _ { \mathsf { s c o r e } } ( t ) } \end{array}$ , as done in [18, 3]. We define, for each game, the Human Normalized Score (HNS) at number of frame $t$ : $\begin{array} { r } { \mathtt { H N S } ( t ) = \frac { \mathtt { A g e n t } _ { \mathtt { s c o r e } } ( t ) - \mathtt { R a n d o m } _ { \mathtt { s c o r e } } } { \mathtt { H u m a n } _ { \mathtt { s c o r e } } - \mathtt { R a n d o m } _ { \mathtt { s c o r e } } } } \end{array}$ as well as the HNS over the whole training: $\mathrm { H N S } = \operatorname* { m a x } _ { t } \mathrm { H N S } ( t )$ . A HNS higher than 1 means superhuman performance on a specific task. We similarly define the CHNS Score as HNS clipped between 0 and 1.
124
+
125
+ # 4.2 Atari Results
126
+
127
+ In these experiments, we set the target EMA rate $\alpha = 0 . 9 9$ and open-loop horizon $K = 8$ . We use $\lambda = 0 . 1$ to combine the intrinsic and extrinsic rewards. We follow the classical 30 random no-ops evaluation regime [46, 73], and average performance over 10 episodes and over 3 seeds. This evaluation regime does not use sticky actions [43].
128
+
129
+ Fig. 3 (left) shows that BYOL-Explore is almost superhuman on the 10-hardest exploration games and outperforms the different baselines of RND, ICM, and pure RL. Fig. 3 (right) compares BYOL-Explore against its ablations to gain finer insights into our method. The No clipping ablation performs comparably, showing that the prioritization of intrinsic rewards is not necessary on Atari tasks. Similarly, the Horizon $= I$ ablation performs slightly better, indicating that simply predicting one-step latents is sufficient to explore efficiently on the fully-observable Atari tasks. The Fixed Targets ablation performs much worse, showing that our approach of predicting learned targets (rather than fixed random projections) is vital for good performance. It is also worth noting that all the ablations except Fixed Targets outperform all of our baselines, demonstrating the robustness of our approach.
130
+
131
+ ![](images/61d84e312001e1672c9edb8a0ecfa8dfc8333f5793e0c49bcdd04bd44aa788ae.jpg)
132
+ Figure 3: Mean ${ \mathrm { C H N S } } ( t )$ score across the tasks in Atari. Left: BYOL-Explore and the baselines in the mixed regime for Atari. Right: BYOL-Explore and its ablations in the mixed regime.
133
+
134
+ Finally, because the Horizon $= I$ ablation was close to superhuman on Atari, we run the same configuration but double the length of the sequences on which we train from 64 to 128 (also doubling memory requirements while learning). With this small adjustment, this agent (BYOL-Explore (big)) becomes superhuman on all of the 10-hardest exploration games.
135
+
136
+ Purely intrinsic exploration. We test how BYOL-Explore behaves when only given intrinsic rewards without any extrinsic signal on the well-known Montezuma’s Revenge game. We measure exploratory behavior in terms of the number of different rooms of the dungeon the agent is able to explore over its lifetime. Note that accessing later rooms requires navigating complex dynamics such as collecting keys to open doors, avoiding enemies, and carefully traversing rooms filled with traps such as timed lasers. Figure 4 shows how much room coverage is achieved during training when no extrinsic reward is used, showing that BYOL-Explore explores further than the best result reported by RND [8]. Importantly, we use the episodic setting for intrinsic rewards whereas the published RND results considers the non-episodic setting for intrinsic rewards — facilitating exploration as the agent is less risk-averse. Therefore, our setting could be considered even more challenging. Our agent explores more than 20 rooms on average versus 17 with best published RND results. As expected in the episodic setting, our RND re-implementation visits even fewer rooms. However, we can reproduce the published RND results in the episodic setting when using recurrent policies.
137
+
138
+ ![](images/602168114186732a46f414d3b974cd2961d2aa62284309ea2ec414eef6d9e5ff.jpg)
139
+ Figure 4: Number of rooms visited in Montezuma’s Revenge during training in the self-supervised regime over 3 seeds.
140
+
141
+ Further results. More fine-grained results are reported in App D.1. We report, in Fig.11 and in Fig.12, the agent scores learning curves for each game. Tab. 1 and Tab. 2 have agent score at the end of training. Finally, Tab. 3 and Tab. 4 show the mean CHNS and different statistics (mean and percentiles) of the HNS across the selected games. An interesting finding from examining the HNS is that clipping and longer-horizon predictions are critical for very high scores on some games such as Montezuma’s Revenge or Hero. BYOL-Explore has a median HNS of 331.98 compared to the No-clipping ablation and the Horizon $= I$ which have a median HNS of only 181.39 and 199.80 respectively. Therefore, while clipping is not necessary to get to human-level performance, it is still crucial to achieve top performance. We also provide further results regarding the pure exploration setting on all 10 games in App. D.2.
142
+
143
+ # 4.3 Atari’s results in the Presence of Stochastic Distractors
144
+
145
+ Stochastic distractors or noise are well known to break intrinsic curiosity methods based on prediction error of future frames. This is because the prediction squared-error loss of a future frame has an irreducible component which corresponds to the variance of the future frame distribution [51, 52]. However, because BYOL-Explore is not a prediction error method at the frame-level but at the latent level, we can hope that some noise present in the frame can be removed from the latent embedding. More specifically, we hypothesize that BYOL-Explore removes noisy features of the frame that are not useful to minimize the BYOL-Explore loss in order to better minimize this loss. Those are features that are not useful for future predictions. On the other hand, since RND uses a random network to build it targets, RND by construction cannot actively remove noisy features from its targets. To better show this, we slightly changed the Atari environment to generate noisy frames. More precisely, the new observation is made of two parts of the same size $( 8 4 \times 8 4 )$ , on the right side we have noise and on the left we have the original Atari image. Each time the no-op action is chosen by the agent, a new noise is sampled. The noise is composed of $1 4 \times 1 4$ blocks of $6 \times 6$ pixels. Each block of pixel is assigned a uniform random value between 0 and 255 if a new noise is sampled. We provide a frame of this modified Atari environment in Fig. 5 (left).
146
+
147
+ ![](images/207a18fbbb5afd39782a04d8f763f648f128de373924bc788f9014a5e6b65424.jpg)
148
+ Figure 5: Experiments on noisy Atari. Left: Noisy Atari environment. Right: Learning curves in terms of agent score for BYOL-Explore and RND for noisy and normal Atari on Montezuma’s Revenge, averaged over 10 episodes and 3 seeds.
149
+
150
+ We train BYOL-Explore and RND on this noisy and normal version of Atari on the game Montezuma’s revenge (we do not include a comparison with ICM because it was already not performing well in the normal version). To get better results for BYOL-Explore, we increase the predictor to have 3 hidden layers of 512 instead of 1 hidden layer of 256. The results are reported in Fig. 5 (right). We observe that BYOL-Explore is perfectly able to deal with that type of controllablenoise whereas RND is not and completely flat-lined in the noisy environment because the agent is attracted to the noise and keeps repeating the no-op action.
151
+
152
+ # 4.4 DM-HARD-8 Results
153
+
154
+ In these experiments, we set the target EMA rate $\alpha = 0 . 9 9$ and open-loop horizon $K = 1 0$ . We use $\lambda = 0 . 0 1$ to combine the intrinsic and extrinsic rewards. In contrast to prior work [22], we perform experiments in the more challenging multi-task regime, training a single agent to solve all eight tasks. At the beginning of each episode, a task is drawn uniformly at random from the suite.
155
+
156
+ In Fig. 6 (left) we report the mean ${ \mathrm { C H N S } } ( t )$ across the tasks, averaged over 3 seeds. We see that BYOL-Explore outperforms the baselines of RND, ICM, and pure RL by a large margin. Fig. 6 (right) compares the performance of BYOL-Explore to its various ablations. Note that the No-clipping ablation performs similarly to BYOL-Explore in terms of CHNS. However, unlike the fully-observable Atari tasks, the Horizon $= I$ ablation learns considerably slower and achieves lower final performance (see also our extended ablations on the horizon length in Fig. 15 in App. D.3). We note once again that the BYOL-Explore bootstrapping mechanism for learning representations is essential, as confirmed by the poor performance of the Fixed-targets ablation. Due to computational limitations, we did not run the No Sharing ablation, as using separate networks requires twice the memory.
157
+
158
+ ![](images/91391ea48e9e309e906440fb46da4049dad3e38f147d5754fbced15af99278fe.jpg)
159
+ Figure 6: Mean CHNS $( t )$ score across the tasks in the DM-HARD-8 suite. Left: BYOL-Explore against baselines: ICM, RND and Pure RL. Right: BYOL-Explore against various ablations.
160
+
161
+ We now analyze our method more closely by examining per-task performance. The full learning curves for each task can be found in Fig. 7 for BYOL-Explore and the main baselines and in Appendix D.3 (see Fig. 14) for the various ablations. First, we take note that other curiosity-driven methods (ICM and RND) cannot get any positive score on the majority of the DM-HARD-8 tasks, even with additional hyperparameter tuning and reward prioritizing (see Fig. 17 and Fig. 18 in App. D.3).
162
+
163
+ In contrast, we see that BYOL-Explore achieves strong performance on five out of the eight hard exploration tasks. Importantly, BYOL-Explore achieves this without human demonstrations, which was not the case in prior work [22]. BYOL-Explore even surpasses humans on 4 tasks, namely Navigate cubes, Throw-across, Baseball, and Wall Sensors (see Tab. 9 in App. D.3 for details). Most impressively, BYOL-Explore can solve Throw-across, which is a challenging task even for a skilful human player and was not solvable in prior work without collecting additional successful human demonstrations [22].
164
+
165
+ Interestingly, note that on the Navigate Cubes task, both RND and the Fixed-targets ablation achieve maximum performance alongside BYOL-Explore. We argue that this is because the prediction of random projections (either at the same step as done by RND or multi-step as done by BYOL-Explore) leads to the policy learned performing spatial, navigational exploration — this is the kind of behavior required to explore well on the Navigate Cubes task. In contrast, the other tasks require exploratory behavior involving interaction with objects and the use of tools, where both RND and the Fixed-targets ablation fail. Finally, we observe that two games, namely Remember Sensor and Push Blocks, are particularly challenging, where all of our considered methods perform poorly. We hypothesize that this is due to the larger variety of procedurally generated objects spawned in these levels, and the need to remember previous cues in the environment leading to a hard credit assignment problem.
166
+
167
+ Purely intrinsic exploration. Each of the DM-HARD-8 tasks has complex dynamics and object interactions, making it difficult to assess qualitatively the behavior of purely intrinsically motivated exploration. Nevertheless, for completeness, we provide results of BYOL-Explore trained only with intrinsic rewards in App. D.3, showing that it does achieve some positive signal on the Drawbridge and Wall Sensor tasks (see Fig. 19).
168
+
169
+ # 5 Conclusion
170
+
171
+ We showed that BYOL-Explore is a simple curiosity-driven exploration method that achieves excellent performance on hard exploration tasks with fairly deterministic dynamics. BYOL-Explore is a multi-step prediction error method at the latent level that relies on recent advances in self-supervised learning to train its representation as well as its world-model without any additional loss. In Atari, BYOL-Explore achieves superhuman performance on the 10-hardest exploration games while being of much simpler design than other superhuman agents. Moreover, BYOL-Explore substantially outperforms previous exploration methods on DM-HARD-8 navigation and manipulation tasks in a 3-D, multi-task, partially-observable and procedurally-generated environment. This shows the generality of our algorithm to handle either 2-D or 3-D, single or multi-task, fully or partially-observable environments. While one main limitation of our algorithm is that it is not designed to fully handle stochasticity in environments (e.g. sticky actions), we show that BYOL-Explore is robust to some simple kinds of controllable noise (’TV-noise’) since operating in latent space allows the latent representation to filter it out.
172
+
173
+ ![](images/278d864438d5904eb60e8773b2aed29ab8d698728a512371c1e326da0fd5b617.jpg)
174
+ Figure 7: Agent’s score for each task in the DM-HARD-8 suite for BYOL-Explore against baselines. Shaded areas correspond to the minimum and maximum values across three seeds.
175
+
176
+ In the future, we would like to improve performance in DM-HARD-8 and to demonstrate the generality of our method by extending it to other domains. In DM-HARD-8, we believe we can improve performance by scaling up the world model and finding better ways to trade off exploration and exploitation. Beyond DM-HARD-8, there are opportunities to tackle further challenges, most notably highly-stochastic and procedurally-generated environment dynamics such as NetHack [40]. To do so, we are investigating different mechanisms to adapt prediction-based methods to stochastic environments in order to only use the epistemic uncertainty as an intrinsic reward and discard the aleatoric uncertainty.
177
+
178
+ # Acknowledgments and Disclosure of Funding
179
+
180
+ We would like to thank Abbas Abdolmaleki, Arunkumar Byravan, Adrià Puidomenech Badia, Tim Harley, Steven Kapturowski, Thomas Keck, Jean-Baptiste Lespiau, Kat McKinney, Kyriacos Nikiforou, Georg Ostrovski, Razvan Pascanu, Doina Precup, Satinder Singh, Hubert Soyer, Pablo Sprechmann, and Karl Tuyls for their support and advice in developing and publishing this work.
181
+
182
+ References
183
+ [1] Marcin Andrychowicz, Filip Wolski, Alex Ray, Jonas Schneider, Rachel Fong, Peter Welinder, Bob McGrew, Josh Tobin, Pieter Abbeel, and Wojciech Zaremba. Hindsight experience replay. In Advances in neural information processing systems, pages 5048–5058, 2017.
184
+ [2] Mohammad Gheshlaghi Azar, Bilal Piot, Bernardo Avila Pires, Jean-Bastien Grill, Florent Altché, and Rémi Munos. World discovery models. arXiv preprint arXiv:1902.07685, 2019.
185
+ [3] Adrià Puigdomènech Badia, Bilal Piot, Steven Kapturowski, Pablo Sprechmann, Alex Vitvitskyi, Zhaohan Daniel Guo, and Charles Blundell. Agent57: Outperforming the atari human benchmark. In International Conference on Machine Learning, pages 507–517. PMLR, 2020.
186
+ [4] Adrià Puigdomènech Badia, Pablo Sprechmann, Alex Vitvitskyi, Daniel Guo, Bilal Piot, Steven Kapturowski, Olivier Tieleman, Martin Arjovsky, Alexander Pritzel, Andrew Bolt, and Charles Blundell. Never give up: Learning directed exploration strategies. In International Conference on Learning Representations, 2020.
187
+ [5] Marc Bellemare, Sriram Srinivasan, Georg Ostrovski, Tom Schaul, David Saxton, and Remi Munos. Unifying count-based exploration and intrinsic motivation. In Advances in neural information processing systems, pages 1471–1479, 2016.
188
+ [6] Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47:253–279, 2013.
189
+ [7] Yuri Burda, Harri Edwards, Deepak Pathak, Amos Storkey, Trevor Darrell, and Alexei A Efros. Large-scale study of curiosity-driven learning. arXiv preprint arXiv:1808.04355, 2018.
190
+ [8] Yuri Burda, Harrison Edwards, Amos Storkey, and Oleg Klimov. Exploration by random network distillation. In Seventh International Conference on Learning Representations, pages 1–17, 2019.
191
+ [9] Xiaoyu Chen, Jiachen Hu, Lin F Yang, and Liwei Wang. Near-optimal reward-free exploration for linear mixture mdps with plug-in solver. arXiv preprint arXiv:2110.03244, 2021.
192
+ [10] Kyunghyun Cho, Bart Van Merriënboer, Dzmitry Bahdanau, and Yoshua Bengio. On the properties of neural machine translation: Encoder-decoder approaches. arXiv preprint arXiv:1409.1259, 2014.
193
+ [11] Junyoung Chung, Caglar Gulcehre, KyungHyun Cho, and Yoshua Bengio. Empirical evaluation of gated recurrent neural networks on sequence modeling. arXiv preprint arXiv:1412.3555, 2014.
194
+ [12] Cédric Colas, Pierre Fournier, Mohamed Chetouani, Olivier Sigaud, and Pierre-Yves Oudeyer. Curious: intrinsically motivated modular multi-goal reinforcement learning. In International conference on machine learning, pages 1331–1340. PMLR, 2019.
195
+ [13] Mayank Daswani, Peter Sunehag, and Marcus Hutter. Q-learning for history-based reinforcement learning. In Asian Conference on Machine Learning, pages 213–228. PMLR, 2013.
196
+ [14] Adrien Ecoffet, Joost Huizinga, Joel Lehman, Kenneth O Stanley, and Jeff Clune. Go-explore: a new approach for hard-exploration problems. arXiv preprint arXiv:1901.10995, 2019.
197
+ [15] Adrien Ecoffet, Joost Huizinga, Joel Lehman, Kenneth O Stanley, and Jeff Clune. First return, then explore. Nature, 590(7847):580–586, 2021.
198
+ [16] Chelsea Finn, Ian Goodfellow, and Sergey Levine. Unsupervised learning for physical interaction through video prediction. Advances in neural information processing systems, 29, 2016.
199
+ [17] Carlos Florensa, David Held, Xinyang Geng, and Pieter Abbeel. Automatic goal generation for reinforcement learning agents. In International Conference on Machine Learning, pages 1515–1528, 2018.
200
+
201
+ [18] Meire Fortunato, Mohammad Gheshlaghi Azar, Bilal Piot, Jacob Menick, Ian Osband, Alex Graves, Vlad Mnih, Remi Munos, Demis Hassabis, Olivier Pietquin, et al. Noisy networks for exploration. arXiv preprint arXiv:1706.10295, 2017.
202
+
203
+ [19] Karol Gregor, Danilo Jimenez Rezende, Frederic Besse, Yan Wu, Hamza Merzic, and Aaron van den Oord. Shaping belief states with generative environment models for rl. Advances in Neural Information Processing Systems, 32, 2019.
204
+
205
+ [20] Jean-Bastien Grill, Florian Strub, Florent Altché, Corentin Tallec, Pierre Richemond, Elena Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, et al. Bootstrap your own latent-a new approach to self-supervised learning. Advances in Neural Information Processing Systems, 33:21271–21284, 2020.
206
+
207
+ [21] Oliver Groth, Markus Wulfmeier, Giulia Vezzani, Vibhavari Dasagi, Tim Hertweck, Roland Hafner, Nicolas Heess, and Martin Riedmiller. Is curiosity all you need? on the utility of emergent behaviours from curious exploration. arXiv preprint arXiv:2109.08603, 2021.
208
+
209
+ [22] Caglar Gulcehre, Tom Le Paine, Bobak Shahriari, Misha Denil, Matt Hoffman, Hubert Soyer, Richard Tanburn, Steven Kapturowski, Neil Rabinowitz, Duncan Williams, et al. Making efficient use of demonstrations to solve hard exploration problems. In International conference on learning representations, 2019.
210
+
211
+ [23] Zhaohan Daniel Guo, Mohammad Gheshlagi Azar, Alaa Saade, Shantanu Thakoor, Bilal Piot, Bernardo Avila Pires, Michal Valko, Thomas Mesnard, Tor Lattimore, and Rémi Munos. Geometric entropic exploration. arXiv preprint arXiv:2101.02055, 2021.
212
+
213
+ [24] Zhaohan Daniel Guo, Bernardo Avila Pires, Bilal Piot, Jean-Bastien Grill, Florent Altché, Rémi Munos, and Mohammad Gheshlaghi Azar. Bootstrap latent-predictive representations for multitask reinforcement learning. In International Conference on Machine Learning, pages 3875–3886. PMLR, 2020.
214
+
215
+ [25] David Ha and Jürgen Schmidhuber. World models. arXiv preprint arXiv:1803.10122, 2018.
216
+
217
+ [26] Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. arXiv preprint arXiv:1912.01603, 2019.
218
+
219
+ [27] Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In International conference on machine learning, pages 2555–2565. PMLR, 2019.
220
+
221
+ [28] Kristian Hartikainen, Xinyang Geng, Tuomas Haarnoja, and Sergey Levine. Dynamical distance learning for semi-supervised and unsupervised skill discovery. In International Conference on Learning Representations, 2020.
222
+
223
+ [29] Elad Hazan, Sham Kakade, Karan Singh, and Abby Van Soest. Provably efficient maximum entropy exploration. In International Conference on Machine Learning, pages 2681–2691, 2019.
224
+
225
+ [30] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
226
+
227
+ [31] Matteo Hessel, Manuel Kroiss, Aidan Clark, Iurii Kemaev, John Quan, Thomas Keck, Fabio Viola, and Hado van Hasselt. Podracer architectures for scalable reinforcement learning. arXiv preprint arXiv:2104.06272, 2021.
228
+
229
+ [32] Matteo Hessel, Hubert Soyer, Lasse Espeholt, Wojciech Czarnecki, Simon Schmitt, and Hado van Hasselt. Multi-task deep reinforcement learning with popart. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 3796–3803, 2019.
230
+
231
+ [33] Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural computation, 9(8):1735–1780, 1997.
232
+
233
+ [34] Rein Houthooft, Xi Chen, Yan Duan, John Schulman, Filip De Turck, and Pieter Abbeel. Variational information maximizing exploration. Advances in Neural Information Processing Systems (NIPS), 2016.
234
+ [35] Marcus Hutter. Universal artificial intelligence: Sequential decisions based on algorithmic probability. Springer Science & Business Media, 2004.
235
+ [36] Marcus Hutter et al. Feature reinforcement learning: Part I. unstructured MDPs. De Gruyter Open, 2009.
236
+ [37] Chi Jin, Akshay Krishnamurthy, Max Simchowitz, and Tiancheng Yu. Reward-free exploration for reinforcement learning. In International Conference on Machine Learning, pages 4870–4879. PMLR, 2020.
237
+ [38] Steven Kapturowski, Georg Ostrovski, John Quan, Remi Munos, and Will Dabney. Recurrent experience replay in distributed reinforcement learning. In International conference on learning representations, 2018.
238
+ [39] Emilie Kaufmann, Pierre Ménard, Omar Darwiche Domingues, Anders Jonsson, Edouard Leurent, and Michal Valko. Adaptive reward-free exploration. In Algorithmic Learning Theory, pages 865–891. PMLR, 2021.
239
+ [40] Heinrich Küttler, Nantas Nardelli, Alexander Miller, Roberta Raileanu, Marco Selvatici, Edward Grefenstette, and Tim Rocktäschel. The nethack learning environment. Advances in Neural Information Processing Systems, 33:7671–7684, 2020.
240
+ [41] Michael Laskin, Aravind Srinivas, and Pieter Abbeel. Curl: Contrastive unsupervised representations for reinforcement learning. In International Conference on Machine Learning, pages 5639–5650. PMLR, 2020.
241
+ [42] Manuel Lopes, Tobias Lang, Marc Toussaint, and Pierre-Yves Oudeyer. Exploration in modelbased reinforcement learning by empirically estimating learning progress. In Advances in neural information processing systems, pages 206–214, 2012.
242
+ [43] Marlos C Machado, Marc G Bellemare, Erik Talvitie, Joel Veness, Matthew Hausknecht, and Michael Bowling. Revisiting the arcade learning environment: Evaluation protocols and open problems for general agents. Journal of Artificial Intelligence Research, 61:523–562, 2018.
243
+ [44] R Andrew McCallum. Instance-based utile distinctions for reinforcement learning with hidden state. In Machine Learning Proceedings 1995, pages 387–395. Elsevier, 1995.
244
+ [45] Pierre Ménard, Omar Darwiche Domingues, Anders Jonsson, Emilie Kaufmann, Edouard Leurent, and Michal Valko. Fast active learning for pure exploration in reinforcement learning. In International Conference on Machine Learning, pages 7599–7608. PMLR, 2021.
245
+ [46] Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. nature, 518(7540):529–533, 2015.
246
+ [47] Ashvin V Nair, Vitchyr Pong, Murtaza Dalal, Shikhar Bahl, Steven Lin, and Sergey Levine. Visual reinforcement learning with imagined goals. Advances in Neural Information Processing Systems, 31:9191–9200, 2018.
247
+ [48] Junhyuk Oh, Xiaoxiao Guo, Honglak Lee, Richard L Lewis, and Satinder Singh. Actionconditional video prediction using deep networks in atari games. Advances in neural information processing systems, 28, 2015.
248
+ [49] Pierre-Yves Oudeyer and Frederic Kaplan. What is intrinsic motivation? a typology of computational approaches. Frontiers in neurorobotics, 1:6, 2009.
249
+ [50] Pierre-Yves Oudeyer, Frédéric Kaplan, and Véréna Hafner. Intrinsic Motivation for Autonomous Mental Development. IEEE Transactions on Evolutionary Computation, 11(2):265–286, January 2007.
250
+
251
+ [51] Deepak Pathak, Pulkit Agrawal, Alexei A Efros, and Trevor Darrell. Curiosity-driven exploration by self-supervised prediction. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops, pages 16–17, 2017.
252
+
253
+ [52] Deepak Pathak, Dhiraj Gandhi, and Abhinav Gupta. Self-supervised exploration via disagreement. In International Conference on Machine Learning, pages 5062–5071. PMLR, 2019.
254
+
255
+ [53] Silviu Pitis, Harris Chan, Stephen Zhao, Bradly Stadie, and Jimmy Ba. Maximum entropy gain exploration for long horizon multi-goal reinforcement learning. In International Conference on Machine Learning, pages 7750–7761. PMLR, 2020.
256
+
257
+ [54] Vitchyr Pong, Murtaza Dalal, Steven Lin, Ashvin Nair, Shikhar Bahl, and Sergey Levine. Skew-fit: State-covering self-supervised reinforcement learning. In International Conference on Machine Learning, pages 7783–7792. PMLR, 2020.
258
+
259
+ [55] Adria Recasens, Pauline Luc, Jean-Baptiste Alayrac, Luyu Wang, Florian Strub, Corentin Tallec, Mateusz Malinowski, Viorica Patr ˘ aucean, Florent Altché, Michal Valko, et al. Broaden ˘ your views for self-supervised video learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 1255–1265, 2021.
260
+
261
+ [56] 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. In NeurIPS 2020 Workshop on Self-Supervised Learning: Theory and Practice, 2020.
262
+
263
+ [57] Tom Schaul, Daniel Horgan, Karol Gregor, and David Silver. Universal value function approximators. In International conference on machine learning, pages 1312–1320, 2015.
264
+
265
+ [58] Juergen Schmidhuber and Rudolf Huber. Learning to generate artificial fovea trajectories for target detection. International Journal of Neural Systems, 2(01n02):125–134, 1991.
266
+
267
+ [59] Jürgen Schmidhuber. Curious model-building control systems. In Proc. international joint conference on neural networks, pages 1458–1463, 1991.
268
+
269
+ [60] Jürgen Schmidhuber. Formal theory of creativity, fun, and intrinsic motivation (1990–2010). IEEE transactions on autonomous mental development, 2(3):230–247, 2010.
270
+
271
+ [61] Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, Laurent Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, et al. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 588(7839):604–609, 2020.
272
+
273
+ [62] Max Schwarzer, Ankesh Anand, Rishab Goel, R Devon Hjelm, Aaron Courville, and Philip Bachman. Data-efficient reinforcement learning with self-predictive representations. arXiv preprint arXiv:2007.05929, 2020.
274
+
275
+ [63] Ramanan Sekar, Oleh Rybkin, Kostas Daniilidis, Pieter Abbeel, Danijar Hafner, and Deepak Pathak. Planning to explore via self-supervised world models. In International Conference on Machine Learning, pages 8583–8592. PMLR, 2020.
276
+
277
+ [64] H Francis Song, Abbas Abdolmaleki, Jost Tobias Springenberg, Aidan Clark, Hubert Soyer, Jack W Rae, Seb Noury, Arun Ahuja, Siqi Liu, Dhruva Tirumala, et al. V-mpo: On-policy maximum a posteriori policy optimization for discrete and continuous control. arXiv preprint arXiv:1909.12238, 2019.
278
+
279
+ [65] Sumedh A Sontakke, Arash Mehrjou, Laurent Itti, and Bernhard Schölkopf. Causal curiosity: Rl agents discovering self-supervised experiments for causal representation learning. In International Conference on Machine Learning, pages 9848–9858. PMLR, 2021.
280
+
281
+ [66] Yi Sun, Faustino Gomez, and Jürgen Schmidhuber. Planning to be surprised: Optimal bayesian exploration in dynamic environments. In International conference on artificial general intelligence, pages 41–51. Springer, 2011.
282
+
283
+ [67] Richard Sutton and Andrew Barto. Reinforcement Learning: An Introduction. MIT Press, 1998.
284
+
285
+ [68] Haoran Tang, Rein Houthooft, Davis Foote, Adam Stooke, Xi Chen, Yan Duan, John Schulman, Filip DeTurck, and Pieter Abbeel. # exploration: A study of count-based exploration for deep reinforcement learning. In Advances in neural information processing systems, pages 2753–2762, 2017.
286
+
287
+ [69] Jean Tarbouriech and Alessandro Lazaric. Active exploration in markov decision processes. In The 22nd International Conference on Artificial Intelligence and Statistics, pages 974–982, 2019.
288
+
289
+ [70] Jean Tarbouriech, Shubhanshu Shekhar, Matteo Pirotta, Mohammad Ghavamzadeh, and Alessandro Lazaric. Active model estimation in markov decision processes. In Conference on Uncertainty in Artificial Intelligence, pages 1019–1028. PMLR, 2020.
290
+
291
+ [71] Shantanu Thakoor, Corentin Tallec, Mohammad Gheshlaghi Azar, Mehdi Azabou, Eva L Dyer, Remi Munos, Petar Velickovi ˇ c, and Michal Valko. Large-scale representation learning on graphs ´ via bootstrapping. In International Conference on Learning Representations, 2022.
292
+
293
+ [72] Yuandong Tian, Xinlei Chen, and Surya Ganguli. Understanding self-supervised learning dynamics without contrastive pairs. In International Conference on Machine Learning, pages 10268–10278. PMLR, 2021.
294
+
295
+ [73] Hado Van Hasselt, Arthur Guez, and David Silver. Deep reinforcement learning with double q-learning. In Proceedings of the AAAI conference on artificial intelligence, volume 30, 2016.
296
+
297
+ [74] Ruosong Wang, Simon S Du, Lin Yang, and Russ R Salakhutdinov. On reward-free reinforcement learning with linear function approximation. In Advances in Neural Information Processing Systems, volume 33, pages 17816–17826, 2020.
298
+
299
+ [75] David Warde-Farley, Tom Van de Wiele, Tejas Kulkarni, Catalin Ionescu, Steven Hansen, and Volodymyr Mnih. Unsupervised control through non-parametric discriminative rewards. In International Conference on Learning Representations, 2019.
300
+
301
+ [76] Zixin Wen and Yuanzhi Li. The mechanism of prediction head in non-contrastive self-supervised learning. arXiv preprint arXiv:2205.06226, 2022.
302
+
303
+ [77] Yuxin Wu and Kaiming He. Group normalization. In Proceedings of the European conference on computer vision (ECCV), pages 3–19, 2018.
304
+
305
+ [78] Andrea Zanette, Alessandro Lazaric, Mykel J Kochenderfer, and Emma Brunskill. Provably efficient reward-agnostic navigation with linear value iteration. In Advances in Neural Information Processing Systems, volume 33, pages 11756–11766, 2020.
306
+
307
+ [79] Weitong Zhang, Dongruo Zhou, and Quanquan Gu. Reward-free model-based reinforcement learning with linear function approximation. Advances in Neural Information Processing Systems, 34, 2021.
308
+
309
+ [80] Yunzhi Zhang, Pieter Abbeel, and Lerrel Pinto. Automatic curriculum learning through value disagreement. In Advances in Neural Information Processing Systems, pages 7648–7659, 2020.
310
+
311
+ [81] Zihan Zhang, Simon Du, and Xiangyang Ji. Near optimal reward-free reinforcement learning. In International Conference on Machine Learning, pages 12402–12412. PMLR, 2021.
312
+
313
+ [82] Rui Zhao, Xudong Sun, and Volker Tresp. Maximum entropy-regularized multi-goal reinforcement learning. In International Conference on Machine Learning, pages 7553–7562, 2019.
314
+
315
+ # Checklist
316
+
317
+ 1. For all authors...
318
+
319
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
320
+ (b) Did you describe the limitations of your work? [Yes]
321
+ (c) Did you discuss any potential negative societal impacts of your work? [No]
322
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
323
+
324
+ 2. If you are including theoretical results...
325
+
326
+ (a) Did you state the full set of assumptions of all theoretical results? [N/A] We are not including theoretical results.
327
+ (b) Did you include complete proofs of all theoretical results? [N/A] We are not including theoretical results.
328
+
329
+ 3. If you ran experiments...
330
+
331
+ (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] The code is proprietary
332
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We specify the main training details in the paper and we include a full list of hyperparameters description in the appendix.
333
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] We report error bars in learning curves of the agent score for every agent we run.
334
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We include all the information regarding the compute in the appendix.
335
+
336
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
337
+
338
+ (a) If your work uses existing assets, did you cite the creators? [Yes] We use the ALE and DM-HARD-8 and we cite the creators.
339
+ (b) Did you mention the license of the assets? [N/A]
340
+ (c) Did you include any new assets either in the supplemental material or as a URL? [No]
341
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
342
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
343
+
344
+ 5. If you used crowdsourcing or conducted research with human subjects...
345
+
346
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] We did not use crowdsourcing.
347
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] We did not use crowdsourcing.
348
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] We did not use crowdsourcing.
md/dev/qQuzhbU3Gto/qQuzhbU3Gto.md ADDED
@@ -0,0 +1,322 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AN INTERPRETABLE GRAPH GENERATIVE MODEL WITH HETEROPHILY
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Many models for graphs fall under the framework of edge-independent dot product models. These models output the probabilities of edges existing between all pairs of nodes, and the probability of a link between two nodes increases with the dot product of vectors associated with the nodes. Recent work has shown that these models are unable to capture key structures in real-world graphs, particularly heterophilous structures, wherein links occur between dissimilar nodes. We propose the first edge-independent graph generative model that is a) expressive enough to capture heterophily, b) produces nonnegative embeddings, which allow link predictions to be interpreted in terms of communities, and c) optimizes effectively on realworld graphs with gradient descent on a cross-entropy loss. Our theoretical results demonstrate the expressiveness of our model in its ability to exactly reconstruct a graph using a number of clusters that is linear in the maximum degree, along with its ability to capture both heterophily and homophily in the data. Further, our experiments demonstrate the effectiveness of our model for a variety of important application tasks such as multi-label clustering and link prediction.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Graphs naturally arise in data from a variety of fields including sociology (Mason & Verwoerd, 2007), biology (Scott, 1988), and computer networking (Bonato, 2004). A key underlying task in machine learning for graph data is forming models of graphs which can predict edges between nodes, form useful representations of nodes, and reveal interpretable structure in the graph, such as detecting clusters of nodes. Many graph models fall under the framework of edge-independent graph generative models, which can output the probabilities of edges existing between any pair of nodes. The parameters of such models can be trained iteratively on the network, or some fraction of the network which is known, in the link prediction task, e.g., by minimizing a cross-entropy loss. To choose among these models, one must consider whether the model is capable of expressing structures of interest in the graph, as well as the interpretability of the model.
12
+
13
+ Expressiveness As real-world graphs are high-dimensional objects, graph models generally compress information about the graph. Such models are exemplified by the family of dot product models, which associate each node with a real-valued “embedding” vector; the predicted probability of the link between two nodes increases with the dot product of their embedding vectors. These models can alternatively be seen as factorizing the adjacency matrix of the graph in terms of a low-rank matrix. Recent work (Seshadhri et al., 2020) has shown that dot product models are limited in their ability to model common structures in real-world graphs, such as triangles incident only on low-degree nodes. In response, Chanpuriya et al. (2020) showed that with the logistic PCA (LPCA) model, which has two embeddings per node (i.e. using the dot product of the “left” embedding of one node and the “right” embedding of another), not only can such structures be represented, but further, any graph can be exactly represented with embedding vectors whose lengths are linear in the maximum degree of the graph. Peysakhovich & Bottou (2021) show that the limitations of the single-embedding model, which are overcome by having two embeddings, stem from only being able to represent adjacency matrices which are positive semi-definite, which prevents them from representing heterophilous structures in graphs; heterophilous structures are those wherein dissimilar nodes are linked.
14
+
15
+ ![](images/4cbb4631f27135d025b9e9f8e55ea47b9f304058a042cff0b6d108833fd11bc5.jpg)
16
+ Figure 1: The motivating synthetic graph. The expected adjacency matrix (left) and the sampled matrix (right); the latter is passed to the training algorithms. The network is approximately a union of ten bipartite graphs, each of which correspond to recruiters and non-recruiters at one of the ten locations.
17
+
18
+ ![](images/30f0710793281139c69cccabe143dc14f2935fb76f343d1dd08e1e3c62414da5.jpg)
19
+ Figure 2: (Right) Reconstructions of the motivating synthetic graph of Figure 1 with SVD, BIGCLAM, and our model, using 12 communities or singular vectors. Note the lack of the small diagonal structure in BIGCLAM’s reconstruction; this corresponds to its inability to capture the heterophilous interaction between recruiters and non-recruiters. (Left) Frobenius error when reconstructing the motivating synthetic graph of Figure 1 with SVD, BIGCLAM, and our model, as the embedding length is varied. The error is normalized by the sum of the true adjacency matrix (i.e., the number of edges).
20
+
21
+ Heterophily: Motivating example To demonstrate how heterophily can manifest in networks, as well as how models which assume homophily can fail to represent such networks, we provide a simple synthetic example. Suppose a recruiting website allows its members to contact each other; we construct a graph of these members, with an edge indicating that two members have been in contact. Members are either recruiters or non-recruiters, and each member comes from one of ten locations (e.g., a city). Members from the same location are likely to contact each other; this typifies homophily, wherein links occur between similar nodes. Furthermore, recruiters are unlikely to contact other recruiters, and non-recruiters are unlikely to contact other non-recruiters; this typifies heterophily. Figure 1 shows an instantiation of such an adjacency matrix with 1000 nodes, which are randomly assigned to one of the ten locations and one of recruiter / non-recruiter. We recreate this network with our embedding model and the BIGCLAM algorithm of Yang & Leskovec (2013), which explicitly assumes homophily. We also compare with the best low-rank approximation to the adjacency matrix in terms of Frobenius error; this is the SVD of the matrix, discarding all but the top singular values. In Figure 1, we show how BIGCLAM captures only the ten communities based on location, i.e., only the homophilous structure, and fails to capture the heterophilous distinction between recruiters and non-recruiters. We also plot the error of the reconstructions as the embedding length increases. There are $1 0 \cdot 2 = 2 0$ different kinds of nodes, meaning the expected adjacency matrix is rank-20, and our model maintains the lowest error up to this embedding length; by contrast, BIGCLAM is unable to decrease error after capturing location information with length-10 embeddings.
22
+
23
+ Interpretability Beyond being able to capture a given network accurately, it is often desirable for a graph model to form interpretable representations of nodes and to produce edge probabilities in an interpretable fashion. Dot product models can achieve this by restricting the node embeddings to be nonnegative. Nonnegative factorization has long been used to decompose data into parts (Donoho & Stodden, 2003). In the context of graphs, this entails decomposing the set of nodes of the network into clusters or communities. In particular, each entry of the nonnegative embedding vector of a node represents the intensity with which the node participates in a community. Note that this allows the edge probabilities output by dot product models to be interpretable in terms of coparticipation in communities. Depending on the model, these vectors may have restrictions such as a sum-to-one requirement, meaning the node is assigned a categorical distribution over communities. The least restrictive and most expressive case is that of soft assignments to overlapping communities, where the entries can vary totally independently. In models for this case, the output of the dot product is often mapped through a nonlinear link function to produce a probability, i.e. to ensure the value lies in [0, 1]. This link function ideally also facilitates straightforward interpretation.
24
+
25
+ We propose the first edge-independent graph generative model that is a) expressive enough to capture heterophily, b) interpretable in that it produces nonnegative embeddings, and c) optimizes effectively on real-world graphs with gradient descent on a cross-entropy loss.
26
+
27
+ Summary of main contributions The key contributions of this work are as follows:
28
+
29
+ • We introduce a graph generative model, based on nonnegative matrix factorization, which is able to represent both heterophily and overlapping communities. Our model outputs link probabilities which are interpretable in terms of the communities it detects.
30
+ • We provide a scheme for initialization of the nonnegative factors using the arbitrary real factors generated by logistic PCA. We show theoretically how a graph which is represented exactly by LPCA can also be represented exactly by our model.
31
+ • We show theoretically that, with a small number of communities, our model can exactly represent a natural class of graphs which exhibits both heterophily and overlapping communities.
32
+ • In experiments, we show that our algorithm is competitive on real-world graphs in terms of representing the network, doing link prediction, and producing communities which align with ground-truth.
33
+
34
+ # 2 GRAPH GENERATIVE MODEL
35
+
36
+ Consider the set of undirected, unweighted graphs on $n$ nodes, i.e., the set of graphs with symmetric adjacency matrices in $\{ 0 , 1 \} ^ { n \times n }$ . We propose an edge-independent, generative model for such graphs. Given a diagonal matrix $\check { W } \in \mathbb { R } ^ { k \times k }$ and a matrix $\mathbf { \bar { \boldsymbol { V } } } \in [ 0 , 1 ] ^ { n \times k }$ , we set the probability of an edge existing between nodes $i$ and $j$ to be the $( i , j )$ -th entry of matrix $\tilde { A }$ :
37
+
38
+ $$
39
+ \tilde { A } : = \sigma ( V ^ { \top } W V ) ,
40
+ $$
41
+
42
+ where $\sigma$ is the logistic function. $k$ represents the number of clusters; intuitively, if $\mathbf { v } _ { i } \in \mathbb { R } ^ { k }$ is the $i$ -th row of matrix $V$ , then $\mathbf { v } _ { i }$ is soft assignment of node $i$ to the $k$ communities. $W$ can be viewed as a cluster affinity matrix. An equivalent alternative formulation is
43
+
44
+ $$
45
+ \begin{array} { r } { \tilde { A } _ { i , j } = \sigma ( \mathbf { v } _ { i } W \mathbf { v } _ { j } ^ { \top } ) . } \end{array}
46
+ $$
47
+
48
+ Interpretation The edge probabilities output by this model have an intuitive interpretation, and to maximize interpretability, we focus on the case where $W$ is diagonal. Recall that there is a one-to-one-to-one relationship between probability $p \in [ 0 , 1 ]$ , odds $\begin{array} { r } { \bar { o } = \frac { p } { 1 - p } \in [ 0 , \infty ) } \end{array}$ , and logit $\ell = \log ( o ) \in ( - \infty , + \infty )$ . The logit of the link probability between nodes $i$ and $j$ is $\mathbf { v } _ { i } ^ { \top } \mathbf { W } \mathbf { v } _ { j }$ , which is a summation of terms $\mathbf { v } _ { i c } \mathbf { v } _ { j c } W _ { c c }$ over all communities $c \in [ k ]$ . If the nodes both fully participate in community $c$ , that is, $\mathbf { v } _ { i c } = \mathbf { v } _ { j c } = 1$ , then the edge logit is changed by $W _ { c c }$ starting from a baseline of 0, or equivalently the odds of an edge is multiplied by $\exp ( W _ { c c } )$ starting from a baseline odds of 1; if either of the nodes participates only partially in community $c$ , then the change in logit and odds is accordingly prorated. Homophily and heterophily also have a clear interpretaion in this model: homophilous communities are those with $W _ { c c } > 0$ , where two nodes both participating in the community increases the odds of a link, whereas communities with $W _ { c c } < 0$ are heterophilous, and coparticipation decreases the odds of a link.
49
+
50
+ # 3 RELATED WORK
51
+
52
+ Node clustering There is extensive prior work on the node clustering problem (Schaeffer, 2007; Aggarwal & Wang, 2010; Nascimento & De Carvalho, 2011), perhaps the most well-known being the normalized cuts algorithm of Shi & Malik (2000), which produces a clustering based on the entrywise signs of an eigenvector of the graph Laplacian matrix. However, the clustering algorithms which are most relevant to our work are those based on non-negative matrix factorization (NMF) (Lee & Seung, 1999; Berry et al., 2007; Wang & Zhang, 2012; Gillis, 2020). One such algorithm is that of Yu et al. (2005), which approximately factors a graph’s adjacency matrix $A \in \{ 0 , 1 \} ^ { n \times n }$ into two positive matrices $H$ and $\Lambda$ , where $H \in \mathbb { R } _ { + } ^ { n \times k }$ is left-stochastic (i.e. each of its columns sums to 1) and $\Lambda \in \mathbb { R } _ { + } ^ { k \times k }$ is diagonal, such that $H \Lambda H ^ { \top } \approx A$ . Here $H$ represents a soft clustering of the $n$ nodes into $k$ clusters, while the diagonal entries of $\Lambda$ represent the prevalence of edges within clusters. Note the similarity of the factorization to our model, save for the lack of a nonlinearity. Other NMF approaches include those of Ding et al. (2008), Yang et al. (2012), Kuang et al. (2012), and Kuang et al. (2015) (SYMNMF).
53
+
54
+ Modeling heterophily Much of the existing work on graph models has an underlying assumption of network homophily (Newman, 2002; Johnson et al., 2010; Noldus & Van Mieghem, 2015). There has been significant recent interest in the limitations of graph neural network (GNN) models (Duvenaud et al., 2015; Li et al., 2016; Kipf & Welling, 2017; Hamilton et al., 2017) at addressing network heterophily (Nt & Maehara, 2019; Zhu et al., 2020), as well as proposed solutions (Pei et al., 2020; Zhu et al., 2021; Yan et al., 2021), but relatively less work for more fundamental models such as those for clustering. Some existing NMF approaches to clustering do naturally model heterophilous structure in networks. The model of Nourbakhsh et al. (2014), for example, is similar to that of $\mathrm { Y u }$ et al. (2005), but allows the cluster affinity matrix $\Lambda$ to be non-diagonal; this allows for inter-cluster edge affinity to exceed intra-cluster edge affinity, so heterophily can arise in this model, though it is not a focus of their work. Further, the model of Miller et al. (2009) is similar to ours and also allows for heterophily, though it restricts the cluster assignment matrix $V$ to be binary; additionally, their training algorithm is not based on gradient descent as ours is, and it does not scale to large networks. More recently, Peysakhovich & Bottou (2021) propose a decomposition of the form $\pmb { A } \approx \pmb { D } + \pmb { B } \pmb { B } ^ { \top } - \pmb { C } \dot { \pmb { C } } ^ { \top }$ , where $D \in \mathbb { R } ^ { n \times n }$ is diagonal and $B , C \in \mathbb { R } ^ { n \times k }$ are low-rank; the authors discuss how, interestingly, this model separates the homophilous and heterophilous structure into different factors, namely $\textbf { { B } }$ and $C$ . However, this work does not pursue a clustering interpretation or investigate setting the factors $\textbf { { B } }$ and $C$ to be nonnegative. One stage of our training algorithm uses a similar decomposition, though it includes the nonnegativity constraint; this is detailed in Section 4.
55
+
56
+ Overlapping clustering Many models discussed above focus on the single-label clustering task. We are interested in the closely-related but distinct task of multi-label clustering, also known as overlapping community detection (Xie et al., 2013; Javed et al., 2018). The BIGCLAM algorithm of Yang & Leskovec (2013) uses the following generative model for this task: the probability of a link between two nodes $i$ and $j$ is given by $1 { \bar { - } } \exp ( - { \bf f } _ { i } \cdot { \bf f } _ { j } )$ , where $f _ { i } , f _ { j } \in \mathbb { R } _ { + } ^ { k }$ represent the intensities with which the nodes participate in each of the $k$ communities. This model allows for intersections of communities to be especially dense with edges, which the authors generally observe in real-world networks; by contrast, they claim that prior state-of-the-art approaches, including ones based on clustering links (Ahn et al., 2010) and clique detection (Palla et al., 2005), as well as a mixed-membership variant (Airoldi et al., 2008) of the stochastic block model (Holland et al., 1983), implicitly assume that intersections are sparse. BIGCLAM assumes strict homophily of the communities, whereas our model allows for both homophily and heterophily. Additionally, unlike in our model, there is no upper bound to the intensities of community participation (i.e. the entries of each $f$ ), so it is unclear how to incorporate prior knowledge about community membership in the form of binary labels, as in a semi-supervised situation.
57
+
58
+ The approach of Zhang & Yeung (2012) is more similar to ours and more amenable to such prior information in that community assignments are bounded; specifically, the model is similar to those of Yu et al. (2005) and Nourbakhsh et al. (2014), but allows the cluster assignment matrix $H$ to be an arbitrary matrix of probabilities rather left-stochastic. However, unlike our model and BIGCLAM, these models lack a nonlinear linking function; recent work outside clustering and community detection on graph generative models (Rendsburg et al., 2020; Chanpuriya et al., 2020) suggests that the addition of a nonlinear linking function, specifically softmax and logistic nonlinearities as in our model, can make matrix factorization-based graph models more expressive. Lastly, a recent approach is the VGRAPH model of Sun et al. (2019), which also lacks a final nonlinear linking function, but, interestingly, has an intermediate linking function: the matrix factors (i.e. the cluster assignment matrices) themselves are a product of learned embeddings for the nodes and communities, put through a softmax linking function. Their algorithm ultimately determines overlapping communities as in link clustering approaches, and they find that it generally achieves state-of-the-art results in matching ground-truth communities; as discussed in Section 6.2, we find that our algorithm’s performance on this task compares favorably to VGRAPH.
59
+
60
+ # 4 TRAINING ALGORITHM
61
+
62
+ Given an input graph $\pmb { A } \in \{ 0 , 1 \} ^ { n \times n }$ , we find $V$ and $W$ such that the model produces ${ \tilde { A } } =$ $\sigma ( V W V ^ { \top } ) \in ( \bar { 0 } , \bar { 1 } ) ^ { n \times n }$ as in Eq. (1) which approximately matches $\pmb { A }$ . In particular, we train the model to minimize the sum of binary cross-entropies of the link predictions over all pairs of nodes:
63
+
64
+ $$
65
+ R = - \sum \left( A \log ( \tilde { A } ) \right) - \sum \left( ( 1 - A ) \log ( 1 - \tilde { A } ) \right) ,
66
+ $$
67
+
68
+ where $\displaystyle \sum$ denotes the scalar summation of all entries in the matrix. Rather than optimizing the model of Equation 1 directly, we optimize different parametrizations which we find are more effective. This optimization comprises three stages. Note that while we outline a non-stochastic version of the algorithm, each stage can generalize straightforwardly to a stochastic version, i.e., by sampling links and non-links for the loss function.
69
+
70
+ First stage We first fit the unconstrained logistic principal components analysis (LPCA) model to the input graph as in Chanpuriya et al. (2020). This model reconstructs a graph $\tilde { A } \in \{ 0 , 1 \} ^ { n \times n }$ using logit factors $\mathbf { \bar { \boldsymbol { X } } } , \mathbf { \boldsymbol { Y } } \in \mathbb { R } ^ { n \times k }$ via the model
71
+
72
+ $$
73
+ \tilde { A } = \sigma ( X Y ^ { \top } ) .
74
+ $$
75
+
76
+ Factors $\boldsymbol { X }$ and $\mathbf { Y }$ are initialized randomly, then trained via gradient descent on the loss of Equation 3 so that $\tilde { A } \approx A$ . Note that entries of the factors $\boldsymbol { X }$ and $\mathbf { Y }$ are not necessarily nonnegative; hence this model does not directly admit an interpretation as community detection. Unlike Chanpuriya et al. (2020), which explicitly seeks to exactly fit the graph, i.e., to find $X , Y$ such that ${ \tilde { A } } = { \bar { A } }$ , and does not explore the graph structure which is recovered in the factors, we employ $L _ { 2 }$ regularization of the factors to avoid overfitting. See Algorithm 1 for pseudocode of this stage.
77
+
78
+ Second stage The factors $\boldsymbol { X }$ and $\mathbf { Y }$ from the first stage are processed into nonnegative factors $B \in \mathbb { R } _ { + } ^ { n \times k _ { B } }$ and $C \in \mathbb { R } _ { + } ^ { n \times k _ { C } }$ such that $\displaystyle k _ { B } + k _ { C } = 3 k$ and
79
+
80
+ $$
81
+ \begin{array} { r } { B B ^ { \top } - C C ^ { \top } \approx \frac { 1 } { 2 } \left( X Y ^ { \top } + Y X ^ { \top } \right) . } \end{array}
82
+ $$
83
+
84
+ Note that the left-hand side can only represent symmetric matrices. Let $\begin{array} { r } { { \pmb { L } } = \frac { 1 } { 2 } \left( { \pmb X } { \pmb Y } ^ { \top } + { \pmb Y } { \pmb X } ^ { \top } \right) } \end{array}$ . $\pmb { L }$ is a symmetrization of $X Y ^ { \top }$ ; if $\sigma ( X Y ^ { \top } )$ closely approximates the symmetric matrix $\pmb { A }$ as desired, so too should the symmetrized logits. Pseudocode for this stage is given in Algorithm 2. The concept of this stage is to first separate the logit matrix $\pmb { L }$ into a sum and difference of rank-1 components via eigendecomposition. Each of these components can be written as $+ \mathbf { v } \mathbf { v } ^ { \top }$ or $- \mathbf { v } \mathbf { v } ^ { \top }$ with $\mathbf { v } \in \mathbb { R } ^ { n }$ , where the sign depends on the sign of the eigenvalue. Each component is then separated into a sum or difference of three outer products of nonnegative vectors, via the claim below.
85
+
86
+ Claim 4.1. Let $\phi : \mathbb { R } \mathbb { R }$ denote the ReLU activation function, i.e., $\phi ( z ) = \operatorname* { m a x } \{ z , 0 \}$ . For any vector v,
87
+
88
+ $$
89
+ \mathbf { v } \mathbf { v } ^ { \top } = 2 \phi ( \mathbf { v } ) \phi ( \mathbf { v } ) ^ { \top } + 2 \phi ( - \mathbf { v } ) \phi ( - \mathbf { v } ) ^ { \top } - | \mathbf { v } | | \mathbf { v } | ^ { \top }
90
+ $$
91
+
92
+ Proof. Take any $\mathbf { v } \in \mathbb { R } ^ { k }$ . Then
93
+
94
+ $$
95
+ \begin{array} { r l } & { \mathbf { v v } ^ { \top } = ( \phi ( \mathbf { v } ) - \phi ( - \mathbf { v } ) ) \cdot ( \phi ( \mathbf { v } ) ^ { \top } - \phi ( - \mathbf { v } ) ^ { \top } ) } \\ & { \qquad = \phi ( \mathbf { v } ) \phi ( \mathbf { v } ) ^ { \top } + \phi ( - \mathbf { v } ) \phi ( - \mathbf { v } ) ^ { \top } - \phi ( \mathbf { v } ) \phi ( - \mathbf { v } ) ^ { \top } - \phi ( - \mathbf { v } ) \phi ( \mathbf { v } ) ^ { \top } } \\ & { \qquad = 2 \phi ( \mathbf { v } ) \phi ( \mathbf { v } ) ^ { \top } + 2 \phi ( - \mathbf { v } ) \phi ( - \mathbf { v } ) ^ { \top } - ( \phi ( \mathbf { v } ) + \phi ( - \mathbf { v } ) ) \cdot ( \phi ( \mathbf { v } ) + \phi ( - \mathbf { v } ) ) ^ { \top } } \\ & { \qquad = 2 \phi ( \mathbf { v } ) \phi ( \mathbf { v } ) ^ { \top } + 2 \phi ( - \mathbf { v } ) \phi ( - \mathbf { v } ) ^ { \top } - | \mathbf { v } | | \mathbf { v } | ^ { \top } , } \end{array}
96
+ $$
97
+
98
+ where the first step follows from $\mathbf { v } = \phi ( \mathbf { v } ) - \phi ( - \mathbf { v } )$ , and the last step follows from $| \mathbf { v } | = \phi ( \mathbf { v } ) +$ $\phi ( - \mathbf { v } )$ . 
99
+
100
+ Algorithm 2 constitutes a constructive proof of the following theorem.
101
+
102
+ Theorem 4.2 (Nonnegative Factorization of Rank- $k$ Matrices). Given a symmetric rank- $k$ matrix $\ b { L } \in \mathbb { R } ^ { n \times n }$ , there exist nonnegative matrices $B \in \mathbb { R } _ { + } ^ { n \times k _ { B } }$ and $C \in \mathbb { R } _ { + } ^ { n \times k _ { C } }$ such that $\displaystyle k _ { B } + k _ { C } = 3 k$ and $B B ^ { \top } - C C ^ { \top } = L$ .
103
+
104
+ Third stage The factors $\textbf { { B } }$ and $C$ from the previous stage serve as initialization for the final stage of optimization. Of the $3 k$ communities generated by the previous stage, we keep the top $k$ which are most impactful on the edge logits, as ranked by the $L _ { 2 }$ norms of the columns of $\textbf { { B } }$ and $C$ . Now $B \in \mathbb { R } _ { + } ^ { n \times k _ { B } }$ and $C \in \mathbb { R } _ { + } ^ { n \times k _ { C } }$ such that $k _ { B } + k _ { C } = k$ .
105
+
106
+ These remaining $k$ communities are then directly optimized by minimizing the cross-entropy loss of Equation 3 on the following graph model:
107
+
108
+ $$
109
+ \tilde { A } = \sigma \left( B B ^ { \top } - C C ^ { \top } \right) .
110
+ $$
111
+
112
+ This stage proceeds exactly as the first stage, i.e. as in Algorithm 1, except with Equation 5 as the generative model rather than Equation 4. Additionally, the optimized parameters $\textbf { { B } }$ and $C$ are constrained to be nonnegative.
113
+
114
+ The model in Equation 5 is exactly equivalent to that of Equation 1, where $W$ is constrained to be diagonal (i.e. $\mathrm { d i a g } ( { \pmb w } ) )$ , and parameters can be transformed to that form with a small manipulation.
115
+
116
+ Claim 4.3. Given nonnegative matrices $B \in \mathbb { R } _ { + } ^ { n \times k _ { B } }$ and $C \in \mathbb { R } _ { + } ^ { n \times k _ { C } }$ , letting $\boldsymbol { k } = \boldsymbol { k } _ { B } + \boldsymbol { k } _ { C }$ there exist a matrix $V \in [ 0 , 1 ] ^ { n \times k }$ and a diagonal matrix $W \in \mathbb { R } ^ { k \times k }$ such that $V W V ^ { \top } =$ $B B ^ { \top } - C C ^ { \top }$ .
117
+
118
+ Proof. Let $\mathbf { \nabla } m _ { B }$ and $m _ { C }$ be the vectors containing the maximums of each column of $\textbf { { B } }$ and $C$ , respectively. The equality and the constraints on $V$ and $W$ are satisfied by setting
119
+
120
+ $$
121
+ \begin{array} { c } { { { \cal V } = \left( B \times \mathrm { d i a g } \left( m _ { B } ^ { - 1 } \right) ; { \cal C } \times \mathrm { d i a g } \left( m _ { C } ^ { - 1 } \right) \right) } } \\ { { { \cal W } = \mathrm { d i a g } \left( \left( + m _ { B } ^ { 2 } ; { \bf \sigma } - m _ { C } ^ { 2 } \right) \right) . } } \end{array}
122
+ $$
123
+
124
+ # Algorithm 1 Fitting the Unconstrained LPCA Model
125
+
126
+ input adjacency matrix $\pmb { A } \in \{ 0 , 1 \} ^ { n \times n }$ , rank $k < n$ , regularization weight $\lambda \geq 0$ , number of iters. I output factors $\mathbf { \bar { \cal X } } , \mathbf { \cal Y } \in \mathbb { R } ^ { n \times k }$ such that $\sigma ( X Y ^ { \top } ) \approx \bar { A }$
127
+
128
+ 1: Initialize elements of $\boldsymbol { X } , \boldsymbol { Y } \in \mathbb { R } ^ { n \times k }$ randomly
129
+ 2: for $i \gets 1$ to $I$ do
130
+ 3: $\tilde { A } \sigma ( X Y ^ { \top } )$ . reconstructed adjacency matrix
131
+ 4: $\begin{array} { r l } & { R \gets - \sum \left( \pmb { A } \log ( \tilde { \pmb { A } } ) \right) - \sum \left( ( 1 - \pmb { A } ) \log ( 1 - \tilde { \pmb { A } } ) \right) } \\ & { R \gets R + \lambda \left( \| \pmb { X } \| _ { F } ^ { 2 } + \| \pmb { Y } \| _ { F } ^ { 2 } \right) } \end{array}$ . cross-entropy loss
132
+ 5: . regularization loss
133
+ 6: Calculate $\partial _ { X , Y } R$ via differentiation through Steps 3 to 5
134
+ 7: Update $X , Y$ to minimize $R$ using $\partial _ { X , Y } R$
135
+ 8: end for
136
+ 9: return $X , Y$
137
+
138
+ Implementation details Our implementation uses PyTorch (Paszke et al., 2019) for automatic differentiation and minimizes the loss using the SciPy (Jones et al., 2001) implementation of the L-BFGS (Liu & Nocedal, 1989; Zhu et al., 1997) algorithm with default hyperparameters and up to a maximum of 200 iterations for both stages of optimization. We set the magnitude of the regularization to 10 times the mean entry value of the factor matrices. We include code in the form of a Jupyter notebook (Perez & Granger ´ , 2007) demo in the supplemental material.
139
+
140
+ # Algorithm 2 Initializing the Constrained Model from LPCA Logits
141
+
142
+ input logit factors $\boldsymbol { X } , \boldsymbol { Y } \in \mathbb { R } ^ { n \times k }$
143
+ output $\bar { B } , C \in [ 0 , \infty ) ^ { n \times 3 k }$ such that $B B ^ { \intercal } - C C ^ { \intercal } \approx \frac { 1 } { 2 } \left( X Y ^ { \intercal } + Y X ^ { \intercal } \right)$
144
+ 1: Set $\ b { Q } \in \mathbb { R } ^ { n \times k }$ and $\boldsymbol { \lambda } \in \mathbb { R } ^ { k }$ by truncated eigendecomposition such that $\pmb { Q } \times \mathrm { d i a g } ( \pmb { \lambda } ) \times \pmb { Q } ^ { \top } \approx \frac { 1 } { 2 } ( \pmb { X } \pmb { Y } ^ { \top } + \pmb { Y } \pmb { X } ^ { \top } )$ 2: $B ^ { * } Q ^ { + } \times \mathrm { d i a g } ( \sqrt { + \lambda ^ { + } } )$ , where $\lambda ^ { + }$ , $Q ^ { + }$ are the positive eigenvalues/vectors
145
+ 3: $C ^ { * } \gets Q ^ { - } \times \mathrm { d i a g } ( \sqrt { - \lambda ^ { - } } )$ , where $\lambda ^ { - }$ , $Q ^ { - }$ are the negative eigenvalues/vectors
146
+ 4: $B ( \sqrt { 2 } \phi ( B ^ { * } ) ; \quad \sqrt { 2 } \phi ( - B ^ { * } ) $ ; $| C ^ { * } | ) \triangleright \phi$ and $| \cdot |$ are entrywise ReLU and absolute value
147
+ 5: $C \gets \big ( \sqrt { 2 } \phi ( C ^ { * } ) ; \quad \sqrt { 2 } \phi ( - C ^ { * } ) ; \quad | B ^ { * } | \big )$ 6: return $_ { B , C }$
148
+
149
+ # 5 THEORETICAL RESULTS
150
+
151
+ SYMNMF and BIGCLAM, among other models for undirected graph, assume network homophily, which precludes low-rank representation of networks with heterophily. We first show that our model is highly expressive in that it can capture arbitrary homophilous and heterophilous structure: using a result from Chanpuriya et al. (2020), we show that our model can exactly reconstruct a graph using a number of communities that is linear in the maximum degree of the graph.
152
+
153
+ Lemma 5.1 (Exact LPCA Embeddings for Bounded-Degree Graphs, Chanpuriya et al. (2020)). Let $\pmb { A } \in \{ 0 , 1 \} ^ { n \times n }$ be the adjacency matrix of a graph $G$ with maximum degree c. Then there exist matrices $\bar { X } , Y \in \mathbb { R } ^ { n \times ( 2 c + 1 ) }$ such that $( \boldsymbol { X } \boldsymbol { Y } ^ { \top } ) _ { i j } > 0$ if $A _ { i j } = 1$ and $( { \pmb X } { \pmb Y } ^ { \top } ) _ { i j } < 0$ if $A _ { i j } = 0$ .
154
+
155
+ Theorem 5.2 (Interpretable Exact Reconstruction for Bounded-Degree Graphs). Let $\pmb { A } \in \{ 0 , 1 \} ^ { n \times n }$ be the adjacency matrix of a graph $G$ with maximum degree c. Let $k = 1 2 c + 6$ . For any $\epsilon > 0$ , there exist $m \bar { V } \in [ 0 , \mathbf { \dot { 1 } } ] ^ { n \times k }$ and diagonal $W \in \mathbb { R } ^ { k \times k }$ such that $\left\| \sigma ( V W V ^ { \top } ) - A \right\| _ { F } < \epsilon$ .
156
+
157
+ Proof. Lemma 5.1 guarantees the existence of matrices $\boldsymbol { X } , \boldsymbol { Y } \in \mathbb { R } ^ { n \times ( 2 c + 1 ) }$ such that $( \boldsymbol { X } \boldsymbol { Y } ^ { \top } ) _ { i j } > 0$ if $A _ { i j } = 1$ and $( { \pmb X } { \pmb Y } ^ { \top } ) _ { i j } < 0$ if $A _ { i j } = 0$ . Let $\begin{array} { r } { { \cal L } = \frac { 1 } { 2 } ( X Y ^ { \top } + Y X ^ { \top } ) } \end{array}$ , the symmetrization of $X Y ^ { \top }$ . Since $\pmb { A }$ is symmetric, it still holds that $\mathbf { { { L } } } _ { i j } > 0$ if $A _ { i j } = 1$ and $\mathbf { { L } } _ { i j } < 0$ if $A _ { i j } = 0$ ; further, as the sum of two rank- $( 2 c + 1 )$ matrices, the rank of $\pmb { L }$ is at most $2 \cdot ( 2 c + 1 )$ . Finally, by Claim 4.2 and Theorem 4.3, with $k = 3 \cdot 2 \cdot ( 2 c + 1 ) = 1 2 c + 6$ , there exist matrices $\mathring { V } \in [ 0 , 1 ] ^ { n \times \bar { k } }$ and diagonal $W \in \mathbb { R } ^ { k \times k }$ such that $V W V ^ { \top } = L$ , meaning still $( V W V ^ { \top } ) _ { i j } > 0$ if $A _ { i j } = 1$ and $( V W V ^ { \top } ) _ { i j } < 0$ if $A _ { i j } = 0$ . Since $\begin{array} { r } { \operatorname* { l i m } _ { z - \infty } \sigma ( z ) = 0 } \end{array}$ and $\begin{array} { r } { \operatorname* { l i m } _ { z \to + \infty } \sigma ( z ) = 1 } \end{array}$ , it follows that
158
+
159
+ $$
160
+ \operatorname* { l i m } _ { s \to \infty } \sigma \left( V ( s W ) V ^ { \top } \right) = \operatorname* { l i m } _ { s \to \infty } \sigma \left( s V W V ^ { \top } \right) = A ,
161
+ $$
162
+
163
+ that is, $W$ can be scaled larger to match $\pmb { A }$ arbitrarily closely.
164
+
165
+ The above bound on the number of communities $k$ required for exact representation can be very loose. We additionally show that our model can exactly represent a natural family of graphs which exhibits both homophily and heterophily with small $k$ . The family of graphs is defined below; roughly speaking, nodes in such graphs share an edge iff they coparticipate in some number of homophilous communities and don’t coparticipate in a number of heterophilous communities. For example, the motivating graph described in Section 1 would be an instance of such a graph if there exists an edge between two nodes iff the two members are from the same location and have different roles (i.e., one is a recruiter and the other is a non-recruiter).
166
+
167
+ Theorem 5.3. Suppose there is an undirected, unweighted graph on n nodes with adjacency matrix $A \in \{ 0 , 1 \} ^ { n \times n }$ whose edges are determined by an overlapping clustering and $a$ “thresholding” integer $t \in \mathbb { Z }$ in the following way: for each vertex $i$ , there are two binary vectors $b _ { i } \in \{ 0 , 1 \} ^ { k _ { b } }$ and $\pmb { c } _ { i } \in \{ 0 , 1 \} ^ { k _ { c } }$ , and there is an edge between vertices i and $j$ iff $\mathbf { \hat { b } } _ { i } \cdot \mathbf { b } _ { j } - \mathbf { c } _ { i } \cdot \mathbf { c } _ { j } \geq t$ . Then, for any $\epsilon > 0$ , there exist $V \in [ 0 , 1 ] ^ { n \times ( k + 1 ) }$ and diagonal $W \in \mathbb { R } ^ { ( k + 1 ) \times ( k + 1 ) }$ such that $\begin{array} { r l } { { \| \sigma ( V W V ^ { \top } ) - A \| _ { F } < } } \end{array}$ .
168
+
169
+ Proof. Let the rows of $B \in \{ 0 , 1 \} ^ { n \times k _ { b } }$ and $C \in \{ 0 , 1 \} ^ { n \times k _ { c } }$ contain the vectors $^ { b }$ and $^ c$ of all nodes. By Claim 4.3, we can find $\mathring { V } ^ { \ast } \in [ 0 , 1 ] ^ { n \times k }$ and diagonal $W ^ { * } \in \mathbb { R } ^ { k \times k }$ such that $V ^ { * } W ^ { * } V ^ { * \top } =$
170
+
171
+ Table 1: Datasets used in our experiments. As in Sun et al. (2019), for YOUTUBE and AMAZON, we take only nodes which participate in at least one of the largest 5 ground-truth communities.
172
+
173
+ <table><tr><td>Name</td><td>Reference</td><td>Nodes</td><td>Edges</td><td>Labels</td></tr><tr><td>BLOG</td><td>Tang &amp; Liu (2009)</td><td>10.312</td><td>333,983</td><td>39</td></tr><tr><td>YoUTUBE</td><td>Yang &amp; Leskovec (2015)</td><td>5,346</td><td>24,121</td><td>5</td></tr><tr><td>POS</td><td>Mahoney</td><td>4,777</td><td>92,406</td><td>40</td></tr><tr><td>PPI</td><td>Breitkreutz et al. (2007)</td><td>3,852</td><td>76,546</td><td>50</td></tr><tr><td>AMAZON</td><td>Yang &amp; Leskovec (2015)</td><td>794</td><td>2,109</td><td>5</td></tr></table>
174
+
175
+ $B B ^ { \top } - C C ^ { \top }$ . Now let
176
+
177
+ $$
178
+ V = ( V ^ { * } \mathrm { \bf ~ 1 } ) \qquad W = \left( { \small \begin{array} { c c } { W ^ { * } } & { 0 } \\ { 0 } & { { \frac { 1 } { 2 } } - t } \end{array} } \right) .
179
+ $$
180
+
181
+ Then $\begin{array} { r } { ( V W V ^ { \top } ) _ { i j } = \pmb { b _ { i } } \cdot \pmb { b _ { j } } - \pmb { c _ { i } } \cdot \pmb { c _ { j } } + \frac { 1 } { 2 } - t } \end{array}$ . Hence $( V W V ^ { \top } ) _ { i j } > 0$ iff $b _ { i } \cdot b _ { j } - c _ { i } \cdot c _ { j } > t - \frac { 1 } { 2 }$ , which is true iff $A _ { i j } = 1$ by the assumption on the graph. Similarly, $( V W V ^ { \top } ) _ { i j } < 0$ iff $A _ { i j } = 0$ . It follows that
182
+
183
+ $$
184
+ \operatorname* { l i m } _ { s \to \infty } \sigma \left( V ( s W ) V ^ { \top } \right) = \operatorname* { l i m } _ { s \to \infty } \sigma \left( s V W V ^ { \top } \right) = A .
185
+ $$
186
+
187
+ # 6 EXPERIMENTS
188
+
189
+ # 6.1 EXPRESSIVENESS
190
+
191
+ We investigate the expressiveness of our generative model, that is, the fidelity with which it can reproduce an input network. In Section 1, we used a simple synthetic network to show that our model is able to represent heterophilous structures in addition to homophilous structure. We now evaluate the expressiveness of our model on a benchmark of real-world networks, summarized in Table 1. As with the synthetic graph, we fix the number of communities or singular vectors, fit the model, then evaluate several types of reconstruction error. In Figure 3, we compare the results of our model with those of SVD, BIGCLAM (Yang & Leskovec, 2013), and SYMNMF (Kuang et al., 2015). The BIGCLAM model is discussed in detail in Section 3. SYMNMF simply factors the adjacency matrix as $\pmb { A } \approx \pmb { H } \pmb { H } ^ { \top }$ , where $\pmb { H } \in \mathbb { R } _ { + } ^ { n \times k }$ ; note that, like SVD, SYMNMF does not necessarily output a matrix whose entries are probabilities (i.e., bounded in [0, 1]), and hence it is not a graph generative model like ours and BIGCLAM.
192
+
193
+ For each method, we fix the number of communities or singular vectors at the number of ground-truth communities of the network. For a fair comparison with SVD, we do not regularize the training of the other methods. Our method consistently has the lowest reconstruction error, both in terms of Frobenius error and entrywise cross-entropy (Equation 3).
194
+
195
+ ![](images/b6d6445fca993d21f409a87b096739874cf5c57138a7aecbeeed4977932c4b64.jpg)
196
+ Figure 3: Error when reconstructing real-world graphs with SYMNMF, SVD, BIGCLAM, and our model. Frobenius error is normalized as in Figure 2; cross-entropy is normalized by the number of entries of the matrix $( n ^ { 2 } )$ .
197
+
198
+ # 6.2 SIMILARITY TO GROUND-TRUTH CLUSTERS
199
+
200
+ As a way of assessing the interpretability of the clusters generated by our method, we evaluate the similarity of the clusters to ground-truth communities, and we compare with results from other overlapping clustering algorithms. For all methods, we set the number of communities to be detected as the number of ground-truth communities. We report F1-Score as computed in Yang & Leskovec (2013). See Figure 4. The performance of our method is competitive with SYMNMF, BIGCLAM, and vGraph (Sun et al., 2019).
201
+
202
+ ![](images/714eeeba3a156cdf4f4ab14093e325281e4a68f1adcd63908657dc5612953ce1.jpg)
203
+ Figure 4: Similarity of recovered communities to ground-truth communities of real-world datasets. We were unable to run the authors’ implementation of VGRAPH on BLOG with 16 GB of memory.
204
+
205
+ # 6.3 LINK PREDICTION
206
+
207
+ We assess the predictive power of our generative model via the link prediction task on real-world networks. As discussed in Section 2, the link probabilities output by our model are interpretable in terms of a clustering of nodes that it generates; we compare results with our method to those of other models which permit similar interpretation, namely BIGCLAM and SYMNMF. We randomly select $10 \%$ of node pairs to hold out (i.e. $10 \%$ of entries of the adjacency matrix), fit the models on the remaining $90 \%$ , then use the trained models to predict whether there are links between node pairs in the held out $10 \%$ . As a baseline for comparison, we also show results for randomly predicting link or no link with equal probability. See Figure 5 for the results. The performance of our method is competitive with or exceeds that of the other methods in terms of F1 Score.
208
+
209
+ ![](images/7c62d2a7836e90896afe3b7db40a3266c144c088f77b4a63229c80e6f5e29414.jpg)
210
+ Figure 5: Accuracy of link prediction on real-world datasets.
211
+
212
+ # 7 CONCLUSION
213
+
214
+ We introduce an interpretable, edge-independent graph generative model that is highly expressive at representing both heterophily and overlapping communities. Our experimental results show its effectiveness on many important tasks. Further, our theoretical results demonstrate the expressiveness of our model in its ability to exactly reconstruct a graph using a number of clusters that is linear in the maximum degree, along with its ability to capture both heterophily and homophily in the data. In general, a deeper understanding of the expressiveness of both nonnegative and arbitrary low-rank logit models for graphs, as well as convergence properties of training algorithms, is an interesting direction for future research.
215
+
216
+ # REFERENCES
217
+
218
+ Charu C Aggarwal and Haixun Wang. A survey of clustering algorithms for graph data. In Managing and Mining Graph Data, pp. 275–301. Springer, 2010.
219
+
220
+ Yong-Yeol Ahn, James P Bagrow, and Sune Lehmann. Link communities reveal multiscale complexity in networks. Nature, 466(7307):761–764, 2010.
221
+
222
+ Edoardo Maria Airoldi, David M Blei, Stephen E Fienberg, and Eric P Xing. Mixed membership stochastic blockmodels. Journal of Machine Learning Research, 2008.
223
+
224
+ Michael W Berry, Murray Browne, Amy N Langville, V Paul Pauca, and Robert J Plemmons. Algorithms and applications for approximate nonnegative matrix factorization. Computational Statistics & Data Analysis, 52(1):155–173, 2007.
225
+
226
+ Anthony Bonato. A survey of models of the web graph. In Workshop on Combinatorial and Algorithmic Aspects of Networking, pp. 159–172. Springer, 2004.
227
+
228
+ Bobby-Joe Breitkreutz, Chris Stark, Teresa Reguly, Lorrie Boucher, Ashton Breitkreutz, Michael Livstone, Rose Oughtred, Daniel H Lackner, Jurg B ¨ ahler, Valerie Wood, et al. The biogrid ¨ interaction database: 2008 update. Nucleic acids research, 36(suppl 1):D637–D640, 2007.
229
+
230
+ Sudhanshu Chanpuriya, Cameron Musco, Konstantinos Sotiropoulos, and Charalampos Tsourakakis. Node embeddings and exact low-rank representations of complex networks. Advances in Neural Information Processing Systems, 33, 2020.
231
+
232
+ Chris Ding, Tao Li, and Michael I Jordan. Nonnegative matrix factorization for combinatorial optimization: Spectral clustering, graph matching, and clique finding. In 2008 Eighth IEEE International Conference on Data Mining, pp. 183–192. IEEE, 2008.
233
+
234
+ David L. Donoho and Victoria Stodden. When does non-negative matrix factorization give a correct decomposition into parts? In Advances in Neural Information Processing Systems 16, pp. 1141– 1148. MIT Press, 2003.
235
+
236
+ David Duvenaud, Dougal Maclaurin, Jorge Aguilera-Iparraguirre, Rafael Gomez-Bombarelli, Tim- ´ othy Hirzel, Alan Aspuru-Guzik, and Ryan P. Adams. Convolutional networks on graphs for ´ learning molecular fingerprints. In Advances in Neural Information Processing Systems 28, pp. 2224–2232, 2015.
237
+
238
+ Nicolas Gillis. Nonnegative Matrix Factorization. SIAM, 2020.
239
+
240
+ Will Hamilton, Zhitao Ying, and Jure Leskovec. Inductive representation learning on large graphs. In Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc., 2017.
241
+
242
+ Paul W Holland, Kathryn Blackmond Laskey, and Samuel Leinhardt. Stochastic blockmodels: First steps. Social Networks, 5(2):109–137, 1983.
243
+
244
+ Muhammad Aqib Javed, Muhammad Shahzad Younis, Siddique Latif, Junaid Qadir, and Adeel Baig. Community detection in networks: A multidisciplinary review. Journal of Network and Computer Applications, 108:87–111, 2018.
245
+
246
+ Samuel Johnson, Joaqu´ın J Torres, J Marro, and Miguel A Munoz. Entropic origin of disassortativity in complex networks. Physical Review Letters, 104(10):108702, 2010.
247
+
248
+ Eric Jones, Travis Oliphant, Pearu Peterson, et al. SciPy: Open source scientific tools for Python, 2001. URL http://www.scipy.org/.
249
+
250
+ Thomas N Kipf and Max Welling. Semi-supervised classification with graph convolutional networks. International Conference on Learning Representations, 2017.
251
+
252
+ Da Kuang, Chris Ding, and Haesun Park. Symmetric nonnegative matrix factorization for graph clustering. In Proceedings of the 2012 SIAM International Conference on Data Mining, pp. 106–117. SIAM, 2012.
253
+
254
+ Da Kuang, Sangwoon Yun, and Haesun Park. Symnmf: nonnegative low-rank approximation of a similarity matrix for graph clustering. Journal of Global Optimization, 62(3):545–574, 2015.
255
+
256
+ Daniel D Lee and H Sebastian Seung. Learning the parts of objects by non-negative matrix factorization. Nature, 401(6755):788–791, 1999.
257
+
258
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard S. Zemel. Gated graph sequence neural networks. In 4th International Conference on Learning Representations, ICLR 2016, 2016.
259
+
260
+ Dong C Liu and Jorge Nocedal. On the limited memory BFGS method for large scale optimization. Mathematical Programming, 45(1-3):503–528, 1989.
261
+
262
+ Matt Mahoney. Large text compression benchmark. URL http://www.mattmahoney.net/ dc/textdata.
263
+
264
+ Oliver Mason and Mark Verwoerd. Graph theory and networks in biology. IET Systems Biology, 1 (2):89–119, 2007.
265
+
266
+ Kurt T. Miller, Thomas L. Griffiths, and Michael I. Jordan. Nonparametric latent feature models for link prediction. In Advances in Neural Information Processing Systems 22, pp. 1276–1284. Curran Associates, Inc., 2009.
267
+
268
+ Maria CV Nascimento and Andre CPLF De Carvalho. Spectral methods for graph clustering–a survey. European Journal of Operational Research, 211(2):221–231, 2011.
269
+
270
+ Mark EJ Newman. Assortative mixing in networks. Physical Review Letters, 89(20):208701, 2002.
271
+
272
+ Rogier Noldus and Piet Van Mieghem. Assortativity in complex networks. Journal of Complex Networks, 3(4):507–542, 2015.
273
+
274
+ Farshad Nourbakhsh, Samuel Rota Bulo, and Marcello Pelillo. A matrix factorization approach to graph compression. In 2014 22nd International Conference on Pattern Recognition, pp. 76–81. IEEE, 2014.
275
+
276
+ Hoang Nt and Takanori Maehara. Revisiting graph neural networks: All we have is low-pass filters. arXiv preprint arXiv:1905.09550, 2019.
277
+
278
+ Gergely Palla, Imre Derenyi, Ill ´ es Farkas, and Tam ´ as Vicsek. Uncovering the overlapping community ´ structure of complex networks in nature and society. Nature, 435(7043):814–818, 2005.
279
+
280
+ Adam Paszke, Sam Gross, Francisco Massa, Adam Lerer, James Bradbury, Gregory Chanan, Trevor Killeen, Zeming Lin, Natalia Gimelshein, Luca Antiga, Alban Desmaison, Andreas Kopf, Edward Yang, Zachary DeVito, Martin Raison, Alykhan Tejani, Sasank Chilamkurthy, Benoit Steiner, Lu Fang, Junjie Bai, and Soumith Chintala. Pytorch: An imperative style, high-performance deep learning library. In Advances in Neural Information Processing Systems 32, pp. 8024–8035. Curran Associates, Inc., 2019.
281
+
282
+ Hongbin Pei, Bingzhe Wei, Kevin Chen-Chuan Chang, Yu Lei, and Bo Yang. Geom-gcn: Geometric graph convolutional networks. In 8th International Conference on Learning Representations, ICLR 2020, 2020.
283
+
284
+ Fernando Perez and Brian E. Granger. IPython: a system for interactive scientific computing. ´ Computing in Science and Engineering, 9(3):21–29, May 2007. ISSN 1521-9615. doi: 10.1109/ MCSE.2007.53. URL https://ipython.org.
285
+
286
+ Alexander Peysakhovich and Leon Bottou. An attract-repel decomposition of undirected networks. arXiv preprint arXiv:2106.09671, 2021.
287
+
288
+ Luca Rendsburg, Holger Heidrich, and Ulrike Von Luxburg. Netgan without gan: From random walks to low-rank approximations. In International Conference on Machine Learning, pp. 8073–8082. PMLR, 2020.
289
+
290
+ Satu Elisa Schaeffer. Graph clustering. Computer Science Review, 1(1):27–64, 2007.
291
+
292
+ John Scott. Social network analysis. Sociology, 22(1):109–127, 1988.
293
+
294
+ C Seshadhri, Aneesh Sharma, Andrew Stolman, and Ashish Goel. The impossibility of low-rank representations for triangle-rich complex networks. Proceedings of the National Academy of Sciences, 117(11):5631–5637, 2020.
295
+
296
+ Jianbo Shi and Jitendra Malik. Normalized cuts and image segmentation. IEEE Transactions on pattern analysis and machine intelligence, 22(8):888–905, 2000.
297
+
298
+ Fan-Yun Sun, Meng Qu, Jordan Hoffmann, Chin-Wei Huang, and Jian Tang. vgraph: A generative model for joint community detection and node representation learning. In Advances in Neural Information Processing Systems 32, pp. 512–522, 2019.
299
+
300
+ Lei Tang and Huan Liu. Relational learning via latent social dimensions. In Proceedings of the 15th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, pp. 817–826. ACM, 2009.
301
+
302
+ Yu-Xiong Wang and Yu-Jin Zhang. Nonnegative matrix factorization: A comprehensive review. IEEE Transactions on Knowledge and Data Engineering, 25(6):1336–1353, 2012.
303
+
304
+ Jierui Xie, Stephen Kelley, and Boleslaw K. Szymanski. Overlapping community detection in networks: The state-of-the-art and comparative study. ACM Comput. Surv., 45(4):43:1–43:35, 2013.
305
+
306
+ 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 preprint arXiv:2102.06462, 2021.
307
+
308
+ Jaewon Yang and Jure Leskovec. Overlapping community detection at scale: a nonnegative matrix factorization approach. In Proceedings of the Sixth ACM International Conference on Web Search and Data Mining, pp. 587–596, 2013.
309
+
310
+ Jaewon Yang and Jure Leskovec. Defining and evaluating network communities based on ground-truth. Knowledge and Information Systems, 42(1):181–213, 2015.
311
+
312
+ Zhirong Yang, Tele Hao, Onur Dikmen, Xi Chen, and Erkki Oja. Clustering by nonnegative matrix factorization using graph random walk. In Advances in Neural Information Processing Systems, pp. 1079–1087, 2012.
313
+
314
+ Kai Yu, Shipeng Yu, and Volker Tresp. Soft clustering on graphs. In Advances in Neural Information Processing Systems, pp. 1553–1560, 2005.
315
+
316
+ Yu Zhang and Dit-Yan Yeung. Overlapping community detection via bounded nonnegative matrix tri-factorization. In The 18th ACM SIGKDD International Conference on Knowledge Discovery and Data Mining, KDD ’12, pp. 606–614. ACM, 2012.
317
+
318
+ Ciyou Zhu, Richard H Byrd, Peihuang Lu, and Jorge Nocedal. Algorithm 778: L-BFGS-B: Fortran subroutines for large-scale bound-constrained optimization. ACM Transactions on Mathematical Software (TOMS), 23(4):550–560, 1997.
319
+
320
+ 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.
321
+
322
+ Jiong Zhu, Ryan A. Rossi, Anup Rao, Tung Mai, Nedim Lipka, Nesreen K. Ahmed, and Danai Koutra. Graph neural networks with heterophily. In Thirty-Fifth AAAI Conference on Artificial Intelligence, pp. 11168–11176. AAAI Press, 2021.
md/dev/qf12cWVSksq/qf12cWVSksq.md ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Inception Transformer
2
+
3
+ Chenyang $\mathbf { S _ { i } ^ { 1 * } }$ Weihao $\mathbf { V } _ { \mathbf { u } } { \mathbf { 1 } } , 2 *$ Pan Zhou1 Yichen Zhou1,2 Xinchao Wang2 Shuicheng Yan1
4
+
5
+ 1Sea AI Lab 2National University of Singapore {sicy,yuweihao,zhoupan,zhouyc,yansc}@sea.com, xinchao@nus.edu.sg
6
+
7
+ # Abstract
8
+
9
+ Recent studies show that Transformer has strong capability of building long-range dependencies, yet is incompetent in capturing high frequencies that predominantly convey local information. To tackle this issue, we present a novel and general-purpose Inception Transformer, or iFormer for short, that effectively learns comprehensive features with both high- and low-frequency information in visual data. Specifically, we design an Inception mixer to explicitly graft the advantages of convolution and max-pooling for capturing the high-frequency information to Transformers. Different from recent hybrid frameworks, the Inception mixer brings greater efficiency through a channel splitting mechanism to adopt parallel convolution/max-pooling path and self-attention path as high- and low-frequency mixers, while having the flexibility to model discriminative information scattered within a wide frequency range. Considering that bottom layers play more roles in capturing high-frequency details while top layers more in modeling low-frequency global information, we further introduce a frequency ramp structure, i.e., gradually decreasing the dimensions fed to the high-frequency mixer and increasing those to the low-frequency mixer, which can effectively trade-off high- and lowfrequency components across different layers. We benchmark the iFormer on a series of vision tasks, and showcase that it achieves impressive performance on image classification, COCO detection and ADE20K segmentation. For example, our iFormer-S hits the top-1 accuracy of $8 3 . 4 \%$ on ImageNet-1K, much higher than DeiT-S by $3 . 6 \%$ , and even slightly better than much bigger model Swin-B $( 8 3 . 3 \% )$ with only 1/4 parameters and 1/3 FLOPs. Code and models are released at https://github.com/sail-sg/iFormer.
10
+
11
+ # 1 Introduction
12
+
13
+ Transformer [1] has taken the natural language processing (NLP) domain by storm, achieving surprisingly high performance in many NLP tasks, e.g., machine translation [2] and question-answering [3]. This is largely attributed to its strong capability of modeling long-range dependencies in the data with self-attention mechanism. Its success has led researchers to investigate its adaptation to the computer vision field, and Vision Transformer (ViT) [4] is a pioneer. This architecture is directly inherited from NLP [1], but applied to image classification with raw image patches as input. Later, many ViT variants [5–13] have been developed to boost performance or scale to a wider range of vision tasks, e.g., object detection [10, 11] and segmentation [12, 13].
14
+
15
+ ViT and its variants are highly capable of capturing low-frequencies in the visual data [14], mainly including global shapes and structures of a scene or object, but are not very powerful for learning high-frequencies, mainly including local edges and textures. This can be intuitively explained: selfattention, the main operation used in ViTs to exchange information among non-overlap patch tokens, is a global operation and much more capable of capturing global information (low frequencies) in the data than local information (high frequencies). As shown in Fig. 1(a) and 1(b), the Fourier spectrum and relative log amplitudes of the Fourier show that ViT tends to well capture low-frequency signals but few high-frequency signals. This observation also accords with the empirical results in [14], which shows ViT presents the characteristics of low-pass filters. This low-frequency preferability impairs the performance of ViTs, as 1) low-frequency information filling in all the layers may deteriorate high-frequency components, e.g., local textures, and weakens modeling capability of ViTs; 2) high-frequency information is also discriminative and can benefit many tasks, e.g., (finegrained) classification. Actually, human visual system extracts visual elementary features at different frequencies [15–17]: low frequency provides global information about a visual stimulus, and high frequency conveys local spatial changes in the image (e.g., local edges/textures). Hence, it is necessary to develop a new ViT architecture for capturing both high and low frequencies in the visual data.
16
+
17
+ ![](images/7dcfc32625d6a4de2adb46aae0343a278fe54d15c4a4f86a916dd83be2194ca0.jpg)
18
+ Figure 1: (a) Fourier spectrum of ViT [18] and iFormer. (b) Relative log amplitudes of Fourier transformed feature maps. (c) Performance of models on ImageNet-1K validation set. (a) and (b) show that iFormer captures more high-frequency signals.
19
+
20
+ CNNs are the most fundamental backbone for general vision tasks. Unlike ViTs, they cover more local information through local convolution within the receptive fields, thus effectively extracting high-frequency representations [19, 20]. Recent studies [21–25] have integrated CNNs and ViTs considering their complementary advantages. Some methods [21, 22, 24, 25] stack convolution and attention layers in a serial manner to inject the local information into global context. Unfortunately, this serial manner only models one type of dependency, either global or local, in one layer, and discards the global information during locality modeling, or vice versa. Other works [23, 26] adopt parallel attention and convolution to learn global and local dependencies of the input at the same time. However, it is found in [27] that part of the channels are for processing local information and the other for global modeling, meaning current parallel structures have information redundancy if processing all channels in each branch.
21
+
22
+ To address this issue, we propose a simple and efficient Inception Transformer (iFormer), as shown in Fig. 2, which grafts the merit of CNNs for capturing high-frequencies to ViTs. The key component in iFormer is an Inception token mixer as shown in Fig. 3. This Inception mixer aims to augment the perception capability of ViTs in the frequency spectrum by capturing both high and low frequencies in the data. To this end, the Inception mixer first splits the input feature along the channel dimension, and then feeds the split components into high-frequency mixer and low-frequency mixer respectively. Here the high-frequency mixer consists of a max-pooling operation and a parallel convolution operation, while the low-frequency mixer is implemented by a vanilla self-attention in ViTs. In this way, our iFormer can effectively capture particular frequency information on the corresponding channel, and thus learn more comprehensive features within a wide frequency range compared with vanilla ViTs, which can be clearly observed in Fig. 1(a) and 1(b).
23
+
24
+ Moreover, we find that lower layers often need more local information, while higher layers desire more global information, which also accords with the observations in [27]. This is because, like in human visual system, the details in high frequency components help lower layers to capture visual elementary features and also to gradually gather local information for having a global understanding of the input. Inspired by this, we design a frequency ramp structure. In particular, from lower to higher layers, we gradually feed more channel dimensions to low-frequency mixer and fewer channel dimensions to high-frequency mixer. This structure can trade-off high-frequency and low-frequency components across all layers. Its effectiveness has been verified by experimental results in Sec. 4.
25
+
26
+ Experimental results show that iFormer surpasses state-of-the-art ViTs and CNNs on several vision tasks, including image classification, object detection and segmentation. For example, as shown in Fig. 1(c), with different model sizes, iFormer makes consistent improvements over popular frameworks on ImageNet-1K [28], e.g., DeiT [29], Swin [5] and ConvNeXt [30]. Meanwhile, iFormer outperforms recent frameworks on COCO [31] detection and ADE20K [32] segmentation.
27
+
28
+ # 2 Related work
29
+
30
+ Transformers [1] are firstly proposed for machine translation tasks and then become popular in other tasks like natural language understanding [33–35] and generation [36, 37] in NLP domain, as well as image classification [18, 29, 38], object detection [6, 39, 40] and semantic segmentation [41, 42] in computer vision. The attention module in Transformers has an outstanding ability to capture global dependency, but it makes the models produce similar representations across layers [27]. Moreover, self-attention mainly captures low-frequency information and tends to neglect high-frequency components related to the detailed information [14].
31
+
32
+ CNNs [43–47] are the de-facto model for vision tasks due to their outstanding ability to model local dependency [47–49] as well as extract high-frequency [19, 50]. With these advantages, CNNs are rapidly introduced into Transformers in a serial or parallel manner [23–26, 51–53]. For serial methods, convolutions are applied at different positions of the Transformer. CvT [25] and PVT-v2 [54] replace the hard patch embedding with a layer of overlapping convolution. LV-ViT [51], LeViT [55] and $\mathrm { V i T } _ { C }$ [21] further stack several layers of convolutions as the stem for models, which is found helpful in training and achieving better performance. Besides the stem, ViT-hybrid [18], CoAtNet [24], Hybrid-MS [56] and UniFormer [22] design early stages with convolution layers. However, the combination of convolution and attention in a serial order means each layer can only process either high or low frequency and neglects the other part. To enable each layer to process different frequencies, we adopt the parallel manner to combine convolution and attention in a token mixer.
33
+
34
+ Compared with serial methods, there are not many works combining attention and convolution in a parallel manner in literature. CoaT [26] and ViTAE [23] introduce convolution as a branch parallel to attention and utilize elementwise sum to merge the output of the two branches. However, Raghu et al. find that some channels tend to extract local dependency while others are for modeling global information [27], indicating redundancy for the current parallel mechanism to process all channels in different branches. In contrast, we split channels into branches of high and low frequencies. GLiT [53] also adopt parallel manner but it directly concatenate the features from convolution and attention branches as the mixer output, lacking the fusion of features in different frequencies. Instead, we design a explicit fusion module to merge the outputs from low- and high-frequency branches.
35
+
36
+ # 3 Method
37
+
38
+ # 3.1 Revisit Vision Transformer
39
+
40
+ We first revisit the Vision Transformer. For vision tasks, Transformers first split the input image into a sequence of tokens, and each patch token is projected into a hidden representation vector with a leaner layer, denoted as $\{ \pmb { x } _ { 1 } , \pmb { x } _ { 2 } , . . . , \pmb { x } _ { N } \}$ or $\dot { \boldsymbol { X } } \in \mathbb { R } ^ { N \times C }$ , where $N$ is the number of patch tokens and $C$ indicates the dimension of features. Then, all of the tokens are combined with a positional embedding and fed into the Transformer layers that contain multi-head self-attention (MSA) and a feed-forward network (FFN).
41
+
42
+ In MSA, the attention-based mixer exchanges information between all patch tokens so that it strongly focuses on aggregating the global dependency across all layers. However, excessive propagation of global information would strengthen the low-frequency representation. It can be seen from the visualization of Fourier spectrum in Fig. 1(a) that low-frequency information dominates the representations of ViT [18]. This actually impairs the performance of ViTs, as it may deteriorate the high-frequency components, e.g., local textures, and weakens the modeling capability of ViTs [14]. In the visual data, high-frequency information is also discriminative and can benefit many tasks [19, 20]. Hence, to address the issue, we propose a simple and efficient Inception Transformer, as shown in Fig. 2, with two key novelties, i.e., Inception mixer and frequency ramp structure.
43
+
44
+ ![](images/fa5af282bf147bcb40466814a4ab8f7223cfc008b311bed6387f875a80410c74.jpg)
45
+ Figure 2: The overall architecture of iFormer and details of iFormer block . For each block, yellow and green indicate low- and high-frequency information, respectively. Best viewed in color.
46
+
47
+ # 3.2 Inception token mixer
48
+
49
+ We propose an Inception mixer to graft the powerful capability of CNNs for extracting high-frequency representation to Transformers. Its detailed architecture is depicted in Fig. 3. We use the name of “Inception" since the token mixer is highly inspired by the Inception module [46, 57–59] with multiple branches. Instead of directly feeding image tokens into the MSA mixer, the Inception mixer first splits the input feature along the channel dimension, and then respectively feeds the split components into high-frequency mixer and low-frequency mixer. Here the high-frequency mixer consists of a max-pooling operation and a parallel convolution operation, while the low-frequency mixer is implemented by a self-attention.
50
+
51
+ Technically, given the input feature map $\pmb { X } \in \mathbb { R } ^ { N \times C }$ , it is factorized $\boldsymbol { X }$ into $\mathbf { \bar { X } } _ { h } \in \mathbb { R } ^ { N \times \mathbf { \bar { C } } _ { h } }$ and $\pmb { X } _ { l } \in \mathrm { \overline { { \mathbb { R } } } } ^ { N \times C _ { l } }$ along the channel dimension, where $C _ { h } + C _ { l } = C$ . Then, $X _ { h }$ and $X _ { l }$ are assigned to high-frequency mixer and low-frequency mixer respectively.
52
+
53
+ ![](images/93cf66a843d755e2e7727aab42966c4b375e1686464ff724f292685f7dded607.jpg)
54
+ Figure 3: The details of Inception mixer.
55
+
56
+ High-frequency mixer. Considering the sharp sensitiveness of the maximum filter and the detail perception of convolution operation, we propose a parallel structure to learn the high-frequency components. We divide the input $X _ { h }$ into $\boldsymbol { X } _ { h 1 } \in \mathbb { R } ^ { N \times \frac { C _ { h } } { 2 } }$ and $\boldsymbol { X } _ { h 2 } \in \mathbb { R } ^ { N \times \frac { C _ { h } } { 2 } }$ along the channel. As shown in Fig. 3, $X _ { h 1 }$ is embedded with a max-pooling and a linear layer [46], and $X _ { h 2 }$ is fed into a linear and a depthwise convolution layer [60–62]:
57
+
58
+ $$
59
+ \begin{array} { r } { \pmb { Y } _ { h 1 } = \mathrm { F C } \left( \mathrm { M a x P o o l } \left( \pmb { X } _ { h 1 } \right) \right) , } \\ { \pmb { Y } _ { h 2 } = \mathrm { D w C o n v } \left( \mathrm { F C } \left( \pmb { X } _ { h 2 } \right) \right) , } \end{array}
60
+ $$
61
+
62
+ where $\mathbf { Y } _ { h 1 }$ and $Y _ { h 2 }$ denote the outputs of high-frequency mixers.
63
+
64
+ Finally, the outputs of low- and high-frequency mixers are concatenated along the channel dimension:
65
+
66
+ $$
67
+ Y _ { c } = \mathrm { C o n c a t } \left( \boldsymbol { Y } _ { l } , \boldsymbol { Y } _ { h 1 } , \boldsymbol { Y } _ { h 2 } \right) .
68
+ $$
69
+
70
+ The upsample operation in Eq. (7) selects the value of the nearest point for each position to be interpolated regardless of any other points, which results in excessive smoothness between adjacent tokens. We design a fusion module to elegantly overcome this issue, i.e., a depthwise convolution exchanging information between patches, while keeping a cross-channel linear layer that works per location like in previous Transformers. The final output can be expressed as
71
+
72
+ $$
73
+ \pmb { Y } = \mathrm { F C } \left( \pmb { Y _ { c } } + \mathrm { D w C o n v } \left( \pmb { Y _ { c } } \right) \right) .
74
+ $$
75
+
76
+ Like the vanilla Transformer, our iFormer is equipped with a feed-forward network (FFN), and differently it also incorporates the above Inception token mixer (ITM); LayerNorm (LN) is applied before ITM and FFN. Hence the Inception Transformer block is formally defined as
77
+
78
+ $$
79
+ \begin{array} { r } { Y = X + \mathrm { I T M } \left( \mathrm { L N } \left( \pmb { X } \right) \right) , } \\ { \pmb { H } = \pmb { Y } + \mathrm { F F N } \left( \mathrm { L N } \left( \pmb { Y } \right) \right) . } \end{array}
80
+ $$
81
+
82
+ Low-frequency mixer. We use the vanilla multi-head self-attention to communicate information among all tokens for the low-frequency mixer. Despite the strong capability of the attention for learning global representation, the large resolution of feature maps would bring large computation cost in lower layers. We therefore simply utilize an average pooling layer to reduce the spatial scale of $X _ { l }$ before the attention operation and an upsample layer to recover the original spatial dimension after the attention. This design largely reduces the computational overhead and makes the attention operation focus on embedding global information. This branch can be defined as
83
+
84
+ $$
85
+ \pmb { Y } _ { l } = \mathrm { U p s a m p l e } \left( \mathrm { M S A } \left( \mathrm { A v e P o o l i n g } \left( \pmb { X } _ { l } \right) \right) \right) ,
86
+ $$
87
+
88
+ where $\mathbf { \nabla } _ { Y _ { l } }$ is the output of low-frequency mixer. Note that the kernel size and stride for the pooling and upsample layers are set to 2 only at the first two stages.
89
+
90
+ # 3.3 Frequency ramp structure
91
+
92
+ In the general visual frameworks, bottom layers play more roles in capturing high-frequency details while top layers more in modeling low-frequency global information, i.e., the hierarchical representations of ResNet [47]. Like humans, by capturing the details in high frequency components, lower layers can capture visual elementary features, and also gradually gather local information to achieve a global understanding of the input. We are inspired to design a frequency ramp structure which gradually splits more channel dimensions from lower to higher layers to low-frequency mixer and thus leave fewer channel dimensions to high-frequency mixer. Specifically, as shown in Fig. 2, our backbone has four stages with different channel and spatial dimensions. For each blocks, we define a channel ratio to better balance the high-frequency and low frequency components, i.e., $\frac { C _ { h } } { C }$ and $\frac { C _ { l } } { C }$ , where $\begin{array} { r } { \frac { C _ { h } } { C } + \frac { C _ { l } } { C } = 1 } \end{array}$ . In the proposed frequency ramp structure, $\frac { C _ { h } } { C }$ gradually decreases from shallow to deep layers, while $\frac { C _ { l } } { C }$ gradually increases. Hence, with the flexible frequency ramp structure, iFormer can effectively trade-off high- and low-frequency components across all layers. The configuration of different iFormer models will be described in the appendix.
93
+
94
+ # 4 Experiments
95
+
96
+ We evaluate our iFormer on several vision benchmark tasks, i.e., image classification, object detection and semantic segmentation, by comparing it with representative ViTs, CNNs and their hybrid variants. Ablation analysis is also conducted to show the contribution of each novelty in our method. More results will be reported in the appendix.
97
+
98
+ # 4.1 Results on image classification
99
+
100
+ Setup. For image classification, we evaluate iFormer on the ImageNet dataset [28]. We train the iFormer model with the standard procedure in [6, 22, 29]. Specifically, we use AdamW optimizer with an initial learning rate $1 \times 1 0 ^ { - 3 }$ via cosine decay [70], a momentum of 0.9, and a weight decay of 0.05. We set the training epoch number as 300 and the input size as $2 2 4 \times 2 2 4$ . We adopt the same data augmentations and regularization methods in DeiT [29] for fair comparison.
101
+
102
+ We also use LayerScale [71] to train deep models. Like previous studies [5, 67], we further fine tune iFormer on the input size of $3 8 4 \times 3 8 4$ , with the weight decay of $1 \times 1 0 ^ { - 8 }$ , learning rate of $1 \times 1 0 ^ { - 5 }$ , batch size of 512. For fairness, we adopt Timm [72] to implement and train iFormer.
103
+
104
+ Results. Table 1 summarizes the image classification accuracy of all compared methods on ImageNet. For the small model size $( { \sim } 2 0 \mathbf { M } )$ , our iFormer surpasses both the SoTA ViTs and hybrid ViTs, although some ViTs, e.g., Swin [5], Focal [64] and CSwin [65], actually already introduce convolutionlike inductive bias into their architectures, and hybrid ViTs directly integrate convolution into ViTs. Specifically, our iFormer-S respectively gains $0 . { \dot { 7 } } \%$ and $0 . 5 \%$ top-1 accuracy advantage over SoTA
105
+
106
+ Table 1: Comparison of different types of models on ImageNet-1K [28].
107
+
108
+ <table><tr><td>Model Size</td><td>Arch.</td><td>Method</td><td>#Param. (M)</td><td>FLOPs (G)</td><td colspan="2">Input Size Train Test</td><td colspan="2">ImageNet Top-1 Top-5</td></tr><tr><td rowspan="10">srs gepren</td><td>CNN</td><td>RSB-ResNet-50 [47, 63]</td><td>26</td><td>4.1</td><td>224</td><td>224</td><td>80.4</td><td>-</td></tr><tr><td rowspan="3"></td><td>ConvNeXt-T[30]</td><td>28</td><td>4.5</td><td>224</td><td>224</td><td>82.1</td><td>-</td></tr><tr><td>Deit-S [29]</td><td>22</td><td>4.6</td><td>224</td><td>224</td><td>79.8</td><td>95.0</td></tr><tr><td>PVT-S [6]</td><td>25</td><td>3.8</td><td>224</td><td>224</td><td>79.8</td><td>1</td></tr><tr><td>T2T-14 [38] Swin-T[5]</td><td>22</td><td>5.2</td><td>224</td><td>224</td><td>80.7</td><td>1</td></tr><tr><td></td><td>29</td><td>4.5</td><td>224</td><td>224</td><td>81.3</td><td>95.5</td></tr><tr><td>Focal-T [64]</td><td>29</td><td>4.9</td><td>224</td><td>224</td><td>82.2</td><td>95.9</td></tr><tr><td>CSwin-T [65]</td><td>23</td><td>4.3</td><td>224</td><td>224</td><td>82.7</td><td>1</td></tr><tr><td>CvT-13 [25]</td><td>20</td><td>4.5</td><td>224</td><td>224</td><td>81.6</td><td>1</td></tr><tr><td>CoAtNet-0 [24]</td><td>25</td><td>4.2</td><td>224</td><td>224</td><td>81.6</td><td></td></tr><tr><td rowspan="5">Hybrid</td><td>Container [66]</td><td>22</td><td>8.1</td><td>224</td><td>224</td><td>82.7</td><td>1 -</td></tr><tr><td>ViTAE-S [23]</td><td>24</td><td>5.6</td><td>224</td><td>224</td><td>82.0</td><td>95.9</td></tr><tr><td>ViTAEv2-S [67]</td><td>19</td><td>5.7</td><td>224</td><td>224</td><td>82.6</td><td>96.2</td></tr><tr><td>UniFormer-S [22]</td><td>22</td><td>3.6</td><td>224</td><td>224</td><td>82.9</td><td>1</td></tr><tr><td> iFormer-S</td><td>20</td><td>4.8</td><td>224</td><td>224</td><td>83.4</td><td>96.6</td></tr><tr><td rowspan="9">wrg glpor irrea</td><td rowspan="2">CNN</td><td>RSB-ResNet-101 [47, 63]</td><td>45</td><td>7.9</td><td>224</td><td>224</td><td>81.5</td><td>-</td></tr><tr><td>RSB-ResNet-152 [47, 63]</td><td>60</td><td>11.6</td><td>224</td><td>224</td><td>82.0</td><td>-</td></tr><tr><td>ConvNeXt-S [30]</td><td>50</td><td>8.7</td><td>224</td><td>224</td><td>83.1</td><td>1</td></tr><tr><td rowspan="5">PVT-L [6] ViT</td><td></td><td>61</td><td>9.8</td><td>224</td><td>224</td><td>81.7</td><td>-</td></tr><tr><td>T2T-24 [38]</td><td>64</td><td>13.2</td><td>224</td><td>224</td><td>82.2</td><td>-</td></tr><tr><td>Swin-S[5]</td><td>50</td><td>8.7</td><td>224</td><td>224</td><td>83.0</td><td>96.2</td></tr><tr><td>Focal-S [64]</td><td>51</td><td>9.1</td><td>224</td><td>224</td><td>83.5</td><td>96.2</td></tr><tr><td>CSwin-S [65]</td><td>35</td><td>6.9</td><td>224</td><td>224</td><td>83.6</td><td>1</td></tr><tr><td rowspan="5">Hybrid</td><td>CvT-21[25]</td><td>32</td><td>7.1</td><td>224</td><td>224</td><td>82.5</td><td>1</td></tr><tr><td>CoAtNet-1 [24]</td><td>42</td><td>8.4</td><td>224</td><td>224</td><td>83.3</td><td>1</td></tr><tr><td>ViTAEv2-48M[67]</td><td>49</td><td>13.3</td><td>224</td><td>224</td><td>83.8</td><td>96.6</td></tr><tr><td>UniFormer-B [22]</td><td>50</td><td>8.3</td><td>224</td><td>224</td><td>83.9</td><td>-</td></tr><tr><td>iFormer-B</td><td>48</td><td>9.4</td><td>224</td><td>224</td><td>84.6</td><td>97.0</td></tr><tr><td rowspan="7">geporee (IW00I~)</td><td>CNN</td><td>RegNetY-16GF [29, 68]</td><td>84</td><td>16.0</td><td>224</td><td>224</td><td>82.9</td><td>-</td></tr><tr><td rowspan="3">ViT</td><td>ConvNeXt-B [30]</td><td>89</td><td>15.4</td><td>224</td><td>224</td><td>83.8</td><td>1</td></tr><tr><td>DeiT-B [29]</td><td>86</td><td>17.5</td><td>224</td><td>224</td><td>81.8</td><td>95.6</td></tr><tr><td>Swin-B [5] Focal-B [64]</td><td>88 90</td><td>15.4</td><td>224</td><td>224</td><td>83.3</td><td>96.5</td></tr><tr><td rowspan="3">CSwin-B [65]</td><td></td><td></td><td>16.0</td><td>224 224</td><td>224 224</td><td>83.8 84.2</td><td>96.5</td></tr><tr><td></td><td>78</td><td>15.0</td><td></td><td></td><td></td><td>-</td></tr><tr><td>BoTNet-T7 [69] CoAtNet-3 [24]</td><td>79 168</td><td>19.3</td><td>256 224</td><td>256 224</td><td>84.2 84.5</td><td>-</td></tr><tr><td rowspan="3">Hybrid</td><td></td><td></td><td>34.7</td><td></td><td></td><td></td><td>-</td></tr><tr><td>ViTAEv2-B 67]</td><td>90</td><td>24.3</td><td>224</td><td>224</td><td>84.6</td><td>96.9</td></tr><tr><td> iFormer-L</td><td>87</td><td>14.0</td><td>224</td><td>224</td><td>84.8</td><td>97.0</td></tr></table>
109
+
110
+ ViTs ( i.e., CSwin-T) and hybrid ViTs ( i.e., UniFormer-S), while enjoying the same or smaller model size.
111
+
112
+ For the medium model size $( \sim 5 0 \mathrm { M } )$ , iFormer-B achieves $8 4 . 6 \%$ top-1 accuracy, and improves over the SoTA ViTs and hybrid ViTs with similar model sizes by significant margins $1 . 0 \%$ and $0 . 7 \%$ respectively. For CNNs, similar to comparison results on medium model size, our iFormer-B outperforms ConvNeXt-S by $1 . 5 \%$ . As for the large mode $\left( \sim 1 0 0 \mathbf { M } \right)$ , one can observe similar results on small and medium model sizes.
113
+
114
+ Table 2 reports the fine-tuning accuracy on the larger resolution, i.e., $3 8 4 \times 3 8 4$ . One can observe that iFormer consistently outperforms the counterparts by a significant margin across different computation settings. These results clearly demonstrate the advantages of iFormer on image classifications.
115
+
116
+ Table 2: Fine-tuning Results with larger resolution $( 3 8 4 \times 3 8 4 )$ on ImageNet-1K [28]. The models in gray color are trained with larger input size.
117
+
118
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">#Param. (M)</td><td rowspan="2">FLOPs (G)</td><td colspan="2">Input Size</td><td rowspan="2">ImageNet Top-1</td></tr><tr><td>Train</td><td>Test</td></tr><tr><td>EfficientNet-B5 [73]</td><td>30</td><td>9.9</td><td>456</td><td>456</td><td>83.6</td></tr><tr><td>EfficientNetV2-S [74]</td><td>22</td><td>8.5</td><td>384</td><td>384</td><td>83.9</td></tr><tr><td>CSwin-T↑384 [65]</td><td>23</td><td>14.0</td><td>224</td><td>384</td><td>84.3</td></tr><tr><td>CvT-13↑384 [25]</td><td>20</td><td>16.3</td><td>224</td><td>384</td><td>83.0</td></tr><tr><td>CoAtNet-0↑384 [24]</td><td>20</td><td>13.4</td><td>224</td><td>384</td><td>83.9</td></tr><tr><td>ViTAEv2-S↑384 [67]</td><td>19</td><td>17.8</td><td>224</td><td>384</td><td>83.8</td></tr><tr><td>iFormer-S↑384</td><td>20</td><td>16.1</td><td>224</td><td>384</td><td>84.6</td></tr><tr><td>EfficientNet-B7 [73]</td><td>66</td><td>39.2</td><td>600</td><td>600</td><td>84.3</td></tr><tr><td>EfficientNetV2-M [74]</td><td>54</td><td>25.0</td><td>480</td><td>480</td><td>85.1</td></tr><tr><td>ViTAEv2-48M ↑384 [67]</td><td>49</td><td>41.1</td><td>224</td><td>384</td><td>84.7</td></tr><tr><td>CSwin-S↑384 [65]</td><td>35</td><td>22.0</td><td>224</td><td>384</td><td>85.0</td></tr><tr><td>CoAtNet-1↑384 [24]</td><td>42</td><td>27.4</td><td>224</td><td>384</td><td>85.1</td></tr><tr><td>iFormer-B↑384</td><td>48</td><td>30.5</td><td>224</td><td>384</td><td>85.7</td></tr><tr><td>EfficientNetV2-L [74]</td><td>121</td><td>53</td><td>480</td><td>480</td><td>85.7</td></tr><tr><td>Swin-B↑384 [5]</td><td>88</td><td>47.0</td><td>224</td><td>384</td><td>84.2</td></tr><tr><td>CSwin-B↑384 [65]</td><td>78</td><td>47.0</td><td>224</td><td>384</td><td>85.4</td></tr><tr><td>ViTAEv2-B↑384 [67]</td><td>90</td><td>74.4</td><td>224</td><td>384</td><td>85.3</td></tr><tr><td>CoAtNet-2↑384 [24]</td><td>75</td><td>49.8</td><td>224</td><td>384</td><td>85.7</td></tr><tr><td>iFormer-L↑384</td><td>87</td><td>45.3</td><td>224</td><td>384</td><td>85.8</td></tr></table>
119
+
120
+ Table 3: Performance of object detection and instance segmentation on COCO val2017 [31]. $A P ^ { b }$ and $A P ^ { m }$ represent bounding box AP and mask AP, respectively. All models are based on Mask R-CNN [75] and trained by $1 \times$ training schedule. The FLOPs are measured at resolution $8 0 0 \times 1 2 8 0$ .
121
+
122
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">#Param. (M)</td><td rowspan="2">FLOPs (G)</td><td colspan="6">Mask R-CNN1 ×</td></tr><tr><td>Ap6</td><td>AP</td><td>AP</td><td>Apm</td><td>AP50</td><td>AP75</td></tr><tr><td>ResNet50 [47]</td><td>44</td><td>260</td><td>38.0</td><td>58.6</td><td>41.4</td><td>34.4</td><td>55.1</td><td>36.7</td></tr><tr><td>PVT-S [6]</td><td>44</td><td>245</td><td>40.4</td><td>62.9</td><td>43.8</td><td>37.8</td><td>60.1</td><td>40.3</td></tr><tr><td>TwinsP-S[76]</td><td>44</td><td>245</td><td>42.9</td><td>65.8</td><td>47.1</td><td>40.0</td><td>62.7</td><td>42.9</td></tr><tr><td>Twins-S [76]</td><td>44</td><td>228</td><td>43.4</td><td>66.0</td><td>47.3</td><td>40.3</td><td>63.2</td><td>43.4</td></tr><tr><td>Swin-T[5]</td><td>48</td><td>264</td><td>42.2</td><td>64.6</td><td>46.2</td><td>39.1</td><td>61.6</td><td>42.0</td></tr><tr><td>ViL-S [77]</td><td>45</td><td>218</td><td>44.9</td><td>67.1</td><td>49.3</td><td>41.0</td><td>64.2</td><td>44.1</td></tr><tr><td>Focal-T [64]</td><td>49</td><td>291</td><td>44.8</td><td>67.7</td><td>49.2</td><td>41.0</td><td>64.7</td><td>44.2</td></tr><tr><td>UniFormer-Sh14 [22]</td><td>41</td><td>269</td><td>45.6</td><td>68.1</td><td>49.7</td><td>41.6</td><td>64.8</td><td>45.0</td></tr><tr><td> iFormer-S</td><td>40</td><td>263</td><td>46.2</td><td>68.5</td><td>50.6</td><td>41.9</td><td>65.3</td><td>45.0</td></tr><tr><td>ResNet101 [47]</td><td>63</td><td>336</td><td>40.4</td><td>61.1</td><td>44.2</td><td>36.4</td><td>57.7</td><td>38.8</td></tr><tr><td>X101-32</td><td>63</td><td>340</td><td>41.9</td><td>62.5</td><td>45.9</td><td>37.5</td><td>59.4</td><td>40.2</td></tr><tr><td>PVT-M [6]</td><td>64</td><td>302</td><td>42.0</td><td>64.4</td><td>45.6</td><td>39.0</td><td>61.6</td><td>42.1</td></tr><tr><td>TwinsP-B[76]</td><td>64</td><td>302</td><td>44.6</td><td>66.7</td><td>48.9</td><td>40.9</td><td>63.8</td><td>44.2</td></tr><tr><td>Twins-B[76]</td><td>76</td><td>340</td><td>45.2</td><td>67.6</td><td>49.3</td><td>41.5</td><td>64.5</td><td>44.8</td></tr><tr><td>Swin-S [5]</td><td>69</td><td>354</td><td>44.8</td><td>66.6</td><td>48.9</td><td>40.9</td><td>63.4</td><td>44.2</td></tr><tr><td>Focal-S [64]</td><td>71</td><td>401</td><td>47.4</td><td>69.8</td><td>51.9</td><td>42.8</td><td>66.6</td><td>46.1</td></tr><tr><td>CSWin-S [65]</td><td>54</td><td>342</td><td>47.9</td><td>70.1</td><td>52.6</td><td>43.2</td><td>67.1</td><td>46.2</td></tr><tr><td>UniFormer-B [22]</td><td>69</td><td>399</td><td>47.4</td><td>69.7</td><td>52.1</td><td>43.1</td><td>66.0</td><td>46.5</td></tr><tr><td> iFormer-B</td><td>67</td><td>351</td><td>48.3</td><td>70.3</td><td>53.2</td><td>43.4</td><td>67.2</td><td>46.7</td></tr></table>
123
+
124
+ # 4.2 Results on object detection and instance segmentation
125
+
126
+ Setup. We evaluate iFormer on the COCO object detection and instance segmentation tasks [31], where the models are trained on 118K images and evaluated on validation set with 5K images. Here, we use iFormer as the backbone in Mask R-CNN [75]. In the training phase, we use iFormer pretrained on ImageNet to initialize the detector, and adopt AdamW to train with an initial learning rate of $1 \times 1 0 ^ { - 4 }$ , a batch size of 16, and $1 \times$ training schedule with 12 epochs. For training, the input images are resized to be 800 pixels on the shorter side an no more than 1,333 pixels on the longer side. For the test image, its shorter side is fixed to 800 pixels. All experiments are implemented on mmdetection [78] codebase.
127
+
128
+ Results. Table 3 reports the box mAP $( \mathsf { A P } ^ { b } )$ and mask mAP $( \mathbf { A P } ^ { m } )$ of the compared models. Under similar computation configurations, iFormers outperforms all previous backbones. Specifically, compared with popular ResNet [47] backbones, our iFormer-S brings 8.2 points of $\mathbf { A } \bar { \mathbf { P } } ^ { b }$ and 7.5 points $\mathbf { A P } ^ { m }$ improvements over ResNet50. Compared with various Transformer backbones, our iFormers still maintain the performance superiority over their results. For example, our iFormer-B surpasses UniFormer-B [22], Swin-S [5] by 0.9 points of $\mathsf { A P } ^ { b }$ and 3.5 points of $\mathsf { A P } ^ { b }$ respectively.
129
+
130
+ # 4.3 Results on semantic segmentation
131
+
132
+ Setup. We further evaluate the generality of iFormer through a challenging scene parsing benchmark on semantic segmentation, i.e., ADE20K [32]. The dataset contains 20K training images and 2K validation images. We adopt iFormer pretrained on ImageNet as the backbone of the Semantic FPN [79] framework. Following PVT [6] and UniFormer [22], we use AdamW with an initial learning rate of $2 \times 1 0 ^ { - 4 }$ with cosine learning rate schedule to train 80k iterations. All experiments are implemented on mmsegmentation [80] codebase.
133
+
134
+ Results. In Table 4, we report the mIoU results of different backbones. On the Semantic FPN [79] framework, our iFormer consistently outperforms previous backbones on this task, in
135
+
136
+ Table 4: Semantic segmentation with semantic FPN [79] on ADE20K [32]. The FLOPs are measured at resolution $5 1 2 \times 2 0 4 8$ .
137
+
138
+ <table><tr><td rowspan=1 colspan=2>Method</td><td rowspan=1 colspan=1>#Param.(M)</td><td rowspan=1 colspan=1>FLOPs(G)</td><td rowspan=1 colspan=1>mIoU(%)</td></tr><tr><td rowspan=5 colspan=2>ResNet50 [47]PVT-S [6]TwinsP-S [76]Twins-S [76]Swin-T[5]</td><td rowspan=1 colspan=1>29</td><td rowspan=1 colspan=1>183</td><td rowspan=1 colspan=1>36.7</td></tr><tr><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>28</td><td rowspan=1 colspan=1>161</td><td rowspan=1 colspan=1>39.8</td></tr><tr><td rowspan=1 colspan=1>28</td><td rowspan=1 colspan=1>162</td><td rowspan=1 colspan=1>44.3</td></tr><tr><td rowspan=1 colspan=1>28</td><td rowspan=1 colspan=1>144</td><td rowspan=1 colspan=1>43.2</td></tr><tr><td rowspan=1 colspan=1>32</td><td rowspan=1 colspan=1>182</td><td rowspan=1 colspan=1>41.5</td></tr><tr><td rowspan=2 colspan=2>UniFormer-Sh32 [22]UniFormer-S [22]</td><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>199</td><td rowspan=1 colspan=1>46.2</td></tr><tr><td rowspan=1 colspan=1>25</td><td rowspan=1 colspan=1>247</td><td rowspan=1 colspan=1>46.6</td></tr><tr><td rowspan=1 colspan=2>UniFormer-B [22]</td><td rowspan=1 colspan=1>54</td><td rowspan=1 colspan=1>471</td><td rowspan=1 colspan=1>48.0</td></tr><tr><td rowspan=1 colspan=2>iFormer-S</td><td rowspan=1 colspan=1>24</td><td rowspan=1 colspan=1>181</td><td rowspan=1 colspan=1>48.6</td></tr></table>
139
+
140
+ cluding CNNs and (hybrid) ViTs. For instance, iFormer-S achieves $4 8 . 6 \mathrm { m I o U }$ , surpassing UniFormerS [22] by 2.0 mIoU, while using less computation complexity. Moreover, compared with UniFormerB [22], our iFormer-S still achieves 0.6 mIoU improvement with only $1 / 2$ parameters and nearly $1 / 3$ FLOPs.
141
+
142
+ # 4.4 Ablation study and visualization
143
+
144
+ In this section, we conduct experiments to better understand iFormer. All the models are trained for 100 epochs on ImageNet, with the same training setting as described in Sec. 4.1.
145
+
146
+ Inception token mixer. The Inception mixer is proposed to augment the perception capability of ViTs in the frequency spectrum. To evaluate the effects of the components in the Inception mixer, we remove the max-pooling or convolution from the full model and then report the results in Table 5, where !and %denote whether or not the corresponding branch is enabled. Observably, combining attention with convolution and max-pooling can the highest classification accuracy. To further explore this scheme, Fig. 4 visualizes the Fourier spectrum of the Attention, MaxPool and DwConv branches in Inception mixer. We can see the attention mixer has higher concentrations on low frequencies; with the high-frequency mixer, i.e., convolution and max-pooling, the model is encouraged to learn high frequency information. Overall, these results prove the effectiveness of the Inception mixer for expanding the perception capability of the Transformer in the frequency spectrum.
147
+
148
+ Table 5: Ablation study of Inception mixer and frequency ramp structure on ImageNet-1K. All the models are trained for 100 epochs.
149
+
150
+ <table><tr><td rowspan="3">Mixer</td><td>Attention</td><td>MaxPool</td><td>DwConv</td><td>|#Param. (M)</td><td>FLOPs (G)</td><td>Top-1(%)</td></tr><tr><td></td><td></td><td>x&lt;&gt;</td><td>20</td><td>4.9</td><td>81.2</td></tr><tr><td>&gt;&lt;&gt;</td><td>&lt;x&gt;</td><td></td><td>20</td><td>4.9</td><td>81.4</td></tr><tr><td rowspan="4">Structure</td><td></td><td></td><td></td><td>20</td><td>4.8</td><td>81.5</td></tr><tr><td></td><td>Ci/C↓,Cn/C ↑</td><td></td><td>19</td><td>4.7</td><td>80.5</td></tr><tr><td></td><td>Ci/C = Cn/C</td><td></td><td>19</td><td>4.7</td><td>80.7</td></tr><tr><td></td><td>Ci/C ↑,Cn/C ↓</td><td></td><td>20</td><td>4.8</td><td>81.2</td></tr></table>
151
+
152
+ ![](images/46ddba43fd578185a56c3e611b19794455edf54c4b21d572a3b4b6faa58adddc.jpg)
153
+ Figure 4: (a) (b) Fourier spectrum of iFormer-S for the MaxPool, DwConv and Attention branches in the Inception mixer. We can observe that attention mixer tends to reduce highfrequencies, while MaxPool and DwConv enhance them.
154
+
155
+ ![](images/416b5c09f34f21b40fbb9af24cfa6e4397c72b5f2888c05290bcdb791b4b0a4f.jpg)
156
+ Figure 5: Grad-CAM [81] activation maps of Swin-T [5] and iFormer-S trained on ImageNet.
157
+
158
+ Frequency ramp structure. Previous investigations [27] show requirement of more local information at lower layers of the Transformer and more global information at higher layers. We accordingly assume that a frequency ramp structure, i.e., decreasing dimensions at high-frequency components and increasing dimensions at low-frequency components from lower to higher layers, has a better trade-off between high-frequency and low-frequency components across all layers. In order to justify this hypothesis, we investigate the effects of the channel ratio ( $\frac { C _ { h } } { C }$ and $\begin{array} { r } { \frac { C _ { l } } { C } . } \end{array}$ ) in Table 5. It can be clearly seen that the model with $C _ { l } / C \uparrow , C _ { h } / C \downarrow$ outperforms the other two models, which is consistent with the previous investigations. Hence, this indicates the rationality of the frequency ramp structure and its potential for leaning discriminating vision representations.
159
+
160
+ Visualization. We visualize the Grad-CAM [81] activation maps of iFormer-S as well as Swin-T [5] models trained on ImageNet-1K in Fig. 5. It can be seen that compared with Swin, iFormer can more accurately and completely locate the objects. For example, in the hummingbird image, iFormer skips the branch and accurately attends to the whole bird including the tail.
161
+
162
+ # 5 Conclusion
163
+
164
+ In this paper, we present an Inception Transformer (iFormer), a novel and general Transformer backbone. iFormer adopts a channel splitting mechanism to simply and efficiently couple convolution/maxpooling and self-attention, giving more concentrations on high frequencies and expanding the perception capability of the Transformer in the frequency spectrum. Based on the flexible Inception token mixer, we further design a frequency ramp structure, enabling effective trade-off between high-frequency and low-frequency components across all layers. Extensive experiments show that iFormer outperforms representative vision Transformers on image classification, object detection and semantic segmentation, demonstrating the great potential of our iFormer to serve as a general-purpose backbone for computer vision. We hope this study will provide valuable insights for the community to design efficient and effective Transformer architectures.
165
+
166
+ Limitation. One obvious limitation of the proposed iFormer is that it requires manually defined channel ratio in the frequency ramp structure i.e., $\frac { C _ { h } } { C }$ and $\frac { C _ { l } } { C }$ for each iFormer block, which needs rich experience to define better on different tasks. it is not trained on large scale datasets, e.g.,
167
+
168
+ ImageNet-21K [48], due to computational constraint, which will be explored in further. Also, iFormer requires manually defined channel ratio in the frequency ramp structure i.e., $\textstyle { \frac { C _ { h } } { C } }$ and $\frac { C _ { l } } { C }$ for each iFormer block, which needs rich experience to define better on different tasks. A straightforward solution would be to use neural architecture search.
169
+
170
+ # Acknowledgement
171
+
172
+ Weihao Yu would like to thank TRC program and GCP research credits for the support of partial computational resources. This project is in part supported by the National Research Foundation Singapore under its AI Singapore Programme (Award Number: AISG2-RP-2021-023).
173
+
174
+ # References
175
+
176
+ [1] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
177
+ [2] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
178
+ [3] 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.
179
+ [4] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2020.
180
+ [5] 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.
181
+ [6] Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 568–578, 2021.
182
+ [7] Weihao Yu, Mi Luo, Pan Zhou, Chenyang Si, Yichen Zhou, Xinchao Wang, Jiashi Feng, and Shuicheng Yan. Metaformer is actually what you need for vision. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2022.
183
+ [8] Drew A Hudson and Larry Zitnick. Generative adversarial transformers. In International Conference on Machine Learning, pages 4487–4499. PMLR, 2021.
184
+ [9] Anurag Arnab, Mostafa Dehghani, Georg Heigold, Chen Sun, Mario Luciˇ c, and Cordelia Schmid. Vivit: A ´ video vision transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 6836–6846, 2021.
185
+ [10] Josh Beal, Eric Kim, Eric Tzeng, Dong Huk Park, Andrew Zhai, and Dmitry Kislyuk. Toward transformerbased object detection. arXiv preprint arXiv:2012.09958, 2020.
186
+ [11] Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, and Wenyu Liu. You only look at one sequence: Rethinking transformer in vision through object detection. Advances in Neural Information Processing Systems, 34, 2021.
187
+ [12] 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, pages 6881–6890, 2021.
188
+ [13] Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M Alvarez, and Ping Luo. Segformer: Simple and efficient design for semantic segmentation with transformers. Advances in Neural Information Processing Systems, 34, 2021.
189
+ [14] Namuk Park and Songkuk Kim. How do vision transformers work? In International Conference on Learning Representations, 2021.
190
+ [15] Jean Bullier. Integrated model of visual processing. Brain research reviews, 36(2-3):96–107, 2001.
191
+ [16] Moshe Bar. A cortical mechanism for triggering top-down facilitation in visual object recognition. Journal of cognitive neuroscience, 15(4):600–609, 2003.
192
+ [17] Louise Kauffmann, Stephen Ramanoël, and Carole Peyrin. The neural bases of spatial frequency processing during scene perception. Frontiers in integrative neuroscience, 8:37, 2014.
193
+ [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.
194
+ [19] Haohan Wang, Xindi Wu, Zeyi Huang, and Eric P Xing. High-frequency component helps explain the generalization of convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 8684–8694, 2020.
195
+ [20] Dong Yin, Raphael Gontijo Lopes, Jon Shlens, Ekin Dogus Cubuk, and Justin Gilmer. A fourier perspective on model robustness in computer vision. Advances in Neural Information Processing Systems, 32, 2019.
196
+ [21] Tete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dollár, and Ross Girshick. Early convolutions help transformers see better. Advances in Neural Information Processing Systems, 34:30392–30400, 2021.
197
+ [22] Kunchang Li, Yali Wang, Peng Gao, Guanglu Song, Yu Liu, Hongsheng Li, and Yu Qiao. Uniformer: Unified transformer for efficient spatiotemporal representation learning. arXiv preprint arXiv:2201.04676, 2022.
198
+ [23] Yufei Xu, Qiming Zhang, Jing Zhang, and Dacheng Tao. Vitae: Vision transformer advanced by exploring intrinsic inductive bias. Advances in Neural Information Processing Systems, 34, 2021.
199
+ [24] Zihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. Advances in Neural Information Processing Systems, 34:3965–3977, 2021.
200
+ [25] Haiping Wu, Bin Xiao, Noel Codella, Mengchen Liu, Xiyang Dai, Lu Yuan, and Lei Zhang. Cvt: Introducing convolutions to vision transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 22–31, 2021.
201
+ [26] Weijian Xu, Yifan Xu, Tyler Chang, and Zhuowen Tu. Co-scale conv-attentional image transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 9981–9990, 2021.
202
+ [27] 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, 34, 2021.
203
+ [28] 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.
204
+ [29] Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Hervé Jégou. Training data-efficient image transformers & distillation through attention. In International Conference on Machine Learning, pages 10347–10357. PMLR, 2021.
205
+ [30] 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.
206
+ [31] Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollár, and C Lawrence Zitnick. Microsoft coco: Common objects in context. In European conference on computer vision, pages 740–755. Springer, 2014.
207
+ [32] Bolei Zhou, Hang Zhao, Xavier Puig, Sanja Fidler, Adela Barriuso, and Antonio Torralba. Scene parsing through ade20k dataset. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 633–641, 2017.
208
+ [33] 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.
209
+ [34] Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. Advances in neural information processing systems, 32, 2019.
210
+ [35] 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.
211
+ [36] Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018.
212
+ [37] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020.
213
+ [38] Li Yuan, Yunpeng Chen, Tao Wang, Weihao Yu, Yujun Shi, Zi-Hang Jiang, Francis EH Tay, Jiashi Feng, and Shuicheng Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 558–567, 2021.
214
+ [39] Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In European conference on computer vision, pages 213–229. Springer, 2020.
215
+ [40] 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.
216
+ [41] 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, pages 6881–6890, 2021.
217
+ [42] Jieneng Chen, Yongyi Lu, Qihang Yu, Xiangde Luo, Ehsan Adeli, Yan Wang, Le Lu, Alan L Yuille, and Yuyin Zhou. Transunet: Transformers make strong encoders for medical image segmentation. arXiv preprint arXiv:2102.04306, 2021.
218
+ [43] 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.
219
+ [44] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25, 2012.
220
+ [45] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
221
+ [46] Christian Szegedy, Wei Liu, Yangqing Jia, Pierre Sermanet, Scott Reed, Dragomir Anguelov, Dumitru Erhan, Vincent Vanhoucke, and Andrew Rabinovich. Going deeper with convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1–9, 2015.
222
+ [47] Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
223
+ [48] Alex Krizhevsky, Ilya Sutskever, and Geoffrey E Hinton. Imagenet classification with deep convolutional neural networks. Advances in neural information processing systems, 25, 2012.
224
+ [49] Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint arXiv:1409.1556, 2014.
225
+ [50] Yunpeng Chen, Haoqi Fan, Bing Xu, Zhicheng Yan, Yannis Kalantidis, Marcus Rohrbach, Shuicheng Yan, and Jiashi Feng. Drop an octave: Reducing spatial redundancy in convolutional neural networks with octave convolution. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 3435–3444, 2019.
226
+ [51] Zi-Hang Jiang, Qibin Hou, Li Yuan, Daquan Zhou, Yujun Shi, Xiaojie Jin, Anran Wang, and Jiashi Feng. All tokens matter: Token labeling for training better vision transformers. Advances in Neural Information Processing Systems, 34, 2021.
227
+ [52] Zhengzhong Tu, Hossein Talebi, Han Zhang, Feng Yang, Peyman Milanfar, Alan Bovik, and Yinxiao Li. Maxvit: Multi-axis vision transformer. arXiv preprint arXiv:2204.01697, 2022.
228
+ [53] Boyu Chen, Peixia Li, Chuming Li, Baopu Li, Lei Bai, Chen Lin, Ming Sun, Junjie Yan, and Wanli Ouyang. Glit: Neural architecture search for global and local image transformer. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 12–21, 2021.
229
+ [54] 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, pages 1–10, 2022.
230
+ [55] 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 Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 12259–12269, 2021.
231
+ [56] Yucheng Zhao, Guangting Wang, Chuanxin Tang, Chong Luo, Wenjun Zeng, and Zheng-Jun Zha. A battle of network structures: An empirical study of cnn, transformer, and mlp. arXiv preprint arXiv:2108.13002, 2021.
232
+ [57] Sergey Ioffe and Christian Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In International conference on machine learning, pages 448–456. PMLR, 2015.
233
+ [58] Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jon Shlens, and Zbigniew Wojna. Rethinking the inception architecture for computer vision. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 2818–2826, 2016.
234
+ [59] Christian Szegedy, Sergey Ioffe, Vincent Vanhoucke, and Alexander A Alemi. Inception-v4, inceptionresnet and the impact of residual connections on learning. In Thirty-first AAAI conference on artificial intelligence, 2017.
235
+ [60] François Chollet. Xception: Deep learning with depthwise separable convolutions. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 1251–1258, 2017.
236
+ [61] Franck Mamalet and Christophe Garcia. Simplifying convnets for fast learning. In International Conference on Artificial Neural Networks, pages 58–65. Springer, 2012.
237
+ [62] Mark Sandler, Andrew Howard, Menglong Zhu, Andrey Zhmoginov, and Liang-Chieh Chen. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 4510–4520, 2018.
238
+ [63] Ross Wightman, Hugo Touvron, and Hervé Jégou. Resnet strikes back: An improved training procedure in timm. arXiv preprint arXiv:2110.00476, 2021.
239
+ [64] Jianwei Yang, Chunyuan Li, Pengchuan Zhang, Xiyang Dai, Bin Xiao, Lu Yuan, and Jianfeng Gao. Focal self-attention for local-global interactions in vision transformers. arXiv preprint arXiv:2107.00641, 2021.
240
+ [65] 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 preprint arXiv:2107.00652, 2021.
241
+ [66] Jiasen Lu, Roozbeh Mottaghi, Aniruddha Kembhavi, et al. Container: Context aggregation networks. Advances in Neural Information Processing Systems, 34, 2021.
242
+ [67] Qiming Zhang, Yufei Xu, Jing Zhang, and Dacheng Tao. Vitaev2: Vision transformer advanced by exploring inductive bias for image recognition and beyond. arXiv preprint arXiv:2202.10108, 2022.
243
+ [68] Ilija Radosavovic, Raj Prateek Kosaraju, Ross Girshick, Kaiming He, and Piotr Dollár. Designing network design spaces. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10428–10436, 2020.
244
+ [69] Aravind Srinivas, Tsung-Yi Lin, Niki Parmar, Jonathon Shlens, Pieter Abbeel, and Ashish Vaswani. Bottleneck transformers for visual recognition. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pages 16519–16529, 2021.
245
+ [70] Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. arXiv preprint arXiv:1608.03983, 2016.
246
+ [71] Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Hervé Jégou. Going deeper with image transformers. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 32–42, 2021.
247
+
248
+ [72] Ross Wightman. Pytorch image models. https://github.com/rwightman/pytorch-image-models, 2019.
249
+
250
+ [73] Mingxing Tan and Quoc Le. Efficientnet: Rethinking model scaling for convolutional neural networks. In International conference on machine learning, pages 6105–6114. PMLR, 2019.
251
+
252
+ [74] Mingxing Tan and Quoc Le. Efficientnetv2: Smaller models and faster training. In International Conference on Machine Learning, pages 10096–10106. PMLR, 2021.
253
+
254
+ [75] Kaiming He, Georgia Gkioxari, Piotr Dollár, and Ross Girshick. Mask r-cnn. In Proceedings of the IEEE international conference on computer vision, pages 2961–2969, 2017.
255
+
256
+ [76] 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.
257
+
258
+ [77] Pengchuan Zhang, Xiyang Dai, Jianwei Yang, Bin Xiao, Lu Yuan, Lei Zhang, and Jianfeng Gao. Multiscale vision longformer: A new vision transformer for high-resolution image encoding. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pages 2998–3008, 2021.
259
+
260
+ [78] Kai Chen, Jiaqi Wang, Jiangmiao Pang, Yuhang Cao, Yu Xiong, Xiaoxiao Li, Shuyang Sun, Wansen Feng, Ziwei Liu, Jiarui Xu, Zheng Zhang, Dazhi Cheng, Chenchen Zhu, Tianheng Cheng, Qijie Zhao, Buyu Li, Xin Lu, Rui Zhu, Yue Wu, Jifeng Dai, Jingdong Wang, Jianping Shi, Wanli Ouyang, Chen Change Loy, and Dahua Lin. MMDetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019.
261
+
262
+ [79] Alexander Kirillov, Ross Girshick, Kaiming He, and Piotr Dollár. Panoptic feature pyramid networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 6399–6408, 2019.
263
+
264
+ [80] MMSegmentation Contributors. MMSegmentation: Openmmlab semantic segmentation toolbox and benchmark. https://github.com/open-mmlab/mmsegmentation, 2020.
265
+
266
+ [81] Ramprasaath R Selvaraju, Michael Cogswell, Abhishek Das, Ramakrishna Vedantam, Devi Parikh, and Dhruv Batra. Grad-cam: Visual explanations from deep networks via gradient-based localization. In Proceedings of the IEEE international conference on computer vision, pages 618–626, 2017.
267
+
268
+ [82] Tete Xiao, Yingcheng Liu, Bolei Zhou, Yuning Jiang, and Jian Sun. Unified perceptual parsing for scene understanding. In Proceedings of the European Conference on Computer Vision (ECCV), pages 418–434, 2018.
269
+
270
+ [83] Zilong Huang, Youcheng Ben, Guozhong Luo, Pei Cheng, Gang Yu, and Bin Fu. Shuffle transformer: Rethinking spatial shuffle for vision transformer. arXiv preprint arXiv:2106.03650, 2021.
271
+
272
+ # Checklist
273
+
274
+ 1. For all authors...
275
+
276
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
277
+ (b) Did you describe the limitations of your work? [Yes] See Section 5.
278
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] See Appendix.
279
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
280
+
281
+ 2. If you are including theoretical results...
282
+
283
+ (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]
284
+
285
+ 3. If you ran experiments...
286
+
287
+ (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] The code will be released in future.
288
+
289
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes]
290
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes]
291
+ (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]
292
+
293
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
294
+
295
+ (a) If your work uses existing assets, did you cite the creators? [Yes]
296
+ (b) Did you mention the license of the assets? [Yes]
297
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes]
298
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [Yes]
299
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [Yes]
300
+
301
+ 5. If you used crowdsourcing or conducted research with human subjects...
302
+
303
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
304
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
305
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/r5hq-Ooh_Ba/r5hq-Ooh_Ba.md ADDED
@@ -0,0 +1,373 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MUTEXMATCH: SEMI-SUPERVISED LEARNING WITH MUTEX-BASED CONSISTENCY REGULARIZATION
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ The core issue in semi-supervised learning (SSL) lies in how to effectively leverage unlabeled data, whereas most existing methods usually concentrate on the utilization of high-confidence samples yet seldom fully explore the usage of lowconfidence samples. Early SSL methods mostly require low-confidence samples to optimize the same loss function as high-confidence samples, but this setting might largely challenge the low-confidence samples especially at the early training stage. In this paper, we aim to utilize low-confidence samples in a novel way, which is realized by our proposed mutex-based consistency regularization, namely MutexMatch. To be specific, the high-confidence samples are required to exactly predict “What it is” by conventional True-Positive Classifier, while the low-confidence samples, for a much simpler goal, are employed to predict “What it is not” by True-Negative Classifier with ease. In this way, we not only mitigate the pseudo-labeling errors but also make full use of the low-confidence unlabeled data in the training stage. The proposed MutexMatch achieves superior performance on multiple benchmark datasets, i.e., CIFAR-10, CIFAR-100, SVHN, and STL-10. Particularly, our method shows further superiority under few quantities of labeled data, e.g., $9 1 . 7 7 \%$ accuracy with only 20 labeled data on CIFAR-10.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Aiming to escape from time-consuming and laborious labeling tasks, semi-supervised learning (SSL) (Chapelle et al., 2009; Zhu, 2017) has been a longstanding yet important direction to leverage a large quantity of unlabeled data along with few labeled data during training. Recent SSL models could be categorized into consistency regularization based or entropy minimization based methods where the utilization of unlabeled data is crucial in both. In particular, consistency regularization based methods like (Laine & Aila, 2016; Tarvainen & Valpola, 2017) intend to utilize all unlabeled data together with the supervision on labeled data, which is at the risk of strong confirmation bias. Although recent holistic methods such as Sohn et al. (2020) realize consistency regularization by combining entropy minimization via pseudo labeling, a fatal limitation is that they set a confidence threshold to control whether unlabeled data should participate in training, preventing low-confidence unlabeled data from being effectively involved. Different from consistency based methods, recent entropy minimization based methods Rizve et al. (2021) employ pseudo labeling to iteratively incorporate a part of low-confidence samples into training process. However, in this way, in addition to possible error accumulation, some low-confidence unlabeled samples are still neglected. In a nutshell, the waste of unlabeled samples with low confidence causes the model difficult to learn the potential pattern from all unlabeled data, which might deteriorate the final performance.
12
+
13
+ Being aware of the aforementioned limitations, we try to answer — if we could treat these lowconfidence unlabeled samples in a novel way? As shown in Figure 1, imaging a low-confidence sample with its actual label of a “horse”, it might be hard for a trained model to propose an accurate prediction, i.e., “it is a horse”. On the contrary, it can be much easier for the model to “guess what it is not, e.g., it is not a cat”. This drives us to consider a straightforward yet feasible direction — for low-confidence samples, can we design a paradigm to exclude “what it is not” to benefit the learning of “what it is”. Intuitively, by introducing this paradigm, the space of searching the optimal classifier could be largely reduced since the most impossible classes are initially excluded.
14
+
15
+ That is to say, for a low-confidence image, it is unnecessary to get a certain class, and its complementary pseudo-label is easier to obtain. Thus, we could learn less error information when using unlabeled data with low confidence.
16
+
17
+ As aforementioned, to leverage all unlabeled data in a novel way, we propose MutexMatch, a new framework of SSL using mutex-based consistency regularization. We utilize True-Positive Classifier (TPC): to predict “What it is”, and TrueNegative Classifier (TNC): to predict “What it is not”, which is designed to learn feature representation of unlabeled data from a mutex perspective. An improvement of MutexMatch compared with the existing methods is that it allows low-confidence unlabeled samples to participate in training by optimizing a much simpler objective compared with that of high-confidence unlabeled samples. Inspired by FixMatch (Sohn et al., 2020), the weakly-augmented unlabeled samples are used to generate pseudo-labels, and we use RandAugument (Cubuk et al., 2020) for strong augmentation. We set a threshold to control the high-confidence portion and low-confidence portion of pseudo-labels. In high-confidence portion and low-confidence portion, we enforce the consistency regularization on the output of TPC and TNC, respectively. A diagram of MutexMatch is shown in Figure 2.
18
+
19
+ ![](images/207647779515a6cfe4c418f405c73582ec86d916211dba5834302b336e5fbcd8.jpg)
20
+ Figure 1: Graphical explanations of the “Exclusion Method” for classification task. For an image, the proposed method excludes some wrong classes via different images of the same class, so as to eliminate the wrong answers.
21
+
22
+ In this work, the key contributions include three aspects: (1) We propose mutex-based consistency regularization for SSL, which can make full use of unlabeled data in a more effective way; (2) We use two classifiers (TPC and TNC) to construct MutexMatch, a novel framework using pseudolabel and complementary label to learn an informative representation of unlabeled samples; (3) By exploiting all unlabeled data, we can obtain better classification results in a label-scarce setting than recently-proposed SSL algorithm. For example, on the most commonly-studied SSL benchmark CIFAR-10, the accuracy of MutexMatch using only 20 labels can reach up to $9 1 . 7 7 { \pm } 2 . 6 0 \%$ .
23
+
24
+ # 2 RELATED WORK
25
+
26
+ Consistency regularization is a significant branch of recent state-of-the-art (SOTA) SSL methods, which is proposed in Bachman et al. (2014). Such methods encourage the classifier to output same class probability distribution after different versions of augmentation for the same unlabeled data. Generally, the consistency regularization based models are trained with unlabeled data using the loss function: $| | p ( y | \alpha ( x ) \dot { - } p \bar { ( y | \alpha ( x ) ) ) } | | _ { 2 } ^ { 2 }$ , where $x$ is the input image and $\alpha ( \cdot )$ is an kind of transformation that does not change the image label. Particularly, $\alpha ( \cdot )$ can adopt different augmentation methods, e.g., Mixup (Zhang et al., 2017) in Berthelot et al. (2019), RandAugment (Sohn et al., 2020) in Sohn et al. (2020) and CTAugment in Berthelot et al. (2020). Laine & Aila (2016) enforces a loss of consistency on the predictions of two augmented variants of unlabeled data. In Tarvainen & Valpola (2017), a teacher model is maintained to generate more stable targets for unlabeled data, and the mean squared error is used to encourage same predictions of the student and teacher models. Xie et al. (2020) adopts automatic augmentation for data perturbation and enforces a loss of consistency by the KL divergence. Recently, some holistic methods (Sohn et al., 2020; Berthelot et al., 2020) have been proposed to combine consistency regularization with pseudo-labeling for better SSL performance. Differently, in MutexMatch, in addition to enforcing prediction consistency on TPC, we propose a novel mutex-based consistency to effectively leverage all unlabeled samples.
27
+
28
+ Pseudo-labeling is widely leveraged for entropy minimization by constructing one-hot labels from predictions of unlabeled data with high-confidence and makes use of them based on cross-entropy loss (Lee et al., 2013; Shi et al., 2018; Sohn et al., 2020; Xie et al., 2020). However, these methods have a significant limitation, i.e., using confidence thresholds to select pseudo-labels results in that all unlabeled data is not sufficiently exploited. Recent pseudo-labeling based method (Rizve et al., 2021) proposes an uncertainty-aware pseudo-label selection framework to use both high and lowconfidence samples. However, it introduces two thresholds to control the pseudo-label generation, thus some unlabeled samples are still not utilized.
29
+
30
+ ![](images/ea87b65a4a75f58c4f5b1c9dcf561cf90691b4f26b6f6e39703b4922c331498a.jpg)
31
+ Figure 2: Diagram of the proposed MutexMatch. Given a batch of unlabeled samples, TPC $\mathcal { P }$ uses their weakly-augmented variants to generate pseudo-labels. Then we adopt the classes with the lowest confidence as the complementary labels to train TNC $\mathcal { N }$ separately. Meanwhile, TPC and TNC are used for mutex-based consistency regularization in the high and low-confidence portion of TPC’s predictions respectively. $f$ denotes output features and $p , r$ denote predictions of TPC and TNC. Superscripts $w$ and $s$ represent corresponding outputs for the weakly-augmented variant and strongly-augmented variant, respectively.
32
+
33
+ Complementary label is used to help the model learn which class the input image does not belong to (Ishida et al., 2017; 2018; Yu et al., 2018). Considering a $c$ -class classification task, we denote $x \in \mathcal { X }$ as an input image and $y \in \mathcal { Y } = \{ 1 , . . . , c \}$ as its label. Complementary label $\overline { y }$ is generated by select from $\mathcal { V } \backslash \{ \boldsymbol { y } \}$ at random. Inspired by Rizve et al. (2021) and Kim et al. $( 2 0 1 9 ) ^ { 1 }$ , in MutexMatch, we design a novel way (detailed in Section 3.2) to propose complementary labels, so as to ensure their effectiveness in semi supervised learning. Experiments about using standard complementary label selections are discussed in Section 5.2.
34
+
35
+ # 3 MUTEXMATCH
36
+
37
+ # 3.1 OVERVIEW
38
+
39
+ Different from existing SSL approaches, in addition to a feature extractor $\theta ( \cdot )$ , MutexMatch jointly trains two distinct classifiers, a True-Positive Classifier (TPC) $\mathcal { P } ( \cdot )$ and a True-Negative Classifier (TNC) $\mathcal { N } ( \cdot )$ . To be specific, TPC is used to predict which class the instance belongs to (i.e., true positive), while TNC is employed to indicate which class the instance is not (i.e., true negative). To mitigate pseudo-labeling errors, a pre-defined high-confidence threshold $\tau$ is utilized to split the unlabeled data into high-confidence and low-confidence portions. Besides training TPC on the highconfidence portion, we explore complementary labels on low-confidence samples to train TNC. In this way, all the unlabeled data could be effectively exploited.
40
+
41
+ In a mini-batch, we have $B$ labeled data $\mathcal { X } ~ = ~ \{ ( x _ { b } ^ { l b } , y _ { b } ^ { l b } ) \} _ { b = 1 } ^ { B }$ and $\mu B$ unlabeled data $u \ =$ $\{ ( x _ { b } ^ { u l b } , y _ { b } ^ { u l b } ) \} _ { b = 1 } ^ { \mu B }$ , where $\mu$ represents the relative size of $\mathcal { X }$ and $\mathcal { U }$ . Following (Sohn et al., 2020), we perform weak and strong augmentations for data perturbations, denoted by $\alpha _ { w } ( \cdot )$ and $\alpha _ { s } ( \cdot )$ , respectively. Given weakly-augmented instance $x ^ { w }$ and strongly-augmented instance $x ^ { s }$ , MutexMatch simultaneously optimizes four losses: the supervised loss $\mathcal { L } _ { s u p }$ , the separated negative loss $\mathcal { L } _ { s e p }$ , the positive consistency loss ${ \mathcal { L } } _ { p }$ and the negative consistency loss ${ \mathcal { L } } _ { n }$ . In summary, the total loss is
42
+
43
+ $$
44
+ \mathcal { L } = \mathcal { L } _ { s u p } + \lambda _ { s e p } \mathcal { L } _ { s e p } + \lambda _ { p } \mathcal { L } _ { p } + \lambda _ { n } \mathcal { L } _ { n } ,
45
+ $$
46
+
47
+ where $\lambda _ { s e p }$ , $\lambda _ { p }$ and $\lambda _ { n }$ are scalar hyper-parameters to adjust the relative importance of corresponding losses. The supervised loss $\mathcal { L } _ { s u p }$ is simply defined as the cross-entropy between $y ^ { l b }$ and the
48
+
49
+ predictions of TPC on labeled data $x ^ { l b }$ , calculated as follows:
50
+
51
+ $$
52
+ \mathcal { L } _ { s u p } = \frac { 1 } { B } \sum _ { n = 1 } ^ { B } H ( y _ { n } ^ { l b } , \mathcal { P } ( \theta ( \alpha _ { w } ( x _ { n } ^ { l b } ) ) ) ) ,
53
+ $$
54
+
55
+ where $H ( p , q )$ denotes the standard cross-entropy loss between distribution $q$ and $p$
56
+
57
+ # 3.2 TRUE-NEGATIVE CLASSIFIER
58
+
59
+ In multi-class classification tasks, for a specific instance, it is easier to predict which class it does not belong to than to know which class it exactly is. For example, given an image of airplane in CIFAR-10, we can predict which class it does not belong to with a probability $90 \%$ at random, whereas we only have the probability of $10 \%$ to correctly predict it is an airplane. To this end, we design a True-Negative Classifier to predict which class it is not. Compared to
60
+
61
+ ![](images/6de18e33fa1a4e3e4c06c6e0e1140d78d074d9ef3c09a6db8bcbe63da0b747b8.jpg)
62
+ Figure 3: Training of TNC
63
+
64
+ TPC, it is much easier to obtain correct labels for TNC. Thus we exploit TNC to provide more guidance information on unlabeled data. We then propose a mutex-based prediction consistency on TPC and TNC to make full use of unlabeled data, which is described in Section 3.3. The high-level training process of TNC is shown in Figure 3. Unlike the standard complementary label generations (Ishida et al., 2017; Yu et al., 2018), we use the class with the lowest confidence in TPC’s predictions as the complementary label to train TNC. The training loss $\mathcal { L } _ { s e p }$ can be calculated as
65
+
66
+ $$
67
+ \mathcal { L } _ { s e p } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } H ( \arg \operatorname* { m i n } ( \mathcal { P } ( \theta ( x _ { n } ^ { w } ) ) , \mathcal { N } ( \hat { \theta } ( x _ { n } ^ { w } ) ) ) ,
68
+ $$
69
+
70
+ where $\hat { \theta }$ represents that $\theta$ is considered constant for the generation of this loss, i.e., stop backpropagating gradients. Since our downstream task is to accurately classify images, we adopt such gradient-blocking operation to ensure that the feature extractor will not be affected by the training of TNC. We extensively investigate the effectiveness of TNC in Section 4.3.
71
+
72
+ # 3.3 MUTEX-BASED CONSISTENCY REGULARIZATION
73
+
74
+ In recent consistency-regularization based SSL methods, only samples with high-confidence predictions are leveraged to train models. However, it could lead to inefficient utilization of unlabeled data, especially at the early stage of the training process. Differently, MutexMatch can also effectively exploit low-confidence unlabeled samples via introducing a novel mutex-based consistency regularization. A high-confidence threshold $\tau$ on TPC’s predictions is defined to split the unlabeled samples into two portions with mutex confidence intervals, i.e., the high-confidence one $( > \tau )$ and the low-confidence one $( \leq \tau )$ . In the high-confidence portion, we use TPC to learn what the unlabeled data is, while in the low-confidence portion, we employ TNC to learn what it is not, because it is difficult for us to obtain its real class information.
75
+
76
+ On the one hand, we use weakly-augmented example $x ^ { w }$ to generate pseduo-labels from TPC and enforce positive consistency against its corresponding strongly-augmented variant $x ^ { s }$ . We can then obtain their predictions, $p ^ { \bar { w } } \ \stackrel { \cdot } { = } \ \mathcal { P } ( \theta ( x ^ { w } ) )$ and $p ^ { s } \doteq \mathcal { P } ( \bar { \theta ( } \bar { x ^ { s } } ) )$ . Let $\hat { p } ^ { w } = \arg \operatorname* { m a x } ( p ^ { w } )$ , such consistency can be achieved by minimizing the loss ${ \mathcal { L } } _ { p }$ :
77
+
78
+ $$
79
+ \mathcal { L } _ { p } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { n } ^ { w } ) \geq \tau ) H ( \hat { p } _ { n } ^ { w } , p _ { n } ^ { s } ) ,
80
+ $$
81
+
82
+ where $\mathbb { 1 } ( \operatorname* { m a x } ( p ^ { w } ) > \tau )$ retains the predictions whose maximum probabilities are larger than $\tau$ . On the other hand, for these low-confidence samples, we enforce consistency regularization against TNC’s predictions by minimizing the ${ \mathcal { L } } _ { n }$ :
83
+
84
+ $$
85
+ \mathcal { L } _ { n } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { n } ^ { w } ) < \tau ) H ( r _ { n } ^ { w } , r _ { n } ^ { s } ) ,
86
+ $$
87
+
88
+ Table 1: Accuracy for CIFAR-10, CIFAR100 and SVHN averaged on 5 different folds. Results with ∗ were reported in CoMatch (Li et al., 2020), while results with † are using our own reimplementation. Other results were reported in FixMatch (Sohn et al., 2020). Results with DA are achieved by combining the distribution alignment technique (Berthelot et al., 2020).
89
+
90
+ <table><tr><td rowspan="2">Method</td><td colspan="4">CIFAR-10</td><td colspan="3">CIFAR-100</td><td colspan="2">SVHN</td></tr><tr><td>10 labels</td><td>20 labels</td><td>40 labels</td><td>80 labels</td><td>200 labels</td><td>400 labels</td><td>2500 labels</td><td>40 labels</td><td>250 labels</td></tr><tr><td>UDA</td><td>=</td><td></td><td>70.95±5.93</td><td>=</td><td>=</td><td>40.72±0.88</td><td>66.87±0.22</td><td>47.37±20.51</td><td>94.31±2.76</td></tr><tr><td>MixMatch</td><td></td><td>27.84±10.63*</td><td>52.46±11.50</td><td>80.79±1.28*</td><td></td><td>33.39±1.32</td><td>60.06±0.37</td><td>57.45±14.53</td><td>96.02±0.23</td></tr><tr><td>ReMixMatch w. DA</td><td></td><td></td><td>80.90±9.64</td><td>=</td><td></td><td>55.72±2.06</td><td>72.57±0.31</td><td>96.66±0.20</td><td>97.08±0.48</td></tr><tr><td>FixMatch</td><td>64.08±20.33†</td><td>82.32±9.77*</td><td>88.61±3.35</td><td>92.06±0.88*</td><td>38.87±2.50†</td><td>51.15±1.75</td><td>71.71±0.11</td><td>96.04±2.17</td><td>97.52±0.38</td></tr><tr><td>FixMatch w. DA*</td><td></td><td>83.81±9.35</td><td>86.98±3.40</td><td>92.29±0.86</td><td></td><td></td><td></td><td></td><td>=</td></tr><tr><td>CoMatch*</td><td>69.87±11.82†</td><td>87.67±8.47</td><td>93.09±1.39</td><td>93.97±0.62</td><td></td><td></td><td></td><td>96.47 ± 1.29†</td><td>97.75± 0.19†</td></tr><tr><td>MutexMatch</td><td>78.73±11.21</td><td>91.77±2.60</td><td>93.49±0.22</td><td>94.34±0.81</td><td>40.38±2.36</td><td>56.14±1.46</td><td>71.80±0.23</td><td>97.19±0.26</td><td>97.73±0.18</td></tr></table>
91
+
92
+ where $r ^ { w } \ = \ \mathcal { N } ( \theta ( x ^ { w } ) )$ and $r ^ { s } = \mathcal { N } ( \theta ( x ^ { s } ) )$ are the label predictions of TNC for $x ^ { w }$ and $x ^ { s }$ , respectively. For the purpose of entropy minimization (Lee et al., 2013), we adopt hard pseudolabel $\hat { p } ^ { w }$ to enforce the consistency regularization on TPC. Differently, we use soft pseudo-label $r ^ { w }$ for consistency regularization of TNC, so as MutexMatch can know more information of impossible class for classification. We further discuss this soft-label setting in Section 5.2. The whole algorithm is presented in Section 1 of Appendix.
93
+
94
+ # 4 EXPERIMENTS
95
+
96
+ Following Tarvainen & Valpola (2017); Sohn et al. (2020), we perform evaluation on four benchmark datasets, including STL-10, CIFAR-10/100 and SVHN. We also conduct ablation studies in Section 5 to investigate the efficacy of MutexMatch. Other experiments, e.g., the impact of learning rate and hyper-parameters, are shown in Section D in the Appendix.
97
+
98
+ # 4.1 CIFAR-10, CIFAR-100 AND SVHN
99
+
100
+ We evaluate our method and baselines on three widely used SSL datasets: (1) CIFAR-10, consisting of 50,000 images from 10 classes, (2) CIFAR-100, consisting of 50,000 images from 100 classes, and (3) SVHN, consisting of more than 70,000 street view house number images from 10 classes.
101
+
102
+ Baselines. We introduce recent state-of-the-art SSL methods, i.e., CoMatch (Li et al., 2020), FixMatch (Sohn et al., 2020) and FixMatch with distribution alignment (Berthelot et al., 2020) to compare with MutexMatch. Moreover, we compare our method with SSL methods such as UDA (Xie et al., 2020), MixMatch (Berthelot et al., 2019) and ReMixMatch (Berthelot et al., 2020).
103
+
104
+ Settings. For all experiments, in MutexMatch, we adopt Wide ReseNet (Zagoruyko & Komodakis, 2016) as the backbone (WRN-28-2 for CIFAR-10, SVHN and WRN-28-8 for CIFAR100) following Sohn et al. (2020). In our implementation, TNC is the same two-layer MLP as TPC. For fair comparison, We follow these baseline methods (Sohn et al., 2020; Li et al., 2020) using SGD with a momentum of 0.9 and a weight decay of 0.0005 during training. Also, we train the model for 1024 epochs, using a learning rate of 0.03 without the decay schedule for CIFAR-10, and with cosine decay schedule for CIFAR-100 and SVHN. For hyper-parameters in MutexMatch, we set $\tau = 0 . 9 5 , \mu = 7 , B = 6 4$ for all experiments. Particularly, we set $\tau = 0 . 5$ on CIFAR-10 with 80 labels and train the model with cosine decay schedule for learning rate. In our method, RandAugment (Cubuk et al., 2020) is used for strong augmentation. Also, $\lambda _ { s e p }$ , $\lambda _ { p }$ and $\lambda _ { n }$ are set to 1 for simplicity. To reduce the influence from random data partition, we report the mean and variance of accuracy on five different folds of labeled/unlabeled data.
105
+
106
+ Results. Table 1 shows the comparison between MutexMatch and baselines. With only 4 labeled data per class, MutexMatch achieves an accuracy of $9 3 . 4 9 { \pm } 0 . 2 2 \%$ on CIFAR-10, $5 6 . 1 4 { \pm } 1 . 4 6 \%$ on CIFAR-100 and $9 7 . 1 9 { \pm } 0 . 2 6 \%$ on SVHN, yielding improvement over prior SSL results. Especially, we demonstrate the superiority of MutexMatch under the extremely label-scarce setting. e.g., achieving an average accuracy of $9 1 . 7 7 \%$ on CIFAR-10 with only 20 labels, $4 0 . 3 8 \%$ on CIFAR-100 with 200 labels. In addition, details on barely supervised learning can be found in
107
+
108
+ Section B of Appendix. The fewer labels will lead to the accumulation of more noise pseudo-labels in training, whereas MutexMatch uses all unlabeled data while introducing little error information.
109
+
110
+ Moreover, we report additional results on CIFAR-10 with different backbone CNN-13 and more available labels. We compare MutexMatch with MT (Tarvainen & Valpola, 2017), ICT (Verma et al., 2019), DualStudent (Ke et al., 2019) and UPS Rizve et al. (2021). We conduct experiments using the same setting as CIFAR-10 with 80 labels. In Table 2, we find that MutexMatch is not backbone dependent, and achieves performance improvement when more labels are given, outperforming all baseline methods. More discussion of experimental results can be found in Section 4.3.
111
+
112
+ Table 2: Accuracy on CIFAR-10 with larger amounts of labels and CNN-13 backbone. Results of baseline methods are reported in UPS (Rizve et al., 2021).
113
+
114
+ <table><tr><td rowspan=2 colspan=4>CIFAR-10Method1000 labels 4000 labels</td></tr><tr><td rowspan=1 colspan=2>1000 labels</td><td rowspan=1 colspan=1>4000 labels</td></tr><tr><td rowspan=1 colspan=1>MT</td><td rowspan=1 colspan=1>80.96±0:51</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>88.59±0.25</td></tr><tr><td rowspan=1 colspan=1>ICT</td><td rowspan=1 colspan=1>84.52±0.78</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>92.71±0.02</td></tr><tr><td rowspan=1 colspan=1>DualStudent</td><td rowspan=1 colspan=1>85.83±0.38</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>91.11±0.09</td></tr><tr><td rowspan=1 colspan=1>UPS</td><td rowspan=1 colspan=1>91.82±0.15</td><td rowspan=1 colspan=1></td><td rowspan=1 colspan=1>93.61±0.02</td></tr><tr><td rowspan=1 colspan=4>MutexMatch 93.01±0.32 94.10±0.24</td></tr></table>
115
+
116
+ Table 3: Accuracy on STL-10 averaged on 5 pre-defined folds with ResNet-18 backbone. Results of baseline methods are reported in CoMatch (Li et al., 2020).
117
+
118
+ <table><tr><td>Method</td><td>STL-10 ResNet-18</td></tr><tr><td>MixMatch</td><td>38.02±8.29</td></tr><tr><td>FixMatch</td><td>65.38±0.42</td></tr><tr><td>FixMatch w.DA</td><td>66.53±0.39</td></tr><tr><td>CoMatch</td><td>79.80±0.38</td></tr><tr><td>MutexMatch</td><td>83.36±0.22</td></tr></table>
119
+
120
+ # 4.2 STL-10
121
+
122
+ STL-10 contains 10 classes of 5,000 labeled and 100,000 unlabeled images extracted from a similar but broader distribution. The challenge of STL-10 lies in other unlabeled images contains out of distribution images and this distribution shift enables us to test the robustness of SSL algorithm.
123
+
124
+ Settings. For STL-10, we evaluate MutexMatch on the 5 pre-defined folds. Each fold contains 1,000 labeled data and 100,000 unlabeled data. Therefore, we trained five models and averaged their performance as the final result. Following Li et al. (2020), we use ResNet-18 as the backbone because it consumes less computing resources than WRN-28-8 used in Sohn et al. (2020). We use the same hyperparameters and learning rate as CIFAR-100 in Section 4.1, and train the models using SGD with a momentum of 0.9 and a weight decay of 0.0005.
125
+
126
+ Results. Table 3 shows the results, averaged on all 5 runs. In this setting, MutexMatch achieves accuracy improvement from $7 9 . 8 0 { \pm } 0 . 3 8 \%$ to $8 3 . 3 6 { \pm } 0 . 2 2 \%$ compared with CoMatch. The performance of MutexMatch on STL-10 is much better than that of the existing methods, showing TNC is less sensitive to data distribution shift between labeled and unlabeled data, so that MutexMatch can maintain robust performance like on other datasets.
127
+
128
+ # 4.3 EFFECTIVENESS ANALYSIS OF TNC
129
+
130
+ As shown in Figure 1, the TNC of MutexMatch uses exclusion method to help the model deal with unlabeled data with low confidence. Ideally, we think that for one class, the distribution of complementary pseudo-labels from TNC should be evenly dispersed or diverse unlike pseudo-label from TPC, so MutexMatch can exclude more error classes as much as possible. We conduct experiments on CIFAR-10 with 40 labels using the same setting as in Section 4.1. We observe that the class prediction from TNC is indeed generally consistent with our hypothesis. As shown in Figure 4, during training, for each class of CIFAR-10, the prediction of TNC is gradually dispersed to several classes (i.e., far away from the main diagonal of heat map), instead of gathering at a single class, indicating that TNC could play the role of exclusion method. On the contrary, the prediction outputted by TPC is gradually concentrated to the correct class (i.e., gathered to the main diagonal of the heat map). Note that, TNC uses soft labels for consistency regularization, which can explore more complementary information to help TPC classify correctly.
131
+
132
+ Compared with other baseline methods shown in Table 1, MutexMatch performs better on CIFAR10 with extremely scarce labels. We believe that confirmation bias (Yu et al., 2018) leads to the poor performance of other methods. Fewer labels will introduce more noisy pseudo-labeled examples to participate in the learning process. Nevertheless, MutexMatch utilizes the unlabeled samples with low confidence, in an exclusive manner by TNC, introducing few noisy pseudo-labels. As shown in Figure 5, our experiments on CIFAR-10 show MutexMatch produces more accurate pseudo-labels than FixMatch (Sohn et al., 2020), especially when there are very few labeled samples. In this figure, $M$ indicates the results of MutexMatch and $F$ indicates the results of FixMatch.
133
+
134
+ ![](images/c0040f1531bae28167b29b35bea5073b61fa823340a41d44c23ce2c3ec2a7714.jpg)
135
+ Figure 4: The rate $( \% )$ of each class (column in heat map) in the pseudo-label and complementary pseudo-label outputted by TPC and TNC respectively corresponding to each class (row in heat map) in CIFAR-10. The darker, the higher. Results are reported in a run on CIFAR-10 with 40 labels.
136
+
137
+ The accuracy of complementary pseudo-label is very crucial. An important premise for MutexMatch to work is that the complementary pseudolabel outputted by TNC is easy to predict, so it will introduce less error information into the model. Figure 5 shows that the complementary pseudolabels outputted by TNC achieves high accuracy. Compared with the pseudo-label outputted by TPC, complementary label is more insensitive to the change of the number of labels. Even with only one label per class, it can maintain a high accuracy.
138
+
139
+ ![](images/bbe2a02403308f6a14471776d3983c2f8c4c669db531d3edc246903e5eaf57fe.jpg)
140
+ Figure 5: Accuracy of pseudo-label and complementary label on CIFAR-10 with different amount of labeled data.
141
+
142
+ # 5 ABLATION STUDY
143
+
144
+ We conduct an extensive ablation study to verify the effectiveness of MutexMatch. The experiments are mainly conducted on CIFAR-10 and SVHN using four labels per class, where MutexMatch achieves $9 3 . 4 9 { \pm } 0 . 2 2 \%$ and $9 7 . 1 9 { \pm } 0 . 2 6 \%$ accuracy using default setting. In the following experiments, we keep the supervised loss as Equation (2) and positive consistency loss as Equation (4).
145
+
146
+ # 5.1 UTILIZATION OF LOW-CONFIDENCE SAMPLES
147
+
148
+ In order to fairly verify the effectiveness of TNC, we use the same settings as Section 4.1. We believe that the reason why the performance of MutexMatch is better than other earlier SSL algorithms is that the existence of TNC enables the model to learn from all unlabeled data. For example, in
149
+
150
+ FixMatch, with a predefined confidence threshold, the unlabeled samples whose confidence is less than this threshold will not participate in the training. Therefore, we use the three most intuitive ways to use all the unlabeled data. We first use TPC to compute prediction $p ^ { w } = \mathcal { P } ( x ^ { w } )$ of weaklyaugmented unlabeled data $x ^ { w }$ and then:
151
+
152
+ (i) We use $\hat { p } ^ { w } = \arg \operatorname* { m a x } ( p ^ { w } )$ as a hard pseudo-label, and enforce the cross-entropy loss against the model’s prediction $p ^ { s } = \mathcal { P } ( x ^ { s } )$ of strongly-augmented unlabeled data $x ^ { s }$ :
153
+
154
+ $$
155
+ \mathcal { L } _ { a b 1 } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { n } ^ { w } ) < \tau ) H ( \hat { p } _ { n } ^ { w } , p _ { n } ^ { s } ) .
156
+ $$
157
+
158
+ (ii) We use $p ^ { w }$ as a soft pseudo-label and enforce the cross-entropy loss against $p ^ { s }$ :
159
+
160
+ $$
161
+ \mathcal { L } _ { a b 1 } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { n } ^ { w } ) < \tau ) H ( p _ { n } ^ { w } , p _ { n } ^ { s } ) .
162
+ $$
163
+
164
+ (iii) We use the features $f ^ { w } = \theta ( x ^ { w } )$ of weakly-augmented image and the features $f ^ { s } = \theta ( x ^ { s } )$ of strongly-augmented image extracted by the feature extractor:
165
+
166
+ $$
167
+ \mathcal { L } _ { a b 1 } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { n } ^ { w } ) < \tau ) E ( f _ { n } ^ { w } , f _ { n } ^ { s } ) ,
168
+ $$
169
+
170
+ where $E ( p , q )$ denotes the mean squared loss between two distributions $p$ and $q$
171
+
172
+ The loss given above minimized by experiments is simply $\mathcal { L } _ { s u p } + \mathcal { L } _ { p } + \mathcal { L } _ { a b 1 }$ . All models are trained on SVHN using four labels per class and we show the results of all experiments in Figure 6. In this figure, the FULL indicates the setting of (i), the $S O F T$ indicates the setting of (ii) and the MSE indicates the setting of (iii). On this dataset, the default MutexMatch achieves an accuracy of $9 7 . 1 9 { \pm } 0 . 2 6 \%$ , outperforming all other experiments. Other ways using low-confidence samples will introduce more noisy pseudo-labels, resulting in the decline and instability of the accuracy of pseudo-label, which is not conducive to consistency regularization.
173
+
174
+ ![](images/81b9511dbb909e0cbda8589a39505652619bd86c557ca4be519f147d7cd842e8.jpg)
175
+ Figure 6: The learning curve of ablation study on SVHN. The $\mathbf { X }$ -axis represents the training epoch and y-axis represents the test accuracy in (a) and the pseudo-label accuracy in (b).
176
+
177
+ # 5.2 EVALUATION ON LEARNING SCHEME OF TNC
178
+
179
+ The learning of TNC in MutexMatch is very important. In default MutexMatch, we use hard complementary pseudo-label $\hat { q } ^ { w } = \arg \operatorname* { m i n } ( p ^ { w } )$ to train TNC separately when stopping gradient back propagation on the feature extractor, and enforce consistency regularization against soft pseudolabel $\bar { r ^ { w } } = \mathcal { N } ( x ^ { w } )$ in the low-confidence portion of $p ^ { w } \leq \tau$ . In order to validate the effectiveness of learning scheme of TNC in MutexMatch, we use three changed learning schemes for experiments:
180
+
181
+ (i) We use hard pseudo-label $\hat { q } ^ { w } = \arg \operatorname* { m i n } ( p ^ { w } )$ to train TNC separately while stopping gradient back propagation on $\theta$ , and enforce consistency regularization against hard complementary pseudo-label:
182
+
183
+ $$
184
+ \mathcal { L } _ { s e p } = \frac { 1 } { B } \sum _ { n = 1 } ^ { B } H ( \hat { q } _ { n } ^ { w } , r _ { n } ^ { w } ) , \mathcal { L } _ { a b 2 } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { n } ^ { w } ) < \tau ) H ( \hat { r } _ { n } ^ { w } , r _ { n } ^ { s } ) ,
185
+ $$
186
+
187
+ where $\hat { r } ^ { w } = \arg \operatorname* { m a x } ( r ^ { w } )$ and $r ^ { s } = \mathcal { N } ( { x } ^ { s } )$ .
188
+
189
+ (ii) We use hard complementary pseudo-label $\hat { \gamma } ^ { w }$ , which is generated via randomly selecting the class without the highest confidence from $p ^ { w }$ (just like the standard complementary label selection) to train TNC separately, while stopping gradient back propagation on $\theta$ , and enforce consistency regularization against soft complementary pseudo-label:
190
+
191
+ $$
192
+ \mathcal { L } _ { s e p } = \frac { 1 } { B } \sum _ { n = 1 } ^ { B } H ( \hat { \gamma } _ { n } ^ { w } , r _ { n } ^ { w } ) , L _ { a b 2 } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { n } ^ { w } ) < \tau ) H ( r _ { n } ^ { w } , r _ { n } ^ { s } ) .
193
+ $$
194
+
195
+ (iii) We remove the separately training part of TNC. The complementary pseudo-label for TNC is obtained directly by $q ^ { w } \ = \ \mathtt { N o r m } ( 1 \ - \ p ^ { w } )$ where $\operatorname { N o r m } ( \cdot )$ is operation normalizing $q ^ { w }$ into interval $[ 0 , 1 ]$ . We enforce consistency regularization against soft complementary pseudo-label:
196
+
197
+ $$
198
+ \mathcal { L } _ { a b 2 } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { n } ^ { w } ) < \tau ) H ( q _ { n } ^ { w } , r _ { n } ^ { s } ) .
199
+ $$
200
+
201
+ The loss given above minimized by experiments is simply $\mathcal { L } _ { s u p } + \mathcal { L } _ { p } + \mathcal { L } _ { s e p } + \mathcal { L } _ { a b 2 }$ in (i), (ii) and $\mathcal { L } _ { s u p } + \mathcal { L } _ { p } + \mathcal { L } _ { a b 2 }$ in (iii).
202
+
203
+ All models are trained on CIFAR-10 using four labels per class, and we show the results of all experiments in Figure 7. In the figure, the Hard-Hard indicates setting of (i), the Rand-Soft indicates setting of (ii) and the Rev-Norm indicates setting of (iii). (i), (ii) and (iii) achieve accuracy of $9 0 . 5 6 \%$ , $9 1 . 5 3 \%$ and $9 1 . 0 3 \%$ respectively. The default MutexMatch achieved an accuracy of $9 3 . 4 9 \%$ which outperforms other settings. Furthermore, experiments show that the accuracy and stability of the complementary pseudo-labels which are outputted by TNC of default MutexMatch are dominant. TNC uses hard pseudo-label for separate training to ensure the accuracy and stability of complementary pseudo-label, and uses soft pseudo-label to participate in mutex-based consistency regularization to exclude more potential error classes.
204
+
205
+ ![](images/8680b672c399d43c5b55e4c775ab7be58a50520aa8e62e96b9d77626f9b522b5.jpg)
206
+ Figure 7: The learning curve of ablation study on CIFAR-10 with 40 labels. The $\mathbf { X }$ -axis represents the training epoch and the y-axis represents the test accuracy in (a), the pseudo-label accuracy in (b), and the complementary pseudo-label accuracy in (c).
207
+
208
+ # 6 CONCLUSION
209
+
210
+ In this paper, we propose MutexMatch, a novel SSL algorithm using a mutex-based consistency regularization derived by two distinct classifiers, one is to predict “what it is” and the other is to predict “what it is not”. MutexMatch can achieve superior performance on various SSL benchmarks, especially under label-scarce conditions. Last but not least, we validate that low-confidence samples could still be well utilized in training from a novel way. We believe this usage of low-confidence samples could be borrowed to other semi-supervised tasks, e.g., segmentation and detection.
211
+
212
+ # REFERENCES
213
+
214
+ Phil Bachman, Ouais Alsharif, and Doina Precup. Learning with pseudo-ensembles. In Advances in Neural Information Processing Systems 27, volume 27, pp. 3365–3373, 2014.
215
+
216
+ David Berthelot, Nicholas Carlini, Ian Goodfellow, Nicolas Papernot, Avital Oliver, and Colin A. Raffel. Mixmatch: A holistic approach to semi-supervised learning. In Advances in Neural Information Processing Systems, volume 32, pp. 5049–5059, 2019.
217
+
218
+ David Berthelot, Nicholas Carlini, Ekin D. Cubuk, Alex Kurakin, Kihyuk Sohn, Han Zhang, and Colin Raffel. Remixmatch: Semi-supervised learning with distribution matching and augmentation anchoring. In Eighth International Conference on Learning Representations, 2020.
219
+
220
+ Olivier Chapelle, Bernhard Scholkopf, and Alexander Zien. Semi-supervised learning (chapelle, o. et al., eds.; 2006)[book reviews]. IEEE Transactions on Neural Networks, 20(3):542–542, 2009.
221
+
222
+ Ekin Dogus Cubuk, Barret Zoph, Jon Shlens, and Quoc Le. Randaugment: Practical automated data augmentation with a reduced search space. In Advances in Neural Information Processing Systems, volume 33, pp. 18613–18624, 2020.
223
+
224
+ Takashi Ishida, Gang Niu, Weihua Hu, and Masashi Sugiyama. Learning from complementary labels. In Advances in Neural Information Processing Systems, volume 30, pp. 5639–5649, 2017.
225
+
226
+ Takashi Ishida, Gang Niu, Aditya Krishna Menon, and Masashi Sugiyama. Complementary-label learning for arbitrary losses and models. In International Conference on Machine Learning, pp. 2971–2980, 2018.
227
+
228
+ Zhanghan Ke, Daoye Wang, Qiong Yan, Jimmy Ren, and Rynson Lau. Dual student: Breaking the limits of the teacher in semi-supervised learning. In IEEE International Conference on Computer Vision, pp. 6728–6736, 2019.
229
+
230
+ Youngdong Kim, Junho Yim, Juseung Yun, and Junmo Kim. Nlnl: Negative learning for noisy labels. In 2019 IEEE International Conference on Computer Vision, pp. 101–110, 2019.
231
+
232
+ Samuli Laine and Timo Aila. Temporal ensembling for semi-supervised learning. arXiv preprint arXiv:1610.02242, 2016.
233
+
234
+ Dong-Hyun Lee et al. Pseudo-label: The simple and efficient semi-supervised learning method for deep neural networks. In Workshop on challenges in representation learning, ICML, volume 3, pp. 896, 2013.
235
+
236
+ Junnan Li, Caiming Xiong, and Steven C. H. Hoi. Comatch: Semi-supervised learning with contrastive graph regularization. arXiv preprint arXiv:2011.11183, 2020.
237
+
238
+ Ilya Loshchilov and Frank Hutter. Sgdr: Stochastic gradient descent with warm restarts. In Fifth International Conference on Learning Representations, 2017.
239
+
240
+ Giorgio Patrini, Alessandro Rozza, Aditya Krishna Menon, Richard Nock, and Lizhen Qu. Making deep neural networks robust to label noise: A loss correction approach. In IEEE Conference on Computer Vision and Pattern Recognition, pp. 2233–2241, 2017.
241
+
242
+ Mamshad Nayeem Rizve, Kevin Duarte, Yogesh S Rawat, and Mubarak Shah. In defense of pseudolabeling: An uncertainty-aware pseudo-label selection framework for semi-supervised learning. In The Ninth International Conference on Learning Representations, 2021.
243
+
244
+ Weiwei Shi, Yihong Gong, Chris Ding, Zhiheng MaXiaoyu Tao, and Nanning Zheng. Transductive semi-supervised deep learning using min-max features. In Proceedings of the European Conference on Computer Vision, pp. 299–315, 2018.
245
+
246
+ Kihyuk Sohn, David Berthelot, Chun-Liang Li, Zizhao Zhang, Nicholas Carlini, Ekin D. Cubuk, Alex Kurakin, Han Zhang, and Colin Raffel. Fixmatch: Simplifying semi-supervised learning with consistency and confidence. arXiv preprint arXiv:2001.07685, 2020.
247
+
248
+ Antti Tarvainen and Harri Valpola. Mean teachers are better role models: Weight-averaged consistency targets improve semi-supervised deep learning results. In Advances in neural information processing systems, 2017.
249
+
250
+ Vikas Verma, Alex Lamb, Juho Kannala, Yoshua Bengio, and David Lopez-Paz. Interpolation consistency training for semi-supervised learning. In Proceedings of the Twenty-Eighth International Joint Conference on Artificial Intelligence, pp. 3635–3641, 2019.
251
+
252
+ Qizhe Xie, Zihang Dai, Eduard Hovy, Thang Luong, and Quoc Le. Unsupervised data augmentation for consistency training. Advances in Neural Information Processing Systems, 33, 2020.
253
+
254
+ Xiyu Yu, Tongliang Liu, Mingming Gong, and Dacheng Tao. Learning with biased complementary labels. In Proceedings of the European Conference on Computer Vision, pp. 69–85, 2018.
255
+
256
+ Sergey Zagoruyko and Nikos Komodakis. Wide residual networks. In British Machine Vision Conference, 2016.
257
+
258
+ Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
259
+
260
+ Xiaojin Zhu. Semi-supervised learning. Encyclopedia of Machine Learning and Data Mining, pp. 1142–1147, 2017.
261
+
262
+ # A ALGORITHM
263
+
264
+ # Algorithm 1: MutexMatch algorithm
265
+
266
+ Input: batch of labeledfeature extractor ata , T $\mathcal { X } = \{ ( x _ { b } ^ { l b } , y _ { b } ^ { l b } ) \} _ { b = 1 } ^ { B }$ , batch of unlabeled data $\mathcal { U } = \{ x _ { b } ^ { u l b } \} _ { b = 1 } ^ { \mu B }$
267
+ $\theta$ $\mathcal { P }$ $\mathcal { N }$
268
+ 1 for iteration $t$ do
269
+ 2 $\begin{array} { r l } { \mathcal { L } _ { s u p } = \frac { 1 } { B } \sum _ { n = 1 } ^ { B } H ( y _ { n } ^ { l b } , \mathcal { P } ( x _ { n } ^ { l b } ) ) } & { { } / / \operatorname { \it S u p e r v i s e d l o s s f o r } x ^ { l b } } \end{array}$
270
+ 3 for iteration $b = 1$ to $\mu B$ do
271
+ 4 $p _ { b } ^ { w } = \mathcal { P } ( \theta ( \alpha _ { w } ( x _ { b } ^ { u l b } ) ) )$ // Compute TPC’s prediction for weakly-augmented $x ^ { u l b }$
272
+ 5 $p _ { b } ^ { s } = \mathcal { P } ( \theta ( \alpha _ { s } ( x _ { b } ^ { u l b } ) ) )$ // Compute TPC’s prediction for strongly-augmented $x ^ { u l b }$
273
+ 6 $r _ { b } ^ { w } = \mathcal { N } ( \theta ( \alpha _ { w } ( x _ { b } ^ { u l b } ) ) )$ // Compute TNC’s prediction for weakly-augmented $x ^ { u l b }$
274
+ 7 $r _ { b } ^ { s } = \mathcal { N } ( \theta ( \alpha _ { s } ( x _ { b } ^ { u l b } ) ) )$ // Compute TNC’s prediction for strongly-augmented $x ^ { u l b }$
275
+ 8 $\hat { p } _ { b } ^ { w } = \arg \operatorname* { m a x } ( p _ { b } ^ { w } )$ // Select pseudo-labels for $x ^ { u l b }$
276
+ 9 $\hat { q } _ { b } ^ { w } = \arg \operatorname* { m i n } ( p _ { b } ^ { w } )$ // Select complementary pseudo-labels for $x ^ { u l b }$
277
+ 10 end
278
+ 11 $\begin{array} { r l } { \mathcal { L } _ { s e p } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } H ( \hat { q } _ { n } ^ { w } , \mathcal { N } ( \hat { \theta } ( x _ { n } ^ { w } ) ) ) } \end{array}$ // Stop back-propagating gradients on θ
279
+ 12 = 1µB PµBn=1 1(max(pwn ) ≥ τ )H(ˆpwn , psn) // Positive consistency loss for xulb
280
+ 13 $\begin{array} { r } { \mathcal { L } _ { n } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } \mathbb { 1 } ( \operatorname* { m a x } ( p _ { n } ^ { w } ) < \tau ) H ( r _ { n } ^ { w } , r _ { n } ^ { s } ) } \end{array}$ // Negative consistency loss for $x ^ { u l b }$
281
+ 14 update $\theta , \mathcal { P } , \mathcal { N }$ by SGD to optimise $\mathcal { L } _ { s u p } + \lambda _ { s e p } \mathcal { L } _ { s e p } + \lambda _ { p } \mathcal { L } _ { p } + \lambda _ { n } \mathcal { L } _ { n }$
282
+
283
+ # B BARELY SUPERVISED LEARNING
284
+
285
+ The experimental protocol of barely supervised learning (BSL) described in Sohn et al. (2020) assume a limited availability (e.g., 1 or 5) of labeled data from categories of interest. In order to test the performance of our method in extreme cases, we conduct experiments on CIFAR-10 with only one label per class, and consider developing a simple method to use our TNC in the test phase. As shown in Table 4, we use five different random seeds to extract one label of each class from CIFAR-10, and use MutexMatch to achieve test accuracy reaching between $6 5 . 3 0 \%$ and $9 3 . 0 7 \%$ with a mean of $7 8 . 7 3 \%$ . Compared with FixMatch (Sohn et al., 2020) reaching between $4 8 . 5 8 \%$ and $8 5 . 3 2 \%$ , the performance of MutexMatch is more superior. Then we consider using TNC to complete the test phase under this setting to obtain the test accuracy. We assume that in the ideal case, according to Equation (3), for test data $x$ , the prediction of TNC $r _ { x } = \mathcal { N } ( x )$ and the prediction of TPC $p _ { x } = \mathcal { P } ( x )$ should satisfy arg $\operatorname* { m a x } ( r _ { x } ) = \arg \operatorname* { m i n } ( p _ { x } )$ .
286
+
287
+ According to negative learning proposed in Kim et al. (2019), we hypothesis TNC is trained to classify what input image does not belong to its complementary label, so that we can use $\hat { r } _ { x } = \arg \operatorname* { m i n } ( r _ { x } )$ to classify an input image $x$ . Compared with TPC, TNC may learn less error information when the label is extremely scarce, so as to obtain better test performance. In order to verify this idea, we used TNC to participate in the test phase showed in Figure 8. For test sample $x$ , we set a confidence threshold $T$ , if $p _ { x } > T$ we uses TPC to predict, if $p _ { x } < T$ uses TNC instead, that is, the leftmost point $T = 0$ ) in the figure represents only TNC for test, and the rightmost point $T = 1$ ) represents only TNC for test. Taking 20 labels as the dividing line, we can see that using TNC for prediction has more advantages in the case of fewer labels.
288
+
289
+ ![](images/30814809dbc0e0079295d450d91755d7597c6c1a4adaa51bca39e87484fccf02.jpg)
290
+ Figure 8: Test accuracy on CIFAR-10 in single run with various amount of labels using TNC to participate test phase. The $\mathbf { X }$ -axis represents confidence threshold $T$ and y-axis represents test accuracy.
291
+
292
+ Table 4: Accuracy of MutexMatch on a single 1-label split of CIFAR-10 with different random seeds. Results are ordered by accuracy.
293
+
294
+ <table><tr><td>Fold</td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr><tr><td> Accuracy</td><td>65.30</td><td>71.12</td><td>77.83</td><td>86.33</td><td>93.07</td></tr></table>
295
+
296
+ # C SEMI-SUPERVISED LEARNING WITH NOISY LABELS
297
+
298
+ To evaluate the robustness of MutexMatch, we conduct our experiments following settings of semi-supervised learning with noisy labels on CIFAR-10. Semi-supervised learning and noise labels are challenging problems, and semi-supervised learning with noise labels is much more because the ability of the model to resist noise labels will be greatly weakened when there is only a small amount of labeled data.
299
+
300
+ Setting. Following Kim et al. (2019); Patrini et al. (2017), we applied three different types of noise in experiments:
301
+
302
+ (1) Symmetric-inc noise is created by randomly selecting the label from all classes.
303
+ (2) Symmetric-exc noise is created by randomly selecting the label from all classes without ground truth label.
304
+ (3) Asymmetric noise is generated by mapping TRUCK AUTOMOBILE, BIRD $\mathrm { \Sigma } \mathrm { P L A }$ NE, DEER $ \mathrm { H O R S E }$ , and $\mathbf { C A T } \mathbf { D O G }$ for CIFAR-10.
305
+ We evaluate MutexMatch and baselines with noisy labels mentioned above using the same settings as in Section 4.1. All experiments use 40 labeled data for training, varying radio of noisy labels in labeled data $( 2 5 \% \& 5 0 \% )$ .
306
+
307
+ Results. Table 5 shows the accuracy comparison between MutexMatch and baselines. All the results are reported by averaging on 5 different folds. Experiments show the robustness of MutexMatch under this setting. For example, with 2 labels and 2 noisy labels (Symmetric-inc) per class, MutexMatch achieves $8 8 . 7 2 { \scriptstyle \pm 3 . 5 1 \% }$ accuracy, while training of FixMatch collapse reaching a lower $7 7 . 8 0 { \pm } 1 7 . 5 7 \%$ accuracy. MutexMatch contains the idea of negative learning. Learning from the perspective of complementary pseudo-label can prevents model from overfitting to noisy data (Kim et al., 2019) so that MutexMatch achieves superior performance in SSL with noisy labels.
308
+
309
+ Table 5: Accuracy on CIFAR-10 with noisy labels averaged on 5 different folds. All experiments were based on 40 labeled data with varying radio of noisy labels.
310
+
311
+ <table><tr><td rowspan="2">Method</td><td colspan="2">Symmetric-inc</td><td colspan="2">Symmetric-exc</td><td colspan="2">Asymmetric</td></tr><tr><td>25%noisy</td><td>50%noisy</td><td>25%noisy</td><td>50%noisy</td><td>25%noisy</td><td>50%noisy</td></tr><tr><td>FixMatch</td><td>77.80±17.57</td><td>81.54±18.47</td><td>80.05±5.80</td><td>75.11±14.66</td><td>84.58±5.90</td><td>72.91±19.30</td></tr><tr><td>MutexMatch</td><td>88.72±8.51</td><td>77.18±10.55</td><td>89.37±6.10</td><td>81.85±8.00</td><td>89.51±5.14</td><td>78.28±15.44</td></tr></table>
312
+
313
+ # D ADDITIONAL EXPERIMENTAL RESULTS
314
+
315
+ # D.1 ABLATION STUDY ON LEARNING RATE AND LEARNING RATE SCHEDULE
316
+
317
+ We note that learning rate and learning rate schedule are very important for MutexMatch. In this section, we use the experimental setting in Section 4.1 to conduct additional ablation experiments for both. Following Loshchilov & Hutter (2017), recent work (Sohn et al., 2020; Li et al., 2020) use a cosine learning rate decay and achieve best performance. However, as shown in Table 6, we found that MutexMatch achieves better results without learning rate decay on CIFAR-10, outperforming cosine learning rate decay by $0 . 3 2 \%$ . When there are many labels, the pseudo-labels outputted by TPC are more likely to have high-confidence and remain stable. It is necessary for MutexMatch to use cosine learning rate decay to jump out of the local optimum.
318
+
319
+ Table 6: Ablation study on learning rate and learning rate schedule. Results are reported on CIFAR10 varying number of labels.
320
+
321
+ <table><tr><td>Decay Schedule</td><td>Learning Rate</td><td>Labels</td><td>Backbone</td><td>Accuracy</td></tr><tr><td>No Decay</td><td>0.03</td><td>40</td><td>WRN-28-2</td><td>93.54</td></tr><tr><td>No Decay</td><td>0.07</td><td>40</td><td>WRN-28-2</td><td>93.02</td></tr><tr><td>No Decay</td><td>0.10</td><td>40</td><td>WRN-28-2</td><td>92.89</td></tr><tr><td>Cosine Decay</td><td>0.03</td><td>40</td><td>WRN-28-2</td><td>93.22</td></tr><tr><td>Cosine Decay</td><td>0.07</td><td>40</td><td>WRN-28-2</td><td>93.20</td></tr><tr><td>Cosine Decay</td><td>0.10</td><td>40</td><td>WRN-28-2</td><td>92.59</td></tr><tr><td>No Decay</td><td>0.03</td><td>80</td><td>WRN-28-2</td><td>93.95</td></tr><tr><td>Cosine Decay</td><td>0.03</td><td>80</td><td>WRN-28-2</td><td>94.53</td></tr><tr><td>No Decay</td><td>0.03</td><td>1000</td><td>CNN-13</td><td>91.57</td></tr><tr><td>Cosine Decay</td><td>0.03</td><td>1000</td><td>CNN-13</td><td>93.46</td></tr><tr><td>No Decay</td><td>0.03</td><td>4000</td><td>CNN-13</td><td>92.75</td></tr><tr><td>Cosine Decay</td><td>0.03</td><td>4000</td><td>CNN-13</td><td>94.41</td></tr></table>
322
+
323
+ # D.2 HYPERPARAMETERS
324
+
325
+ For MutexMatch, the choice of $\tau$ needs to be very cautious, because different $\tau$ will lead to the division of high and low-confidence portions, which will affect the impact of the mutex-based consistency regularization on the model. We use the identical setting of experiments in Section 4.1 for MutexMatch and vary $\tau$ to verify the sensitivity of MutexMatch to this hyperparameter. As shown in Table 7, MutexMatch needs to select appropriate $\tau$ to divide confidence portions. We note that when there are many labels, $\tau$ has a greater impact on performance. The more labels are available, the less confirmation bias will be when using TPC directly for classification, so the portion of TPC in mutex-based consistency regularization can be used directly for learning. Therefore, we guess that in general, we should choose a smaller $\tau$ to make more pseudo-labels participate in the training of TPC when the number of labels increases.
326
+
327
+ Table 7: Ablation study on confidence threshold $\tau$ . Results are reported on CIFAR-10 varying number of labels.
328
+
329
+ <table><tr><td>T</td><td>Labels</td><td>Backbone</td><td> Accuracy</td></tr><tr><td>0.5</td><td>40</td><td>WRN-28-2</td><td>93.52</td></tr><tr><td>0.75</td><td>40</td><td>WRN-28-2</td><td>93.44</td></tr><tr><td>0.85</td><td>40</td><td>WRN-28-2</td><td>93.28</td></tr><tr><td>0.95</td><td>40</td><td>WRN-28-2</td><td>93.54</td></tr><tr><td>0.99</td><td>40</td><td>WRN-28-2</td><td>92.17</td></tr><tr><td>0.5</td><td>80</td><td>WRN-28-2</td><td>94.53</td></tr><tr><td>0.95</td><td>80</td><td>WRN-28-2</td><td>93.64</td></tr><tr><td>0.5</td><td>1000</td><td>CNN-13</td><td>93.46</td></tr><tr><td>0.95</td><td>1000</td><td>CNN-13</td><td>92.07</td></tr><tr><td>0.5</td><td>4000</td><td>CNN-13</td><td>94.41</td></tr><tr><td>0.95</td><td>4000</td><td>CNN-13</td><td>92.94</td></tr></table>
330
+
331
+ At the same time, showed in Figure 9, we vary the weight $\lambda _ { s e p }$ of the separate training loss for TNC $\mathcal { L } _ { s e p }$ and $\lambda _ { n }$ of the negative consistency loss ${ \mathcal { L } } _ { n }$ . Choosing the appropriate weight of loss is very important for MutexMatch. Larger $\lambda _ { s e p }$ ensures the accuracy of complementary pseudo-labels, which helps TNC better participate in training. Appropriate $\lambda _ { n }$ weighs the contribution of TNC and TPC in mutex-based consistency regularization, so that the model can achieve better performance.
332
+
333
+ Additionaly, we provide more ablation studies on various $\lambda _ { s e p }$ , $\lambda _ { n }$ and $\lambda _ { p }$ shown in Table 8. We find that increasing $\lambda _ { s e p }$ and $\lambda _ { n }$ at the same time will cause severe performance degradation, which shows that we must carefully control the importance of TNC in the learning process, because TPC has always maintained the most important position in completing our classification tasks. Meanwhile, appropriate $\lambda _ { p }$ ensures model can benefit from learning of TNC. More results of experiments about situation where $\lambda _ { p } = 0$ or $\lambda _ { n } = 0$ can be found in Section D.3.
334
+
335
+ Table 8: Accuracy on CIFAR-10 with 40 labels and various $\lambda _ { s e p } , \lambda _ { n } , \lambda _ { p }$ .
336
+
337
+ <table><tr><td>Xsep</td><td>入n</td><td>Xp</td><td>Accuracy</td></tr><tr><td>1</td><td>1</td><td>1</td><td>93.49</td></tr><tr><td>1</td><td>1</td><td>10</td><td>91.27</td></tr><tr><td>1</td><td>1</td><td>20</td><td>85.05</td></tr><tr><td>10</td><td>1</td><td>1</td><td>88.94</td></tr><tr><td>20</td><td>1</td><td>1</td><td>85.44</td></tr><tr><td>20</td><td>10</td><td>1</td><td>18.03</td></tr><tr><td></td><td></td><td></td><td></td></tr><tr><td>20</td><td>10</td><td>10</td><td>15.96</td></tr></table>
338
+
339
+ ![](images/0a082e49f276a6d9fd0da8cd59d788738b4a8a1da723759d2dd943276b71db30.jpg)
340
+ Figure 9: Accuracy on CIFAR-10 with $4 0 1 \mathrm { a }$ - bels and various $\lambda _ { s e p }$ , $\lambda _ { n }$ .
341
+
342
+ # D.3 ABLATION STUDY ON TPC AND TNC
343
+
344
+ We explain why we enforce consistency regularization on TNC as follows. Given two augmented variants derived from the same unlabeled instance, we claim that the class probability distributions (i.e., soft-labels) of their complementary predictions (i.e., the TNC’s outputs) should be consistent. Under the help of an independent training process of TNC, the model can be more confident on “what it is not”. As a result, such prediction consistency on TNC can effectively decrease the FalseNegative probability on TPC’s predictions. As shown in Figure 10, given a instance of class 1, the independent training of TNC can generate an accurate complementary prediction with extremely low probability of class 1. Then encouraging a similar prediction on its strongly augmented variant can help the model to learn more discriminative features. It can in turn affect the TPC’s prediction, such that the False-Negative probabilities (to be predicted as a class of 2, 3, 4, 5) can be effectively decreased. Consequently, the True-Positive probability of TPC’s predictions is enlarged.
345
+
346
+ ![](images/8ee3047fcae56fe3247e0e4b3879c64ca88844cbf1b6ab96f28751aeee398af0.jpg)
347
+ Figure 10: The correct component in prediction vector is class 1.
348
+
349
+ We construct an experiment on CIFAR-10 with 40 labels to verify our findings. We denote MutexMatch without consistency reguarlization on TNC as M wo. c (i.e., MutexMatch degenerates to FixMatch). Although the confidence of the correct predictions of MutexMatch and M wo. $c$ is very high (are very close to $1 0 0 \%$ ), we check their wrong predictions as an example for comparison. In fact, for the correct part of the pseudo-labels, MutexMatch obtains more correct pseudo-labels than M wo. $c$ (FixMatch) thanks to the use of consistency regularization on TNC (i.e., MutexMatch’s accuracy of pseduo-labels is higher than FixMatch, which is shown in Figure 5).
350
+
351
+ As shown in Figure 11(a), given the unlabeled instances belonging to “automobile”, the MutexMatch’s average probability of “automobile” component in prediction vector is higher than that of M wo. c. We can also obtain similar findings on other different classes, as shown in Figure 11(b). Such observations demonstrate enforcing prediction consistency on TNC can successfully help the model lower the False-Negative probability, which in turn improve the True-Positive probability in the TPC’s prediction vector.
352
+
353
+ ![](images/7493c3663455406ffd0325a930915cde0a0e05e37845af4add418830bf7a3b5a.jpg)
354
+ Figure 11: (a) Average probability of each component in prediction vector of automobile images. (b) Average probability of correct component in prediction vector of all classes in CIFAR-10.
355
+
356
+ Moreover, this design is based on the consideration of it’s unreasonable to directly involve complementary label based negative learning in semi-supervised. In the early training stage of semisupervised learning, the accuracy of pseudo-labels is often not very high. In this process, the introduction of complementary labels directly into the learning process will not only be helpful, but even harmful, and lead to training collapse finally. Therefore, we use consistency regularization to “decouple” the part where complementary label are directly involved in training. We believe that it is reasonable to use consistency regularization on TNC at the sample level, because we only need TNC to show the various results for each class at the dataset level, which is shown in Section 4.3. This demonstrates TNC has learned discriminative information from the aspect of complementary label. Implementing consistency regularization on TNC at the sample level is to help TNC learn from the perspective of complementary labels, so that feature extraction can learn better data representation of unlabeled data with low confidence. In addition, we use soft labels for consistency regularization on TNC, which also ensures TNC can learn multi-class information, which is described in Section 3.3. For further discussion on the effectiveness of TPC and TNC, we consider removing these two components respectively. Given mentioned above, we designed the following experiments:
357
+
358
+ (i) What happens if consistency regularization on TNC is abandoned (i.e., $\lambda _ { n } = 0$ )? Taking into account that in the default MutexMatch, training of TNC with complementary pseudolabels stops the gradient, so if we set $\lambda _ { n } = 0$ , then TNC is equivalent to not participating in the training of the model at all, which means that MutexMatch degenerates into FixMatch. So a more reasonable setting is to restore the backpropagation on feature extractor $\theta$ in Equation (3). Then we explore the effect of not using consistency regularization on TNC:
359
+
360
+ $$
361
+ \mathcal { L } _ { s e p } = \frac { 1 } { \mu B } \sum _ { n = 1 } ^ { \mu B } H ( \arg \operatorname* { m i n } ( \mathcal { P } ( \theta ( x _ { n } ^ { w } ) ) , \mathcal { N } ( \theta ( x _ { n } ^ { w } ) ) ) ,
362
+ $$
363
+
364
+ where we restore the back propagation on $\theta$ and set $\lambda _ { n } = 0$ in Equation (1).
365
+
366
+ (ii) What happens when we train TNC with complementary labels generated by TPC without stopping the gradient on TNC? We keep $\lambda _ { n } = 1$ in Equation (1), and restore the backpropagation on $\theta$ like Equation (12).
367
+ (iii) At the same time, in order to explore the role of TPC component, we set $\lambda _ { p } = 0$ in Equation (1) for ablation study.
368
+ (iv) We simply set $( \lambda _ { p } , \lambda _ { n } , \lambda _ { s e p } )$ to $( 0 , 0 , 0 ) , ( 0 , 1 , 0 )$ and $( 1 , 1 , 0 )$ .
369
+
370
+ As shown in Figure 12, the default MutexMatch achieves dominant performance compared with other settings. In figures, wo. TNC represents setting of (i), wo. $_ { S G }$ represents setting of (ii), wo. $T P C$ represents setting of (iii) and $w . \ 0 0 0 , w . \ 0 l 0 , w . \ l l 0$ represent setting of (iv). Obviously, TNC participates in model training directly will cause training to collapse, which means that the model is seriously affected by the learning of TNC, and there is no way to learn effective information of “what it is”. (iii) shows that TPC in this case does not get adequate training and it can’t complete the classification task. i.e., the training of TPC is equivalent to using only labeled data. Meanwhile, The training of TNC is closely related to TPC. In this case, TNC has not been well trained, too. And in fact, we don’t use TNC to participate in the testing phase. (i) and (ii) illustrate the superiority of using consistency regularization for learning on TNC. This “decoupling” ensures that TNC can make the model learn a better data representation without affecting the learning of TPC. Finally, the combination of (iv) and other settings proves the necessity of each component in MutexMatch.
371
+
372
+ ![](images/df8412667028cb8aecb1f42e55870b95531041612f83866e9add7013c6a04086.jpg)
373
+ Figure 12: The learning curve of ablation study on SVHN. The $\mathbf { X }$ -axis represents the training epoch and $\mathbf { y }$ -axis represents the test accuracy in (a), (c) and the pseudo-label accuracy in (b), (d).
md/dev/sP1fo2K9DFG/sP1fo2K9DFG.md ADDED
@@ -0,0 +1,544 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IS CONDITIONAL GENERATIVE MODELING ALL YOU NEED FOR DECISION-MAKING?
2
+
3
+ Anurag Ajay∗ †§¶, Yilun Du \*§¶, Abhi Gupta $\ast \ddag \mathfrak { S } \ P$ , Joshua Tenenbaum¶, Tommi Jaakkola‡§¶, Pulkit Agrawal†§¶
4
+
5
+ Improbable AI Lab†
6
+ Operations Research Center‡
7
+ Computer Science and Artificial Intelligence Lab§
8
+ Massachusetts Institute of Technology¶
9
+
10
+ # ABSTRACT
11
+
12
+ Recent improvements in conditional generative modeling have made it possible to generate high-quality images from language descriptions alone. We investigate whether these methods can directly address the problem of sequential decisionmaking. We view decision-making not through the lens of reinforcement learning (RL), but rather through conditional generative modeling. To our surprise, we find that our formulation leads to policies that can outperform existing offline RL approaches across standard benchmarks. By modeling a policy as a returnconditional diffusion model, we illustrate how we may circumvent the need for dynamic programming and subsequently eliminate many of the complexities that come with traditional offline RL. We further demonstrate the advantages of modeling policies as conditional diffusion models by considering two other conditioning variables: constraints and skills. Conditioning on a single constraint or skill during training leads to behaviors at test-time that can satisfy several constraints together or demonstrate a composition of skills. Our results illustrate that conditional generative modeling is a powerful tool for decision-making.
13
+
14
+ # 1 INTRODUCTION
15
+
16
+ Over the last few years, conditional generative modeling has yielded impressive results in a range of domains, including high-resolution image generation from text descriptions (DALL-E, ImageGen) (Ramesh et al., 2022; Saharia et al., 2022), language generation (GPT) (Brown et al., 2020), and step-by-step solutions to math problems (Minerva) (Lewkowycz et al., 2022). The success of generative models in countless domains motivates us to apply them to decision-making. Conveniently, there exists a wide body of research on recovering high-performing policies from data logged by already operational systems (Kostrikov et al., 2022; Kumar et al., 2020; Walke et al., 2022). This is particularly useful in real-world settings where interacting with the environment is not always possible, and exploratory decisions can have fatal consequences (Dulac-Arnold et al., 2021). With access to such offline datasets, the problem of decision-making reduces to learning a probabilistic model of trajectories, a setting where generative models have already found success.
17
+
18
+ In offline decision-making, we aim to recover optimal reward-maximizing trajectories by stitching together sub-optimal reward-labeled trajectories in the training dataset. Prior works (Kumar et al., 2020; Kostrikov et al., 2022; Wu et al., 2019; Kostrikov et al., 2021; Dadashi et al., 2021; Ajay et al., 2020; Ghosh et al., 2022) have tackled this problem with reinforcement learning (RL) that uses dynamic programming for trajectory stitching. To enable dynamic programming, these works learn a value function that estimates the discounted sum of rewards from a given state. However, value function estimation is prone to instabilities due to function approximation, off-policy learning, and bootstrapping together, together known as the deadly triad (Sutton & Barto, 2018). Furthermore, to stabilize value estimation in offline regime, these works rely on heuristics to keep the policy within the dataset distribution. These challenges make it difficult to scale existing offline RL algorithms.
19
+
20
+ ![](images/9dac5e5f723a941f045f73b69f622ccae89b7291e5b8f4eed92c65b334c4c613.jpg)
21
+ Figure 1: Decision Making using Conditional Generative Modeling. Framing decision making as a conditional generative modeling problem allows us to maximize rewards, satisfy constraints and compose skills.
22
+
23
+ In this paper, we ask if we can perform dynamic programming to stitch together sub-optimal trajectories to obtain an optimal trajectory without relying on value estimation. Since conditional diffusion generative models can generate novel data points by composing training data (Saharia et al., 2022), we leverage it for trajectory stitching in offline decision-making. Given a dataset of reward-labeled trajectories, we adapt diffusion models (Sohl-Dickstein et al., 2015) to learn a return-conditional trajectory model. During inference, we use classifier-free guidance with lowtemperature sampling, which we hypothesize to implicitly perform dynamics programming, to capture the best behaviors in the dataset and glean return maximizing trajectories (see Appendix A). Our straightforward conditional generative modeling formulation outperforms existing approaches on standard D4RL tasks (Fu et al., 2020).
24
+
25
+ Viewing offline decision-making through the lens of conditional generative modeling allows going beyond conditioning on returns (Figure 1). Consider an example (detailed in Appendix A) where a robot with linear dynamics navigates an environment containing two concentric circles (Figure 2). We are given a dataset of state-action trajectories of the robot, each satisfying one of two constraints: (i) the final position of the robot is within the larger circle, and (ii) the final position of the robot is outside the smaller circle. With conditional diffusion modeling, we can use the datasets to learn a constraintconditioned model that can generate trajectories satisfying any set of constraints. During inference, the learned trajectory model can merge constraints from the dataset and generate trajectories that satisfy the combined constraint. Figure 2 shows that the constraint-conditioned model can generate trajectories such that the final position of the robot lies between the concentric circles.
26
+
27
+ ![](images/3f638c6b9477f25a868e5f8e34ac18c10ed64b5789def600b6b4750a38198356.jpg)
28
+ Figure 2: Illustrative example. We visualize the 2d robot navigation environment and the constraints satisfied by the trajectories in the dataset derived from the environment. We show the ability of the conditional diffusion model to generate trajectories that satisfy the combined constraints.
29
+
30
+ Here, we demonstrate the benefits of modeling policies as conditional generative models. First, conditioning on constraints allows policies to not only generate behaviors satisfying individual constraints but also generate novel behaviors by flexibly combining constraints at test time. Further, conditioning on skills allows policies to not only imitate individual skills but also generate novel behaviors by composing those skills. We instantiate this idea with a state-sequence based diffusion probabilistic model (Ho et al., 2020) called Decision Diffuser, visualized in Figure 1. In summary, our contributions include (i) illustrating conditional generative modeling as an effective tool in offline decision making, (ii) using classifier-free guidance with low-temperature sampling, instead of dynamic programming, to get return-maximizing trajectories and, (iii) leveraging the framework of conditional generative modeling to combine constraints and compose skills during inference flexibly.
31
+
32
+ # 2 BACKGROUND
33
+
34
+ # 2.1 REINFORCEMENT LEARNING
35
+
36
+ We formulate the sequential decision-making problem as a discounted Markov Decision Process (MDP) defined by the tuple $\langle \rho _ { 0 } , S , { \mathcal { A } } , { \mathcal { T } } , { \mathcal { R } } , { \gamma } \rangle$ , where $\rho _ { 0 }$ is the initial state distribution, $s$ and $\mathcal { A }$ are state and action spaces, $\mathcal { T } : \mathcal { S } \times \mathcal { A } \mathcal { S }$ is the transition function, $\mathcal { R } : \mathcal { S } \times \mathcal { A } \times \mathcal { S } \mathbb { R }$ gives the reward at any transition and $\gamma \in [ 0 , 1 )$ is a discount factor. The agent acts with a stochastic policy $\pi :$ ${ \cal S } \to \Delta _ { \cal A }$ , generating a sequence of state-action-reward transitions or trajectory $\tau : = ( s _ { k } , a _ { k } , r _ { k } ) _ { k \geq 0 }$ with probability $p _ { \pi } ( \tau )$ and return $\begin{array} { r } { R ( \tau ) : = \sum _ { k \geq 0 } \gamma ^ { k } r _ { k } } \end{array}$ . The standard objective in RL is to find a return-maximizing policy $\begin{array} { r } { \pi ^ { * } = \arg \operatorname* { m a x } _ { \pi } \mathbb { E } _ { \tau \sim p _ { \pi } } \overline { { [ R ( \tau ) ] } } } \end{array}$ .
37
+
38
+ Temporal Difference Learning TD methods (Fujimoto et al., 2018; Lillicrap et al., 2015) estimate $Q ^ { * } ( s , a ) : = \mathbb { E } _ { \tau \sim p _ { \pi ^ { * } } } [ R ( \tau ) | s _ { 0 } = s , a _ { 0 } = a ]$ , the return achieved under the optimal policy $\pi ^ { * }$ when starting in state $s$ and taking action $a$ , with a parameterized $Q$ -function. This requires minimizing the following TD loss:
39
+
40
+ $$
41
+ \mathcal { L } _ { \mathrm { T D } } ( \theta ) : = \mathbb { E } _ { ( s , a , r , s ^ { \prime } ) \in \mathcal { D } } [ ( r + \gamma \operatorname* { m a x } _ { a ^ { \prime } \in \mathcal { A } } Q _ { \theta } ( s ^ { \prime } , a ^ { \prime } ) - Q _ { \theta } ( s , a ) ) ^ { 2 } ]
42
+ $$
43
+
44
+ Continuous action spaces further require learning a parametric policy $\pi _ { \phi } ( a | s )$ that plays the role of the maximizing action in equation 1. This results in a policy objective that must be maximized:
45
+
46
+ $$
47
+ \mathcal { I } ( \phi ) : = \mathbb { E } _ { s \in \mathcal { D } , a \sim \pi _ { \phi } ( . | s ) } [ Q ( s , a ) ]
48
+ $$
49
+
50
+ Here, the dataset of transitions $\mathcal { D }$ evolves as the agent interacts with the environment and both $Q _ { \theta }$ and $\pi _ { \phi }$ are trained together. These methods make use of function approximation, off-policy learning, and bootstrapping, leading to several instabilities in practice (Sutton, 1988; Van Hasselt et al., 2018).
51
+
52
+ Offline RL requires finding a return-maximizing policy from a fixed dataset of transitions collected by an unknown behavior policy $\mu$ (Levine et al., 2020). Using TD-learning naively causes the state visitation distribution $d ^ { \pi _ { \phi } } ( s )$ to move away from the distribution of the dataset $d ^ { \mu } ( s )$ . In turn, the policy $\pi _ { \phi }$ begins to take actions that are substantially different from those already seen in the data. Offline RL algorithms resolve this distribution-shift by imposing a constraint of the form $D ( d ^ { \pi _ { \phi } } | | d ^ { \mu } )$ , where $D$ is some divergence metric, directly in the TD-learning procedure. The constrained optimization problem now demands additional implementation heuristics to achieve any reasonable performance (Kumar et al., 2021). The Decision Diffuser, in comparison, doesn’t have any of these disadvantages. It does not require estimating any kind of $Q$ -function, thereby sidestepping TD methods altogether. It also does not face the risk of distribution-shift as generative models are trained with maximum-likelihood estimation.
53
+
54
+ # 2.2 DIFFUSION PROBABILISTIC MODELS
55
+
56
+ Diffusion models (Sohl-Dickstein et al., 2015; Ho et al., 2020) are a specific type of generative model that learn the data distribution $q ( { \pmb x } )$ from a dataset $\mathcal { D } : = \{ \pmb { x } ^ { i } \} _ { 0 \leq i < M }$ . They have been used most notably for synthesizing high-quality images from text descriptions (Saharia et al., 2022; Nichol et al., 2021). Here, the data-generating procedure is modelled with a predefined forward noising process $q ( \pmb { x } _ { k + 1 } | \pmb { x } _ { k } ) : = \mathcal { N } ( \pmb { x } _ { k + 1 } ; \sqrt { \alpha _ { k } } \pmb { x } _ { k } , ( 1 - \alpha _ { k } ) \pmb { I } )$ and a trainable reverse process $p _ { \theta } ( \pmb { x } _ { k - 1 } | \pmb { x } _ { k } ) : =$ $\mathcal { N } ( \pmb { x } _ { k - 1 } | \mu _ { \theta } ( \pmb { x } _ { k } , k ) , \Sigma _ { k } )$ , where $\mathcal { N } ( \boldsymbol { \mu } , \boldsymbol { \Sigma } )$ denotes a Gaussian distribution with mean $\mu$ and variance $\Sigma$ , $\alpha _ { k } \in \mathbb { R }$ determines the variance schedule, $\scriptstyle { \pmb { x } } _ { 0 } : = { \pmb { x } }$ is a sample, ${ \pmb x } _ { 1 } , { \pmb x } _ { 2 } , . . . , { \pmb x } _ { K - 1 }$ are the latents, and $\pmb { x } _ { K } \sim \mathcal { N } ( \mathbf { 0 } , \pmb { I } )$ for carefully chosen $\alpha _ { k }$ and long enough $K$ . Starting with Gaussian noise, samples are then iteratively generated through a series of ”denoising” steps.
57
+
58
+ Although a tractable variational lower-bound on $\log p _ { \theta }$ can be optimized to train diffusion models, Ho et al. (2020) propose a simplified surrogate loss:
59
+
60
+ $$
61
+ \mathcal { L } _ { \mathrm { d e n o i s e } } ( \theta ) : = \mathbb { E } _ { k \sim [ 1 , K ] , \boldsymbol { x } _ { 0 } \sim q , \epsilon \sim \mathcal { N } ( \mathbf { 0 } , I ) } [ | | \epsilon - \epsilon _ { \theta } ( \boldsymbol { x } _ { k } , k ) | | ^ { 2 } ]
62
+ $$
63
+
64
+ The predicted noise $\boldsymbol { \epsilon } _ { \boldsymbol { \theta } } ( \boldsymbol { x } _ { k } , k )$ , parameterized with a deep neural network, estimates the noise $\epsilon \sim$ $\mathcal { N } ( 0 , I )$ added to the dataset sample $\scriptstyle { \mathbf { { \mathit { x } } } } _ { 0 }$ to produce noisy $\scriptstyle { \mathbf { { \mathit { x } } } } _ { k }$ . This is equivalent to predicting the mean of $p _ { \theta } ( \pmb { x } _ { k - 1 } | \pmb { x } _ { k } )$ since $\mu _ { \boldsymbol { \theta } } ( \mathbf { \boldsymbol { x } } _ { k } , k )$ can be calculated as a function of $\epsilon _ { \theta } ( \pmb { x } _ { k } , k )$ (Ho et al., 2020).
65
+
66
+ Guided Diffusion Modelling the conditional data distribution $q ( { \pmb x } | { \pmb y } )$ makes it possible to generate samples with attributes of the label $\textbf { { y } }$ . The equivalence between diffusion models and scorematching (Song et al., 2021), which shows $\epsilon _ { \theta } ( x _ { k } , \bar { k } ) \propto \nabla _ { x _ { k } } \log p ( \pmb { x } _ { k } )$ , leads to two kinds of methods for conditioning: classifier-guided (Nichol & Dhariwal, 2021) and classifier-free (Ho & Salimans, 2022). The former requires training an additional classifier $p _ { \phi } ( \pmb { y } | \pmb { x } _ { k } )$ on noisy data so that samples may be generated at test-time with the perturbed noise $\epsilon _ { \theta } ( \pmb { x } _ { k } , k ) - \omega \sqrt { 1 - \bar { \alpha } _ { k } } \nabla _ { \pmb { x } _ { k } } \log p ( \pmb { y } | \pmb { x } _ { k } )$ , where $\omega$ is referred to as the guidance scale. The latter does not separately train a classifier but modifies the original training setup to learn both a conditional $\epsilon _ { \theta } ( \pmb { x } _ { k } , \pmb { y } , k )$ and an unconditional $\epsilon _ { \theta } ( \pmb { x } _ { k } , k )$ model for the noise. The unconditional noise is represented, in practice, as the conditional noise $\epsilon _ { \theta } ( \pmb { x } _ { k } , 0 , k )$ where a dummy value $\varnothing$ takes the place of $\textbf { { y } }$ . The perturbed noise $\epsilon _ { \theta } ( { \pmb x } _ { k } , k ) + \omega ( \epsilon _ { \theta } ( { \pmb x } _ { k } , { \pmb y } , k ) - \epsilon _ { \theta } ( { \pmb x } _ { k } , k ) )$ is used to later generate samples.
67
+
68
+ # 3 GENERATIVE MODELING WITH THE DECISION DIFFUSER
69
+
70
+ It is useful to solve RL from offline data, both without relying on TD-learning and without risking distribution-shift. To this end, we formulate sequential decision-making as the standard problem of
71
+
72
+ ![](images/5193fd80ab094ae9c4154b23239d26a5d2b68886d0126e16c31679f9afe8be80.jpg)
73
+ Figure 3: Planning with Decision Diffuser. Given the current state $s _ { t }$ and conditioning, Decision Diffuser uses classifier-free guidance with low-temperature sampling to generate a sequence of future states. It then uses inverse dynamics to extract and execute the action $a _ { t }$ that leads to the immediate future state $s _ { t + 1 }$ .
74
+
75
+ conditional generative modeling:
76
+
77
+ $$
78
+ \operatorname* { m a x } _ { \theta } \mathbb { E } _ { \tau \sim \mathcal { D } } [ \log p _ { \theta } ( \pmb { x } _ { 0 } ( \tau ) | \pmb { y } ( \tau ) ) ]
79
+ $$
80
+
81
+ Our goal is to estimate the conditional data distribution with $p _ { \theta }$ so we can later generate portions of a trajectory $\pmb { x } _ { 0 } ( \tau )$ from information $\pmb { y } ( \tau )$ about it. Examples of $\textbf { { y } }$ could include the return under the trajectory, the constraints satisfied by the trajectory, or the skill demonstrated in the trajectory. We construct our generative model according to the conditional diffusion process:
82
+
83
+ $$
84
+ \begin{array} { r l } { q ( \pmb { x } _ { k + 1 } ( \tau ) | \pmb { x } _ { k } ( \tau ) ) , } & { { } p _ { \theta } ( \pmb { x } _ { k - 1 } ( \tau ) | \pmb { x } _ { k } ( \tau ) , \pmb { y } ( \tau ) ) } \end{array}
85
+ $$
86
+
87
+ As usual, $q$ represents the forward noising process while $p _ { \theta }$ the reverse denoising process. In the following, we discuss how we may use diffusion for decision making. First, we discuss the modeling choices for diffusion in Section 3.1. Next, we discuss how we may utilize classifier-free guidance to capture the best aspects of trajectories in Section 3.2. We then discuss the different behaviors that may be implemented with conditional diffusion models in Section 3.3. Finally, we discuss practical training details of our approach in Section 3.4.
88
+
89
+ # 3.1 DIFFUSING OVER STATES
90
+
91
+ In images, the diffusion process is applied across all pixel values in an image. Na¨ıvely, it would therefore be natural to apply a similar process to model the state and actions of a trajectory. However, in the reinforcement learning setting, directly modeling actions using a diffusion process has several practical issues. First, while states are typically continuous in nature in RL, actions are more varied, and are often discrete in nature. Furthermore, sequences over actions, which are often represented as joint torques, tend to be more high-frequency and less smooth, making them much harder to predict and model (Tedrake, 2022). Due to these practical issues, we choose to diffuse only over states, as defined below:
92
+
93
+ $$
94
+ \pmb { x } _ { k } ( \tau ) : = ( s _ { t } , s _ { t + 1 } , . . . , s _ { t + H - 1 } ) _ { k }
95
+ $$
96
+
97
+ Here, $k$ denotes the timestep in the forward process and $t$ denotes the time at which a state was visited in trajectory $\tau$ . Moving forward, we will view ${ \pmb x } _ { k } ( \tau )$ as a noisy sequence of states from a trajectory of length $H$ . We represent ${ \pmb x } _ { k } ( \tau )$ as a two-dimensional array with one column for each timestep of the sequence.
98
+
99
+ Acting with Inverse-Dynamics. Sampling states from a diffusion model is not enough for defining a controller. A policy can, however, be inferred from estimating the action $a _ { t }$ that led the state $s _ { t }$ to $s _ { t + 1 }$ for any timestep $t$ in ${ \pmb x } _ { 0 } ( \tau )$ . Given two consecutive states, we generate an action according to the inverse dynamics model (Agrawal et al., 2016; Pathak et al., 2018):
100
+
101
+ $$
102
+ a _ { t } : = f _ { \phi } ( s _ { t } , s _ { t + 1 } )
103
+ $$
104
+
105
+ Note that the same offline data used to train the reverse process $p _ { \theta }$ can also be used to learn $f _ { \phi }$ . We illustrate in Table 2 how the design choice of directly diffusing state distributions, with an inverse dynamics model to predict action, significantly improves performance over diffusing across both states and actions jointly. Furthermore, we empirically compare and analyze when to use inverse dynamics and when to diffuse over actions in Appendix F.
106
+
107
+ # 3.2 PLANNING WITH CLASSIFIER-FREE GUIDANCE
108
+
109
+ Given a diffusion model representing the different trajectories in a dataset, we next discuss how we may utilize the diffusion model for planning. To use the model for planning, it is necessary to additionally condition the diffusion process on characteristics $\pmb { y } ( \tau )$ . One approach could be to train a classifier $p _ { \phi } ( \pmb { y } ( \tau ) | \pmb { x } _ { k } ( \tau ) )$ to predict $\pmb { y } ( \tau )$ from noisy trajectories ${ \pmb x } _ { k } ( \tau )$ . In the case that $\pmb { y } ( \tau )$ represents the return under a trajectory, this would require estimating a $Q$ -function, which requires a separate, complex dynamic programming procedure.
110
+
111
+ One approach to avoid dynamic programming is to directly train a conditional diffusion model conditioned on the returns $\pmb { y } ( \tau )$ in the offline dataset. However, as our dataset consists of a set of sub-optimal trajectories, the conditional diffusion model will be polluted by such sub-optimal behaviors. To circumvent this issue, we utilize classifier-free guidance (Ho & Salimans, 2022) with low-temperature sampling, to extract high-likelihood trajectories in the dataset. We find that such trajectories correspond to the best set of behaviors in the dataset. For a detailed discussion comparing Q-function guidance and classifier-free guidance, please refer to Appendix K. Formally, to implement classifier free guidance, a $\pmb { x } _ { 0 } ( \tau )$ is sampled by starting with Gaussian noise ${ \pmb x } _ { K } ( \tau )$ and refining ${ \pmb x } _ { k } ( \tau )$ into $\pmb { x } _ { k - 1 } ( \tau )$ at each intermediate timestep with the perturbed noise:
112
+
113
+ $$
114
+ \hat { \epsilon } : = \epsilon _ { \theta } ( { \pmb x } _ { k } ( \tau ) , \mathcal { O } , k ) + \omega ( \epsilon _ { \theta } ( { \pmb x } _ { k } ( \tau ) , { \pmb y } ( \tau ) , k ) - \epsilon _ { \theta } ( { \pmb x } _ { k } ( \tau ) , \mathcal { O } , k ) ) ,
115
+ $$
116
+
117
+ where the scalar $\omega$ applied to $( \epsilon _ { \theta } ( { \pmb x } _ { k } ( \tau ) , { \pmb y } ( \tau ) , k ) - \epsilon _ { \theta } ( { \pmb x } _ { k } ( \tau ) , \emptyset , k ) )$ seeks to augment and extract the best portions of trajectories in the dataset that exhibit $\pmb { y } ( \tau )$ . With these ingredients, sampling from the Decision Diffuser becomes similar to planning in RL. First, we observe a state in the environment. Next, we sample states later into the horizon with our diffusion process conditioned on $\textbf { { y } }$ and history of last $C$ states observed. Finally, we identify the action that should be taken to reach the most immediate predicted state with our inverse dynamics model. This procedure repeats in a standard receding-horizon control loop described in Algorithm 1 and visualized in Figure 3.
118
+
119
+ # 3.3 CONDITIONING BEYOND RETURNS
120
+
121
+ So far we have not explicitly defined the conditioning variable $\pmb { y } ( \tau )$ . Though we have mentioned that it can be the return under a trajectory, we may also consider guiding our diffusion process towards sequences of states that satisfy relevant constraints or demonstrate specific behavior.
122
+
123
+ Maximizing Returns To generate trajectories that maximize return, we condition the noise model on the return of a trajectory so $\begin{array} { r } { \epsilon _ { \theta } ( \bar { \mathbf { x } } _ { k } ( \tau ) , \mathbf { \boldsymbol { y } } ( \tau ) , k ) : = \epsilon _ { \theta } ( \mathbf { \Delta x } _ { k } ( \tau ) , R ( \tau ) , k ) } \end{array}$ . These returns are normalized to keep $R ( \tau ) \in [ 0 , 1 ]$ . Sampling a high return trajectory amounts to conditioning on $R ( \tau ) = 1$ . Note that we do not make use of any $Q$ -values, which would then require dynamic programming.
124
+
125
+ Satisfying Constraints Trajectories may satisfy a variety of constraints, each represented by the set $\mathcal { C } _ { i }$ , such as reaching a specific goal, visiting states in a particular order, or avoiding parts of the state space. To generate trajectories satisfying a given constraint $\mathcal { C } _ { i }$ , we condition the noise model on a one-hot encoding so that $\begin{array} { r } { \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \pmb { y } ( \tau ) , \bar { k } ) : = \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \mathbb { 1 } ( \tau \in \mathcal { C } _ { i } ) , k ) } \end{array}$ . Although we train with an offline dataset in which trajectories satisfy only one of the available constraints, at inference we can satisfy several constraints together.
126
+
127
+ Composing Skills A skill $i$ can be specified from a set of demonstrations $B _ { i }$ . To generate trajectories that demonstrate a given skill, we condition the noise model on a one-hot encoding so that $\epsilon _ { \theta } ( { \pmb x } _ { k } ( \tau ) , { \pmb y } ( \tau ) , k ) : = \epsilon _ { \theta } ( \bar { { \pmb x } } _ { k } ( \tau ) , \mathbb { 1 } ( \tau \in \mathcal { B } _ { i } ) , k )$ . Although we train with individual skills, we may further compose these skills together during inference.
128
+
129
+ Assuming we have learned the data distributions $q ( { \pmb x } _ { 0 } ( \tau ) | { \pmb y } ^ { 1 } ( \tau ) ) , \dots , q ( { \pmb x } _ { 0 } ( \tau ) | { \pmb y } ^ { n } ( \tau ) )$ for $n$ different conditioning variables, we can sample from the composed data distribution $q ( \pmb { x } _ { 0 } ( \tau ) | \pmb { y } ^ { 1 } ( \tau ) , \dots , \pmb { y } ^ { n } ( \bar { \tau } ) )$ using the perturbed noise (Liu et al., 2022):
130
+
131
+ $$
132
+ \hat { \epsilon } : = \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \emptyset , k ) + \omega \sum _ { i = 1 } ^ { n } ( \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \pmb { y } ^ { i } ( \tau ) , k ) - \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \emptyset , k ) )
133
+ $$
134
+
135
+ This property assumes that $\{ \pmb { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n }$ are conditionally independent given the state trajectory $\pmb { x } _ { 0 } ( \tau )$ . However, we empirically observe that this assumption doesn’t have to be strictly satisfied as long as the composition of conditioning variables is feasible. For more detailed discussion, please refer to Appendix D. We use this property to compose more than one constraint or skill together at test-time. We also show how Decision Diffuser can avoid particular constraint or skill (NOT) in Appendix J.
136
+
137
+ # Algorithm 1 Conditional Planning with the Decision Diffuser
138
+
139
+ ![](images/978ee750ffe38aa619ac11373331980f674e6924fad8991ee08cfb832205fc9a.jpg)
140
+ Figure 4: Results Overview. Decision Diffuser performs better than both TD learning (CQL) and Behavorial Cloning (BC) across D4RL locomotion tasks, D4RL Kitchen tasks and Kuka Block Stacking tasks (single constraint) using only a conditional generative modeling objective. For performance metric, we use normalized average returns (Fu et al., 2020) for D4RL tasks (Locomotion and Kitchen) and success rate for Block Stacking.
141
+
142
+ # 3.4 TRAINING THE DECISION DIFFUSER
143
+
144
+ The Decision Diffuser, our conditional generative model for decision-making, is trained in a supervised manner. Given a dataset $\mathcal { D }$ of trajectories, each labeled with the return it achieves, the constraint that it satisfies, or the skill that it demonstrates, we simultaneously train the reverse diffusion process $p _ { \theta }$ , parameterized through the noise model $\epsilon _ { \theta }$ , and the inverse dynamics model $f _ { \phi }$ with the following loss:
145
+
146
+ $\begin{array} { r } { \natural ( \theta , \phi ) : = \mathbb { E } _ { k , \tau \in \mathcal { D } , \beta \sim \mathrm { B e n } ( p ) } [ \| \epsilon - \epsilon _ { \theta } ( { x } _ { k } ( \tau ) , ( 1 - \beta ) y ( \tau ) + \beta \mathcal { O } , k ) \| ^ { 2 } ] + \mathbb { E } _ { ( s , a , s ^ { \prime } ) \in \mathcal { D } } [ \| a - f _ { \phi } ( s , s ^ { \prime } ) \| ^ { 2 } ] } \end{array}$ For each trajectory $\tau$ , we first sample noise $\epsilon \sim \mathcal { N } ( 0 , I )$ and a timestep $k \sim \mathcal { U } \{ 1 , \dots , K \}$ . Then, we construct a noisy array of states ${ \pmb x } _ { k } ( \tau )$ and finally predict the noise as $\hat { \epsilon } _ { \boldsymbol { \theta } } : = \epsilon _ { \boldsymbol { \theta } } ( \pmb { x } _ { k } ( \tau ) , \pmb { y } ( \tau ) , k )$ . Note that with probability $p$ we ignore the conditioning information and the inverse dynamics is trained with individual transitions rather than trajectories.
147
+
148
+ Architecture We parameterize $\epsilon _ { \theta }$ with a temporal U-Net architecture, a neural network consisting of repeated convolutional residual blocks (Janner et al., 2022). This effectively treats a sequence of states ${ \pmb x } _ { k } ( \tau )$ as an image where the height represents the dimension of a single state and the width denotes the length of the trajectory. We encode the conditioning information $\pmb { y } ( \tau )$ as either a scalar or a one-hot vector and project it into a latent variable $z \in \mathbb { R } ^ { h }$ with a multi-layer perceptron (MLP). When $\pmb { y } ( \tau ) = 0$ , we zero out the entries of $z$ . We also parameterize the inverse dynamics $f _ { \phi }$ with an MLP. For implementation details, please refer to the Appendix B.
149
+
150
+ Low-temperature Sampling In the denoising step of Algorithm 1, we compute $\mu _ { k - 1 }$ and $\Sigma _ { k - 1 }$ from a noisy sequence of states and a predicted noise. We find that sampling $x _ { k - 1 } \sim$ $\mathcal { N } ( \mu _ { k - 1 } , \alpha \Sigma _ { k - 1 } )$ where the variance is scaled by $\alpha \in [ 0 , 1 )$ leads to better quality sequences (corresponding to sampling lower temperature samples). For a proper ablation study, please refer to Appendix C.
151
+
152
+ # 4 EXPERIMENTS
153
+
154
+ In this section, we explore the efficacy of the Decision Diffuser on a variety of decision-making tasks (performance illustrated in Figure 4). In particular, we evaluate (1) the ability to recover effective RL policies from offline data, (2) the ability to generate behavior that satisfies multiple sets of constraints, (3) the ability compose multiple different skills together. In addition, we empirically justify use of classifier-free guidance, low-temperature sampling (Appendix C), and inverse dynamics (Appendix F) and test the robustness of Decision Diffuser to stochastic dynamics (Appendix G).
155
+
156
+ # 4.1 OFFLINE REINFORCEMENT LEARNING
157
+
158
+ Setup We first test whether the Decision Diffuser can generate return-maximizing trajectories. To test this, we train a state diffusion process and inverse dynamics model on publicly available
159
+
160
+ D4RL datasets (Fu et al., 2020). We compare with existing offline RL methods, including modelfree algorithms like CQL (Kumar et al., 2020) and IQL (Kostrikov et al., 2022), and model-based algorithms such as trajectory transformer (TT, Janner et al. (2021)) and MoReL (Kidambi et al., 2020). We also compare with sequence-models like the Decision Transformer (DT) (Chen et al. (2021) and diffusion models like Diffuser (Janner et al., 2022).
161
+
162
+ <table><tr><td>Dataset</td><td>Environment</td><td>BC</td><td>CQL</td><td>IQL</td><td>DT</td><td>TT</td><td>MOReL</td><td>Diffuser</td><td>DD</td></tr><tr><td>Med-Expert</td><td>HalfCheetah</td><td>55.2</td><td>91.6</td><td>86.7</td><td>86.8</td><td>95</td><td>53.3</td><td>79.8</td><td>90.6 ±1.3</td></tr><tr><td>Med-Expert</td><td>Hopper</td><td>52.5</td><td>105.4</td><td>91.5</td><td>107.6</td><td>110.0</td><td>108.7</td><td>107.2</td><td>111.8 ±1.8</td></tr><tr><td>Med-Expert</td><td>Walker2d</td><td>107.5</td><td>108.8</td><td>109.6</td><td>108.1</td><td>101.9</td><td>95.6</td><td>108.4</td><td>108.8 ±1.7</td></tr><tr><td>Medium</td><td>HalfCheetah</td><td>42.6</td><td>44.0</td><td>47.4</td><td>42.6</td><td>46.9</td><td>42.1</td><td>44.2</td><td>49.1 ±1.0</td></tr><tr><td>Medium</td><td>Hopper</td><td>52.9</td><td>58.5</td><td>66.3</td><td>67.6</td><td>61.1</td><td>95.4</td><td>58.5</td><td>79.3 ±3.6</td></tr><tr><td>Medium</td><td>Walker2d</td><td>75.3</td><td>72.5</td><td>78.3</td><td>74.0</td><td>79</td><td>77.8</td><td>79.7</td><td>82.5±1.4</td></tr><tr><td>Med-Replay</td><td>HalfCheetah</td><td>36.6</td><td>45.5</td><td>44.2</td><td>36.6</td><td>41.9</td><td>40.2</td><td>42.2</td><td>39.3 ±4.1</td></tr><tr><td>Med-Replay</td><td>Hopper</td><td>18.1</td><td>95</td><td>94.7</td><td>82.7</td><td>91.5</td><td>93.6</td><td>96.8</td><td>100±0.7</td></tr><tr><td>Med-Replay</td><td>Walker2d</td><td>26.0</td><td>77.2</td><td>73.9</td><td>66.6</td><td>82.6</td><td>49.8</td><td>61.2</td><td>75±4.3</td></tr><tr><td colspan="2">Average</td><td>51.9</td><td>77.6</td><td>77</td><td>74.7</td><td>78.9</td><td>72.9</td><td>75.3</td><td>81.8</td></tr><tr><td>Mixed</td><td>Kitchen</td><td>51.5</td><td>52.4</td><td>51</td><td>1</td><td>、</td><td>1</td><td>1</td><td>65 ±2.8</td></tr><tr><td>Partial</td><td>Kitchen</td><td>38</td><td>50.1</td><td>46.3</td><td>-</td><td>-</td><td>=</td><td>=</td><td>57 ±2.5</td></tr><tr><td colspan="2">Average</td><td>44.8</td><td>51.2</td><td>48.7</td><td>-</td><td>1</td><td>-</td><td>-</td><td>61</td></tr></table>
163
+
164
+ Results Across different offline RL tasks, we find that the Decision Diffuser is either competitive or outperforms many offline RL baselines (Table 1). It also outperforms Diffuser and sequence modeling approaches, such as Decision Transformer and Trajectory Transformer. The difference between Decision Diffuser and other methods becomes even more significant on harder D4RL Kitchen tasks which require long-term credit assignment.
165
+
166
+ To convey the importance of classifier-free guidance, we also compare with the baseline CondDiffuser, which diffuses over both state and action sequences as in Diffuser without classifierguidance. In Table 2, we observe that CondDiffuser improves over Diffuser in 2 out of 3 environments. Decision Diffuser further improves over CondDiffuser, performing better across all 3 environments. We conclude that learning the inverse dynamics is a good alternative to diffusing over actions. We further empirically analyze when to use inverse dynamics and when to diffuse over actions in Appendix F. We also compare against CondMLPDiffuser, a policy where the current action is denoised according to a diffusion process conditioned on both the state and return. We see that CondMLPDiffuser performs the worst amongst diffusion models. Till now, we mainly tested on offline RL tasks that have deterministic (or near deterministic) environment dynamics. Hence, we test the robustness of Decision Diffuser to stochastic dynamics and compare it to Diffuser and CQL as we vary the stochasticity in environment dynamics, in Appendix G. Finally, we analyze the runtime characteristics of Decision Diffuser in Appendix E.
167
+
168
+ # 4.2 CONSTRAINT SATISFACTION
169
+
170
+ Setup We next evaluate how well we can generate trajectories that satisfy a set of constraints using the Kuka Block Stacking environment (Janner et al., 2022) visualized in Figure 5. In this domain, there are four blocks which can be stacked as a single tower or rearranged into several towers. A constraint like BlockHeigh $\mathsf { \Lambda } = ( i ) > \mathsf { B l o c k H e i g h t } ( j )$ requires that block $i$ be placed above block $j$ . We train the Decision Diffuser from 10, 000 expert demonstrations each satisfying one of these constraints. We randomize the positions of these blocks and consider two tasks at inference: sampling trajectories that satisfy a single constraint seen before in the dataset or satisfy a group of constraints for which demonstrations were never provided. In the latter, we ask the Decision Diffuser to generate trajectories so BlockHeight $( i ) >$ BlockHeight $( j ) >$ BlockHeight $( k )$ for three of the four blocks $i , j , k$ . For more details, please refer to Appendix H.
171
+
172
+ Results In both the stacking and rearrangement settings, Decision Diffuser satisfies single constraints with greater success rate than Diffuser (Table 3). We also compare with BCQ (Fujimoto et al., 2019) and CQL (Kumar et al., 2020), but they consistently fail to stack or rearrange the blocks leading to a 0.0 success rate. Unlike these baselines, our method can just as effectively satisfy several constraints together according to Equation 9. For a visualization of these generated trajectories, please see the website https://anuragajay.github.io/decision-diffuser/.
173
+
174
+ <table><tr><td>Hopper-*</td><td colspan="4">Diffuser CondDiffuser CondMLPDiffuser Decision Diffuser</td></tr><tr><td>Med-Expert</td><td>107.6</td><td>111.3</td><td>105.6</td><td>111.8 ±1.6</td></tr><tr><td>Medium</td><td>58.5</td><td>66.3</td><td>54.1</td><td>79.3 ±3.6</td></tr><tr><td>Med-Replay</td><td>96.8</td><td>76.5</td><td>66.5</td><td>100 ±0.7</td></tr></table>
175
+
176
+ Table 2: Ablations. Using classifier-free guidance with Diffuser, resulting in CondDiffuser, improves performance in 2 (out of 3) environments. Additionally, using inverse dynamics for action prediction in Decision Diffuser improves performance in all 3 environments. CondMLPDiffuser, that diffuses over current action given the current state and the target return, doesn’t perform as well.
177
+
178
+ <table><tr><td>Environment</td><td>Diffuser</td><td>DD</td></tr><tr><td>Single Constraint - Stacking</td><td>45.6 ±3.1</td><td>58.0 ±3.1</td></tr><tr><td>Single Constraint - Rearrangement</td><td>58.9 ±3.4</td><td>62.7 ±3.1</td></tr><tr><td>Single Constraint Average</td><td>52.3</td><td>60.4</td></tr><tr><td>Multiple Constraints - Stacking</td><td>1</td><td>60.3 ±3.1</td></tr><tr><td>Multiple Constraints - Rearrangement</td><td></td><td>67.2 ±3.1</td></tr><tr><td>Multiple Constraints Average</td><td>1</td><td>63.8</td></tr></table>
179
+
180
+ ![](images/52d2870f8dae13bbc0f1462a3db00c970f194d62fa9583c2df125b201342dd4a.jpg)
181
+ Figure 5: Kuka Block Stacking task.
182
+ Table 3: Block Stacking through Constraint Minimization. Decision Diffuser (DD) improves over Diffuser in terms of the success rate of generating trajectories satisfying a set of block-stacking constraints. It can also flexibly combine multiple constraints during test time. We report the mean success rate and the standard error over 5 random seeds.
183
+
184
+ # 4.3 SKILL COMPOSITION
185
+
186
+ Setup Finally, we look at how to compose different skills together. We consider the Unitree-gorunning environment (Margolis & Agrawal, 2022), where a quadruped robot can be found running with various gaits, like bounding, pacing, and trotting. We explore if it is possible to generate trajectories that transition between these gaits after only training on individual gaits. For each gait, we collect a dataset of 2500 demonstrations on which we train Decision Diffuser.
187
+
188
+ Results During testing, we use the noise model of our reverse diffusion process according to equation 9 to sample trajectories of the quadruped robot with entirely new running behavior. Figure 6 shows a trajectory that begins with bounding but ends with pacing. Appendix I provides additional visualizations of running gaits being composed together. Although it visually appears that trajectories generated with the Decision Diffuser contain more than one gait, we would like to quantify exactly how well different gaits can be composed. To this end, we train a classifier to predict at every time-step or frame in a trajectory the running gait of the quadruped (i.e. bound, pace, or trott). We reuse the demonstrations collected for training the Decision Diffuser to also train this classifier, where our inputs are defined as robot joint states over a fixed period of time (i.e. state sub-sequences of length 10) and the label is the gait demonstrated in this sequence. The complete details of our gait classification procedure can be found in Appendix I.
189
+
190
+ <table><tr><td>Condition</td><td>Trott</td><td>Pace</td><td>Bound</td></tr><tr><td>Only Bound</td><td>0.8</td><td>1.0</td><td>98.2</td></tr><tr><td>Only Pace</td><td>1.4</td><td>97.7</td><td>0.9</td></tr><tr><td>Bound + Pace</td><td>1.4</td><td>38.5</td><td>60.1</td></tr></table>
191
+
192
+ ![](images/8874639fd20e50d9304875bc9a9d40220fd33875e237e4b977f7e557544d6fc5.jpg)
193
+ Figure 7: Classifying Running Gaits. A classifier predicts the running gait of the quadruped at every timestep. On trajectories generated by conditioning on a single skill, like only bounding or pacing, the classifier predicts the respective gait with largest probability. When conditioned on both skills, some timesteps are classified as bounding while others as pacing.
194
+
195
+ We use our running gait classifier in two ways: to evaluate how the behavior of the quadruped changes over the course of a single, generated trajectory and to measure how often each gait emerges over several generated trajectories. In the former, we first sample three trajectories from the Decision Diffuser conditioned either on the bounding gait, the pacing gait, or both. For every trajectory, we separately plot the classification probability of each gait over the length of the sequence. As shown in the plots of Figure 7, the classifier predicts bound and pace respectively to be the most likely running gait in trajectories sampled with this condition. When the trajectory is generated by conditioning on both gaits, the classifier transitions between predicting one gait with largest probability to the other. In fact, there are several instances where the behavior of the quadruped switches between bounding and pacing according to the classifier. This is consistent with the visualizations reported in Figure 6. In the table depicted in Figure 7, we consider 1000 trajectories generated with the Decision Diffuser when conditioned on one or both of the gaits as listed. We record the fraction of time that the quadruped’s running gait was classified as either trott, pace, or bound. It turns out that the classifier identifies the behavior as bounding for $3 8 . 5 \%$ of the time and as pacing for the other $6 0 . 1 \%$ when trajectories are sampled by composing both gaits. This corroborates the fact that the Decision Diffuser can indeed compose running behaviors despite only being trained on individual gaits.
196
+
197
+ ![](images/ae5902e9ec2fa29c05349103c337c534e1a146b5725255f610070875b832cd24.jpg)
198
+ Figure 6: Composing Movement Skills. Decision Diffuser can imitate individual running gaits using expert demonstrations and compose multiple different skills together during test time. The results are best illustrated by videos viewable at https://anuragajay.github.io/decision-diffuser/.
199
+
200
+ # 5 RELATED WORK
201
+
202
+ Diffusion Models Diffusion Models is proficient in learning generative models of image and text data (Saharia et al., 2022; Nichol et al., 2021; Nichol & Dhariwal, 2021). It formulates the data sampling process as an iterative denoising procedure (Sohl-Dickstein et al., 2015; Ho et al., 2020). The denoising procedure can be alternatively interpreted as parameterizing the gradients of the data distribution (Song et al., 2021) optimizing the score matching objective (Hyvarinen ¨ , 2005) and thus as a Energy-Based Model (Du & Mordatch, 2019; Nijkamp et al., 2019; Grathwohl et al., 2020). To generate data samples (eg: images) conditioned on some additional information (eg:text), prior works (Nichol & Dhariwal, 2021) have learned a classifier to facilitate the conditional sampling. More recent works (Ho & Salimans, 2022) have argued to leverage gradients of an implicit classifier, formed by the difference in score functions of a conditional and an unconditional model, to facilitate conditional sampling. The resulting classifier-free guidance has been shown to generate better conditional samples than classifier-based guidance. Recent works have also used diffusion models to imitate human behavior (Pearce et al., 2023) and to parameterize policy in offline RL (Wang et al., 2022). Janner et al. (2022) generate trajectories consisting of states and actions with an unconditional diffusion model, therefore requiring a trained reward function on noisy state-action pairs. At inference, the estimated reward function guides the reverse diffusion process towards samples of high-return trajectories. In contrast, we do not train reward functions or diffusion processes separately, but rather model the trajectories in our dataset with a single, conditional generative model. This ensures that the sampling procedure of the learned diffusion process is the same at inference as it is during training.
203
+
204
+ Reward Conditioned Policies Prior works (Kumar et al., 2019; Schmidhuber, 2019; Emmons et al., 2021; Chen et al., 2021) have studied learning of reward conditioned policies via reward conditioned behavioral cloning. Chen et al. (2021) used a transformer (Vaswani et al., 2017) to model the reward conditioned policies and obtained a performance competitive with offline RL approaches. Emmons et al. (2021) obtained similar performance as Chen et al. (2021) without using a transformer policy but relied on careful capacity tuning of MLP policy. In contrast, Decision Diffuser can also model constraints or skills and their resulting compositions.
205
+
206
+ # 6 DISCUSSION
207
+
208
+ We propose Decision Diffuser, a conditional generative model for sequential decision making. It frames offline sequential decision making as conditional generative modeling and sidesteps the need of reinforcement learning, thereby making the decision making pipeline simpler. By sampling for high returns, it is able to capture the best behaviors in the dataset and outperforms existing offline RL approaches on standard D4RL benchmarks. In addition to returns, it can also be conditioned on constraints or skills and can generate novel behaviors by flexibly combining constraints or composing skills during test time. In this work, we focused on offline sequential decision making, thus circumventing the need for exploration. Using ideas from Zheng et al. (2022), future works could look into online fine-tuning of Decision Diffuser by leveraging entropy of the state-sequence model for exploration. While our work focused on state based environments, it can be extended to image based environments by performing the diffusion in latent space, rather than observation space, as done in Rombach et al. (2022). For a detailed discussion on limitations of Decision Diffuser, please refer to Appendix L.
209
+
210
+ # ACKNOWLEDGEMENTS
211
+
212
+ The authors would like to thank Ofir Nachum, Anthony Simeonov and Richard Li for their helpful feedback on an earlier draft of the work; Jay Whang and Ge Yang for discussions on classifierfree guidance; Gabe Margolis for helping with unitree experiments; Micheal Janner for providing visualization code for Kuka block stacking; and the members of Improbable AI Lab for discussions and helpful feedback. We thank MIT Supercloud and the Lincoln Laboratory Supercomputing Center for providing compute resources. This research was supported by an NSF graduate fellowship, a DARPA Machine Common Sense grant, a MURI grant, an MIT-IBM grant, and ARO W911NF-21-1- 0097.
213
+
214
+ This research was also partly sponsored by the United States Air Force Research Laboratory and the United States Air Force Artificial Intelligence Accelerator and was accomplished under Cooperative Agreement Number FA8750-19- 2-1000. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the United States Air Force or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes, notwithstanding any copyright notation herein.
215
+
216
+ # AUTHOR CONTRIBUTIONS
217
+
218
+ Anurag Ajay conceived the framework of viewing decision-making as conditional diffusion generative modeling, implemented the Decision Diffuser algorithm, ran experiments on Offline RL and Skill Composition, and helped in paper writing.
219
+
220
+ Yilun Du helped in conceiving the framework of viewing decision-making as conditional diffusion generative modeling, ran experiments on Constraint Satisfaction, helped in paper writing and advised Anurag.
221
+
222
+ Abhi Gupta helped in running experiments on Offline RL and Skill Composition, participated in research discussions, and played the leading role in paper writing and making figures.
223
+
224
+ Joshua Tenenbaum participated in research discussions.
225
+
226
+ Tommi Jaakkola participated in research discussions and suggested the experiment of classifying running gaits.
227
+
228
+ Pulkit Agrawal was involved in research discussions, suggested experiments related to dynamic programming, provided feedback on writing, positioning of the work, and overall advising.
229
+
230
+ # REFERENCES
231
+
232
+ Pulkit Agrawal, Ashvin V Nair, Pieter Abbeel, Jitendra Malik, and Sergey Levine. Learning to poke by poking: Experiential learning of intuitive physics. Advances in neural information processing systems, 29, 2016.
233
+
234
+ Anurag Ajay, Aviral Kumar, Pulkit Agrawal, Sergey Levine, and Ofir Nachum. Opal: Offline primitive discovery for accelerating offline reinforcement learning. arXiv preprint arXiv:2010.13611, 2020.
235
+
236
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel Ziegler, Jeffrey Wu, Clemens Winter, Chris Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In Advances in Neural Information Processing Systems, 2020.
237
+
238
+ Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Misha Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. In Advances in Neural Information Processing Systems, 2021.
239
+
240
+ Robert Dadashi, Shideh Rezaeifar, Nino Vieillard, Leonard Hussenot, Olivier Pietquin, and Matthieu ´ Geist. Offline reinforcement learning with pseudometric learning. arXiv preprint arXiv:2103.01948, 2021.
241
+
242
+ Yilun Du and Igor Mordatch. Implicit generation and generalization in energy-based models. In Advances in Neural Information Processing Systems, 2019.
243
+
244
+ Gabriel Dulac-Arnold, Nir Levine, Daniel J Mankowitz, Jerry Li, Cosmin Paduraru, Sven Gowal, and Todd Hester. Challenges of real-world reinforcement learning: definitions, benchmarks and analysis. Machine Learning, 110(9):2419–2468, 2021.
245
+
246
+ Scott Emmons, Benjamin Eysenbach, Ilya Kostrikov, and Sergey Levine. Rvs: What is essential for offline rl via supervised learning? arXiv preprint arXiv:2112.10751, 2021.
247
+
248
+ Justin Fu, Aviral Kumar, Ofir Nachum, George Tucker, and Sergey Levine. D4RL: Datasets for deep data-driven reinforcement learning. arXiv preprint arXiv:2004.07219, 2020.
249
+
250
+ Scott Fujimoto, Herke Hoof, and David Meger. Addressing function approximation error in actorcritic methods. In International conference on machine learning, pp. 1587–1596. PMLR, 2018.
251
+
252
+ Scott Fujimoto, David Meger, and Doina Precup. Off-policy deep reinforcement learning without exploration. In International Conference on Machine Learning, 2019.
253
+
254
+ Dibya Ghosh, Anurag Ajay, Pulkit Agrawal, and Sergey Levine. Offline rl policies should be trained to be adaptive. In International Conference on Machine Learning, pp. 7513–7530. PMLR, 2022.
255
+
256
+ Will Grathwohl, Kuan-Chieh Wang, Joern-Henrik Jacobsen, David Duvenaud, and Richard Zemel. Learning the stein discrepancy for training and evaluating energy-based models without sampling. In International Conference on Machine Learning, 2020.
257
+
258
+ Abhishek Gupta, Russell Mendonca, YuXuan Liu, Pieter Abbeel, and Sergey Levine. Metareinforcement learning of structured exploration strategies. Advances in neural information processing systems, 31, 2018.
259
+
260
+ Tuomas Haarnoja, Aurick Zhou, Pieter Abbeel, and Sergey Levine. Soft actor-critic: Off-policy maximum entropy deep reinforcement learning with a stochastic actor. In International Conference on Machine Learning, 2018.
261
+
262
+ Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. arXiv preprint arXiv:2207.12598, 2022.
263
+
264
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. In Advances in Neural Information Processing Systems, 2020.
265
+
266
+ Aapo Hyvarinen. Estimation of non-normalized statistical models by score matching. ¨ Journal of Machine Learning Research, 2005.
267
+
268
+ Michael Janner, Qiyang Li, and Sergey Levine. Offline reinforcement learning as one big sequence modeling problem. In Advances in Neural Information Processing Systems, 2021.
269
+
270
+ Michael Janner, Yilun Du, Joshua Tenenbaum, and Sergey Levine. Planning with diffusion for flexible behavior synthesis. In International Conference on Machine Learning, 2022.
271
+
272
+ Rahul Kidambi, Aravind Rajeswaran, Praneeth Netrapalli, and Thorsten Joachims. MOReL: Modelbased offline reinforcement learning. In Advances in Neural Information Processing Systems, 2020.
273
+
274
+ Diederik Kingma, Tim Salimans, Ben Poole, and Jonathan Ho. Variational diffusion models. Advances in neural information processing systems, 34:21696–21707, 2021.
275
+
276
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In International Conference on Learning Representations, 2015.
277
+
278
+ Ilya Kostrikov, Jonathan Tompson, Rob Fergus, and Ofir Nachum. Offline reinforcement learning with fisher divergence critic regularization. arXiv preprint arXiv:2103.08050, 2021.
279
+
280
+ Ilya Kostrikov, Ashvin Nair, and Sergey Levine. Offline reinforcement learning with implicit Q-learning. In International Conference on Learning Representations, 2022.
281
+
282
+ Aviral Kumar, Xue Bin Peng, and Sergey Levine. Reward-conditioned policies. arXiv preprint arXiv:1912.13465, 2019.
283
+
284
+ Aviral Kumar, Aurick Zhou, George Tucker, and Sergey Levine. Conservative Q-learning for offline reinforcement learning. In Advances in Neural Information Processing Systems, 2020.
285
+
286
+ Aviral Kumar, Anikait Singh, Stephen Tian, Chelsea Finn, and Sergey Levine. A workflow for offline model-free robotic reinforcement learning. arXiv preprint arXiv:2109.10813, 2021.
287
+
288
+ Sergey Levine, Aviral Kumar, George Tucker, and Justin Fu. Offline reinforcement learning: Tutorial, review, and perspectives on open problems. arXiv preprint arXiv:2005.01643, 2020.
289
+
290
+ Aitor Lewkowycz, Anders Andreassen, David Dohan, Ethan Dyer, Henryk Michalewski, Vinay Ramasesh, Ambrose Slone, Cem Anil, Imanol Schlag, Theo Gutman-Solo, et al. Solving quantitative reasoning problems with language models. arXiv preprint arXiv:2206.14858, 2022.
291
+
292
+ 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.
293
+
294
+ Nan Liu, Shuang Li, Yilun Du, Antonio Torralba, and Joshua B Tenenbaum. Compositional visual generation with composable diffusion models. arXiv preprint arXiv:2206.01714, 2022.
295
+
296
+ Calvin Luo. Understanding diffusion models: A unified perspective. arXiv preprint arXiv:2208.11970, 2022.
297
+
298
+ Gabriel Margolis and Pulkit Agrawal. Walk these ways: Gait-conditioned policies yield diversified quadrupedal agility. In Conference on Robot Learning, 2022.
299
+
300
+ Diganta Misra. Mish: A self regularized non-monotonic neural activation function. In British Machine Vision Conference, 2019.
301
+
302
+ 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.
303
+
304
+ Alexander Quinn Nichol and Prafulla Dhariwal. Improved denoising diffusion probabilistic models. In International Conference on Machine Learning, 2021.
305
+
306
+ Erik Nijkamp, Mitch Hill, Song-Chun Zhu, and Ying Nian Wu. Learning non-convergent nonpersistent short-run MCMC toward energy-based model. In Advances in Neural Information Processing Systems, 2019.
307
+
308
+ Pedro A Ortega, Markus Kunesch, Gregoire Del ´ etang, Tim Genewein, Jordi Grau-Moya, Joel Veness, ´ Jonas Buchli, Jonas Degrave, Bilal Piot, Julien Perolat, et al. Shaking the foundations: delusions in sequence models for interaction and control. arXiv preprint arXiv:2110.10819, 2021.
309
+
310
+ Keiran Paster, Sheila McIlraith, and Jimmy Ba. You can’t count on luck: Why decision transformers fail in stochastic environments. arXiv preprint arXiv:2205.15967, 2022.
311
+
312
+ Deepak Pathak, Parsa Mahmoudieh, Guanghao Luo, Pulkit Agrawal, Dian Chen, Yide Shentu, Evan Shelhamer, Jitendra Malik, Alexei A Efros, and Trevor Darrell. Zero-shot visual imitation. In Proceedings of the IEEE conference on computer vision and pattern recognition workshops, pp. 2050–2053, 2018.
313
+
314
+ Tim Pearce, Tabish Rashid, Anssi Kanervisto, Dave Bignell, Mingfei Sun, Raluca Georgescu, Sergio Valcarcel Macua, Shan Zheng Tan, Ida Momennejad, Katja Hofmann, et al. Imitating human behaviour with diffusion models. arXiv preprint arXiv:2301.10677, 2023.
315
+
316
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
317
+
318
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10684–10695, 2022.
319
+
320
+ Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, et al. Photorealistic text-to-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022.
321
+
322
+ Juergen Schmidhuber. Reinforcement learning upside down: Don’t predict rewards–just map them to actions. arXiv preprint arXiv:1912.02875, 2019.
323
+
324
+ Jascha Sohl-Dickstein, Eric Weiss, Niru Maheswaranathan, and Surya Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In International Conference on Machine Learning, 2015.
325
+
326
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2021.
327
+
328
+ Richard S. Sutton. Learning to predict by the methods of temporal differences. Machine Learning, 1988.
329
+
330
+ Richard S Sutton and Andrew G Barto. Reinforcement learning: An introduction. MIT press, 2018.
331
+
332
+ Russ Tedrake. Underactuated Robotics. 2022. URL http://underactuated.mit.edu.
333
+
334
+ Hado Van Hasselt, Yotam Doron, Florian Strub, Matteo Hessel, Nicolas Sonnerat, and Joseph Modayil. Deep reinforcement learning and the deadly triad. arXiv preprint arXiv:1812.02648, 2018.
335
+
336
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, 2017.
337
+
338
+ Adam R Villaflor, Zhe Huang, Swapnil Pande, John M Dolan, and Jeff Schneider. Addressing optimism bias in sequence modeling for reinforcement learning. In International Conference on Machine Learning, pp. 22270–22283. PMLR, 2022.
339
+
340
+ Homer Walke, Jonathan Yang, Albert Yu, Aviral Kumar, Jedrzej Orbik, Avi Singh, and Sergey Levine. Don’t start from scratch: Leveraging prior data to automate robotic reinforcement learning. arXiv preprint arXiv:2207.04703, 2022.
341
+
342
+ Zhendong Wang, Jonathan J Hunt, and Mingyuan Zhou. Diffusion policies as an expressive policy class for offline reinforcement learning. arXiv preprint arXiv:2208.06193, 2022.
343
+
344
+ Yifan Wu, George Tucker, and Ofir Nachum. Behavior regularized offline reinforcement learning. arXiv preprint arXiv:1911.11361, 2019.
345
+
346
+ Yuxin Wu and Kaiming He. Group normalization. In European Conference on Computer Vision, 2018.
347
+
348
+ Mengjiao Yang, Dale Schuurmans, Pieter Abbeel, and Ofir Nachum. Dichotomy of control: Separating what you can control from what you cannot. arXiv preprint arXiv:2210.13435, 2022.
349
+
350
+ Hongyi Zhang, Moustapha Cisse, Yann N Dauphin, and David Lopez-Paz. mixup: Beyond empirical risk minimization. arXiv preprint arXiv:1710.09412, 2017.
351
+
352
+ Qinqing Zheng, Amy Zhang, and Aditya Grover. Online decision transformer. arXiv preprint arXiv:2202.05607, 2022.
353
+
354
+ # Appendix
355
+
356
+ In this appendix, we discuss details of the illustrative examples in Section A. Next, we discuss hyperparameters and architectural details in Section B. We analyze the importance of low temperature sampling in Section C, further explain composition of conditioning variable in Section D, discuss the run-time characteristics of decision diffuser in Section E, discuss when to use inverse dynamics in Section F and analyze robustness of Decision Diffuser to stochastic dynamics in Section G. Finally, we provide details of the Kuka Block Stacking environment in Section H and the Unitree environment in Section I.
357
+
358
+ # A ILLUSTRATIVE EXAMPLES
359
+
360
+ # A.1 IMPLICIT DYNAMIC PROGRAMMING
361
+
362
+ ![](images/06c49faf819f369ba151ad9d3ff002a905c14d4f9d446bec58e52f70a39c1d4b.jpg)
363
+ Figure A1: Illustrative example. We demonstrate the ability of Decision Diffuser to stitch together suboptimal trajectories in training dataset to obtain (near) optimal trajectories, thereby implicitly performing dynamic programming in Maze2D-open environment from Fu et al. (2020).
364
+
365
+ We empirically demonstrate the ability of Decision Diffuser to perform implicit dynamic programming in Maze2D-open environment from Fu et al. (2020). The task in Maze2D-open environment is to reach point C and the reward is negative distance from point C. The training dataset consists of 500 trajectories from point A to point B and 500 trajectories from point B to point C. The maximum trajectory length is 50. During test time, the agent starts from point A and needs to reach point C as quickly as possible. As shown in Figure A1, Decision Diffuser can stitch trajectories in training dataset to form trajectories that goes from point A to point B in (near) straight lines.
366
+
367
+ # A.2 CONSTRAINT COMBINATION
368
+
369
+ Setup In linear system robot navigation, Decision Diffuser is trained on 1000 expert trajectories either satisfying the constraint $\lVert s _ { T } \rVert \leq R$ $R = 1$ ) or the constraint $\| s _ { T } \| \geq r$ $\mathit { r } = 0 . 7$ ). Here, $s _ { T } = [ x _ { T } , y _ { T } ]$ represents the final robot state in a trajectory, specifying its final 2d position. The maximum trajectory length is 50. During test time, Decision Diffuser is asked to generate trajectories satisfying $\| s _ { T } \| \le R$ and $\| s _ { T } \| \geq r$ to test its ability to satisfy single constraints. Furthermore, Decision Diffuser is also asked to generate trajectories satisfying $r \leq \left\lceil | s _ { T } | | \leq R \right\rceil$ to test its ability to satisfy combined constraints.
370
+
371
+ Results Figure 2 shows that Decision Diffuser learns to generate trajectories perfectly (i.e. with $1 0 0 \%$ success rate) satisfying single constraints in linear system robot navigation. Furthermore, it learns to generate trajectories satisfying the composed constraint in linear system robot navigation with $9 1 . 3 \hat { \% } ( \pm 2 . 6 \% )$ accuracy where the standard error is calculated over 5 random seeds.
372
+
373
+ # B HYPERPARAMETER AND ARCHITECTURAL DETAILS
374
+
375
+ In this section, we describe various architectural and hyperparameter details:
376
+
377
+ • We represent the noise model $\epsilon _ { \theta }$ with a temporal U-Net (Janner et al., 2022), consisting of a U-Net structure with 6 repeated residual blocks. Each block consisted of two temporal convolutions, each followed by group norm (Wu & He, 2018), and a final Mish nonlinearity (Misra, 2019). Timestep and condition embeddings, both 128-dimensional vectors, are produced by separate 2-layered MLP (with 256 hidden units and Mish nonlinearity) and are concatenated together before getting added to the activations of the first temporal convolution within each block. We borrow the code for temporal U-Net from https://github.com/jannerm/diffuser.
378
+
379
+ • We represent the inverse dynamics $f _ { \phi }$ with a 2-layered MLP with 512 hidden units and ReLU activations.
380
+
381
+ • We represent the gait classifier with a 3-layered MLP with 1024 hidden units and ReLU activations.
382
+
383
+ • We train $\epsilon _ { \theta }$ and $f _ { \phi }$ using the Adam optimizer (Kingma & Ba, 2015) with a learning rate of $2 e - 4$ and batch size of 32 for 2e6 train steps.
384
+
385
+ • We train the gait classifier using the Adam optimizer with a learning rate of $2 e - 4$ and batch size of 64 for 1e6 train steps.
386
+
387
+ • We choose the probability $p$ of removing the conditioning information to be 0.25.
388
+
389
+ • We use $K = 1 0 0$ diffusion steps.
390
+
391
+ • We use a planning horizon $H$ of 100 in all the D4RL locomotion tasks, 56 in D4RL kitchen tasks, 128 in Kuka block stacking, 56 in unitree-go-running tasks, 50 in the illustrative example and 60 in Block push tasks.
392
+
393
+ • We use a guidance scale $s \in \{ 1 . 2 , 1 . 4 , 1 . 6 , 1 . 8 \}$ but the exact choice varies by task.
394
+
395
+ • We choose $\alpha = 0 . 5$ for low temperature sampling.
396
+
397
+ • We choose context length $C = 2 0$
398
+
399
+ # C IMPORTANCE OF LOW TEMPERATURE SAMPLING
400
+
401
+ In Algorithm 1, we compute $\mu _ { k - 1 }$ and $\Sigma _ { k - 1 }$ from a noisy sequence of states and predicted noise. We find that sampling $x _ { k - 1 } \sim { \mathcal { N } } ( \mu _ { k - 1 } , \alpha \Sigma _ { k - 1 } )$ (where $\alpha \in [ 0 , 1 )$ ) with a reduced variance produces high-likelihood state sequences. We refer to this as low-temperature sampling. To empirically show its importance, we compare performances of Decision Diffuser with different values of $\alpha$ (Table A1). We show that low temperature sampling ( $\alpha = 0 . 5$ ) gives the best average returns. However, reducing the $\alpha$ to 0 eliminates the entropy in sampling and leads to lower returns. On the other hand, $\alpha = 1 . 0$ leads to a higher variance in terms of returns of the trajectories.
402
+
403
+ <table><tr><td>Decision Diffuser</td><td>Hopper-Medium-Expert</td></tr><tr><td>α=0</td><td>104.3 ± 0.7</td></tr><tr><td>α= 0.5</td><td>111.8 ±1.6</td></tr><tr><td>α= 1.0</td><td>107.1 ± 3.5</td></tr></table>
404
+
405
+ Table A1: Low-temperature sampling $( \alpha = 0 . 5 )$ ) allows us to get high return trajectories consistently. While $\alpha = 1 . 0$ leads to a higher variance in returns of the trajectories, $\alpha = 0 . 0$ eliminates entropy in the sampling and leads to lower returns.
406
+
407
+ # D COMPOSING CONDITIONING VARIABLES
408
+
409
+ In this section, we detail how Decision Diffuser trained with different conditioning variables $\{ \pmb { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n }$ composes these conditioning variables together. It learns the denoising model $\epsilon _ { \theta } ( { \pmb x } _ { k } ( \tau ) , { \pmb y } ^ { i } ( \tau ) , k )$ for a given conditioning variable $\mathbf { \dot { \mathbf { y } } } ^ { i } ( \tau )$ . From the derivations outlined in prior works (Luo, 2022; Song et al., 2021), we know that $\nabla _ { \pmb { x } _ { k } ( \tau ) } \log q ( \pmb { x } _ { k } ( \tau ) | \pmb { y } ^ { i } ( \tau ) ) \propto$ $- \epsilon _ { \theta } ( { \pmb x } _ { k } ( \tau ) , { \pmb y } ^ { i } ( \tau ) , k )$ . Therefore, each conditional trajectory distribution $\{ q ( \pmb { x } _ { k } ( \tau ) | \pmb { y } ^ { i } ( \tau ) ) \} _ { i = 1 } ^ { n }$ can be modelled with a single denoising model $\epsilon _ { \theta }$ that conditions on the respective variable $y ^ { i } ( \tau )$ .
410
+
411
+ In order to compose $n$ different conditioning variables (i.e. skills or constraints), we would like to model $q ( \pmb { x } _ { k } ( \hat { \tau } ) | \{ \pmb { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n } )$ . We assume that $\{ y ^ { i } ( \tau ) \} _ { i = 1 } ^ { n }$ are conditionally independent given
412
+
413
+ ${ \pmb x } _ { k } ( \tau )$ . Thus, we can factorize as follows:
414
+
415
+ $$
416
+ \begin{array} { r l } { \displaystyle q ( \mathbf { x } _ { k } ( \tau ) | \{ \boldsymbol { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n } ) \propto q ( \mathbf { x } _ { k } ( \tau ) ) \displaystyle \prod _ { i = 1 } ^ { n } \frac { q ( \alpha _ { k } ( \tau ) | \boldsymbol { y } ^ { i } ( \tau ) ) } { q ( \alpha _ { k } ( \tau ) ) } } & { ( \mathrm { B a y e s ~ R u l e } ) } \\ { \displaystyle \Rightarrow \log q ( \alpha _ { k } ( \tau ) | \{ \boldsymbol { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n } ) \propto \log q ( \alpha _ { k } ( \tau ) ) + \displaystyle \sum _ { i = 1 } ^ { n } ( \log q ( \alpha _ { k } ( \tau ) | \boldsymbol { y } ^ { i } ( \tau ) ) - \log q ( \alpha _ { k } ( \tau ) ) ) } \\ { \displaystyle \Rightarrow \nabla _ { \mathbf { x } _ { k } ( \tau ) } \log q ( x _ { k } ( \tau ) | \{ \boldsymbol { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n } ) = \nabla _ { \mathbf { x } _ { k } ( \tau ) } \log q ( \alpha _ { k } ( \tau ) ) } \\ & { \displaystyle + \sum _ { i = 1 } ^ { n } ( \nabla _ { \mathbf { x } _ { k } ( \tau ) } \log q ( \alpha _ { k } ( \tau ) ) y ^ { i } ( \tau ) ) - \nabla _ { \mathbf { x } _ { k } ( \tau ) } \log q ( \alpha _ { k } ( \tau ) ) ) } \\ { \displaystyle \Rightarrow \epsilon _ { \theta } ( \alpha _ { k } ( \tau ) , \{ \boldsymbol { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n } , k ) = \epsilon _ { \theta } ( \alpha _ { k } ( \tau ) , \boldsymbol { \mathcal { O } } , k ) + \displaystyle \sum _ { i = 1 } ^ { n } ( \epsilon _ { \theta } ( \alpha _ { k } ( \tau ) , \boldsymbol { y } ^ { i } ( \tau ) , k ) - \epsilon _ { \theta } ( x _ { k } ( \tau ) , \boldsymbol { \mathcal { O } } , k ) ) } \end{array}
417
+ $$
418
+
419
+ Using the above equations, we can sample from $q ( \pmb { x } _ { 0 } ( \tau ) | \{ \pmb { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n } )$ with classifier free guidance using the perturbed noise:
420
+
421
+ $$
422
+ \begin{array} { r l } & { \hat { \boldsymbol { \epsilon } } : = \boldsymbol { \epsilon } _ { \boldsymbol { \theta } } ( \mathbf { x } _ { k } ( \tau ) , \mathcal { O } , \boldsymbol { k } ) + \omega ( \epsilon _ { \boldsymbol { \theta } } ( \mathbf { x } _ { k } ( \tau ) , \{ \boldsymbol { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n } , \boldsymbol { k } ) - \epsilon _ { \boldsymbol { \theta } } ( \mathbf { x } _ { k } ( \tau ) , \mathcal { O } , \boldsymbol { k } ) ) } \\ & { \quad = \epsilon _ { \boldsymbol { \theta } } ( \mathbf { x } _ { k } ( \tau ) , \mathcal { O } , \boldsymbol { k } ) + \omega \displaystyle \sum _ { i = 1 } ^ { n } ( \epsilon _ { \boldsymbol { \theta } } ( \mathbf { x } _ { k } ( \tau ) , \boldsymbol { y } ^ { i } ( \tau ) , \boldsymbol { k } ) - \epsilon _ { \boldsymbol { \theta } } ( \mathbf { x } _ { k } ( \tau ) , \mathcal { O } , \boldsymbol { k } ) ) } \end{array}
423
+ $$
424
+
425
+ We use the perturbed noise to compose skills or combine constraints at test time. This derivation was borrowed from Liu et al. (2022) and is presented here for completeness.
426
+
427
+ While the composition of conditioning variables $\{ \pmb { y } ^ { i } ( \tau ) \} _ { i = 1 } ^ { n }$ requires them to be conditionally independent given the state trajectory $\pmb { x } _ { 0 } ( \tau )$ , we empirically observe that this condition doesn’t have to be strictly satisfied. However, we require composition of conditioning variables to be feasible (i.e. $\exists x _ { 0 } ( \tau )$ that satisfies all the conditioning variables). When the composition is infeasible, Decision Diffuser produces trajectories with incoherent behavior, as expected. This is best illustrated by videos viewable at https://anuragajay.github.io/decision-diffuser/.
428
+
429
+ Requirements on the dataset First, the dataset should have a diverse set of demonstrations that shows different ways of satisfying each conditioning variable $y ^ { i } ( \tau )$ . This would allow Decision Diffuser to learn diverse ways of satisfying each conditioning variable $y ^ { i } ( \tau )$ . Since we use inverse dynamics to extract actions from the predicted state trajectory $\pmb { x } _ { 0 } ( \tau )$ , we assume that the state trajectory ${ \pmb x } _ { 0 } ( \tau )$ resulting from the composition of different conditioning variables contains consecutive state pairs $\left( { { s _ { t } } , { s _ { t + 1 } } } \right)$ that come from the same distribution that generated the demonstration dataset. Otherwise, inverse dynamics can give erroneous predictions.
430
+
431
+ # E RUNTIME CHARACTERISTIC OF DECISION DIFFUSER
432
+
433
+ We analyze the runtime characteristics of Decision Diffuser in this section. After training the Decision Diffuser on trajectories from the D4RL Hopper-Medium-Expert dataset, we plan in the corresponding environment according to Algorithm 1. Every action taken in the environment requires running 100 reverse diffusion steps to generate a state sequence taking on average 1.26s in wall-clock time. We can improve the run-time of planning by warm-starting the state diffusion as suggested in Janner et al. (2022). Here, we start with a generated state sequence (from the previous environment step), run forward diffusion for a fixed number of steps, and finally run the same number of reverse diffusion steps from the partially noised state sequence to generate another state sequence. Warm-starting in this way allows us to decrease the number of denoising steps to 40 (0.48s on average) without any loss in performance, to 20 (0.21s on average) with minimal loss in performance, and to 5 with less than $2 0 \%$ loss in performance (0.06s on average). We demonstrate the trade-off between performance, measured by normalized average return achieved in the environment, and planning time, measured in wall-clock time after warm-starting the reverse diffusion process, in Figure A2.
434
+
435
+ ![](images/582a316558824d8218903d31c84d2ea265682dcdd6126b4d53b0d942b675b615.jpg)
436
+ Figure A2: Performance vs planning time. We visualize the trade-off between performance, measured by normalized average return achieved in the environment, and planning time, measured in wall-clock time after warm-starting the reverse diffusion process.
437
+
438
+ <table><tr><td>Environment</td><td>BC</td><td>CondDiffuser</td><td>Decision Diffuser</td></tr><tr><td>Position Control</td><td>57.3 ±1.2</td><td>87.3 ±3.1</td><td>87.8 ±2.8</td></tr><tr><td>Torque Control</td><td>55.2 ±1.5</td><td>71.8 ±3.4</td><td>84.7 ±2.2</td></tr></table>
439
+
440
+ ![](images/b7e5f34bba8b05d1a3659b787a4b3d2616878cdfbc9e2f790df9d0e668b1b9ef.jpg)
441
+ Figure A3: Block push environment.
442
+
443
+ Table A2: Block pushing with different controls. Decision Diffuser and CondDiffuser perform similarly when the agent uses position control. However, when the agent uses torque control, CondDiffuser performs worse than Decision Diffuser given it’s harder to diffuse over non-smooth action trajectories. We use the success rate of the red cube reaching the green circle as the performance metric. We report the mean success rate and the standard error over 5 random seeds.
444
+
445
+ # F WHEN TO USE INVERSE DYNAMICS?
446
+
447
+ In this section, we try to analyze further when using inverse dynamics is better than diffusing over actions. Table 2 showed that Decision Diffuser outperformed CondDiffuser on 3 hopper environment, thereby suggesting that inverse dynamics is a better alternative to diffusing over actions. Our intuition was that sequences over actions, represented as joint torques in our environments, tend to be more high-frequency and less smooth, thus making it harder for the diffusion model to predict (Kingma et al., 2021). We now try to verify this intuition empirically.
448
+
449
+ Setup We choose Block Push environment adapted from Gupta et al. (2018) where the goal is to push the red cube to the green circle. When the red cube reaches the green circle, the agent gets a reward of $+ 1$ . The state space is 10-dimensional consisting of joint angles (3) and velocities (3) of the gripper, COM of the gripper (2) and position of the red cube (2). The green circle’s position is fixed and at an initial distance of 0.5 from COM of the gripper. The red cube (of size 0.03) is initially at a distance of 0.1 from COM of the gripper and at an angle $\theta$ sampled from $\mathcal { U } ( - \pi / 4 , \pi / 4 )$ at the start of every episode. The task horizon is 60 timesteps.
450
+
451
+ There are 2 control types: (i) torque control, where the agent needs to specify joint torques (3 dimensional) and (ii) position control where the agent needs to specify the position change of COM of the gripper and the angular change in gripper’s orientation $( \Delta x , \Delta y , \Delta \phi )$ (3 dimensional). While action trajectories from position control are smooth, the action trajectories from torque control have higher frequency components.
452
+
453
+ Offline dataset collection To collect the offline data, we use Soft Actor-Critic (SAC) (Haarnoja et al., 2018) first to train an expert policy for 1 million environment steps. We then use 1 million environment transitions as our offline dataset, which contains expert trajectories collected towards the end of the training and random action trajectories collected at the beginning of the training. We collect 2 datasets, one for each control type.
454
+
455
+ Results Table A2 shows that Decision Diffuser and CondDiffuser perform similarly when the agent uses position control. This is because action trajectories resulting from position control are smoother and hence easier to model with diffusion. However, when the agent uses torque control, CondDiffuser performs worse than Decision Diffuser, given the action trajectories have higher frequency components and hence are harder to model with diffusion.
456
+
457
+ # G ROBUSTNESS TO STOCHASTIC DYNAMICS
458
+
459
+ <table><tr><td>p</td><td>BC</td><td>Decision Diffuser</td><td>Diffuser</td><td>CQL</td></tr><tr><td>0.00</td><td>55.2±1.5</td><td>84.7±2.2</td><td>72.4±1.4</td><td>73.2±2.3</td></tr><tr><td>0.05</td><td>49.3±3.6</td><td>77.3±3.1</td><td>63.2±2.9</td><td>61.8±3.7</td></tr><tr><td>0.10</td><td>25.8±3.8</td><td>53.2±4.1</td><td>52.3±4.6</td><td>51.2±4.3</td></tr><tr><td>0.15</td><td>15.1±4.3</td><td>41.3±4.9</td><td>41.6±5.1</td><td>42.2±5.5</td></tr></table>
460
+
461
+ Table A3: Robustness to stochastic dynamics. Decision Diffuser’s performance suffers when stochasticity is introduced in dynamics function. While it still outperforms Diffuser and CQL when $p = 0 . 0 5$ , its performance becomes similar to that of Diffuser and CQL for higher $p$ values. We use the success rate of the red cube reaching the green circle as the performance metric. We report the mean success rate and the standard error over 5 random seeds.
462
+
463
+ We empirically analyze robustness of Decision Diffuser to stochasticity in dynamics function.
464
+
465
+ Setup We use Block Push environment, described in Appendix F, with torque control. However, we inject stochasticity into the environment dynamics. For every environment step, we either sample a random action from $\mathcal { U } ( [ - 1 , - 1 , - 1 ] , [ 1 , 1 , \dot { 1 } ] )$ with probability $p$ or execute the action given by the policy with probability $( 1 - p )$ . We use $p \in \{ 0 , 0 . 0 5 , 0 . 1 , 0 . 1 5 \}$ in our experiments.
466
+
467
+ Offline dataset collection We collect separate offline datasets for different block push environments, each characterized by a different value of $p$ . Each offline dataset consists of 1 million environment transitions collected using the method described in Appendix F.
468
+
469
+ Results Table A3 characterizes how the performance of BC, Decision Diffuser, Diffuser, and CQL changes with increasing stochasticity in the environment dynamics. We observe that the Decision Diffuser outperforms Diffuser and CQL for $p = 0 . 0 5$ , however all methods including the Decision Diffuser settle to a similar performance for larger values of $p$ .
470
+
471
+ Several works (Paster et al., 2022; Yang et al., 2022) have shown that the performance of returnconditioned policies suffers as the stochasticity in environment dynamics increases. This is because the return-conditioned policies aren’t able to distinguish between high returns from good actions and high returns from environment stochasticity. Hence, these return-conditioned policies can learn sub-optimal actions that got associated with high-return trajectories in the dataset due to environment stochasticity. Given Decision diffuser uses return conditioning to generate actions in offline RL, its performance also suffers when stochasticity in environment dynamics increases.
472
+
473
+ Some recent works (Yang et al., 2022; Villaflor et al., 2022) address the above issue by learning a latent model for future states and then conditioning the policy on predicted latent future states rather than returns. Conditioning Decision Diffuser on future state information, rather than returns, would make it more robust to stochastic dynamics and could be an interesting avenue for future works.
474
+
475
+ # H KUKA BLOCK STACKING
476
+
477
+ In the Kuka blocking stacking environment, the underlying goal is to stack a set of blocks on top of each other. Models have trained on a set of demonstration data, where a set of 4 blocks are sequentially stacked on top of each other to form a block tower.
478
+
479
+ We construct state-space plans of length 128. Following (Janner et al., 2022), we utilize a close-loop controller to generate actions for each state in our state-space plan (controlling the 7 degrees of freedom in joints). The total maximum trajectory length plan in Kuka block stacking is 384. We detail differences between the two consider conditional stacking environments below:
480
+
481
+ • Stacking In the stacking environment, at test time we wish to again construct a tower of four blocks.
482
+
483
+ • Rearrangement In the rearrangement environment, at test time wish to stack blocks in a configuration where a set of blocks are above a second set. This set of stack-place relations may not precisely correspond to a single block tower (can instead construct two block towers), making this environment an out-of-distribution challenge.
484
+
485
+ In addition to Diffuser (Janner et al., 2022), we used goal-conditioned variants of CQL (Kumar et al., 2020) and BCQ (Fujimoto et al., 2019) as baselines for the block stacking and rearrangement with single constraint. However, they get a success rate of 0.0.
486
+
487
+ # I UNITREE GO RUNNING
488
+
489
+ We consider Unitree-go-running environment (Margolis & Agrawal, 2022) where a quadruped robot runs in 3 different gaits: bounding, pacing, and trotting. The state space is 56 dimensional, the action space is 12 dimensional, and the maximum trajectory length is 250.
490
+
491
+ As described in Section 4.3, we train Decision Diffuser on expert trajectories demonstrating individual gaits. During testing, we compose the noise model of our reverse diffusion process according to equation 9. This allows us to sample trajectories of the quadruped robot with entirely new running behavior. Figures A4,A5,A6 shows the ability of Decision Diffuser to imitate bounding, trotting and pacing and their combinations.
492
+
493
+ # I.1 QUANTITATIVE VERIFICATION OF COMPOSITION
494
+
495
+ We now try to quantitatively verify whether the trajectories resulting from composition of 2 gaits does indeed contain only those 2 gaits.
496
+
497
+ Setup We learn a gait classifier that takes in a sub-sequence of states (of length 10) and predicts the gait-ID. It is represented by a 3-layered MLP with 1024 hidden units and ReLU activations that concatenates the sub-sequence of states (of length 10) into a single vector of dimension 560 before taking it in as an input. We train the gait classifier on the demonstration dataset. To ensure that the learned classifier can predict gait-ID on trajectories generated by the composition of skills, we use MixUp-style (Zhang et al., 2017) data augmentation during training. We create a synthetic subsequence of length 10 by concatenating two sampled sub-sequence (from the demonstration dataset) of length $l _ { i }$ and $l _ { j }$ (where $l _ { i } + l _ { j } = 1 0$ ) from gaits with $\operatorname { I D } i$ and $j$ and give it a label $\frac { l _ { i } } { l _ { i } + l _ { j } }$ one-ho $( i ) +$ $\frac { l _ { j } } { l _ { i } + l _ { j } }$ one-hot $( j )$ . During training, we sample a sub-sequence from the demonstration dataset with $7 0 \%$ probability and a sythenthic sub-sequence with $3 0 \%$ probability. We train the classifier for $2 e 6$ train steps with a learning rate of $2 e - 4$ and a batch size of 64.
498
+
499
+ Results Figures A4,A5,A6 show that the classifier’s prediction is consistent with the visualized composed trajectories. Furthermore, we use Decision diffuser to act in the environment and generate 1000 trott trajectories, 1000 pace trajectories, 1000 bound trajectories, and 1000 composed trajectories for each possible pair of individual gaits. We then evaluate the learned gait classifier on these trajectories and compute the percentage of timesteps a particular gait has the highest probability. From Figures A4,A5,A6, we can see that if trajectories are generated by the composition of two gaits, then those two gaits will have the two highest probabilities across different timesteps in those trajectories.
500
+
501
+ # I.2 A SIMPLE BASELINE FOR COMPOSITION
502
+
503
+ Let one-hot $( i )$ and one- $\cdot \mathrm { h o t } ( j )$ represent two different gaits that can be generated using noise models $\epsilon _ { \theta } ( { \pmb x } _ { k } ( \tau ) , \mathrm { o n e - h o t } ( i ) , k )$ and $\begin{array} { r } { \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \mathrm { o n e - h o t } ( j ) , k ) } \end{array}$ respectively. To compose these gaits, we compose the above-mentioned noise models using equation 9. As an alternative, we see if the noise model $\epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \mathrm { o n e - h o t } ( i ) + \mathrm { o n e - h o t } ( j ) , k )$ can lead to composed gaits. However, we observe that $\epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau )$ , one- $\mathbf { \cdot h o t } ( i ) + \mathbf { o n e - h o t } ( j ) , k )$ catastrophically fail to generate any gait (see videos at https://anuragajay.github.io/decision-diffuser/). This happens because the condition variable one- $\mathsf { 1 o t } ( i ) + \mathsf { o n e { \mathrm { - } } h o t } ( j )$ was never seen by the noise model $\epsilon _ { \theta }$ during training.
504
+
505
+ ![](images/c6eca9326f1240e24c5bc046689af995227c5ce856ee5e3438368121d3c1e16c.jpg)
506
+ Figure A4: Composing Trott and Pace. Decision Diffuser can imitate individual running gaits using expert demonstrations and compose multiple different skills together during test time. The results are best illustrated by videos viewable at https://anuragajay.github.io/decision-diffuser/.
507
+
508
+ ![](images/718ee11d8a554aad4ad0463dc91824091eb322e60b29c2deeafd23463aa4b13e.jpg)
509
+ Figure A5: Composing Trott and Bound. Decision Diffuser can imitate individual running gaits using expert demonstrations and compose multiple different skills together during test time. The results are best illustrated by videos viewable at https://anuragajay.github.io/decision-diffuser/.
510
+
511
+ # J NOT COMPOSITIONS WITH DECISION DIFFUSER
512
+
513
+ Decision diffuser can also support ”NOT” composition. Suppose we wanted to sample from $q ( \pmb { x } _ { 0 } ( \tau ) | \mathrm { N O T } \ y ^ { j } ( \tau ) )$ . Let $\{ y ^ { i } ( \tau ) \} _ { i = 1 } ^ { n }$ be the set of all conditioning variables. Then, following derivations from Liu et al. (2022) and using $\beta = 1$ , we can sample from $q ( \pmb { x } _ { 0 } ( \tau ) | \mathrm { N O T } \ y ^ { j } ( \tau ) )$ using the perturbed noise:
514
+
515
+ $$
516
+ \begin{array} { l } { \hat { \epsilon } : = \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \emptyset , k ) + \omega ( \displaystyle \sum _ { i \neq j } ( \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \pmb { y } ^ { i } ( \tau ) , k ) - \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \emptyset , k ) ) } \\ { - \left( \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \pmb { y } ^ { j } ( \tau ) , k ) - \epsilon _ { \theta } ( \pmb { x } _ { k } ( \tau ) , \emptyset , k ) ) \right) } \end{array}
517
+ $$
518
+
519
+ We demonstrate the ability of Decision Diffuser to support ”NOT” composition by using it to satisfy constraint of type BlockHeight $( i ) >$ BlockHeight $( j )$ AND (NOT BlockHeight $. ( j ) ~ >$ BlockHeight $( i )$ ) in Kuka block stacking task, as visualized in videos at https://anuragajay.github.io/decision-diffuser/. As the Decision Diffuser does not provide an explicit density estimate for each skill, it can’t natively support OR composition.
520
+
521
+ ![](images/79557db21666a3824496a144965288975b56e26dcafa64a8c6e3a89d15f4a7a3.jpg)
522
+ Figure A6: Composing Bound and Pace. Decision Diffuser can imitate individual running gaits using expert demonstrations and compose multiple different skills together during test time. The results are best illustrated by videos viewable at https://anuragajay.github.io/decision-diffuser/.
523
+
524
+ # K COMPARING Q-FUNCTION GUIDED DIFFUSION AND CLASSIFIER-FREE GUIDED DIFFUSION
525
+
526
+ Classifier-free guided diffusion and Q-value guided diffusion are theoretically equivalent. However, as noted in several works (Nichol et al., 2021; Ho & Salimans, 2022; Saharia et al., 2022), classifier-free guidance performs better than classifier guidance (i.e. Q function guidance in our case) in practice. This is due to following reasons:
527
+
528
+ • Classifier-guided diffusion models learns an unconditional diffusion model along with a classifier (Q-function in our case) and uses gradients from the classifier to perform conditional sampling. However, the unconditional diffusion model doesn’t need to focus on conditional modeling during training and only cares about conditional generation during testing after it has been trained. In contrast, classifier-free guidance relies on conditional diffusion model to estimate gradients of the implicit classifier. Since the conditional diffusion model, learned when using classifier-free guidance, focuses on conditional modeling during train time, it performs better in conditional generation during test time. Q function trained on an offline dataset can erroneously predict high Q values for out-ofdistribution actions given any state. This problem has been extensively studied in offline RL literature (Kumar et al., 2020; Fujimoto et al., 2019; Levine et al., 2020). In online RL, this issue is automatically corrected when the policy acts in the environment, thinking an action to be good but then receives a low reward for it. In offline RL, this issue can’t be corrected easily; hence, the learned Q-function can often guide the diffusion model towards out-of-distribution actions that might be sub-optimal. In contrast, classifier-free guidance circumvents the issue of learning a Q-function and directly conditions the diffusion model on returns. Hence, classifier-free guidance doesn’t suffer due to errors in learned Q-functions and hence performs better than Q-function guided diffusion.
529
+
530
+ # L LIMITATIONS OF DECISION DIFFUSER
531
+
532
+ We summarize the limitations of Decision Diffuser:
533
+
534
+ • No partial observability Decision Diffuser works with fully observable MDPs. Naive extensions to partially observed MDPs (POMDPs) may cause self-delusions (Ortega et al., 2021) in Decision Diffuser. Hence, extending Decision Diffuser to POMDPs could be an exciting avenue for future work.
535
+
536
+ • Inability to explore the environment and update itself in online setting In this work, we focused on offline sequential decision making, thus circumventing the need for exploration. Using ideas from Zheng et al. (2022), future works could look into online fine-tuning of Decision Diffuser by leveraging entropy of the state-sequence model for exploration.
537
+
538
+ • Experiments on only state-based environments While our work focused on state based environments, it can be extended to image based environments by performing the diffusion in latent space, rather than observation space, as done in Rombach et al. (2022).
539
+
540
+ • Only AND and NOT compositions are supported Since Decision Diffuser does not provide an explicit density estimate for each condition variable, it can’t natively support OR composition.
541
+
542
+ • Performance degradation in environments with stochastic dynamics In environments with highly stochastic dynamics, Decision Diffuser loses its advantage and performs similarly to Diffuser and CQL. To tackle environments with stochastic dynamics, recent works (Yang et al., 2022; Villaflor et al., 2022) propose learning a latent model for future states and then conditioning the policy on predicted latent future states rather than returns. Conditioning Decision Diffuser on future state information, rather than returns, would make it more robust to stochastic dynamics and could be an interesting avenue for future works.
543
+
544
+ • Performance in limited data regime Since diffusion models are prone to overfitting in case of limited data, Decision Diffuser is also prone to overfitting in limited data regime.
md/dev/t877958UGZ/t877958UGZ.md ADDED
@@ -0,0 +1,465 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Cheap and Quick: Efficient Vision-Language Instruction Tuning for Large Language Models
2
+
3
+ Gen Luo13, Yiyi Zhou12, Tianhe Ren1, Shengxin Chen1, Xiaoshuai Sun12, Rongrong $\mathbf { J i ^ { 1 2 3 * } }$
4
+ 1Key Laboratory of Multimedia Trusted Perception and Efficient Computing, Ministry of Education of China, School of Informatics, Xiamen University, 361005, P.R. China.
5
+ 2Institute of Artificial Intelligence, Xiamen University, 361005, P.R. China.
6
+ 3 Peng Cheng Laboratory, Shenzhen, 518000, China. {luogen,chenshengxin,rentianhe}@stu.xmu.edu.cn, {zhouyiyi,xssun,rrji}@xmu.edu.cn
7
+
8
+ # Abstract
9
+
10
+ Recently, growing interest has been aroused in extending the multimodal capability of large language models (LLMs), e.g., vision-language (VL) learning, which is regarded as the next milestone of artificial general intelligence. However, existing solutions are prohibitively expensive, which not only need to optimize excessive parameters, but also require another large-scale pre-training before VL instruction tuning. In this paper, we propose a novel and affordable solution for the effective VL adaption of LLMs, called Mixture-of-Modality Adaptation (MMA). Instead of using large neural networks to connect the image encoder and LLM, MMA adopts lightweight modules, i.e., adapters, to bridge the gap between LLMs and VL tasks, which also enables the joint optimization of the image and language models. Meanwhile, MMA is also equipped with a routing algorithm to help LLMs achieve an automatic shift between single- and multi-modal instructions without compromising their ability of natural language understanding. To validate MMA, we apply it to a recent LLM called LLaMA and term this formed large visionlanguage instructed model as LaVIN. To validate MMA and LaVIN, we conduct extensive experiments under two setups, namely multimodal science question answering and multimodal dialogue. The experimental results not only demonstrate the competitive performance and the superior training efficiency of LaVIN than existing multimodal LLMs, but also confirm its great potential as a general-purpose chatbot. More importantly, the actual expenditure of LaVIN is extremely cheap, e.g., only 1.4 training hours with 3.8M trainable parameters, greatly confirming the effectiveness of MMA. Our project is released at https://luogen1996. github.io/lavin.
11
+
12
+ # 1 Introduction
13
+
14
+ In recent years, large language models (LLMs) [3, 37, 5, 52, 38] have continuously pushed the upper limit of natural language understanding with ever increasing parameter sizes and pre-training data scales. The introduction of instruction tuning [30, 31, 35] also enables LLMs to engage in human-like conversations and handle various natural language processing (NLP) tasks [29, 44, 45], approaching artificial general intelligence, e.g., GPT-3.5 [33]. The next milestone is often regarded to extend these LLMs with multimodal capabilities, e.g., vision-language (VL) learning, making LLMs applicable to more real-world application scenarios. Such a target has been recently realized by GPT-4 [34], which is likely to adopt a large-scale vision-language corpus to directly train a multimodal GPT.
15
+
16
+ ![](images/340c69a40a4d3e710a9eb49ac867041ced129c5a5efbad8c52d5a78f7bb58a86.jpg)
17
+
18
+ ![](images/6944d9e8fee85891ef15363dbae9a7ae3d8bb6ef4775c8dda2ffcaf66e19bf91.jpg)
19
+ Stage-2: Instruction Tuning
20
+
21
+ ![](images/192e637425e5d62aff0bebbb8ce2c0387677f1d62b47de6d4c4d4a51f299abd0.jpg)
22
+ Stage-1: VL Alignment
23
+ (a) Expert System
24
+ (b) Modular Training Scheme
25
+
26
+ ![](images/b4382854c5451139ab79487fdfbdb05bb282887ed3807b8c9eef8096fa6166a3.jpg)
27
+ (c) Mixture-of-Modality Adaptation
28
+ Figure 1: Comparison of different multimodal adaptation schemes for LLMs. In the expert system, LLMs play a role of controller, while the ensemble of LLM and vision models is expensive in terms 点:of computation and storage overhead. The modular training regime (b) requires an additional large 计算效率低,参数低效 1. 计算效率高(单张A100可训练),参数高效(2~4 M)neck branch and another large-scale pre-training for cross-modal alignment, which is inefficient in 多阶段优化进一步增大了计算量,同时优化效率低 2. 单阶段联合优化(Training from scratch )training and performs worse in previous NLP tasks. In contrast, the proposed Mixture-of-Modality Adaption (MMA) (c) is an end-to-end optimization scheme, which is cheap in training and superior in the automatic shift between text-only and image-text instructions.
29
+
30
+ However, the training regime of GPT-4 [34] is prohibitively expensive, and recent endeavors [49, 50, 1, 8, 56, 4] are still keen to efficient VL adaptions of LLMs. As shown in Fig. 1, the existing multimodal solutions for LLMs can be roughly divided into two main categories, i.e., the expert system and the modular training ones, respectively. In the expert system solution [49, 50, 41], LLMs usually serve as a manager to interpret different natural language instructions, and then call the corresponding vision models to handle the input image, e.g., image captioning [18, 27], visual question answering [55, 28] or text-to-image generation [39]. The advantage of this solution is that it does not require the re-training of LLMs and can make full use of existing vision models. However, the ensemble of LLMs and various vision models still exhibits significant redundancy in terms of computation and parameters, leading to excessive memory footprints. Meanwhile, the joint optimization of LLMs and vision models is still an obstacle.
31
+
32
+ In this case, increasing attention has been paid to the modular training of LLMs [17, 21, 56, 15, 56]. As illustrated in Fig. 1, this paradigm often requires LLMs to deploy an additional neck branch to connect the visual encoders, and then performs another pre-training on numerous image-text pairs for cross-modal alignment. Afterwards, the neck branch and LLM are jointly tuned via VL instructions. Despite the effectiveness, the required VL pre-training is still expensive for a quick adaptation of LLMs. For instance, the pre-training of BLIP2 [17] consumes more than 100 GPU hours on 129 millions of image-text pairs. In addition, this paradigm often requires to update most parameters of LLM, limiting the efficiency of VL instruction tuning. For example, LLaVA-13B [21] fully fine-tunes the entire LLM during VL instruction tuning, resulting in significant increases in training time and intermediate storage overhead2. More importantly, these fine-tune schemes will inevitably undermine the NLP capabilities of LLMs due to the drastic changes in their parameter spaces. For instance, the existing multimodal LLMs, such as BLIP2 [17] and miniGPT4 [56], do not support text-only instructions, greatly hindering their applications.
33
+
34
+ In this paper, we propose a novel and efficient solution for vision-language instruction tuning, termed Mixture-of-Modality Adaptation (MMA). Different from existing modular training scheme [17, 21], MMA is an end-to-end optimization regime. By connecting the image encoder and LLM with lightweight adapters, MMA can jointly optimize the entire multimodal LLM via a small number of parameters, saving more than thousands times of storage overhead compared with existing solutions [21, 56, 17]. To obtain a quick shift between text-only and image-text instructions, MMA equips the inserted adapters with a routing scheme, which can dynamically choose the suitable adaptation path for the inputs of different modalities, thereby well preserving the NLP capability of LLMs. To validate MMA, we apply it to a recently proposed LLM called LLaMA [43], and term this new large vision-language instructed model as LaVIN. With the help of MMA, LaVIN can achieve cheap and quick adaptations on VL tasks without the requirement of another large-scale pre-training.
35
+
36
+ To validate LaVIN, we first conduct quantitative experiments on ScienceQA [24]. Experimental results show that LaVIN can achieve on-par performance with the advanced multimodal LLMs, e.g., LLaVA [21], while reducing up to $7 1 . 4 \%$ training time and $9 9 . 9 \%$ storage costs. Notably, fine-tuning
37
+
38
+ LaVIN on ScienceQA only takes 1.4 hours with 8 A100 GPUs, and the updated parameters are only 3.8M. In addition, we also extend LaVIN to a multimodal chatbot via tuning on $5 2 k$ text-only instructions [42] and $1 5 2 k$ text-image pairs [21]. The qualitative comparisons show that LaVIN can accurately execute various types of human instructions, e.g., coding, math and image captioning, while yielding superior vision-language understanding than existing multimodal chatbots [56, 17, 50].
39
+
40
+ In summary, our contributions are three folds:
41
+
42
+ • We present a novel and efficient solution for vision-language instruction tuning, namely Mixture-of-Modality Adaptation (MMA), which does not require the expensive VL pretraining and can maintain the NLP capabilities of LLMs. • Based on MMA, we propose a new multimodal LLM, namely LaVIN. Experimental results show the superior efficiency and competitive performance of LaVIN against existing multimodal LLMs, and also confirm its great potential as a general-purpose chatbot. • We release the source code and pre-trained checkpoints associated with this paper. We believe that our project can well facilitate the development of multimodal LLM.
43
+
44
+ # 2 Related Work
45
+
46
+ # 2.1 Parameter-Efficient Transfer Learning
47
+
48
+ Since large language models have ever-increasing parameter sizes, parameter-efficient transfer learning (PETL) [13, 19, 25, 14, 22, 12] has gained increasing attention to reduce training and storage overhead of LLMs. PETL aims to insert or fine-tune a small number of parameters into LLMs, thereby achieving the adaption on downstream tasks. In early efforts [13, 12], a small MLP network, known as Adapter [13], is inserted into LLMs to project their hidden features to the semantic spaces of downstream tasks. Based on Adapter, numerous PETL methods [19, 46, 25, 14, 22, 12] have been proposed to further enhance adaptation capabilities [19, 46, 25, 22, 12] and inference speed [14]. Among them, AdaMix [46] is a method relatively close to our MMA, which also includes a set of candidate adapters for downstream task routing. However, AdaMix is static and task-dependent, of which routing path is fixed after training. In contrast, our MMA is a dynamic method based on the input modality embeddings. Moreover, AdaMix is still an unimodal module and hard to adaptively adjust the adaptions of different modalities. Driven by the great success in NLP, PETL has also achieved significant progresses in large vision models [26, 2, 54], e.g., ViT [7] and CLIP [36]. Despite the effectiveness, PETL for multimodal LLMs still lacks explorations. A very recent PETL method [51] is proposed for multimodal LLMs , but its performance still lags behind full fine-tuning.
49
+
50
+ # 2.2 Multimodal Instruction-following LLMs
51
+
52
+ Instruction tuning [30, 31, 35, 47, 48] aims to fine-tune LLMs on natural language corpus describing diverse NLP tasks. This simple and effective method has been successfully applied to various wellknown LLMs, such as InstructGPT [35] and FLAN-T5 [6], greatly improving their performance and generalization ability. Motivated by this success, numerous efforts have been devoted to constructing multimodal instruction-following LLMs. Existing works can be categorized into two groups, e.g., the expert systems [49, 50, 41] and modular training ones [17, 21, 56, 15, 56], respectively. The representative expert systems, such as Visual ChatGPT [49] and MMREACT [50], employ LLMs as the controller to invoke various vision models to accomplish the VL instructions. Despite the effectiveness, this heavy system also incurs non-negligible burdens in terms of storage and computation. Recently, modular training models [17, 21, 56, 15, 56] as proposed as more efficient alternatives. Among them, Flamingo [1] is the first large-scale multimodal LLM that pre-trains on numerous image-text pairs, which demonstrates strong zero-shot ability on diverse tasks. The following works, including BLIP-2 [17], FROMAGe [16], PaLM-E [8], KOSMOS-1 [15] and LLaVA [21], not only optimize the model architecture [17, 16, 8, 15] but also improve the quality of VL instruction data [21]. Despite their effectiveness, most multimodal LLMs require expensive training costs and perform worse on text-only instructions.
53
+
54
+ Response: The image features a small brown dog running across a grassy field, with its tongue out and ears flapping. The dog appears to be enjoying itself as it runs through the open space. In the background, there are several trees scattered across the field, adding to the natural setting.
55
+
56
+ ![](images/ca9e2a02931ae3cea7f3c46c984db7063ab615d82ac1336f36c6174ef35e8498.jpg)
57
+ Figure 2: The overview of the Mixture-of-Modality Adaptation (MMA) and the architecture of LaVIN. In LaVIN, the novel Mixture-of-Modality Adapters are employed to process the instructions of different modalities. During instruction tuning, LaVIN is optimized by Mixture of Modality Training (MMT) in an end-to-end manner.
58
+
59
+ # 3 Method
60
+
61
+ # 3.1 Mixture-of-Modality Adaptation
62
+
63
+ In this paper, we propose a novel learning regime for the vision-language adaption of LLMs, which is called Mixture-of-Modality Adaptation (MMA). As shown in Fig. 2, MMA includes two novel designs, namely Mixture-of-Modality Adapter (MM-Adapter) and Mixture-of-Modality Training (MMT). Specifically, MM-Adapter extends LLMs with multimodal abilities via lightweight adapters, which also realizes the automatic shift between single- and multi-modal instructions. Afterwards, the entire multimodal LLM is jointly optimized via MMT, which is cheap in training time and storage.
64
+
65
+ Mixture-of-Modality Adapter (MM-Adapter). As shown in Fig. 2, we connect the LLM with the image encoder with a set of lightweight adaptation modules. In the image encoder, these modules can be the common adapters [13, 26]. In the LLM, unimodal adaptation modules are inferior in handling single- and multi-modal instructions simultaneously.
66
+
67
+ In particular, we first introduce a modality token $t _ { m } \in \mathbb { R } ^ { c }$ to indicate the input modality, which is defined by
68
+
69
+ $$
70
+ t _ { m } = m E _ { m } .
71
+ $$
72
+
73
+ Here, $E _ { m } \in \mathbb { R } ^ { 2 \times c }$ is the modality embedding. $m \in \mathbb { R } ^ { 2 }$ is a one-hot vector to represent the input modality. Based on the modality token $t _ { m }$ , MM-Adapter can dynamically adjust the adaptations for the input features $Z \in \mathbb { R } ^ { \tilde { n } \times c }$ . In practice, $Z$ can be the single- or multi-modal features, which will be introduced in Sec 3.2. Thus, MM-Adapter can be defined by
74
+
75
+ $$
76
+ Z ^ { \prime } = Z + s \cdot r o u t e r { \left( f _ { a _ { 1 } } ( Z ) , f _ { a _ { 2 } } ( Z ) ; f _ { w } ( t _ { m } ) \right) } .
77
+ $$
78
+
79
+ Here, $f _ { a _ { 1 } }$ and $f _ { a _ { 2 } }$ are RepAdapters [26] in our paper. $s$ is the scale factor, and router $\cdot ( \cdot )$ is a routing function to decide the routing path of two adapters. To further reduce the parameter costs, the downsampling projection of two adapters are shared.
80
+
81
+ ![](images/c799801861aced7f1da25e815a61ab0563d2c722141539638e3f13eb8089b6b7.jpg)
82
+ Figure 3: Illustration of the Mixture-of-Modality Adapter (MMA). MMA can dynamically select the appropriate adapter according to the input modalities.
83
+
84
+ As shown in Fig. 3, the key to realize the dynamic adaptations lies in the design of the routing function router $( \cdot )$ , which is formulated as
85
+
86
+ $$
87
+ \begin{array} { r l } & { r o u t e r { \left( f _ { a _ { 1 } } ( Z ) , f _ { a _ { 2 } } ( Z ) \right) } = \hat { w } _ { 0 } \cdot f _ { a _ { 1 } } ( Z ) + \hat { w } _ { 1 } \cdot f _ { a _ { 2 } } ( Z ) , } \\ & { \mathrm { w h e r e } \quad \hat { w } = f _ { w } ( t _ { m } ) = \mathrm { s o f t m a x } ( \frac { t _ { m } W _ { m } + b _ { m } } { \tau } ) . } \end{array}
88
+ $$
89
+
90
+ Here, $W _ { m } \in \mathbb { R } ^ { c \times 2 }$ and $b _ { m } \in \mathbb { R } ^ { 2 }$ are the weight matrix and bias, respectively. $\hat { w }$ denotes the routing weights, and $\tau$ is the temperature of the softmax. Based on Eq. 2 and 3, MM-Adapter can select the best adaption path according to the modalities of input instructions. More importantly, the process of MM-Adapter only introduces a few of additional parameters, which is still efficient. In practice, MM-Adapter can be used as the unimodal adapter to improve the adaptation ability, thus we also apply it to the image encoder.
91
+
92
+ Mixture-of-Modality Training (MMT). Based on MM-Adapter, the target of MMT is to freeze the large image encoder and LLM, and only fine-tune the inserted adapters. In this case, the entire multimodal LLM can be jointly optimized in an end-to-end manner. Specifically, the end-to-end optimization objective can be formulated by
93
+
94
+ $$
95
+ \arg \operatorname* { m i n } _ { { } } \mathcal { L } ( f _ { \phi } ( Z ) , R ; \theta _ { a } ) .
96
+ $$
97
+
98
+ Here, $R$ and $\mathcal { L } ( \cdot )$ denote the ground-truth response [24] and the objective loss function, respectively. $f _ { \phi }$ is the LLM, and $\theta _ { a }$ denotes the adaptation parameters. $I \in \mathbb { R } ^ { h \times w \times 3 }$ and $T \in \mathbb { R } ^ { l }$ denote the input image and text instruction, respectively.
99
+
100
+ During training, we construct a mini training batch randomly sampled from text-only and text-image instructions. In this case, the overall training objective $\mathcal { L }$ can be defined by
101
+
102
+ $$
103
+ \mathcal { L } = \sum _ { i = 1 } ^ { m } \sum _ { s = 1 } ^ { S + 1 } \log p ( R _ { s } ^ { i } | Z ^ { i } , R _ { 0 : s - 1 } ^ { i } ; \theta _ { a } ) .
104
+ $$
105
+
106
+ Here, $m$ denotes the batch size, and $S$ is the length of the response. After MMT, the multimodal LLM can effectively execute the input instructions of different modalities.
107
+
108
+ In our training scheme, the number of optimized parameters is still kept at a very small scale, e.g., $3 { \sim } 5 \mathbf { M }$ , which greatly reduces the training time and the storage cost. Compared to existing modular training paradigm, MMA does not require additional VL pre-training and can optimize the entire model end-to-end, further improving the training efficiency.
109
+
110
+ # 3.2 Large Vision-language Instructed Model
111
+
112
+ To validate MMA, we apply it to an LLM called LLaMA [43] and adopt CLIP-ViT [36] as the image encoder. Here, we term this new large vision-language instructed model as LaVIN.
113
+
114
+ Given the input image $\boldsymbol { I } \in \mathbb { R } ^ { h \times w \times 3 }$ , we use the [cls] tokens from every fourth layer of ViT [7] as the visual feature, denoted as $\ b { X } \in \mathbb { R } ^ { n \times d }$ . In the image encoder, we insert the adapters before the multi-head attention modules. We represent the text instruction with word embeddings, denoted as $Y \in \mathbb { R } ^ { l \times c }$ . Then, a simple visual adapter is used to transform the visual features to the same dimension with the LLM, which is defined by
115
+
116
+ $$
117
+ X ^ { \prime } = \sigma ( X W _ { d } + b _ { d } ) W _ { u } + b _ { u } .
118
+ $$
119
+
120
+ Here, $W _ { d } \in \mathbb { R } ^ { d \times d _ { h } }$ and $W _ { u } \in \mathbb { R } ^ { d _ { h } \times c }$ denote the weight matrices, while $W _ { d } \in \mathbb { R } ^ { d _ { h } }$ and $b _ { u } \in \mathbb { R } ^ { c }$ are the bias terms. $\sigma$ is the SwiGLU activation function [40]. In practice, $d _ { h }$ is much smaller than $d$ and $c$ , so the input of LLM can be defined by
121
+
122
+ $$
123
+ Z = { \left\{ \begin{array} { l l } { [ t _ { m } , X ^ { \prime } , Y ] } & { t e x t - i m a g e , } \\ { [ t _ { m } , Y ] } & { t e x t o n l y . } \end{array} \right. }
124
+ $$
125
+
126
+ Here, $[ \cdot ]$ denotes the concatenation. Based on the multimodal input, LLM can predict the next token step by step, which can be formulated by
127
+
128
+ $$
129
+ p _ { t } = \prod _ { s = 1 } ^ { S + 1 } p ( R _ { s } | Z , R _ { 0 : s - 1 } ; \theta _ { l } , \theta _ { a } )
130
+ $$
131
+
132
+ Here, $p _ { t } \in \mathbb { R } ^ { m }$ denotes the probabilities of the predicted word and $m$ is the length of the word embeddings. $\theta _ { l }$ and $\theta _ { a }$ denote the parameters of LLM and adaptation modules, respectively.
133
+
134
+ Compared with previous works [17, 56, 21], the architecture of LaVIN is much simpler and more lightweight, which is also easier to optimize. For example, the visual neck of LaVIN is 6 times smaller than that of LLaVA [21], but the performance of two models is close.
135
+
136
+ Table 1: Comparison on ScienceQA test set. Question classes: $\mathbf { N A T } =$ natural science, $\mathrm { S O C = }$ social science, $\mathrm { L A N } =$ language science, TXT $=$ text context, IMG $=$ image context, ${ \mathrm { N O } } =$ no context, G1-6 $=$ grades 1-6, $G 7 - 1 2 =$ grades 7-12. $\dagger$ denotes that LaVIN is trained with 40 epochs. #T-Params denotes that the number of trainable parameters.
137
+
138
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">#T-Param</td><td rowspan="2">LLM</td><td colspan="3">Subject</td><td colspan="3">Context Modality</td><td colspan="2">Grade</td><td rowspan="2">Average</td></tr><tr><td>NAT</td><td>sOC</td><td>LAN</td><td>TXT</td><td>IMG</td><td>NO</td><td>G1-6</td><td>G7-12</td></tr><tr><td colspan="10">Zero-&amp; few-shot methods</td><td></td><td></td><td></td></tr><tr><td>Human [24]</td><td></td><td></td><td>90.23</td><td>84.97</td><td>87.48</td><td>89.60</td><td>87.50</td><td>88.10</td><td>91.59</td><td>82.42</td><td></td><td>88.40</td></tr><tr><td>GPT-3.5 [24]</td><td></td><td>X</td><td>74.64</td><td>69.74</td><td>76.00</td><td>74.44</td><td>67.28</td><td></td><td>77.42</td><td>76.80</td><td>68.89</td><td>73.97</td></tr><tr><td>GPT-3.5 (CoT) [24]</td><td></td><td>√</td><td>75.44</td><td>70.87</td><td>78.09</td><td>74.68</td><td></td><td>67.43</td><td>79.93</td><td>78.23</td><td>69.68</td><td>75.17</td></tr><tr><td>GPT-4 [34]</td><td>-</td><td>√</td><td>84.06</td><td>73.45</td><td>87.36</td><td>81.87</td><td></td><td>70.75</td><td>90.73</td><td>84.69</td><td>79.10</td><td>82.69</td></tr><tr><td colspan="3">Representative&amp;SoTA 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>UnifiedQA [24]</td><td>223M</td><td>X</td><td>71.00</td><td>76.04</td><td>78.91</td><td>66.42</td><td>66.53</td><td></td><td>81.81</td><td>77.06</td><td>68.82</td><td>74.11</td></tr><tr><td>MM-CoTBase [53]</td><td>223M</td><td>X</td><td>87.52</td><td>77.17</td><td>85.82</td><td>87.88</td><td></td><td>82.90</td><td>86.83</td><td>84.65</td><td>85.37</td><td>84.91</td></tr><tr><td>MM-CoTLarge [53]</td><td>738M</td><td>×</td><td>95.91</td><td>82.00</td><td>90.82</td><td>95.26</td><td></td><td>88.80</td><td>92.89</td><td>92.44</td><td>90.31</td><td>91.68</td></tr><tr><td>LLaVA [21]</td><td>13B</td><td>√</td><td>90.36</td><td>95.95</td><td>88.00</td><td>89.49</td><td></td><td>88.00</td><td>90.66</td><td>90.93</td><td>90.90</td><td>90.92</td></tr><tr><td colspan="3">Parameter-efficientmethods</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>LLaMA-Adapter [51]</td><td>1.8M</td><td>√</td><td>84.37</td><td>88.30</td><td>84.36</td><td>83.72</td><td></td><td>80.32</td><td>86.90</td><td>85.83</td><td>84.05</td><td>85.19</td></tr><tr><td>LaVIN-7B (ours)</td><td>3.8M</td><td>√</td><td>89.25</td><td>94.94</td><td>85.24</td><td></td><td>88.51</td><td>87.46</td><td>88.08</td><td>90.16</td><td>88.07</td><td>89.41</td></tr><tr><td>LaVIN-13B (ours)</td><td>5.4M</td><td>√</td><td>90.32</td><td>94.38</td><td>87.73</td><td></td><td>89.44</td><td>87.65</td><td>90.31</td><td>91.19</td><td>89.26</td><td>90.50</td></tr><tr><td>LaVIN-13B† (ours)</td><td>5.4M</td><td>√</td><td>89.88</td><td>94.49</td><td>89.82</td><td></td><td>88.95</td><td>87.61</td><td>91.85</td><td>91.45</td><td>89.72</td><td>90.83</td></tr></table>
139
+
140
+ <table><tr><td>Settings</td><td>#T-Params</td><td>NAT</td><td>SOC</td><td>LAN</td><td>TXT</td><td>IMG</td><td>NO</td><td>G1-6</td><td>G7-12</td><td>Avg.</td></tr><tr><td>Text Only</td><td>1.8M</td><td>82.86</td><td>82.56</td><td>82.28</td><td>81.23</td><td>75.81</td><td>86.06</td><td>83.26</td><td>81.54</td><td>82.65(+0.00)</td></tr><tr><td>+ Vision Modality (MMT)</td><td>2.4M</td><td>85.97</td><td>90.66</td><td>83.55</td><td>84.90</td><td>83.59</td><td>86.41</td><td>88.14</td><td>83.06</td><td>86.32(+3.67)</td></tr><tr><td>+ Joint Opt. (MMT)</td><td>2.5M</td><td>86.59</td><td>94.71</td><td>82.91</td><td>85.63</td><td>84.98</td><td>86.41</td><td>88.62</td><td>85.04</td><td>87.34(+4.69)</td></tr><tr><td>+ Stronger Image Enc.</td><td>2.9M</td><td>88.01</td><td>94.94</td><td>83.64</td><td>87.15</td><td>86.81</td><td>87.04</td><td>89.87</td><td>85.56</td><td>88.33(+5.68)</td></tr><tr><td>+ MM-Adapter</td><td>3.8M</td><td>89.25</td><td>94.94</td><td>85.24</td><td>88.51</td><td>87.46</td><td>88.08</td><td>90.16</td><td>88.07</td><td>89.41(+6.76)</td></tr><tr><td>+ Larger LLM (13B)</td><td>5.4M</td><td>90.32</td><td>94.38</td><td>87.73</td><td>89.44</td><td>87.65</td><td>90.31</td><td>91.19</td><td>89.26</td><td>90.50(+7.85)</td></tr></table>
141
+
142
+ Table 2: Ablation studies on ScienceQA test set. For the text-only baseline, we use the image caption to prompt the model. ViT-B/16 and LLaMA-7B are used as the default image encoder and LLM. “Joint Opt” denotes the joint optimization of image encoder and LLM. The Mixture-of-Modality Training (MMT) is ablated with the settings of “Vision Modality” and “Joint Opt.”.
143
+
144
+ # 4 Experiments
145
+
146
+ # 4.1 Datasets and Metrics
147
+
148
+ ScienceQA. ScienceQA [24] is the large-scale multimodal dataset for science question answering, which covers various domains, including 3 subjects, 26 topics, 127 categories and 379 skills. ScienceQA consists of text-only and text-image examples in three splits namely train, val and test, with 12,726, 4,241 and 4,241 examples, respectively. We evaluate our model using average accuracy.
149
+
150
+ Alphaca-52k & LLaVA-158k. Alphaca-52k [42] contains 52k text-only instruction-following data generated by GPT-3.5 [3]. LLaVA-158k [21] is a large-scale text-image instruction-following dataset, where the answer is automatically generated by GPT-4 [34]. Following LLaVA [21], GPT-4 is employed to evaluate the quality of the chatbot’s responses, which will assign higher scores to superior responses within a range of 1 to 10.
151
+
152
+ # 4.2 Implementation Details
153
+
154
+ We employ the ViT-L/14 [7] of the pre-trained CLIP [36] as the image encoder. The visual features consist of six [cls] tokens extracted from every fourth layer of ViT-L/14. For LLM, LLaMA7B [43] and LLaMA-13B [43] are used. The default dimension of the visual neck is set to 128. The dimension of MM-Adapter is 8, and the temperature is set to 10 for LaVIN-7B and 5 for LaVIN-13B. For text-only baseline, the image encoder is removed, and MM-Adapter is replaced with RepAdapter [26]. We adopt AdamW [23] as the optimizer, and train the model for 20 epochs with a cosine decay learning rate schedule. The batch size, learning rate and weight decay are set to 32, 9e-3 and 0.02, respectively. During the generation stage, the decoding uses top- $p$ sampling with a temperature of 0.1 and a top- $p$ value of 0.75, respectively. For the experiments of multimodal chatbot, all hyperparameters remain the same, except for the training epochs, which are reduced to 15.
155
+
156
+ # 4.3 Experimental Results
157
+
158
+ # 4.3.1 Quantitative Experiments
159
+
160
+ Results on ScienceQA. In Tab. 1, We first compare LaVIN with the state-of-the-art methods on ScienceQA. From this table, the first observation is that the few-shot LLMs, such as GPT-4, still perform worse than human, suggesting the great challenge of ScienceQA. In contrast, existing supervised methods [21, 51, 53] yield better results. In particular, MM-CoTLarge [53] achieves the best performance, e.g., 91.68. However, MM-CoT mainly focuses on the multimodal chain-of-thought for language models, of which contribution is orthogonal to our approach. In particular, LLaVA [21] is an end-to-end multimodal LLM, which is more close to our work.
161
+
162
+ The results show that LLaVA remains competitive performance against MM-CoTLarge[53], especially in the category of SOC. Despite the effectiveness, its number of trainable parameters is still large, leading to higher training overhead. LLaMA-Adapter [51] adopts a parameterefficient scheme to reduce the training overhead, but its performance still greatly lags behind LLaVA. Compared to these approaches, LaVIN achieves the better trade-offs between performance and training efficiency. For exam
163
+
164
+ <table><tr><td>Methods</td><td>#T-Params</td><td>Accuracy</td></tr><tr><td>LLaVA [21]</td><td>13B</td><td>85.81</td></tr><tr><td>LLaMA-Adapter [51]</td><td>1.8M</td><td>85.19</td></tr><tr><td>LaVIN-7B</td><td>3.8M</td><td>89.41 (+4.22)</td></tr><tr><td>LaVIN-13B</td><td> 5.4M</td><td>90.83 (+5.02)</td></tr></table>
165
+
166
+ Table 3: Results of LaVIN and existing multimodal LLMs without the pre-training stage. We report the average accuracy on ScienceQA test set.
167
+
168
+ ple, LaVIN-7B consumes a similar scale of trainable parameters as LLaMA-Adapter [51], while outperforming it by $+ 4 . 2 2$ gains. When scaling up to 13B, LaVIN can obtain more significant performance gains, i.e., $+ 5 . 6 4$ . Compared to LLaVA, LaVIN-13B also achieves comparable performance and even performs better in some question classes, e.g., LAN and NO. Considering the much lower training costs than LLaVA, such competitive performance greatly confirms the efficiency and designs of LaVIN.
169
+
170
+ In Tab. 3, we compare LaVIN with existing methods without VL pretraining. From this table, we observe that both LLaVA [21] and LLaMAAdapter achieve the similar performance, i.e., 85.81 vs. 85.19. In particular, LLaVA [21] and LLaMAAdapter [51] freeze the image backbone, and the entire multimodal LLM is not jointly optimized, which hinders the learning of visual content. Moreover, the adaptation module in LLaMA-Adapter does not consider
171
+
172
+ <table><tr><td>Methods</td><td>PT Data</td><td>#T-Params</td><td>BLEU-4</td><td>CIDEr</td></tr><tr><td>ClipCap [32]</td><td>0</td><td>-</td><td>33.5</td><td>113.1</td></tr><tr><td>LLaMA-Adapter V2 [11]</td><td>0</td><td>14M</td><td>36.2</td><td>122.2</td></tr><tr><td>BLIP [18]</td><td>14M</td><td>583M</td><td>40.4</td><td>136.7</td></tr><tr><td>BLIP-2 [17]</td><td>129M</td><td>188M</td><td>43.7</td><td>145.3</td></tr><tr><td> LaVIN (ours)</td><td>0</td><td> 5.4M</td><td>36.4</td><td>126.9</td></tr><tr><td> LaVIN (ours)</td><td>0.6M</td><td> 5.4M</td><td>37.8</td><td>131.7</td></tr></table>
173
+
174
+ Table 4: Fine-tuning results of LaVIN and existing multimodal LLMs on COCO captioning. We report performance on Karpathy test split.
175
+
176
+ the modality gap in the input instructions, greatly limiting its performance upper bound. In contrast, with the help of MMA, LaVIN significantly outperforms these approaches, e.g., $+ 5 . 0 2$ gains over LLaVA. These results validate the proposed MMA towards the effective and efficient VL adaption, and confirm the designs of LaVIN.
177
+
178
+ Results on COCO Captioning. In Tab 4, we compare LaVIN with existing methods on the task of image captioning. From these results, we can still observe the competitive performance of LaVIN. As a parameter-efficient tuning method, LaVIN outperforms LLaMA-Adapter v2 [11] by a large margin, e.g., up to $+ 9 . 5$ of CIDEr. Compared with large-scale pre-training models, e.g., BLIP and BLIP-2, the performance of LaVIN is still comparable, while the expenditure is much cheaper. For instance, with only $0 . 6 \mathbf { M }$ pre-training data and 5.4M updated parameters, LAVIN can achieve 131.7 CIDEr on COCO Captioning. Notably, our tuning only takes 4 GPU hours on 8 A100s, while BLIP-2 requires more than 300 GPU hours on 16 A100s. These results further validate the effectiveness and training efficiency of MMA and LaVIN.
179
+
180
+ Zero-shot evaluation on NLP and multimodal benchmarks. In Tab. 5, we evaluate the zero-shot ability of LaVIN and existing methods on TruthfulQA [20] and MME [10]. On TruthfulQA [20], we observe that the zero-shot performance of existing multimodal LLMs is obviously inferior to the original LLaMA. In stark contrast, LaVIN can further improve the performance by $+ 9 . 2 \%$ than LLaMA-Base [43] through its mixture-of-modality adaptation. On MME [10], a challenging benchmark for multimodal evaluation, LaVIN still demonstrates competitive performance against existing multimodal LLMs. Expect for BLIP-2 [17], which is pre-trained on numerous data, the other methods perform similarly to or worse than LaVIN, e.g., 866.5 of MiniGPT-4 vs. 963.6 of LaVIN on MME-C. These results confirm the strong generalization ability of LaVIN, and also validate that the NLP capabilities are well preserved by MMA during VL instruction tuning.
181
+
182
+ Ablation study. To gain deep insights into MMA and LaVIN, we conduct comprehensive ablation studies in Tab. 2. From this table, we can see that each design of MMA and LaVIN greatly contributes to the final performance. As shown in Tab. 2, the mixture-of-modality training (MMT) brings the most significant gains, e.g., $+ 4 . 6 9$ . In MMT, the joint training with the vision modality provides up to $+ 3 . 6 7$ performance gains for LaVIN. With the joint optimization of the image encoder and LLM, the performance of LaVIN further boosts from 86.32 to 87.34, suggesting the significance of the joint optimization for multimodal LLMs. With the help of MMT, LaVIN already surpasses the ex
183
+
184
+ Table 5: Zero-shot results on NLP and multimodal benchmarks. “Mc1_targets” setup is used on TruthfulQA [20]. “MME-C” and “MME-P” denote the splits of Cognition and Perception on MME benchmark [10], respectively.
185
+
186
+ <table><tr><td colspan="4">Methods TruthfulQA MME-C MME-P</td></tr><tr><td>LLaMA-Base [43]</td><td>38.7</td><td>=</td><td>=</td></tr><tr><td>LLaMA-Adapter V2 [11]</td><td>24.4</td><td>972.6</td><td>248.9</td></tr><tr><td>LLaVA [21]</td><td>16.4</td><td>502.8</td><td>214.6</td></tr><tr><td>BLIP-2 [17]</td><td>-</td><td>1293.8</td><td>290.0</td></tr><tr><td>MiniGPT-4 [56]</td><td>1</td><td>866.5</td><td>292.1</td></tr><tr><td>LaVIN (ours)</td><td>47.9</td><td>963.6</td><td>249.6</td></tr></table>
187
+
188
+ isting parameter-efficient method, i.e., LLaMA-Adapter. Additionally, the stronger image encoder, i.e., ViT-L/14, also improves the average accuracy by 0.99. An interesting observation is that a better image encoder provides noticeable performance gains for both image-based and text-based questions. When adopting MM-Adapter to LaVIN, we observe $+ 1 . 0 8$ gains on average accuracy. Such an improvement only requires extra 0.9M parameters, which is very lightweight. Meanwhile, the performance of $\mathrm { L a V I N }$ is significantly improved by MM-Adapter on more challenging metrics like G7-12, i.e., $+ 2 . 5 1$ . After scaling up LLM to 13B, the performance of LaVIN is further improved by $+ 1 . 0 9$ . Overall, these ablations well validate the significance of MMA in adapting multimodal LLM, and also confirm the effectiveness of LaVIN.
189
+
190
+ Comparison of training efficiency. In Tab. 6, we compare the training expenditures of LaVIN, LLaVA [21] and BLIP2 [17]. The first observation is that the pre-training cost of BLIP2 is actually expensive, which requires more than 200 hours. Meanwhile, LLaVA cannot be trained on common machines with the default training settings3. Thus, it requires some GPU memorysaving techniques [9] to avoid out of memory (OOM). However, its training time and storage requirement are still significant. For example, it still takes up to 26GB space to store the updated parameters of the LLM. In contrast, LaVIN demonstrates superior training efficiency with the help of MMA. Compared to LLaVA,
191
+
192
+ Table 6: Training costs of LaVIN and existing multimodal LLMs on ScienceQA. $^ \ddag$ denotes that GPU memory-saving techniques are used. “OOM” denotes out of GPU memory. All results are evaluated on 8 A100 GPUs.
193
+
194
+ <table><tr><td>Methods</td><td>#T-Params Memory</td><td></td><td>Time</td><td>#Storage</td></tr><tr><td>BLIP2 [17]</td><td>188M</td><td>1</td><td> &gt;200 hours</td><td>1</td></tr><tr><td>LLaVA [21]</td><td>13B</td><td>OOM</td><td>N/A</td><td>N/A</td></tr><tr><td>LLaVA‡ [21]</td><td>13B</td><td>36.8G</td><td>7 hours</td><td>26GB</td></tr><tr><td>LaVIN-7B</td><td>3.8M</td><td>33.9G</td><td> 1.4 hours</td><td>15M</td></tr><tr><td>LaVIN-13B</td><td>5.4M</td><td>55.9G</td><td>2 hours</td><td>20M</td></tr></table>
195
+
196
+ LaVIN-7B and LaVIN-13B reduce about $80 \%$ and $7 1 . 4 \%$ training time, respectively. In terms of GPU memory and storage cost, our approach can save more than $40 \%$ GPU memory and $9 9 . 9 \%$ disk storage. Overall, these results greatly confirm the training efficiency of MMA.
197
+
198
+ # 4.3.2 Qualitative Experiments
199
+
200
+ Examples of different instruction-following tasks. In Fig 4, we compare LaVIN with existing methods [51, 21] on single- and multi-modal instruction-following tasks, e.g., math, coding and image captioning. Compared to LLaVA [21] and LLaMA-Adapter [51], LaVIN achieves overall better responses across multiple tasks. In Fig.4 (a), LaVIN correctly answers the math problem with a result of 28.8, whereas LLaMA-Adapter [43] provides an incorrect answer. In example (d), LaVIN generates accurate code for the request of “print prime numbers up to 100”. In contrast, the
201
+
202
+ If a toy costs $\$ 24$ and the price is increased by $20 \%$ , what is the new price of the toy?
203
+
204
+ Translate the following Chinese into English :生如夏 花之绚烂死如秋叶之静美.
205
+
206
+ I mix water with water, do I get thin water or thick water?
207
+
208
+ Write a python code that: Print out all prime numbers up to 100.
209
+
210
+ LaVIN (ours): foriinrange(1,101):
211
+
212
+ # LaVIN (ours):
213
+
214
+ The new price of the toy is \$28.80.
215
+
216
+ # LaVIN (ours):
217
+
218
+ Life is like a summer flower, death is like a autumn leaf, quiet and beautiful.
219
+
220
+ # LaVIN (ours):
221
+
222
+ You will get the same type of water, just a mixture of the two.
223
+
224
+ # LLaMA-Adapter:
225
+
226
+ # LLaMA-Adapter:
227
+
228
+ The new price of the toy is $\$ 28.40$ .
229
+
230
+ # LLaMA-Adapter:
231
+
232
+ Born like summer flowers, die like autumn leaves.
233
+
234
+ LLaMA-Adapter: Thin water.
235
+
236
+ 1 def prime_numbers(n): foriin range(2,n): $\mathrm { ~ i ~ } = = \mathrm { ~ 0 ~ }$ print(i) prime_numbers(100) (d) Coding
237
+
238
+ # (a) Math
239
+
240
+ (b) Translation
241
+
242
+ # (c) Question Answering
243
+
244
+ How many food containers are there in the image?
245
+
246
+ Describe the Image.
247
+
248
+ ![](images/8f7b6e724c5812f7e4f1f2eaad1bcc5ea0c9a7c3ac36459378c48829079cc394.jpg)
249
+
250
+ ![](images/cd54236976bc261ab0e8c950614cda609781c2c273232649cd5aa487a18ee313.jpg)
251
+
252
+ The boy's clothes in the image are wet, is it because of the rain?
253
+
254
+ # LaVIN (ours)
255
+
256
+ : In the image, there are two food containers on the dining table. One container holds a sandwich, and the other holds a plate of broccoli. The sandwich appears to be cut in half, and the broccoli is served on a separate plate.
257
+
258
+ # LLaVA
259
+
260
+ : There are three food containers in the image: a bowl, a plate, and a sandwich.
261
+
262
+ ![](images/6deacb50a233ee170b248b15aec205ba36e774e2f62e26ffdd9f90ba6f600596.jpg)
263
+ Figure 4: Comparison between LaVIN-13B and existing methods on single- and multi-modal instructions. The noteworthy aspects of the responses are highlighted in green, whereas the illogical portions are marked in red. More tasks and examples are given in appendix.
264
+
265
+ # LaVIN (ours)
266
+
267
+ # LaVIN (ours)
268
+
269
+ : The image features a beach scene with a large number of kites flying in the sky.
270
+
271
+ : No, the boy's clothes are wet because he is surfing in the ocean
272
+
273
+ # LLaVA
274
+
275
+ : The image captures a lively beach scene with several people enjoying kite flying near the ocean.
276
+
277
+ # LLaVA
278
+
279
+ : Yes, it is likely that the boy's clothes are wet due to the rain.
280
+
281
+ (e) Visual Question Answering (f) Image Captioning (g) Multimodal Reasoning
282
+
283
+ code written by LLaMA-Adapter is to check prime numbers, which does not produce any output during execution. Meanwhile, LaVIN presents a clear and concise coding behavior, acting more like a professional programmer. In Fig 4 (e)-(g), LaVIN demonstrates remarkable visual reasoning ability in accomplishing various multimodal tasks. In Fig.4 (e), LaVIN accurately answers the complex questions about the number of food containers in the image and provides a detailed description about the complex scene. The same observation can also be witnessed in Fig.4 (g), where LaVIN infers a correct reason for the wetness of the boy’s clothes. Overall, these examples show the superior reasoning ability of LaVIN in executing single- and multi-modal instructions, while also confirming the significance of MMA in adapting LLMs to multi-modal tasks.
284
+
285
+ Examples of multimodal dialogue In Fig. 5, we compare LaVIN with existing multimodal LLMs in multi-turn conversations, and use GPT4 [34] to evaluate the quality of their responses. From the results, we can see that LaVIN has higher GPT4 scores among all compared models, suggesting superior ability in multimodal dialogue. Meanwhile, we also observe different response styles of these multimodal LLMs. In particular, BLIP2 [17] tends to produce brief responses, which lack detailed explanations. In contrast, the responses of MiniGPT4 [56] are the longest among all models, but their content is often redundant and repetitive. Compared to them, LaVIN and LLaVA [21] can generate more accurate responses. Particularly, LaVIN performs better than the other methods, mainly due to its more logical and detailed descriptions. As illustrated in the first question, LaVIN not only provides the correct answer, but also explains the reason behind it. In the second question, LaVIN and LLaVA are required to judge whether the man will get wet, and LaVIN answers “yes" while LLaVA considers “no". It can be seen that the reason of LaVIN is more comprehensive, logical and persuasive than LLaVA, which considers the situation of “the overhand may not provide the complete protection”. Overall, these examples confirm that MMA equips LLMs with excellent multi-modal ability, requiring no pre-training on large-scale image-text data.
286
+
287
+ # 5 Limitations and Broader Impact
288
+
289
+ We observe two primary limitations of LaVIN. Firstly, LaVIN may generate incorrect or fabricate responses, similar to existing multimodal LLMs. Secondly, LaVIN can not identify extremely fine
290
+
291
+ # : If it rains now, will the man get wet?
292
+
293
+ # : What is the baby doing in the image?
294
+
295
+ ![](images/2978d1deb486e920023c89afaf0ddf3d6c339af761c07b98b0417c77d2af9e27.jpg)
296
+ : What is the weather in the image now?
297
+
298
+ # : What color is the baby's clothes?
299
+
300
+ # LaVIN (ours)
301
+
302
+ :The weather in the image appears to be sunny, as the man is holding a baby in his arms outside, and there are no visible signs of rain or stormy conditions. The presence of a horse in the scene suggests that the location might be a farm or a rural area, where sunny weather is more common. GPT4 Score: 9
303
+
304
+ # LaVIN (ours)
305
+
306
+ : Yes, if it rains now, the man will get wet. In the image, the man is holding a baby and petting a brown horse, and they are both standing under an overhang. If it starts raining, the overhang will not provide complete protection from the rain, and the man will get wet as he continues to interact with the horse and the baby.
307
+
308
+ # LaVIN (ours)
309
+
310
+ : In the image, the baby is being held by a man, who is also holding a horse's nose. The baby is reaching out to touch the horse's nose, likely experiencing the horse for the first time. This interaction between the baby and the horse creates a moment of connection and curiosity for the child.
311
+
312
+ # LaVIN (ours)
313
+
314
+ : The baby's clothes are white. In the image, the man is holding the baby while the horse is nuzzling the baby's face. The baby is wearing a white onesie, which stands out against the man's brown shirt and the horse's color.
315
+
316
+ # GPT4 Score: 8
317
+
318
+ BLIP2 : Yes. PT4 Score: 6
319
+
320
+ # GPT4 Score: 9
321
+
322
+ # GPT4 Score: 9
323
+
324
+ BLIP2: Petting the horse. GPT4 Score: 7
325
+
326
+ BLIP2 : Blue. GPT4 Score: 2
327
+
328
+ BLIP2 : It is a sunny day. GPT4 Score: 7
329
+
330
+ # LLaVA
331
+
332
+ : The weather in the image is sunny.
333
+ GPT4 Score: 7
334
+
335
+ # LLaVA
336
+
337
+ : No, the man will not get wet if it starts raining, as he is already inside the stable with the horse. The stable provides shelter from the rain, keeping both the man and the horse dry.
338
+
339
+ # LLaVA
340
+
341
+ : The baby is touching the horse, reaching out to pet it while being held by the man.
342
+
343
+ # LLaVA
344
+
345
+ : The baby is wearing white clothes.
346
+
347
+ # GPT4 Score: 7
348
+
349
+ # GPT4 Score: 8
350
+
351
+ # GPT4 Score: 7
352
+
353
+ # MiniGPT4
354
+
355
+ :It is not possible to determine the current weather in the location depicted in the image, as the image does not provide any information about the weather conditions. The image shows a man, a baby, and a horse standing in front of a building with a thatched roof, but it does not provide any information about the weather or the environment in the area.
356
+
357
+ GPT4 Score: 4
358
+
359
+ # MiniGPT4
360
+
361
+ :It is not possible to determine whether the man in the image would get wet if it starts raining, as the image does not provide any information about the current weather conditions or the environment in the area. The image shows a man holding a baby, but it does not provide any information about the weather or the environment in the area.
362
+
363
+ # MiniGPT4
364
+
365
+ :In the image, the baby is reaching out to touch the horse’s nose. The baby is held up by the man, who is standing next to the horse, and the baby is reaching out with one hand to touch the horse’s nose. The baby is smiling and seems to be enjoying the interaction with the horse.
366
+
367
+ # MiniGPT4
368
+
369
+ :The baby in the image is not wearing any clothes.
370
+
371
+ # GPT4 Score: 5
372
+
373
+ GPT4 Score: 9
374
+
375
+ GPT4 Score: 2
376
+
377
+ Figure 5: Comparison of LaVIN-13B and existing multimodal LLMs in multi-turn conversations. GPT-4 assigns a score ranging from 1 to 10 to evaluate the quality of a response, with a higher score indicating superior performance. The noteworthy aspects of the responses are highlighted in green, whereas the illogical portions are marked in red.
378
+
379
+ grained visual content, such as text characters. We believe that the recognition ability of LaVIN still has a large room to improve, which will be left in our future work.
380
+
381
+ # 6 Conclusions
382
+
383
+ In this paper, we propose a novel and affordable solution for vision-language instruction tuning, namely Mixture-of-Modality Adaptation (MMA). Particularly, MMA is an end-to-end optimization regime, which connects the image encoder and LLM via lightweight adapters. With the help of MMA, the entire multimodal LLM can be jointly optimized via a small number of parameters, greatly reducing the training costs. Meanwhile, we also propose a novel routing algorithm in MMA, which can help the model automatically shifts the reasoning paths for single- and multimodal instructions. Based on MMA, we develop a large vision-language instructed model called LaVIN, which demonstrates a superior reasoning ability than existing multimodal LLMs in various instruction-following tasks.
384
+
385
+ Acknowledgements. This work was supported by National Key R&D Program of China (No.2022ZD0118201) , the National Science Fund for Distinguished Young Scholars (No.62025603), the National Natural Science Foundation of China (No. U21B2037, No. U22B2051, No. 62176222, No. 62176223, No. 62176226, No. 62072386, No. 62072387, No. 62072389, No. 62002305 and No. 62272401), the Natural Science Foundation of Fujian Province of China (No.2021J01002, No.2022J06001), and the China Fundamental Research Funds for the Central Universities (Grant No. 20720220068). We also thank Dr. Mingbao Lin for his valuable suggestions.
386
+
387
+ References
388
+ [1] Jean-Baptiste Alayrac, Jeff Donahue, Pauline Luc, Antoine Miech, Iain Barr, Yana Hasson, Karel Lenc, Arthur Mensch, Katherine Millican, Malcolm Reynolds, et al. Flamingo: a visual language model for few-shot learning. Advances in Neural Information Processing Systems, 35:23716–23736, 2022.
389
+ [2] Shoufa Chen, Chongjian Ge, Zhan Tong, Jiangliu Wang, Yibing Song, Jue Wang, and Ping Luo. Adaptformer: Adapting vision transformers for scalable visual recognition. CoRR, abs/2205.13535, 2022.
390
+ [3] Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E Hinton. Big selfsupervised models are strong semi-supervised learners. Advances in neural information processing systems (NeurIPS), 33:22243–22255, 2020.
391
+ [4] Wei-Lin Chiang, Zhuohan Li, Zi Lin, Ying Sheng, Zhanghao Wu, Hao Zhang, Lianmin Zheng, Siyuan Zhuang, Yonghao Zhuang, Joseph E. Gonzalez, Ion Stoica, and Eric P. Xing. Vicuna: An open-source chatbot impressing gpt-4 with $9 0 \% *$ chatgpt quality, March 2023.
392
+ [5] Aakanksha Chowdhery, Sharan Narang, Jacob Devlin, Maarten Bosma, Gaurav Mishra, Adam Roberts, Paul Barham, Hyung Won Chung, Charles Sutton, Sebastian Gehrmann, et al. Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311, 2022.
393
+ [6] Hyung Won Chung, Le Hou, Shayne Longpre, Barret Zoph, Yi Tay, William Fedus, Eric Li, Xuezhi Wang, Mostafa Dehghani, Siddhartha Brahma, et al. Scaling instruction-finetuned language models. arXiv preprint arXiv:2210.11416, 2022.
394
+ [7] Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
395
+ [8] Danny Driess, Fei Xia, Mehdi SM Sajjadi, Corey Lynch, Aakanksha Chowdhery, Brian Ichter, Ayzaan Wahid, Jonathan Tompson, Quan Vuong, Tianhe Yu, et al. Palm-e: An embodied multimodal language model. arXiv preprint arXiv:2303.03378, 2023.
396
+ [9] FairScale authors. Fairscale: A general purpose modular pytorch library for high performance and large scale training. https://github.com/facebookresearch/fairscale, 2021.
397
+ [10] Chaoyou Fu, Peixian Chen, Yunhang Shen, Yulei Qin, Mengdan Zhang, Xu Lin, Zhenyu Qiu, Wei Lin, Jinrui Yang, Xiawu Zheng, et al. Mme: A comprehensive evaluation benchmark for multimodal large language models. arXiv preprint arXiv:2306.13394, 2023.
398
+ [11] Peng Gao, Jiaming Han, Renrui Zhang, Ziyi Lin, Shijie Geng, Aojun Zhou, Wei Zhang, Pan Lu, Conghui He, Xiangyu Yue, et al. Llama-adapter v2: Parameter-efficient visual instruction model. arXiv preprint arXiv:2304.15010, 2023.
399
+ [12] Junxian He, Chunting Zhou, Xuezhe Ma, Taylor Berg-Kirkpatrick, and Graham Neubig. Towards a unified view of parameter-efficient transfer learning. In ICLR, 2022.
400
+ [13] Neil Houlsby, Andrei Giurgiu, Stanislaw Jastrzebski, Bruna Morrone, Quentin de Laroussilhe, Andrea Gesmundo, Mona Attariyan, and Sylvain Gelly. Parameter-efficient transfer learning for NLP. In ICML, 2019.
401
+ [14] Edward J Hu, yelong shen, Phillip Wallis, Zeyuan Allen-Zhu, Yuanzhi Li, Shean Wang, Lu Wang, and Weizhu Chen. LoRA: Low-rank adaptation of large language models. In ICLR, 2022.
402
+ [15] Shaohan Huang, Li Dong, Wenhui Wang, Yaru Hao, Saksham Singhal, Shuming Ma, Tengchao Lv, Lei Cui, Owais Khan Mohammed, Qiang Liu, et al. Language is not all you need: Aligning perception with language models. arXiv preprint arXiv:2302.14045, 2023.
403
+ [16] Jing Yu Koh, Ruslan Salakhutdinov, and Daniel Fried. Grounding language models to images for multimodal generation. arXiv preprint arXiv:2301.13823, 2023.
404
+ [17] Junnan Li, Dongxu Li, Silvio Savarese, and Steven Hoi. Blip-2: Bootstrapping language-image pre-training with frozen image encoders and large language models. arXiv preprint arXiv:2301.12597, 2023.
405
+ [18] Junnan Li, Dongxu Li, Caiming Xiong, and Steven Hoi. Blip: Bootstrapping language-image pre-training for unified vision-language understanding and generation. In International Conference on Machine Learning, pages 12888–12900. PMLR, 2022.
406
+
407
+ [19] Xiang Lisa Li and Percy Liang. Prefix-tuning: Optimizing continuous prompts for generation. In ACL/IJCNLP, 2021.
408
+
409
+ [20] Stephanie Lin, Jacob Hilton, and Owain Evans. Truthfulqa: Measuring how models mimic human falsehoods. arXiv preprint arXiv:2109.07958, 2021.
410
+
411
+ [21] Haotian Liu, Chunyuan Li, Qingyang Wu, and Yong Jae Lee. Visual instruction tuning. arXiv preprint arXiv:2304.08485, 2023.
412
+
413
+ [22] Xiao Liu, Kaixuan Ji, Yicheng Fu, Zhengxiao Du, Zhilin Yang, and Jie Tang. P-tuning v2: Prompt tuning can be comparable to fine-tuning universally across scales and tasks. CoRR, abs/2110.07602, 2021.
414
+
415
+ [23] Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
416
+
417
+ [24] Pan Lu, Swaroop Mishra, Tanglin Xia, Liang Qiu, Kai-Wei Chang, Song-Chun Zhu, Oyvind Tafjord, Peter Clark, and Ashwin Kalyan. Learn to explain: Multimodal reasoning via thought chains for science question answering. Advances in Neural Information Processing Systems, 35:2507–2521, 2022.
418
+
419
+ [25] Yuning Lu, Jianzhuang Liu, Yonggang Zhang, Yajing Liu, and Xinmei Tian. Prompt distribution learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), 2022.
420
+
421
+ [26] Gen Luo, Minglang Huang, Yiyi Zhou, Xiaoshuai Sun, Guannan Jiang, Zhiyu Wang, and Rongrong Ji. Towards efficient visual adaption via structural re-parameterization. arXiv preprint arXiv:2302.08106, 2023.
422
+
423
+ [27] Gen Luo, Yiyi Zhou, Xiaoshuai Sun, Yan Wang, Liujuan Cao, Yongjian Wu, Feiyue Huang, and Rongrong Ji. Towards lightweight transformer via group-wise transformation for vision-and-language tasks. IEEE Transactions on Image Processing, 31:3386–3398, 2022.
424
+
425
+ [28] Gen Luo, Yiyi Zhou, Xiaoshuai Sun, Yongjian Wu, Yue Gao, and Rongrong Ji. Towards language-guided visual recognition via dynamic convolutions. International Journal of Computer Vision, pages 1–19, 2023.
426
+
427
+ [29] Todor Mihaylov, Peter Clark, Tushar Khot, and Ashish Sabharwal. Can a suit of armor conduct electricity? a new dataset for open book question answering. Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing (EMNLP), 2018.
428
+
429
+ [30] Swaroop Mishra, Daniel Khashabi, Chitta Baral, Yejin Choi, and Hannaneh Hajishirzi. Reframing instructional prompts to gptk’s language. ACL Findings, 2021.
430
+
431
+ [31] Swaroop Mishra, Arindam Mitra, Neeraj Varshney, Bhavdeep Sachdeva, Peter Clark, Chitta Baral, and Ashwin Kalyan. Numglue: A suite of fundamental yet challenging mathematical reasoning tasks. The 60th Annual Meeting of the Association for Computational Linguistics (ACL), 2022.
432
+
433
+ [32] Ron Mokady, Amir Hertz, and Amit H Bermano. Clipcap: Clip prefix for image captioning. arXiv preprint arXiv:2111.09734, 2021.
434
+
435
+ [33] OpenAI. Chatgpt, 2023.
436
+
437
+ [34] OpenAI. Gpt-4 technical report, 2023.
438
+
439
+ [35] Long Ouyang, Jeffrey Wu, Xu Jiang, Diogo Almeida, Carroll Wainwright, Pamela Mishkin, Chong Zhang, Sandhini Agarwal, Katarina Slama, Alex Ray, et al. Training language models to follow instructions with human feedback. Advances in Neural Information Processing Systems, 35:27730–27744, 2022.
440
+
441
+ [36] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, Gretchen Krueger, and Ilya Sutskever. Learning transferable visual models from natural language supervision. In ICML, Proceedings of Machine Learning Research, 2021.
442
+
443
+ [37] Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. Language models are unsupervised multitask learners. OpenAI blog, 1(8):9, 2019.
444
+
445
+ [38] Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. J. Mach. Learn. Res., 21:140:1–140:67, 2020.
446
+
447
+ [39] Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Björn Ommer. High-resolution image synthesis with latent diffusion models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 10684–10695, 2022.
448
+
449
+ [40] Noam Shazeer. Glu variants improve transformer. arXiv preprint arXiv:2002.05202, 2020.
450
+ [41] Yongliang Shen, Kaitao Song, Xu Tan, Dongsheng Li, Weiming Lu, and Yueting Zhuang. Hugginggpt: Solving ai tasks with chatgpt and its friends in huggingface. arXiv preprint arXiv:2303.17580, 2023.
451
+ [42] Rohan Taori, Ishaan Gulrajani, Tianyi Zhang, Yann Dubois, Xuechen Li, Carlos Guestrin, Percy Liang, and Tatsunori B. Hashimoto. Stanford alpaca: An instruction-following llama model. https://github. com/tatsu-lab/stanford_alpaca, 2023.
452
+ [43] Hugo Touvron, Thibaut Lavril, Gautier Izacard, Xavier Martinet, Marie-Anne Lachaux, Timothée Lacroix, Baptiste Rozière, Naman Goyal, Eric Hambro, Faisal Azhar, et al. Llama: Open and efficient foundation language models. arXiv preprint arXiv:2302.13971, 2023.
453
+ [44] Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel R Bowman. Glue: A multi-task benchmark and analysis platform for natural language understanding. arXiv preprint arXiv:1804.07461, 2018.
454
+ [45] Yan Wang, Xiaojiang Liu, and Shuming Shi. Deep neural solver for math word problems. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing (EMNLP), pages 845–854, 2017.
455
+ [46] Yaqing Wang, Subhabrata Mukherjee, Xiaodong Liu, Jing Gao, Ahmed Hassan Awadallah, and Jianfeng Gao. Adamix: Mixture-of-adapter for parameter-efficient tuning of large language models. arXiv preprint arXiv:2205.12410, 2022.
456
+ [47] Yizhong Wang, Yeganeh Kordi, Swaroop Mishra, Alisa Liu, Noah A Smith, Daniel Khashabi, and Hannaneh Hajishirzi. Self-instruct: Aligning language model with self generated instructions. arXiv preprint arXiv:2212.10560, 2022.
457
+ [48] Yizhong Wang, Swaroop Mishra, Pegah Alipoormolabashi, Yeganeh Kordi, Amirreza Mirzaei, Anjana Arunkumar, Arjun Ashok, Arut Selvan Dhanasekaran, Atharva Naik, David Stap, et al. Benchmarking generalization via in-context instructions on $1 { , } 6 0 0 { + }$ language tasks. arXiv preprint arXiv:2204.07705, 2022.
458
+ [49] Chenfei Wu, Shengming Yin, Weizhen Qi, Xiaodong Wang, Zecheng Tang, and Nan Duan. Visual chatgpt: Talking, drawing and editing with visual foundation models. arXiv preprint arXiv:2303.04671, 2023.
459
+ [50] Zhengyuan Yang, Linjie Li, Jianfeng Wang, Kevin Lin, Ehsan Azarnasab, Faisal Ahmed, Zicheng Liu, Ce Liu, Michael Zeng, and Lijuan Wang. Mm-react: Prompting chatgpt for multimodal reasoning and action. arXiv preprint arXiv:2303.11381, 2023.
460
+ [51] Renrui Zhang, Jiaming Han, Aojun Zhou, Xiangfei Hu, Shilin Yan, Pan Lu, Hongsheng Li, Peng Gao, and Yu Qiao. Llama-adapter: Efficient fine-tuning of language models with zero-init attention. arXiv preprint arXiv:2303.16199, 2023.
461
+ [52] Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuohui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. Opt: Open pre-trained transformer language models. arXiv preprint arXiv:2205.01068, 2022.
462
+ [53] Zhuosheng Zhang, Aston Zhang, Mu Li, Hai Zhao, George Karypis, and Alex Smola. Multimodal chain-of-thought reasoning in language models. arXiv preprint arXiv:2302.00923, 2023.
463
+ [54] Kaiyang Zhou, Jingkang Yang, Chen Change Loy, and Ziwei Liu. Conditional prompt learning for vision-language models. In CVPR, 2022.
464
+ [55] Yiyi Zhou, Rongrong Ji, Xiaoshuai Sun, Jinsong Su, Deyu Meng, Yue Gao, and Chunhua Shen. Plenty is plague: Fine-grained learning for visual question answering. IEEE transactions on pattern analysis and machine intelligence, 44(2):697–709, 2019.
465
+ [56] Deyao Zhu, Jun Chen, Xiaoqian Shen, Xiang Li, and Mohamed Elhoseiny. Minigpt-4: Enhancing vision-language understanding with advanced large language models. arXiv preprint arXiv:2304.10592, 2023.
md/dev/um2BxfgkT2_/um2BxfgkT2_.md ADDED
@@ -0,0 +1,316 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Pure Transformers are Powerful Graph Learners
2
+
3
+ Jinwoo ${ \bf K i m ^ { 1 * } }$ Tien Dat Nguyen1 Seonwoo $\mathbf { M } \mathbf { i n } ^ { 2 }$ Sungjun Cho2 Moontae Lee2,3 Honglak Lee2† Seunghoon Hong1,2† 1KAIST $^ 2 \mathrm { L G }$ AI Research 3University of Illinois Chicago
4
+
5
+ # Abstract
6
+
7
+ We show that standard Transformers without graph-specific modifications can lead to promising results in graph learning both in theory and practice. Given a graph, we simply treat all nodes and edges as independent tokens, augment them with token embeddings, and feed them to a Transformer. With an appropriate choice of token embeddings, we prove that this approach is theoretically at least as expressive as an invariant graph network (2-IGN) composed of equivariant linear layers, which is already more expressive than all message-passing Graph Neural Networks (GNN). When trained on a large-scale graph dataset (PCQM4Mv2), our method coined Tokenized Graph Transformer (TokenGT) achieves significantly better results compared to GNN baselines and competitive results compared to Transformer variants with sophisticated graph-specific inductive bias. Our implementation is available at https://github.com/jw9730/tokengt.
8
+
9
+ # 1 Introduction
10
+
11
+ In recent years, Transformer [68] has served as a versatile architecture in a broad class of machine learning problems, such as natural language processing [17, 7], computer vision [18], and reinforcement learning [9], to name a few. It is because the fully-attentional structure of Transformer is general and powerful enough to take, process, and relate inputs and outputs of arbitrary structures, eliminating a need for data- and task-specific inductive bias to be baked into the network architecture. Combined with large-scale training, it opens up a new chapter for building a versatile model that can solve a wide range of problems involving diverse data modalities and even a mixture of modalities [31, 30, 57].
12
+
13
+ In graph learning domain, inspired by the breakthroughs, multiple works tried combining selfattention into graph neural network (GNN) architecture where message passing was previously dominant [50]. As global self-attention across nodes cannot reflect the graph structure, however, these methods introduce graph-specific architectural modifications. This includes restricting self-attention to local neighborhoods [69, 51, 19], using global self-attention in conjunction with message-passing GNN [58, 43, 34], and injecting edge information into global self-attention via attention bias [72, 78, 29, 54]. Despite decent performance, such modifications can be a limiting constraint in terms of versatility, especially considering future integration to multi-task and multi-modal general-purpose attentional architectures [31]. In addition, deviating from pure self-attention, these methods may inherit the issues of message-passing such as oversmoothing [40, 8, 52], and become incompatible with useful engineering techniques e.g., linear attention [65] developed for standard self-attention.
14
+
15
+ Instead, we explore the opposite direction of applying a standard Transformer directly for graphs. For this, we treat all nodes and edges as independent tokens, augment them with appropriate token-wise embeddings, and feed the tokens as input to the standard Transformer. The model operates identically to Transformers used in language and vision; each node or edge is treated as a token, identical to the words in a sentence or patches of an image [68, 18]. Perhaps surprisingly, we show that this simple approach yields a powerful graph learner both in theory and practice.
16
+
17
+ ![](images/52bed2530f5286429062a470732b4db3e662dccfbb005d25f54685df83e4fec4.jpg)
18
+ Figure 1: Overview of Tokenized Graph Transformer (TokenGT). We treat all nodes and edges of an input graph as independent tokens, augment them with orthonormal node identifiers and trainable type identifiers, and feed them to a standard Transformer encoder. For graph-level prediction, we follow the common practice [17, 18] of using an extra trainable [graph] token.
19
+
20
+ As a key theoretical result, we prove that with appropriate token-wise embeddings, self-attention over the node and edge tokens can approximate any permutation equivariant linear operator on a graph [47]. Remarkably, we show that a very simple choice of embedding composed of node identifiers and type identifiers is sufficient for accurate approximation. This provides a solid theoretical guarantee that, with the embeddings and enough attention heads, a Transformer is at least as expressive as a second-order invariant graph network (2-IGN) [47, 34], which is already more expressive than all message-passing GNNs [21]. This also immediately grants the model with the expressive power at least as good as the 2-dimensional Weisfeiler-Lehman (WL) graph isomorphism test [46], which is often sufficient for real-world graph data [83]. We further extend our theoretical result to hypergraphs with order- $k$ hyperedges, showing that a Transformer with order- $k$ generalized token embeddings is at least as expressive as $k$ -IGN and, consequently $k$ -WL test.
21
+
22
+ We test our model, named Tokenized Graph Transformer (TokenGT), mainly on the PCQM4Mv2 large-scale quantum chemical property prediction dataset containing 3.7M molecular graphs [27]. Even though TokenGT involves minimal graph-specific architectural modifications, it performs significantly better than all GNN baselines, showing that the advantages of Transformer architecture combined with large-scale training surpass the benefit of hard inductive bias of GNNs. Furthermore, TokenGT achieves competitive performance compared to Transformer variants with strong graphspecific modifications [78, 29, 54]. Finally, we demonstrate that TokenGT can naturally utilize efficient approximations in Transformers in contrast to these variants, using kernel attention [11] that enables linear computation cost without much degradation in performance.
23
+
24
+ # 2 Tokenized Graph Transformer (TokenGT)
25
+
26
+ In this section, we present the Tokenized Graph Transformer (TokenGT), a pure Transformer architecture for graphs with token-wise embeddings composed of node identifiers and type identifiers (Figure 1). Our goal in this section is to provide a practical overview – for theoretical analysis of the architecture, we guide the readers to Section 3.
27
+
28
+ Let $\mathcal { G } = ( \nu , \mathcal { E } )$ an input graph with $n$ nodes $\mathcal { V } = \{ v _ { 1 } , . . . , v _ { n } \}$ and $m$ edges $\mathcal { E } = \{ e _ { 1 } , . . . , e _ { m } \} \subseteq$ $\mathcal { V } ^ { 2 }$ , associated with features $\mathbf { X } ^ { \nu } \in \mathbb { R } ^ { n \times C }$ and ∈ Rm×C , respectively. We treat each node and edge as an independent token (thus $( n + m )$ tokens in total) and construct their features by $\mathbf { X } = [ \bar { \mathbf { X } } ^ { \nu } ; \mathbf { X } ^ { \varepsilon } ] \in \mathbb { R } ^ { ( n + m ) \times C }$ . A naïve way to process a graph is to directly provide the tokens $\mathbf { X }$ as input to a Transformer, but it is inappropriate as graph connectivity is discarded. To thoroughly represent graph structure, we augment the tokens $\mathbf { X }$ with token-wise embeddings, more specifically orthonormal node identifiers used for representing the connectivity of the tokens and trainable type identifiers that encode whether a token is a node or an edge. Despite the simplicity, we show that a Transformer applied on these embeddings is a theoretically powerful graph learner.
29
+
30
+ Node Identifiers The first component of token-wise embedding is the orthonormal node identifier that we use to represent the connectivity structure given in the input graph.
31
+
32
+ For a given input graph $\mathcal { G } = ( \nu , \mathcal { E } )$ , we first produce $n$ node-wise orthonormal vectors $\mathbf { P } \in \mathbb { R } ^ { n \times d _ { p } }$ that we refer to as node identifiers. Then, we augment the tokens $\mathbf { X }$ with node identifiers as follows.
33
+
34
+ • For each node $v \in \mathcal V$ , we augment the token $\mathbf { X } _ { v }$ as $\big [ \mathbf { X } _ { v } , \mathbf { P } _ { v } , \mathbf { P } _ { v } \big ]$ .
35
+ • For each edge $( u , v ) \in \mathcal { E }$ , we augment the token $\mathbf { X } _ { ( u , v ) }$ as $[ \mathbf { X } _ { ( u , v ) } , \mathbf { P } _ { u } , \mathbf { P } _ { v } ]$ .
36
+
37
+ Intuitively, a Transformer operating on the augmented tokens can fully recognize the connectivity structure of the graph since comparing the node identifiers between a pair of tokens reveals their incidence information. For instance, we can tell if an edge $\boldsymbol { e } = \left( u , v \right)$ is connected with a node $k$ through dot-product (attention) since $[ { \bf P } _ { u } , { \bf P } _ { v } ] [ { \bf P } _ { k } , { \bf P } _ { k } ] ^ { \top } = 1$ if and only if $k \in \mathsf { \Gamma } ( u , v )$ and 0 otherwise. This allows the Transformer to identify and exploit the connectivity structure of a graph, for instance by putting more weights on incident pairs when the local operation is important.
38
+
39
+ Notably, as the node identifiers $\mathbf { P }$ are only required to be orthonormal, we have a large degree of freedom in implementation choices. We outline two practical methods below as examples. Their implementation details can be found in Appendix A.3.1.
40
+
41
+ • Orthogonal random features (ORFs), e.g., rows of random orthogonal matrix $\mathbf { Q } \in \mathbb { R } ^ { n \times n }$ obtained with QR decomposition of random Gaussian matrix $\mathbf { G } \in \mathbb { R } ^ { n \times n }$ [79, 12]. • Laplacian eigenvectors obtained from eigendecomposition of graph Laplacian matrix, i.e., rows of U from $ { \Delta } = { \mathbf { I } } - { \mathbf { D } } ^ { - 1 / 2 } { \mathbf { A } } { \mathbf { D } } ^ { - 1 / 2 } = { \mathbf { U } } ^ { \top } { \mathbf { A } } \bar { { \mathbf { U } } }$ , where $\mathbf { A } \in \mathbb { R } ^ { n \times n }$ is adjacency matrix, $\mathbf { D }$ is degree matrix, and $\pmb { \Lambda }$ , U correspond to eigenvalues and eigenvectors respectively [20].
42
+
43
+ Among the two methods, node identifiers generated as ORFs do not encode any information about the graph structure as they are entirely random. This means the Transformer that operates on the ORF-based node identifiers needs to compile and recognize graph structure only from the incidence information provided by the node identifiers. Although this is challenging, perhaps surprisingly, we empirically show in Section 5 that Transformers are strong enough to learn meaningful structural representations out of ORF-based node identifiers and outperform GNNs on large-scale task.
44
+
45
+ In contrast to ORFs, Laplacian eigenvectors provide a kind of graph positional embeddings (graph PEs) that describes the distance between nodes on a graph. Due to the positional information, it yields better performance compared to ORFs in our experiments in Section 5. One interesting aspect of Laplacian eigenvectors is that they can be viewed as a generalization of sinusoidal positional embeddings of NLP Transformers to graphs, as the eigenvectors of 1D chain graphs are sine and cosine functions [20]. Thus, by choosing Laplacian eigenvectors as node identifiers, our approach can be interpreted as a direct extension of the NLP Transformer for inputs involving relational structures.
46
+
47
+ Type Identifiers The second component of token-wise embedding is the trainable type identifier that encodes whether a token is node or edge. For a given input graph $\mathcal { G } = ( \nu , \mathcal { E } )$ , we first prepare a trainable parameter matrix ${ \bf E } = [ { \bf E } ^ { \nu } ; { \bf E } ^ { \varepsilon } ] \in \mathbb { R } ^ { 2 \times d _ { e } }$ that contains two type identifiers $\mathbf { E } ^ { \nu }$ and $\mathbf { E } ^ { \mathcal { E } }$ for nodes and edges respectively. Then, we further augment the tokens with type identifiers as follows.
48
+
49
+ • For each node $v \in \mathcal V$ , we augment the token $[ \mathbf { X } _ { v } , \mathbf { P } _ { v } , \mathbf { P } _ { v } ]$ as $[ \mathbf { X } _ { v } , \mathbf { P } _ { v } , \mathbf { P } _ { v } , \mathbf { E } ^ { \nu } ]$ .
50
+ • For each edge $( u , v ) \in \mathcal { E }$ , we augment the token $[ \mathbf { X } _ { ( u , v ) } , \mathbf { P } _ { u } , \mathbf { P } _ { v } ]$ as $[ \mathbf { X } _ { ( u , v ) } , \mathbf { P } _ { u } , \mathbf { P } _ { v } , \mathbf { E } ^ { \mathcal { E } } ]$ .
51
+
52
+ These embeddings provide information on whether a given token is a node or an edge, which is critical, e.g., when an attention head tries to attend specifically to node tokens and ignore edge tokens.
53
+
54
+ Main Transformer With node identifiers and type identifiers, we obtain augmented token features $\mathbf { X } ^ { i n } \in \mathbb { R } ^ { ( n + m ) \times ( C + 2 d _ { p } + d _ { e } ) }$ , which is further projected by a trainable matrix $\overline { { w } } ^ { i n } \in \mathbb { R } ^ { ( C + 2 d _ { p } + d _ { e } ) \times d }$ to be an input to Transformer. For graph-level prediction, we prepend a special token [graph] with trainable embedding $\mathbf { X } _ { [ \mathrm { g r a p h } ] } \mathbf { \bar { \Pi } } \in \mathbf { \bar { \Pi } } \mathbb { R } ^ { d }$ similar to BERT [17] and ViT [18]. We utilize the feature of [graph] token at the output of the encoder as the graph representation, on which a linear prediction head is applied to produce the final graph-level prediction. Overall, the tokens ${ \bf Z } ^ { ( 0 ) } = [ { \bf X } _ { [ \mathrm { g r a p h } ] } ; { \bf X } ^ { i n } w ^ { i n } ] \bar { \in } \mathbb { R } ^ { ( 1 + n \bar { + } m ) \times d }$ are used as the input to the main encoder. As an encoder, we adopt the standard Transformer [68], which is an alternating stack of multihead self-attention layers (MSA) and feedforward MLP layers. We provide further details in Appendix A.1.1.
55
+
56
+ Inductive Bias Similar to Transformers in language and vision [17, 18], Tokenized Graph Transformer treats input nodes and edges as independent tokens and applies self-attention to them. This approach leads to much less inductive bias than current GNNs, where the sparse graph structure, or more fundamentally, permutation symmetry of graphs is deliberately baked into each layer [21, 47, 46, 34]. For TokenGT, such information is provided entirely as a part of input using token-wise embeddings, and the model has to learn how to interpret and utilize the information from data. Although such weak inductive bias might raise questions on the expressiveness of the model, our theoretical analysis in Section 3 shows that TokenGT is a powerful graph learner thanks to the token-wise embeddings and expressive power of self-attention. For example, we show that TokenGT is more expressive than all message-passing GNNs under the framework of Gilmer et al. (2017) [21].
57
+
58
+ # 3 Theoretical Analysis
59
+
60
+ We now present our theory. Our key result is that TokenGT, a standard Transformer with node and type identifiers presented in Section 2, is provably at least as expressive as the second-order Invariant Graph Network (2-IGN [47]), which is built upon all possible permutation equivariant linear layers on a graph. This provides solid theoretical guarantees for TokenGT, such as being at least as powerful as the 2-WL graph isomorphism test and more expressive than all message-passing GNNs. Our theory is based on a general framework on hypergraphs represented as higher-order tensors, which leads to the formulation of order- $k$ TokenGT that is at least as expressive as order- $k$ IGN $k$ -IGN [47]).
61
+
62
+ # 3.1 Preliminary: Permutation Symmetry and Invariant Graph Networks
63
+
64
+ Representing and Processing Sets and (Hyper)Graphs For a set of $n$ nodes, we often represent their features as $\mathbf { X } \in \mathbb { R } ^ { n \times d }$ where $\mathbf { X } _ { i } \in \mathbb { R } ^ { d }$ is the feature of the $i$ -th node. The set is unordered and, therefore, should be treated invariant to the renumbering of the nodes. Let $S _ { n }$ the symmetric group or the group of permutations $\pi$ on $[ n ] = \{ 1 , . . . , n \}$ . By $\pi \cdot \mathbf { X }$ we denote permuting rows of $\mathbf { X }$ with $\pi$ , i.e., $( \pi \cdot \mathbf { \bar { X } } ) _ { i } = \mathbf { X } _ { \pi ^ { - 1 } ( i ) } .$ . Here, $\mathbf { X }$ and $\pi \cdot \mathbf { X }$ represent the identical set for all $\pi \in S _ { n }$ .
65
+
66
+ Generally, we consider (hyper)graphs represented as order- $k$ tensor $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ with feature $\mathbf { X _ { i } } =$ $\mathbf { X } _ { i _ { 1 } , \dots , i _ { k } } \in \mathbb { R } ^ { d }$ attached to (hyper)edge represented as multi-index $\mathbf { i } = ( i _ { 1 } , . . . , i _ { k } ) \in [ n ] ^ { k }$ . Similar to sets, the tensor should be treated invariant to node renumbering by any $\pi \in S _ { n }$ that acts on $\mathbf { X }$ by $( { \boldsymbol { \pi } } \cdot \mathbf { X } ) _ { \mathbf { i } } = \mathbf { X } _ { \pi ^ { - 1 } ( \mathbf { i } ) }$ where $\pi ^ { - 1 } ( \mathbf { i } ) = ( \pi ^ { - 1 } ( i _ { 1 } ) , . . . , \pi ^ { - 1 } ( i _ { k } ) )$ . That is, $\mathbf { X }$ and $\pi \cdot { \bf X }$ represent the identical (hyper)graph for all $\pi$ . Due to such symmetry, to build a function $F ( \mathbf { X } ) \approx T$ for tensor $\mathbf { X }$ and target $T$ , a suitable way is to make them invariant ${ \bf { \dot { F } } } ( \pi \cdot { \bf { X } } ) = F ( { \bf { X } } )$ when the target is a vector or equivariant $F ( { \boldsymbol \pi } \cdot \mathbf { X } ) = { \boldsymbol \pi } \cdot F ( \mathbf { X } )$ when the target is also a tensor, for all $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ and $\pi \in S _ { n }$
67
+
68
+ In our theoretical analysis, we work on order- $k$ dense tensor representation $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ of a graph as they can represent node features $ { \left( k = 1 \right. }$ ), edge features $k = 2$ ), or hyperedge features $( k > 2 )$ ) in a unified manner. This is interchangeable but slightly different from the sparse representation of a graph with edge set $\mathcal { E }$ used in Section 2. Nevertheless, in Section 5 we empirically verify that our key theoretical findings work equally well for dense and sparse graphs.
69
+
70
+ Invariant Graph Network We mainly develop our theoretical analysis upon Invariant Graph Networks (IGNs) [47, 46], a family of expressive graph networks derived from the permutation symmetry of tensor representation of graphs. Here we provide a summary. In general, we define:
71
+
72
+ Definition 1. An order- $k$ Invariant Graph Network ( $k$ -IGN) is a function $F _ { k } : \mathbb { R } ^ { n ^ { k } \times d _ { 0 } } \mathbb { R }$ written as the following:
73
+
74
+ $$
75
+ F _ { k } = \mathbf { M } \mathbf { L } \mathbf { P } \circ L _ { k 0 } \circ L _ { k k } ^ { ( T ) } \circ \sigma \circ \dots \circ \sigma \circ L _ { k k } ^ { ( 1 ) } ,
76
+ $$
77
+
78
+ where each L(t) is equivariant linear layer [47] from $\mathbb { R } ^ { n ^ { k } \times d _ { t - 1 } }$ to $\mathbb { R } ^ { n ^ { k } \times d _ { t } }$ , $\sigma$ is activation function, and $L _ { k 0 }$ is a invariant linear layer from $\mathbb { R } ^ { n ^ { k } \times d _ { T } } t o \mathbb { R }$ .
79
+
80
+ A body of previous work have shown appealing theoretical properties of $k$ -IGN, including universal approximation [48] and alignment to $k$ -Weisfeiler-Lehman ( $k$ -WL) graph isomorphism test [46, 10]. In particular, it is known that $k$ -IGNs are theoretically at least as powerful as the $k$ -WL test [46]. It is also known that 2-IGNs are already more expressive [47, 34] than all message-passing GNNs under the framework of Gilmer et al. (2017) [21].
81
+
82
+ The core building block of IGN is invariant and equivariant linear layers [47] with maximal expressiveness while respecting node permutation symmetry. The layers are defined as follows:
83
+
84
+ Definition 2. An equivariant linear layer is a function $L _ { k \to l } : \mathbb { R } ^ { n ^ { k } \times d } \mathbb { R } ^ { n ^ { l } \times d ^ { \prime } }$ written as follows for order-k input X ∈ Rnk×d:
85
+
86
+ $$
87
+ L _ { k \to l } ( { \bf X } ) _ { \bf i } = \sum _ { \mu } \sum _ { { \bf j } } { \bf B } _ { { \bf i } , { \bf j } } ^ { \mu } { \bf X } _ { { \bf j } } w _ { \mu } + \sum _ { \lambda } { \bf C } _ { { \bf i } } ^ { \lambda } b _ { \lambda } ,
88
+ $$
89
+
90
+ where $\mathbf { i } \in [ n ] ^ { l } , \mathbf { j } \in [ n ] ^ { k }$ are multi-indices, $w _ { \boldsymbol { \mu } } \in \mathbb { R } ^ { d \times d ^ { \prime } }$ , $b _ { \lambda } \in \mathbb { R } ^ { d ^ { \prime } }$ are weight and bias parameters, and Bµ ∈ Rnl+k and $\mathbf { C } ^ { \lambda } \in \mathbb { R } ^ { n ^ { l } }$ are binary basis tensors corresponding to order- $( l + k )$ and order- $l$ equivalence classes $\mu$ and $\lambda$ , respectively. Invariant linear layer is a special case of $L _ { k l }$ with $l = 0$ .
91
+
92
+ We provide the definition of the equivalence classes and basis tensors in Appendix A.1.1. For now, it is sufficient to know that the basis tensors are binary tensors that form the orthogonal basis of the full space of linear equivariant layers. In general, in Eq. (2) it is known that there exists $\mathrm { b e l l } ( k + l )$ number of basis tensors $\mathbf { B } ^ { \mu }$ for the weight and $\mathsf { b e l l } ( l )$ number of basis tensors $\mathbf { C } ^ { \lambda }$ for the bias.
93
+
94
+ # 3.2 Can Self-Attention Approximate Equivariant Basis?
95
+
96
+ Now, we present an intuition that connects Transformer (Section 2) and equivariant linear layer (Definition 2). For that, we write out the multihead self-attention layer as follows:
97
+
98
+ $$
99
+ \mathbf { M S A } ( \mathbf { X } ) _ { i } = \sum _ { h = 1 } ^ { H } \sum _ { j } \alpha _ { i j } ^ { h } \mathbf { X } _ { j } w _ { h } ^ { V } w _ { h } ^ { O } \mathrm { ~ w h e r e ~ } \alpha ^ { h } = \mathrm { s o f t m a x } \left( \frac { \mathbf { X } w _ { h } ^ { Q } ( \mathbf { X } w _ { h } ^ { K } ) ^ { \top } } { \sqrt { d _ { H } } } \right) ,
100
+ $$
101
+
102
+ where $H$ is number of heads, $d _ { H }$ is head size, and $w _ { h } ^ { Q } , w _ { h } ^ { K } \in \mathbb R ^ { d \times d _ { H } } , w _ { h } ^ { V } \in \mathbb R ^ { d \times d _ { v } } w _ { h } ^ { O } \in \mathbb R ^ { d _ { v } \times d } .$
103
+
104
+ Our intuition is that the weighted sum of values with self-attention matrix $\alpha ^ { h }$ in Eq. (3) is analogous to the masked sum with basis tensor $\mathbf { B } ^ { \mu }$ in Eq. (2) up to normalization. This naturally leads to the following question: for a given equivariant layer $L _ { k \to k } : \mathbb { R } ^ { n ^ { k } \times d } \to \mathbb { R } ^ { n ^ { k } \times d }$ , can we use a Transformer layer with multihead self-attention $\mathbf { M S A } : \mathbb { R } ^ { N \times d ^ { \prime } } \mathbb { R } ^ { N \times d ^ { \prime } }$ with $N = n ^ { k }$ to accurately approximate $L _ { k k }$ by having $H = { \mathsf { b e l l } } ( 2 k )$ attention heads approximate each equivariant basis $\mathbf { B } ^ { \mu }$ ?
105
+
106
+ We show that this can be possible, but only if we provide appropriate auxiliary information to input. For example, let us consider first-order layer $L _ { 1 1 }$ . The layer has ${ \mathsf { b e l l } } ( 2 ) = 2$ basis tensors $\mathbf { B } ^ { \mu _ { 1 } } = \mathbf { I }$ and $\mathbf { B } ^ { \mu _ { 2 } } = \mathbf { 1 1 } ^ { \top } - \mathbf { I }$ for the weight, and bel $1 ( 1 ) = 1$ basis tensor $\mathbf { C } ^ { \lambda _ { 1 } } = \mathbf { 1 }$ for the bias. Given an input set $\mathbf { X } \in \mathbb { R } ^ { n \times d }$ it computes the following with $w _ { 1 } , w _ { 2 } \in \mathbb { R } ^ { d \times d }$ , $b \in \mathbb { R } ^ { d }$ :
107
+
108
+ $$
109
+ L _ { 1 \to 1 } ( \mathbf { X } ) = \mathbf { I } \mathbf { X } w _ { 1 } + ( \mathbf { 1 1 } ^ { \top } - \mathbf { I } ) \mathbf { X } w _ { 2 } + \mathbf { 1 } b ^ { \top } .
110
+ $$
111
+
112
+ Now consider approximating basis tensor $\mathbf { B } ^ { \mu _ { 1 } } = \mathbf { I }$ with an attention matrix $\alpha ^ { 1 }$ . The approximation is accurate when $i$ -th query always only attends to $i$ -th key and ignores the rest. To achieve the attention structure consistently, i.e., agnostic to input $\mathbf { X }$ , we need to provide auxiliary input that self-attention can "latch onto" to faithfully approximate ${ \pmb { \alpha } } ^ { 1 } \approx { \bf I }$ . Without this, attention must entirely rely on the inputs $\mathbf { X }$ , which is unreliable and can lead to approximation failure, e.g., when $\mathbf { X }$ has repeated rows.
113
+
114
+ For the auxiliary information, we prepare $n$ node-wise orthonormal vectors $\mathbf { P } \in \mathbb { R } ^ { n \times d _ { p } }$ (note that this is identical to node identifiers in Section 2), and augment the input to $\mathbf { X } ^ { i n } = [ \mathbf { X } , \mathbf { P } ] \in \mathbb { R } ^ { n \times ( d + d _ { p } ) }$ . Let us assume that the query and key projections in Eq. (3) ignore $\mathbf { X }$ and only leave $\mathbf { P }$ scaled by $\sqrt { a }$ with $a > 0$ . Then attention matrix is computed as $\bar { \mathbf { \alpha } } ^ { 1 } = \bar { \mathrm { s o f t m a x } } ( \mathbf { S } )$ where $\mathbf { S } _ { i j } = a \mathbf { P } _ { i } ^ { \top } \mathbf { P } _ { j }$ . Here, due to the orthonormality of $\mathbf { P }$ , we have ${ \bf P } _ { i } ^ { \top } { \bf P } _ { j } = 1$ only if $i = j$ and otherwise 0, which leads to $\mathbf { S } = a \mathbf { I }$ . With $a \infty$ by scaling up the query and key projection weights, the softmax becomes arbitrarily close to the hardmax operator, and we obtain the following:
115
+
116
+ $$
117
+ \alpha ^ { 1 } = \operatorname { s o f t m a x } ( a \mathbf { I } ) \to \mathbf { I } \operatorname { a s } a \to \infty .
118
+ $$
119
+
120
+ Thus, self-attention can utilize the auxiliary information $\mathbf { P }$ to achieve an input-agnostic approximation of $\alpha ^ { 1 }$ to I. Notably, we can achieve a similar approximation for $\mathbf { B } ^ { \mu _ { 2 } } = \mathbf { \bar { 1 1 } } ^ { \top } - \mathbf { I }$ using the same $\mathbf { P }$ by flipping the sign of keys, which gives $\pmb { \alpha } ^ { 2 } = \mathrm { s o f t m a x } ( - a \mathbf { I } )$ due to orthonormality. By sending $a \to \infty$ , now attention from the $i$ -th query to the $i$ -th key is suppressed, and we obtain the following:
121
+
122
+ $$
123
+ \alpha ^ { 2 } = \operatorname { s o f t m a x } \left( - a \mathbf { I } \right) \to { \frac { 1 } { n - 1 } } ( \mathbf { 1 1 } ^ { \top } - \mathbf { I } ) { \mathrm { ~ a s ~ } } a \to \infty .
124
+ $$
125
+
126
+ Note that this approximation is accurate only up to row normalization as rows of $\alpha ^ { 2 }$ always sum to one due to softmax, while $\mathbf { B } ^ { \mu _ { 2 } } = \mathbf { 1 1 } ^ { \top } - \bar { \mathbf { I } }$ is binary. In our proofs of the theoretical results, we perform appropriate denormalization with MLP after MSA to achieve an accurate approximation.
127
+
128
+ Overall, we see that simple auxiliary input $\mathbf { P }$ suffices for two attention heads to approximate the equivariant basis of $L _ { 1 1 }$ accurately. We now question the following. Given appropriate auxiliary information as input, can a Transformer layer with bell $( 2 k )$ attention heads accurately approximate $L _ { k k }$ by having each head approximate each equivariant basis $\mathbf { B } ^ { \mu } ?$ What would be the sufficient auxiliary input? We answer the question by showing that, with (order- $k$ generalized) node and type identifiers presented in Section 2, Transformer layers can accurately approximate equivariant layers $L _ { k k }$ via input-agnostic head-wise approximation of each equivariant basis.
129
+
130
+ # 3.3 Pure Transformers are Powerful Graph Learners
131
+
132
+ We now present our main theoretical results that extend the discussions in Section 3.2 to any order $k$ . Note that $k = 2$ corresponds to TokenGT for graphs presented in Section 2. With $k > 2$ , we naturally extend TokenGT to hypergraphs. All proofs can be found in Appendix A.1.
133
+
134
+ We first introduce generalized node and type identifiers (Section 2) for order- $k$ tensors $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ We define the node identifier $\mathbf { P } \in \mathbb { R } ^ { n \times d _ { p } }$ as an orthonormal matrix with $n$ rows, and the type identifier as a trainable matrix $\mathbf { E } \in \mathbb { R } ^ { \mathrm { b e l l } ( k ) \times d _ { e } }$ that contains $\mathsf { b e l l } ( k )$ rows $\mathbf { E } ^ { \gamma _ { 1 } } , . . . , \mathbf { E } ^ { \gamma _ { \mathrm { b e l l } } ( k ) }$ , each of which is designated for an order- $k$ equivalence class $\gamma$ . Then, we augment each entry of input tensor as $[ \mathbf { X } _ { i _ { 1 } , . . . , i _ { k } } , \mathbf { \bar { P } } _ { i _ { 1 } } , . . . , \mathbf { P } _ { i _ { k } } , \mathbf { E } ^ { \gamma } ]$ where $( i _ { 1 } , . . . , i _ { k } ) \in \gamma$ .
135
+
136
+ Let us exemplify. For $k = 1$ (sets), each $i$ -th entry is augmented as $\left[ { \bf X } _ { i } , { \bf P } _ { i } , { \bf E } ^ { \gamma _ { 1 } } \right]$ , consistent with our discussion in Section 3.2. For $k = 2$ (graphs), each $( i , i )$ -th entry is augmented as $\left[ { \bf X } _ { i i } , { \bf P } _ { i } , { \bf P } _ { i } , { \bf E } ^ { \gamma _ { 1 } } \right]$ and each $( i , j )$ -th entry $( i \neq j )$ is augmented as $[ { \bf X } _ { i j } , { \bf P } _ { i } , { \bf P } _ { j } , { \bf E } ^ { \gamma _ { 2 } } ]$ . This is consistent with TokenGT in Section 2, which augments nodes with $\mathbf { E } ^ { \nu } = \mathbf { E } ^ { \tilde { \gamma } _ { 1 } }$ and edges with $\mathbf { E } ^ { \mathcal { E } } = \mathbf { E } ^ { \gamma _ { 2 } }$ .
137
+
138
+ With node and type identifiers, we obtain augmented order- $k$ tensor $\mathbf { X } ^ { i n } \in \mathbb { R } ^ { n ^ { k } \times ( d + k d _ { p } + d _ { e } ) }$ . We use a trainable projection $w ^ { i n } \in \mathbb { R } ^ { ( d + k d _ { p } + d _ { e } ) \times d \tau }$ to map them to hidden dimension $d \tau$ of a Transformer. We now show that self-attention on $\mathbf { X } ^ { i n } w ^ { i n }$ can accurately approximate equivariant basis:
139
+
140
+ Lemma 1. For all $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ and their augmentation $\mathbf { X } ^ { i n }$ , self-attention coefficients $\pmb { \alpha } ^ { h }$ (Eq. (3)) computed with $\mathbf { X } ^ { i n } w ^ { i n }$ can approximate any basis tensor $\mathbf { B } ^ { \mu } \in \mathbb { R } ^ { n ^ { 2 k } }$ of order- $k$ equivariant linear layer $L _ { k k }$ (Definition 2) to arbitrary precision up to normalization.
141
+
142
+ Consequently, with the node and type identifiers, a collection of bell $( 2 k )$ attention heads can approximate the collection of all basis tensors of order- $k$ equivariant layer. This leads to the following:
143
+
144
+ Theorem 1. For all $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ and their augmentation $\mathbf { X } ^ { i n }$ , a Transformer layer with bell $( 2 k )$ self-attention heads that operates on $\mathbf { X } ^ { i n } w ^ { i n }$ can approximate an order- $k$ equivariant linear layer $L _ { k \to k } ( \mathbf X )$ (Definition 2) to arbitrary precision.
145
+
146
+ While the approximation in Lemma 1 is only accurate up to normalization over inputs (keys) due to softmax normalization, for the approximation in Theorem 1 we perform appropriate denormalization using MLP after multihead self-attention and can obtain an accurate approximation.
147
+
148
+ By extending the result to multiple layers, we arrive at the following:
149
+
150
+ Theorem 2. For all $\mathbf { X } \in \mathbb { R } ^ { n ^ { k } \times d }$ and their augmentation $\mathbf { X } ^ { i n }$ , a Transformer composed of $T$ layers that operates on $\mathbf { X } ^ { i n } w ^ { i n }$ followed by sum-pooling and MLP can approximate an $k$ -IGN $F _ { k } ( \mathbf { X } )$ (Definition 1) to arbitrary precision.
151
+
152
+ This directly leads to the following corollary:
153
+
154
+ Corollary 1. A Transformer on node and type identifiers in Theorem 2 is at least as expressive as $k$ -IGN composed of order- $k$ equivariant linear layers.
155
+
156
+ Corollary 1 allows us to draw previous theoretical results on the expressiveness of $k$ -IGN [46, 47, 34] and use them to lower-bound the provable expressiveness of a standard Transformer:
157
+
158
+ Corollary 2. A Transformer on node and type identifiers in Theorem 2 is at least as powerful as $k$ -WL graph isomorphism test and is more expressive than all message-passing GNNs within the framework of Gilmer et al. (2017) [21].
159
+
160
+ # 4 Related Work
161
+
162
+ We outline relevant work including equivariant neural networks, theory on expressive power of Transformers and their connection to modeling equivariance, and Transformers for graphs.
163
+
164
+ Equivariant Neural Networks A machine learning task is often invariant or equivariant to specific symmetry of input data, e.g., image classification is invariant to the translation of an input image. A large body of literature advocated baking the invariance or equivariance into a neural network as a type of inductive bias (e.g., translation equivariance of image convolution), showing that it reduces the number of parameters and improves generalization for a wide range of learning tasks involving various geometric structures [13, 14, 73, 66, 49, 53, 60, 6, 34, 39]. Ravanbakhsh et al. (2017) [56] showed that any equivariant layer for discrete group actions is equivalent to a specific parameter sharing structure. Zaheer et al. (2017) [82] and Maron et al. (2019) [47] derived the parameter sharing for node permutation-symmetric data (sets and (hyper)graphs), which gives the maximally expressive equivariant linear layers and $k$ -IGN in Section 3.1. The work on equivariant neural networks underlie our theory of how a standard Transformer can be a powerful learner for sets and (hyper)graphs.
165
+
166
+ Expressive Power of Transformers and Its Connection to Equivariance Recent work involving Transformers often focus on minimizing the domain- and task-specific inductive bias and scaling the model and data so that any useful computation structure can be learned [18, 31, 30, 7, 17, 9, 39]. The success of this approach is, to some degree, attributed to the high expressive power of Transformers that allows learning diverse functions suited for the data at hand [81, 39, 3, 4, 41]. Recent theory has shown that Transformers are expressive enough to even model certain equivariant functions [1, 15, 39]. Andreoli et al. (2019) [1] cast self-attention and convolution into a unified framework using basis tensors similar to ones in Section 3.1. Cordonnier et al. (2020) [15] advanced the idea and showed that Transformers with relative positional encodings can approximate any image convolution layers. Lee et al. (2019) [39] and Kim et al. (2021) [34] showed that Transformers can model equivariant linear layers for sets [82], which can be viewed as the first-order case of our theory (see Section 3.2). To our knowledge, our work is the first to show that standard Transformers are expressive enough to provably model maximally expressive equivariant layers and $k$ -IGN for (hyper)graphs with $k \geq 2$ .
167
+
168
+ Transformers for Graphs Unlike in language and vision, developing Transformers for graphs is challenging due to (1) the presence of edge connectivity and (2) the absence of canonical node ordering that prevents adopting simple positional encodings [50]. To incorporate the connectivity of edges, early methods restricted self-attention to local neighborhoods (thus reducing to messagepassing) [19, 51, 69] or used global self-attention with auxiliary message-passing modules [58, 43]. As message-passing suffers from limited expressive power [77] and oversmoothing [40, 8, 52], recent works often discard them and use global self-attention on nodes with heuristic modifications to process edges [78, 29, 54, 38, 42]. Ying et al. (2021) [78] proposed to inject edge encoding based on shortest paths through self-attention bias. Kreuzer et al. (2021) [38] proposed to incorporate edges into self-attention matrix via elementwise multiplication. On the contrary, we leave the self-attention unmodified and provide both nodes and edges with certain token-wise embeddings (Section 2) as its input. To incorporate graph structure into nodes, on the other hand, some approaches focus on developing graph positional encoding, e.g., based on Laplacian eigenvectors [20, 42, 38]. While these can be directly incorporated into our work via auxiliary node identifiers for better performance, we leave this as future work. We further note that current graph Transformers that utilize Laplacian positional encoding rely heavily on heuristic edge encoding [29, 38] while ours does not. Another closely related approach is the Higher-order Transformer [34] which generalizes $k$ -IGN with masked self-attention. While it is highly complex to implement due to hard-coded head-wise equivariant masks, our method can be implemented effortlessly using any available implementation of standard Transformer. Furthermore, our method is more flexible as the model can choose to use different attention heads to focus on a specific equivariant operator (e.g., local propagation) if needed. We further discuss the difficulty in applying linear attention to graph Transformers in Appendix A.2.
169
+
170
+ # 5 Experiments
171
+
172
+ We first conduct a synthetic experiment that directly confirms our key claims in Lemma 1 (Section 3). Then, we empirically explore the capability of Tokenized Graph Transformer (TokenGT) (Section 2) using the PCQM4Mv2 large-scale quantum chemistry regression dataset [27]. We further present experiments on transductive node classification datasets involving large graphs in Appendix A.4.3.
173
+
174
+ Table 1: Second-order equivariant basis approximation. We report average and standard deviation of L2 error averaged over heads over 3 runs. For Random/ORF (first-order), we sample random embeddings independently for each token.
175
+
176
+ <table><tr><td rowspan="2">node id.</td><td rowspan="2">type id.</td><td colspan="2">dense input</td><td colspan="2">sparse input</td></tr><tr><td>train L2↓</td><td>test L2↓</td><td>train L2↓</td><td>test L2↓</td></tr><tr><td>×</td><td>×</td><td>47.95± 0.600</td><td>53.93 ± 1.426</td><td>29.88±0.450</td><td>34.70±1.167</td></tr><tr><td>×</td><td>O</td><td>32.38± 0.448</td><td>40.06±1.202</td><td>15.92 ± 0.275</td><td>20.39±0.765</td></tr><tr><td>Random (first-order)</td><td>0</td><td>32.19 ± 0.476</td><td>32.49 ± 3.687</td><td>15.87 ± 0.247</td><td>16.56 ± 0.904</td></tr><tr><td>ORF (first-order)</td><td>0</td><td>32.35 ± 0.369</td><td>39.87 ± 1.263</td><td>15.87 ± 0.247</td><td>16.56 ± 0.908</td></tr><tr><td>Random</td><td>×</td><td>5.909 ±0.019</td><td>5.548 ± 0.090</td><td>8.152 ± 0.042</td><td>8.270± 0.285</td></tr><tr><td>ORF</td><td>×</td><td>5.472 ± 0.035</td><td>5.143 ± 0.078</td><td>7.167 ± 0.025</td><td>7.190 ± 0.217</td></tr><tr><td>Laplacian eigenvector</td><td>×</td><td>1.899 ± 3.050</td><td>1.702 ± 2.912</td><td>0.288 ± 0.019</td><td>0.064 ± 0.010</td></tr><tr><td>Random</td><td>0</td><td>0.375±0.009</td><td>0.234 ± 0.011</td><td>0.990±0.108</td><td>0.875 ± 0.042</td></tr><tr><td>ORF</td><td>0</td><td>0.080 ± 0.001</td><td>0.009 ± 5e-5</td><td>0.129 ± 0.002</td><td>0.011 ± 0.002</td></tr><tr><td>Laplacian eigenvector</td><td>○</td><td>0.053 ± 1.5e-5</td><td>0.005 ± 1e-4</td><td>0.101 ± 0.003</td><td>0.019 ± 0.007</td></tr></table>
177
+
178
+ ![](images/40798f626d4b5c8fae6c926ea90652517f3d3ce706f97ef0acc49dd4ce18a5f7.jpg)
179
+ Figure 2: Self-attention maps learned under various node and type identifier configurations for two target equivariant basis tensors (out of 15). For better visualization, we clamp the entries by 0.01. Self-attention learns acute patterns coherent to equivariant basis when orthonormal node identifiers and type identifiers are both provided as input. More images can be found in Appendix A.4.1.
180
+
181
+ # 5.1 Approximating Second-Order Equivariant Basis
182
+
183
+ As in Theorem 1 and 2 (Section 3), our argument on the expressive power of TokenGT relies on its capability to approximate order- $k$ permutation equivariant linear layers $L _ { k k }$ (Definition 2). Specifically, Lemma 1 states that such capability depends on the ability of each self-attention head $\hat { \pmb { \alpha } ^ { 1 } } , . . . , \pmb { \alpha } ^ { H }$ (Eq. (3)) to accurately approximate each equivariant basis $\mathbf { B } ^ { \mu _ { 1 } } , . . . , \mathbf { B } ^ { \mu _ { \mathrm { b e l l } } ( 2 k ) }$ (Definition 2) up to normalization.
184
+
185
+ We verify this claim for $k = 2$ (second-order; graphs) in a synthetic setup using Barabási-Albert random graphs. We use a multihead self-attention layer (Eq. (3)) with bell $( 2 + 2 ) = 1 5$ heads and explicitly supervise head-wise attention scores $\pmb { \alpha } ^ { h }$ to approximate each (normalized) equivariant basis tensor $\mathbf { B } ^ { \mu _ { h } }$ by minimizing L2 loss. Having the layer hyperparameters fixed, we provide different combinations of node and type identifiers, and test if multihead self-attention can jointly approximate all 15 equivariant basis on unseen graphs. We experiment with both dense and sparse graph representations; for graphs with $n$ nodes and $m$ edges, the dense graph considers all $n ^ { 2 }$ pairwise edges as input as in Section 3, whereas the sparse graph considers only the present $m$ edges as in Section 2. Further details can be found in Appendix A.3.2.
186
+
187
+ We outline the results in Table 1. Consistent with Lemma 1, self-attention achieves accurate approximation of equivariant basis only when both the orthonormal node identifiers and type identifiers are given. Here, Laplacian eigenvectors (Lap, $\bigcirc$ ) often yield slightly better results than orthogonal random features (ORF, $\bigcirc$ ) presumably due to less stochasticity. Interestingly, we see that self-attention transfers the learned (pseudo-)equivariant self-attention structure to unseen graphs near perfectly.
188
+
189
+ Table 2: Results on PCQM4Mv2 large-scale graph regression benchmark. We report the Mean Absolute Error (MAE) on the validation set, and report MAE on the unavailable test set if possible.
190
+
191
+ <table><tr><td>method</td><td># parameters</td><td>valid MAE↓</td><td>test-dev MAE↓</td><td>asymptotics</td></tr><tr><td>Message-passingGNNs</td></tr><tr><td>GCN [27] 2.0M</td><td>0.1379</td><td>0.1398</td><td>O(n+m)</td></tr><tr><td>GIN [27] GAT</td><td>3.8M 6.7M</td><td>0.1195 0.1302</td><td>0.1218 N/A</td><td>O(n+m) O(n+m)</td></tr><tr><td>GCN-VN[27]</td><td>4.9M</td><td>0.1153</td><td>0.1152</td><td>O(n+m)</td></tr><tr><td>GIN-VN [27]</td><td>6.7M</td><td>0.1083</td><td>0.1084</td><td>O(n+m)</td></tr><tr><td>GAT-VN</td><td></td><td>0.1192</td><td>N/A</td><td>O(n+m)</td></tr><tr><td>GAT-VN (large)</td><td>6.7M</td><td>0.1361</td><td>N/A</td><td>O(n+m)</td></tr><tr><td></td><td>55.2M</td><td></td><td></td><td></td></tr><tr><td colspan="7">Transformerswith strong graph-specific modifications</td></tr><tr><td>Graphormer[63]</td><td>48.3M</td><td>0.0864</td><td>N/A</td><td>O(n²)</td></tr><tr><td>EGT[29]</td><td>89.3M</td><td>0.0869</td><td>0.0872</td><td>O(n2)</td></tr><tr><td>GRPE[54]</td><td>46.2M</td><td>0.0890</td><td>0.0898</td><td>O(n2)</td></tr><tr><td colspan="2">Pure Transformers</td><td></td><td></td><td></td></tr><tr><td>Transformer</td><td>48.5M</td><td>0.2340</td><td>N/A</td><td>O((n+m)²)</td></tr><tr><td>TokenGT (ORF)</td><td>48.6M</td><td>0.0962</td><td>N/A</td><td>O((n+ m)²)</td></tr><tr><td>TokenGT (Lap)</td><td>48.5M</td><td>0.0910</td><td>0.0919</td><td>O((n+m)²)</td></tr><tr><td>TokenGT(Lap)+Performer</td><td>48.5M</td><td>0.0935</td><td>N/A</td><td>O(n+m)</td></tr><tr><td colspan="3">TokenGT (ORF) 4</td><td colspan="2">TokenGT (Lap) . · .</td></tr><tr><td>(irr grretesertrttteertrs 3 OD 8 2 · . : : 1 + 0 .</td><td>O Head 1 . Head 32 . 5 10 Network depth (layer)</td><td>4 (irr erretsrt rtrtttineerls 3 + 2 . + 0 . 0</td><td>. + O I O COn CD C . .00 CICI 0 . . . . : . . + ·· . Head 32 . :</td><td>. Head 1</td></tr></table>
192
+
193
+ Non-orthogonal random embeddings lead to inaccurate approximation (Random, $\textcircled{)}$ ), highlighting the importance of orthogonality of node identifiers. The approximation is also inaccurate when we sample ORF $\mathbf { P } _ { t }$ independently for each token $t$ (ORF (first-order), $\bigcirc$ ) instead of using concatenated node identifiers $[ \mathbf { P } _ { u } , \mathbf { P } _ { v } ]$ for token $( u , v )$ . This supports our argument in Section 2 that the incidence information implicitly provided via node identifiers plays a key role in approximation.
194
+
195
+ In Figure 2, we provide a visualization of self-attention maps learned under various node and type identifier choices. Additional results can be found in Appendix A.4.1.
196
+
197
+ # 5.2 Large-Scale Graph Learning
198
+
199
+ An exclusive characteristic of TokenGT is its minimal graph-specific inductive bias, which requires it to learn internal computation structure largely from data. As such models are commonly known to work well with large-scale data [68, 18], we explore the capability of TokenGT on the PCQM4Mv2 quantum chemistry regression dataset [27], one of the current largest with $3 . 7 \mathbf { M }$ molecular graphs.
200
+
201
+ For TokenGT, we use both node and type identifiers, and use main Transformer encoder configuration based on Graphormer [78] with 12 layers, 768 hidden dimension, and 32 attention heads. We try both ORF and Laplacian eigenvector as node identifiers, and denote corresponding models as TokenGT (ORF) and TokenGT (Lap) respectively. As an ablation, we also experiment with the same Transformer without node and type identifiers, which we denote as Transformer. Finally, we apply the kernel attention [11] that approximates the attention computation to linear cost (TokenGT (Lap) $^ +$ Performer). We use AdamW optimizer with $( \beta _ { 1 } , \beta _ { 2 } ) = \mathsf { \bar { ( 0 . 9 9 , 0 . 9 9 9 ) } }$ and weight decay 0.1, and 60k learning rate warmup steps followed by linear decay over 1M iteration with batch size 1024. For fine-tuning, we use 1k warmup, 0.1M training steps, and cosine learning rate decay. We train the models on 8 RTX 3090 GPUs for 3 days. Further details are in Appendix A.3.3.
202
+
203
+ We provide the results in Table 2. A standard Transformer on the node and edge tokens cannot recognize graph structure and shows low performance (0.2340 valid MAE). Yet, the picture changes as soon as we augment the tokens with node and type identifiers. Notably, TokenGT (ORF) achieves $0 . 0 9 6 2 \mathrm { M A E }$ , which is already better than all GNN baselines. This is a somewhat surprising result, as both ORF and the Transformer are not aware of graph structures. This implies Transformer is strong enough to learn to interpret and reason over the incidence structure of tokens provided only implicitly by the node and type identifiers. By further switching to Laplacian eigenvectors that encode position on graphs [20], we observe a performance boost to $0 . 0 9 1 0 ~ \mathrm { M A E }$ , competitive to Transformers with sophisticated graph-specific modifications (e.g., shortest path-based spatial encoding [78]). While such methods inject graph structure into attention matrix via bias term and therefore strictly require $\mathcal { O } ( n ^ { 2 } )$ cost, TokenGT enables adopting kernelization for pure self-attention [11], resulting in TokenGT (Lap) $^ +$ Performer with the best performance among ${ \mathcal { O } } ( n + m )$ models (0.0935 MAE). Further discussion on the empirical performance of TokenGT can be found in Appendix A.5.
204
+
205
+ While our theory in Section 3 guarantees that TokenGT can reduce to an equivariant layer by learning fixed equivariant basis at each attention head, in practice, it can freely utilize multihead self-attention to learn less restricted and more useful computation structure from data. To analyze such a structure, we compute the attention distance across heads and network depth by averaging pairwise token distances on a graph weighted by their attention scores (Figure 3). This distance is analogous to the number of hops in message-passing. In both TokenGT (ORF) and TokenGT (Lap), in the lowest layers, some heads attend globally over the graph while others consistently have small receptive fields (acting like a local message-passing operator). In deeper layers, the attention distances increase, and most heads attend globally. Interestingly, this behavior is highly consistent with Vision Transformers on image patches [18], suggesting that hybrid architectures based on convolution to aid ViT [16, 80] might also work well for graphs. While TokenGT (ORF) shows relatively consistent attention distance over heads, TokenGT (Lap) shows higher variance, implying that it learns more diverse attention patterns. Judging from the higher performance of TokenGT (Lap), this suggests that the graph structure information of the Laplacian eigenvector facilitates learning useful and diverse attention structures, which calls for future exploration of better node identifiers based on graph PEs [38, 42].
206
+
207
+ # 6 Conclusion
208
+
209
+ We showed that Transformers directly applied to graphs can work well in both theory and practice. In the theoretical aspect, we proved that with appropriate token-wise embeddings, a Transformer on node and edge tokens is at least as expressive as $k$ -IGN and $k$ -WL test, making it more expressive than all message-passing GNNs. For such token-wise embeddings, we showed that a combination of simple orthonormal node identifiers and trainable type identifiers suffices, which we also verified with a synthetic experiment. In an experiment with PCQM4Mv2 large-scale dataset, we show that Tokenized Graph Transformer (TokenGT) performs significantly better than all GNNs and is competitive with Transformer variants with strong graph-specific architectural components [78, 29, 54].
210
+
211
+ While the results suggest a promising research direction, there are challenges to be addressed in future work. First, treating each node and edge as tokens requires $O ( ( n + m ) ^ { 2 } )$ asymptotic cost due to the quadratic nature of self-attention. While we address this to some degree with kernelization and achieve $O ( n + m )$ cost, other types of efficient Transformers (e.g., sparse) that can deliver better performance are left to be tested. Another issue is slightly lower performance compared to the stateof-the-art. Adopting Transformer engineering techniques from vision and language domains, such as data scaling [7, 18], deepening [70, 74], hybrid architectures [16, 80], and self-supervision [17, 7, 24], are promising. In the societal aspect, to prevent the potential risky behavior in, e.g., decision making from graph-structured inputs, interpretability research regarding self-attention on graphs is desired.
212
+
213
+ We finish with interesting research directions that stem from our work. As our approach advocates viewing a graph as $( n + m )$ tokens [37], it opens up new paradigms of graph learning, including autoregressive decoding, in-context learning, prompting, and multimodal learning. Another interesting direction is to extend our theory and use self-attention to approximate equivariant basis for general discrete group actions, which might be a viable approach for learning equivariance from data.
214
+
215
+ Acknowledgement This work was supported in part by Institute of Information & communications Technology Planning & Evaluation (IITP) (No. 2022-0-00926, 2022-0-00959, 2021-0-02068, and 2019-0-00075) and the National Research Foundation of Korea (NRF) (No. 2021R1C1C1012540) grants funded by the Korea government (MSIT).
216
+
217
+ # References
218
+
219
+ [2] A.-L. Barabasi and R. Albert. Emergence of scaling in random networks. arXiv, 1999. (Cited on 10)
220
+ [3] S. Bhattamishra, A. Patel, and N. Goyal. On the computational power of transformers and its implications in sequence modeling. In CoNLL, 2020. (Cited on 7)
221
+ [4] S. Bhojanapalli, C. Yun, A. S. Rawat, S. J. Reddi, and S. Kumar. Low-rank bottleneck in multi-head attention models. In ICML, 2020. (Cited on 7)
222
+ [5] S. Brody, U. Alon, and E. Yahav. How attentive are graph attention networks? In ICLR, 2022. (Cited on 11)
223
+ [6] M. M. Bronstein, J. Bruna, Y. LeCun, A. Szlam, and P. Vandergheynst. Geometric deep learning: Going beyond euclidean data. IEEE Signal Process. Mag., 2017. (Cited on 7)
224
+ [7] T. B. Brown, B. Mann, N. Ryder, M. Subbiah, J. Kaplan, P. Dhariwal, A. Neelakantan, P. Shyam, G. Sastry, A. Askell, S. Agarwal, A. Herbert-Voss, G. Krueger, T. Henighan, R. Child, A. Ramesh, D. M. Ziegler, J. Wu, C. Winter, C. Hesse, M. Chen, E. Sigler, M. Litwin, S. Gray, B. Chess, J. Clark, C. Berner, S. McCandlish, A. Radford, I. Sutskever, and D. Amodei. Language models are few-shot learners. In NeurIPS, 2020. (Cited on 1, 7, 10)
225
+ [8] C. Cai and Y. Wang. A note on over-smoothing for graph neural networks. arXiv, 2020. (Cited on 1, 7)
226
+ [9] L. Chen, K. Lu, A. Rajeswaran, K. Lee, A. Grover, M. Laskin, P. Abbeel, A. Srinivas, and I. Mordatch. Decision transformer: Reinforcement learning via sequence modeling. In NeurIPS, 2021. (Cited on 1, 7)
227
+ [10] Z. Chen, L. Chen, S. Villar, and J. Bruna. Can graph neural networks count substructures? In NeurIPS, 2020. (Cited on 4)
228
+ [11] K. M. Choromanski, V. Likhosherstov, D. Dohan, X. Song, A. Gane, T. Sarlós, P. Hawkins, J. Q. Davis, A. Mohiuddin, L. Kaiser, D. B. Belanger, L. J. Colwell, and A. Weller. Rethinking attention with performers. In ICLR, 2021. (Cited on 2, 9, 10, 11)
229
+ [12] K. M. Choromanski, M. Rowland, and A. Weller. The unreasonable effectiveness of structured random orthogonal embeddings. In NeurIPS, 2017. (Cited on 3, 10)
230
+ [13] T. Cohen and M. Welling. Group equivariant convolutional networks. In ICML, 2016. (Cited on 7)
231
+ [14] T. S. Cohen and M. Welling. Steerable cnns. In ICLR, 2017. (Cited on 7)
232
+ [15] J. Cordonnier, A. Loukas, and M. Jaggi. On the relationship between self-attention and convolutional layers. In ICLR, 2020. (Cited on 7)
233
+ [16] Z. Dai, H. Liu, Q. V. Le, and M. Tan. Coatnet: Marrying convolution and attention for all data sizes. In NeurIPS, 2021. (Cited on 10)
234
+ [17] J. Devlin, M. Chang, K. Lee, and K. Toutanova. BERT: pre-training of deep bidirectional transformers for language understanding. In NAACL-HLT, 2019. (Cited on 1, 2, 3, 4, 7, 10)
235
+ [18] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. (Cited on 1, 2, 3, 4, 7, 9, 10)
236
+ [19] V. P. Dwivedi and X. Bresson. A generalization of transformer networks to graphs. arXiv, 2020. (Cited on 1, 7)
237
+ [20] V. P. Dwivedi, C. K. Joshi, T. Laurent, Y. Bengio, and X. Bresson. Benchmarking graph neural networks. arXiv, 2020. (Cited on 3, 7, 10, 14)
238
+ [21] J. Gilmer, S. S. Schoenholz, P. F. Riley, O. Vinyals, and G. E. Dahl. Neural message passing for quantum chemistry. In ICML, 2017. (Cited on 2, 4, 6)
239
+ [22] A. N. Gorban, I. Y. Tyukin, D. V. Prokhorov, and K. I. Sofeikov. Approximation with random bases: Pro et contra. Inf. Sci., 2016. (Cited on 14)
240
+ [23] B. Hanin and M. Sellke. Approximating continuous functions by relu nets of minimal width. arXiv, 2017. (Cited on 1, 7)
241
+ [24] K. He, X. Chen, S. Xie, Y. Li, P. Dollár, and R. B. Girshick. Masked autoencoders are scalable vision learners. arXiv, 2021. (Cited on 10)
242
+ [25] D. Hendrycks and K. Gimpel. Gaussian error linear units (gelus). arXiv, 2018. (Cited on 11)
243
+ [26] K. Hornik, M. B. Stinchcombe, and H. White. Multilayer feedforward networks are universal approximators. Neural Networks, 1989. (Cited on 7)
244
+ [27] W. Hu, M. Fey, H. Ren, M. Nakata, Y. Dong, and J. Leskovec. OGB-LSC: A large-scale challenge for machine learning on graphs. arXiv, 2021. (Cited on 2, 7, 9, 11)
245
+ [28] G. Huang, Y. Sun, Z. Liu, D. Sedra, and K. Q. Weinberger. Deep networks with stochastic depth. In ECCV, 2016. (Cited on 11)
246
+ [29] M. S. Hussain, M. J. Zaki, and D. Subramanian. Edge-augmented graph transformers: Global self-attention is enough for graphs. arXiv, 2021. (Cited on 1, 2, 7, 9, 10)
247
+ [30] A. Jaegle, S. Borgeaud, J. Alayrac, C. Doersch, C. Ionescu, D. Ding, S. Koppula, D. Zoran, A. Brock, E. Shelhamer, O. J. Hénaff, M. M. Botvinick, A. Zisserman, O. Vinyals, and J. Carreira. Perceiver IO: A general architecture for structured inputs & outputs. arXiv, 2021. (Cited on 1, 7, 9)
248
+ [31] A. Jaegle, F. Gimeno, A. Brock, O. Vinyals, A. Zisserman, and J. Carreira. Perceiver: General perception with iterative attention. In ICML, 2021. (Cited on 1, 7, 9)
249
+ [32] A. Katharopoulos, A. Vyas, N. Pappas, and F. Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML, 2020. (Cited on 9)
250
+ [33] N. Keriven and G. Peyré. Universal invariant and equivariant graph neural networks. In NeurIPS, 2019. (Cited on 15)
251
+ [34] J. Kim, S. Oh, and S. Hong. Transformers generalize deepsets and can be extended to graphs and hypergraphs. In NeurIPS, 2021. (Cited on 1, 2, 4, 6, 7, 15)
252
+ [35] D. P. Kingma and J. Ba. Adam: A method for stochastic optimization. In ICLR, 2015. (Cited on 14)
253
+ [36] T. N. Kipf and M. Welling. Semi-supervised classification with graph convolutional networks. In ICLR, 2017. (Cited on 14)
254
+ [37] Z. Kolter, S. Bai, D. Wilmott, M. Kornbluth, and J. Mailoa. First place solution of 2019 champs predicting molecular properties challenge. https://www.kaggle.com/c/champs-scalar-coupling/ discussion/106575, 2019. (Cited on 10)
255
+ [38] D. Kreuzer, D. Beaini, W. L. Hamilton, V. Létourneau, and P. Tossou. Rethinking graph transformers with spectral attention. NeurIPS, 2021. (Cited on 7, 10, 9, 14)
256
+ [39] J. Lee, Y. Lee, J. Kim, A. R. Kosiorek, S. Choi, and Y. W. Teh. Set transformer: A framework for attention-based permutation-invariant neural networks. In ICML, 2019. (Cited on 7, 9)
257
+ [40] Q. Li, Z. Han, and X. Wu. Deeper insights into graph convolutional networks for semi-supervised learning. In AAAI, 2018. (Cited on 1, 7)
258
+ [41] V. Likhosherstov, K. Choromanski, and A. Weller. On the expressive power of self-attention matrices. arXiv, 2021. (Cited on 7)
259
+ [42] D. Lim, J. Robinson, L. Zhao, T. E. Smidt, S. Sra, H. Maron, and S. Jegelka. Sign and basis invariant networks for spectral graph representation learning. arXiv, 2022. (Cited on 7, 10, 14)
260
+ [43] K. Lin, L. Wang, and Z. Liu. Mesh graphormer. In ICCV, 2021. (Cited on 1, 7)
261
+ [44] I. Loshchilov and F. Hutter. Decoupled weight decay regularization. In ICLR, 2019. (Cited on 11)
262
+ [45] X. Ma, X. Kong, S. Wang, C. Zhou, J. May, H. Ma, and L. Zettlemoyer. Luna: Linear unified nested attention. NeurIPS, 2021. (Cited on 9)
263
+ [46] H. Maron, H. Ben-Hamu, H. Serviansky, and Y. Lipman. Provably powerful graph networks. In NeurIPS, 2019. (Cited on 2, 4, 6, 1, 15)
264
+ [47] H. Maron, H. Ben-Hamu, N. Shamir, and Y. Lipman. Invariant and equivariant graph networks. In ICLR, 2019. (Cited on 2, 4, 5, 6, 7, 1, 15)
265
+ [48] H. Maron, E. Fetaya, N. Segol, and Y. Lipman. On the universality of invariant networks. In ICML, 2019. (Cited on 4, 15)
266
+ [49] H. Maron, O. Litany, G. Chechik, and E. Fetaya. On learning sets of symmetric elements. In ICML, 2020. (Cited on 7)
267
+ [50] E. Min, R. Chen, Y. Bian, T. Xu, K. Zhao, W. Huang, P. Zhao, J. Huang, S. Ananiadou, and Y. Rong. Transformer for graphs: An overview from architecture perspective. arXiv, 2022. (Cited on 1, 7)
268
+ [51] D. Q. Nguyen, T. D. Nguyen, and D. Phung. Universal graph transformer self-attention networks. In WWW, 2022. (Cited on 1, 7)
269
+ [52] K. Oono and T. Suzuki. Graph neural networks exponentially lose expressive power for node classification. In ICLR, 2020. (Cited on 1, 7)
270
+ [53] H. Pan and R. Kondor. Permutation equivariant layers for higher order interactions. In AISTATS, 2022. (Cited on 7)
271
+ [54] W. Park, W. Chang, D. Lee, J. Kim, and S. won Hwang. Grpe: Relative positional encoding for graph transformer. arXiv, 2022. (Cited on 1, 2, 7, 9, 10)
272
+ [55] H. Peng, N. Pappas, D. Yogatama, R. Schwartz, N. A. Smith, and L. Kong. Random feature attention. In ICLR, 2021. (Cited on 9)
273
+
274
+ (Cited on 7) [57] S. Reed, K. Zolna, E. Parisotto, S. G. Colmenarejo, A. Novikov, G. Barth-Maron, M. Giménez, Y. Sulsky, ˙ J. Kay, J. T. Springenberg, T. Eccles, J. Bruce, A. Razavi, A. Edwards, N. Heess, Y. Chen, R. Hadsell, O. Vinyals, M. Bordbar, and N. de Freitas. A generalist agent. arXiv, 2022. (Cited on 1) [58] Y. Rong, Y. Bian, T. Xu, W. Xie, Y. Wei, W. Huang, and J. Huang. Self-supervised graph transformer on large-scale molecular data. In NeurIPS, 2020. (Cited on 1, 7) [59] B. Rozemberczki, C. Allen, and R. Sarkar. Multi-scale attributed node embedding. J. Complex Networks, 2021. (Cited on 13) [60] H. Serviansky, N. Segol, J. Shlomi, K. Cranmer, E. Gross, H. Maron, and Y. Lipman. Set2graph: Learning graphs from sets. In NeurIPS, 2020. (Cited on 7, 15) [61] O. Shchur, M. Mumme, A. Bojchevski, and S. Günnemann. Pitfalls of graph neural network evaluation. arXiv, 2018. (Cited on 13) [62] Z. Shen, M. Zhang, H. Zhao, S. Yi, and H. Li. Efficient attention: Attention with linear complexities. In WACV, 2021. (Cited on 9) [63] Y. Shi, S. Zheng, G. Ke, Y. Shen, J. You, J. He, S. Luo, C. Liu, D. He, and T. Liu. Benchmarking graphormer on large-scale molecular modeling datasets. arXiv, 2022. (Cited on 9) [64] A. Steiner, A. Kolesnikov, X. Zhai, R. Wightman, J. Uszkoreit, and L. Beyer. How to train your vit? data, augmentation, and regularization in vision transformers. arXiv, 2021. (Cited on 11) [65] Y. Tay, M. Dehghani, D. Bahri, and D. Metzler. Efficient transformers: A survey. arXiv, 2020. (Cited on 1) [66] N. Thomas, T. E. Smidt, S. Kearnes, L. Yang, L. Li, K. Kohlhoff, and P. Riley. Tensor field networks: Rotation- and translation-equivariant neural networks for 3d point clouds. arXiv, 2018. (Cited on 7) [67] J. Tompson, R. Goroshin, A. Jain, Y. LeCun, and C. Bregler. Efficient object localization using convolutional networks. In CVPR, 2015. (Cited on 10) [68] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, 2017. (Cited on 1, 3, 9) [69] P. Velickovic, G. Cucurull, A. Casanova, A. Romero, P. Liò, and Y. Bengio. Graph attention networks. In ICLR, 2018. (Cited on 1, 7, 11, 14) [70] H. Wang, S. Ma, L. Dong, S. Huang, D. Zhang, and F. Wei. Deepnet: Scaling transformers to 1, 000 layers. arXiv, 2022. (Cited on 10) [71] S. Wang, B. Z. Li, M. Khabsa, H. Fang, and H. Ma. Linformer: Self-attention with linear complexity. arXiv, 2020. (Cited on 9) [72] X. Wang, Z. Tu, L. Wang, and S. Shi. Self-attention with structural position representations. In EMNLPIJCNLP, 2019. (Cited on 1) [73] M. Weiler, M. Geiger, M. Welling, W. Boomsma, and T. Cohen. 3d steerable cnns: Learning rotationally equivariant features in volumetric data. In NeurIPS, 2018. (Cited on 7) [74] N. Wies, Y. Levine, D. Jannai, and A. Shashua. Which transformer architecture fits my data? A vocabulary bottleneck in self-attention. In ICML, 2021. (Cited on 10) [75] R. Xiong, Y. Yang, D. He, K. Zheng, S. Zheng, C. Xing, H. Zhang, Y. Lan, L. Wang, and T. Liu. On layer normalization in the transformer architecture. In ICML, 2020. (Cited on 11) [76] Y. Xiong, Z. Zeng, R. Chakraborty, M. Tan, G. Fung, Y. Li, and V. Singh. Nyströmformer: A nyström-based algorithm for approximating self-attention. In AAAI, 2021. (Cited on 9) [77] K. Xu, W. Hu, J. Leskovec, and S. Jegelka. How powerful are graph neural networks? In ICLR, 2019. (Cited on 7, 14) [78] C. Ying, T. Cai, S. Luo, S. Zheng, G. Ke, D. He, Y. Shen, and T. Liu. Do transformers really perform bad for graph representation? In NeurIPS, 2021. (Cited on 1, 2, 7, 9, 10, 11, 14) [79] F. X. Yu, A. T. Suresh, K. M. Choromanski, D. N. Holtmann-Rice, and S. Kumar. Orthogonal random features. In NeurIPS, 2016. (Cited on 3, 10) [80] K. Yuan, S. Guo, Z. Liu, A. Zhou, F. Yu, and W. Wu. Incorporating convolution designs into visual transformers. In ICCV, 2021. (Cited on 10) [81] C. Yun, S. Bhojanapalli, A. S. Rawat, S. J. Reddi, and S. Kumar. Are transformers universal approximators of sequence-to-sequence functions? In ICLR, 2020. (Cited on 7, 1) [82] M. Zaheer, S. Kottur, S. Ravanbakhsh, B. Póczos, R. Salakhutdinov, and A. J. Smola. Deep sets. In NeurIPS, 2017. (Cited on 7) [83] M. Zopf. 1-wl expressiveness is (almost) all you need. arXiv, 2022. (Cited on 2)
275
+
276
+ # Checklist
277
+
278
+ The checklist follows the references. Please read the checklist guidelines carefully for information on how to answer these questions. For each question, change the default [TODO] to [Yes] , [No] , or [N/A] . You are strongly encouraged to include a justification to your answer, either by referencing the appropriate section of your paper or providing a brief inline description. For example:
279
+
280
+ • Did you include the license to the code and datasets? [Yes] See Section 5.
281
+ • Did you include the license to the code and datasets? [No] The code and the data are proprietary.
282
+ • Did you include the license to the code and datasets? [N/A]
283
+
284
+ Please do not modify the questions and only use the provided macros for your answers. Note that the Checklist section does not count towards the page limit. In your paper, please delete this instructions block and only keep the Checklist section heading above along with the questions/answers below.
285
+
286
+ 1. For all authors...
287
+
288
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] See Section 3 and Section 5.
289
+ (b) Did you describe the limitations of your work? [Yes] See Section 6.
290
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 6.
291
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
292
+
293
+ 2. If you are including theoretical results...
294
+
295
+ (a) Did you state the full set of assumptions of all theoretical results? [Yes] See Section 3. (b) Did you include complete proofs of all theoretical results? [Yes] We include them in the supplementary file.
296
+
297
+ 3. If you ran experiments...
298
+
299
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We include them in the supplementary file.
300
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 5.
301
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] See Section 5.
302
+ (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.
303
+
304
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
305
+
306
+ (a) If your work uses existing assets, did you cite the creators? [Yes] See Section 5.2.
307
+ (b) Did you mention the license of the assets? [Yes] See Section 5.2.
308
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We include them in the supplementary file.
309
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A]
310
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A]
311
+
312
+ 5. If you used crowdsourcing or conducted research with human subjects...
313
+
314
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
315
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
316
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
md/dev/vhFu1Acb0xb/vhFu1Acb0xb.md ADDED
@@ -0,0 +1,438 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TRANSFORMERS ARE SAMPLE-EFFICIENT WORLD MODELS
2
+
3
+ Vincent Micheli∗ University of Geneva
4
+
5
+ Eloi Alonso∗ University of Geneva
6
+
7
+ François Fleuret University of Geneva
8
+
9
+ # ABSTRACT
10
+
11
+ Deep reinforcement learning agents are notoriously sample inefficient, which considerably limits their application to real-world problems. Recently, many model-based methods have been designed to address this issue, with learning in the imagination of a world model being one of the most prominent approaches. However, while virtually unlimited interaction with a simulated environment sounds appealing, the world model has to be accurate over extended periods of time. Motivated by the success of Transformers in sequence modeling tasks, we introduce IRIS, a data-efficient agent that learns in a world model composed of a discrete autoencoder and an autoregressive Transformer. With the equivalent of only two hours of gameplay in the Atari $1 0 0 \mathrm { k }$ benchmark, IRIS achieves a mean human normalized score of 1.046, and outperforms humans on 10 out of 26 games, setting a new state of the art for methods without lookahead search. To foster future research on Transformers and world models for sample-efficient reinforcement learning, we release our code and models at https://github.com/eloialonso/iris.
12
+
13
+ # 1 INTRODUCTION
14
+
15
+ Deep Reinforcement Learning (RL) has become the dominant paradigm for developing competent agents in challenging environments. Most notably, deep RL algorithms have achieved impressive performance in a multitude of arcade (Mnih et al., 2015; Schrittwieser et al., 2020; Hafner et al., 2021), real-time strategy (Vinyals et al., 2019; Berner et al., 2019), board (Silver et al., 2016; 2018; Schrittwieser et al., 2020) and imperfect information (Schmid et al., 2021; Brown et al., 2020a) games. However, a common drawback of these methods is their extremely low sample efficiency. Indeed, experience requirements range from months of gameplay for DreamerV2 (Hafner et al., 2021) in Atari 2600 games (Bellemare et al., 2013b) to thousands of years for OpenAI Five in Dota2 (Berner et al., 2019). While some environments can be sped up for training agents, real-world applications often cannot. Besides, additional cost or safety considerations related to the number of environmental interactions may arise (Yampolskiy, 2018). Hence, sample efficiency is a necessary condition to bridge the gap between research and the deployment of deep RL agents in the wild.
16
+
17
+ Model-based methods (Sutton & Barto, 2018) constitute a promising direction towards data efficiency. Recently, world models were leveraged in several ways: pure representation learning (Schwarzer et al., 2021), lookahead search (Schrittwieser et al., 2020; Ye et al., 2021), and learning in imagination (Ha & Schmidhuber, 2018; Kaiser et al., 2020; Hafner et al., 2020; 2021). The latter approach is particularly appealing because training an agent inside a world model frees it from sample efficiency constraints. Nevertheless, this framework relies heavily on accurate world models since the policy is purely trained in imagination. In a pioneering work, Ha & Schmidhuber (2018) successfully built imagination-based agents in toy environments. SimPLe recently showed promise in the more challenging Atari 100k benchmark (Kaiser et al., 2020). Currently, the best Atari agent learning in imagination is DreamerV2 (Hafner et al., 2021), although it was developed and evaluated with two hundred million frames available, far from the sample-efficient regime. Therefore, designing new world model architectures, capable of handling visually complex and partially observable environments with few samples, is key to realize their potential as surrogate training grounds.
18
+
19
+ The Transformer architecture (Vaswani et al., 2017) is now ubiquitous in Natural Language Processing (Devlin et al., 2019; Radford et al., 2019; Brown et al., 2020b; Raffel et al., 2020), and is also gaining traction in Computer Vision (Dosovitskiy et al., 2021; He et al., 2022), as well as in Offline
20
+
21
+ ![](images/718049274cf655f65ecea26f956956f1852508ce240c434575cec3cc98bac1f9.jpg)
22
+ Figure 1: Unrolling imagination over time. This figure shows the policy $\pi$ , depicted with purple arrows, taking a sequence of actions in imagination. The green arrows correspond to the encoder $E$ and the decoder $D$ of a discrete autoencoder, whose task is to represent frames in its learnt symbolic language. The backbone $G$ of the world model is a GPT-like Transformer, illustrated with blue arrows. For each action that the policy $\pi$ takes, $G$ simulates the environment dynamics, by autoregressively unfolding new frame tokens that $D$ can decode. $G$ also predicts a reward and a potential episode termination. More specifically, an initial frame $x _ { 0 }$ is encoded with $E$ into tokens $\mathbf { \dot { \boldsymbol { z } } } _ { 0 } = ( z _ { 0 } ^ { 1 } , \dots , z _ { 0 } ^ { K } ) = E ( \boldsymbol { x } _ { 0 } )$ . The decoder $D$ reconstructs an image $\hat { x } _ { 0 } = D ( z _ { 0 } )$ , from which the policy $\pi$ predicts the action $a _ { 0 }$ . From $z _ { \mathrm { 0 } }$ and $a _ { 0 }$ , $G$ predicts the reward $\hat { r } _ { 0 }$ , episode termination $\hat { d } _ { 0 } \in \{ 0 , 1 \}$ , and in an autoregressive manner $\hat { z } _ { 1 } = ( \hat { z } _ { 1 } ^ { 1 } , \dots , \hat { z } _ { 1 } ^ { K } )$ , the tokens for the next frame. A dashed box indicates image tokens for a given time step, whereas a solid box represents the input sequence of $G$ , i.e. $( z _ { 0 } , a _ { 0 } )$ at $t = 0$ , $( z _ { 0 } , a _ { 0 } , \hat { z } _ { 1 } , a _ { 1 } )$ at $t = 1$ , etc. The policy $\pi$ is purely trained with imagined trajectories, and is only deployed in the real environment to improve the world model $( E , D , G )$ .
23
+
24
+ Reinforcement Learning (Janner et al., 2021; Chen et al., 2021). In particular, the GPT (Radford et al., 2018; 2019; Brown et al., 2020b) family of models delivered impressive results in language understanding tasks. Similarly to world models, these attention-based models are trained with highdimensional signals and a self-supervised learning objective, thus constituting ideal candidates to simulate an environment.
25
+
26
+ Transformers particularly shine when they operate over sequences of discrete tokens (Devlin et al., 2019; Brown et al., 2020b). For textual data, there are simple ways (Schuster & Nakajima, 2012; Kudo & Richardson, 2018) to build a vocabulary, but this conversion is not straightforward with images. A naive approach would consist in treating pixels as image tokens, but standard Transformer architectures scale quadratically with sequence length, making this idea computationally intractable. To address this issue, VQGAN (Esser et al., 2021) and DALL-E (Ramesh et al., 2021) employ a discrete autoencoder (Van Den Oord et al., 2017) as a mapping from raw pixels to a much smaller amount of image tokens. Combined with an autoregressive Transformer, these methods demonstrate strong unconditional and conditional image generation capabilities. Such results suggest a new approach to design world models.
27
+
28
+ In the present work, we introduce IRIS (Imagination with auto-Regression over an Inner Speech), an agent trained in the imagination of a world model composed of a discrete autoencoder and an autoregressive Transformer. IRIS learns behaviors by accurately simulating millions of trajectories. Our approach casts dynamics learning as a sequence modeling problem, where an autoencoder builds a language of image tokens and a Transformer composes that language over time. With minimal tuning, IRIS outperforms a line of recent methods (Kaiser et al., 2020; Hessel et al., 2018; Laskin et al., 2020; Yarats et al., 2021; Schwarzer et al., 2021) for sample-efficient RL in the Atari $1 0 0 \mathrm { k }$ benchmark (Kaiser et al., 2020). After only two hours of real-time experience, it achieves a mean human normalized score of 1.046, and reaches superhuman performance on 10 out of 26 games. We describe IRIS in Section 2 and present our results in Section 3.
29
+
30
+ ![](images/97ff328e6b75f6cd320afb1df101700705e8a6f827aacc1c6a6d16930b213227.jpg)
31
+ Figure 2: Four imagined trajectories in KungFuMaster. We use the same conditioning frame across the four rows, in green, and let the world model imagine the rest. As the initial frame only contains the player, there is no information about the enemies that will come next. Consequently, the world model generates different types and numbers of opponents in each simulation. It is also able to reflect an essential game mechanic, highlighted in the blue box, where the first enemy disappears after getting hit by the player.
32
+
33
+ # 2 METHOD
34
+
35
+ We formulate the problem as a Partially Observable Markov Decision Process (POMDP) with image observations $\boldsymbol { x } _ { t } \in \mathbf { \mathbb { R } } ^ { h \times w \times 3 }$ , discrete actions $a _ { t } \in \{ 1 , \ldots , A \}$ , scalar rewards $r _ { t } \in \mathbb { R }$ , episode termination $d _ { t } \in \{ 0 , 1 \}$ , discount factor $\gamma \in ( 0 , 1 )$ , initial observation distribution $\rho _ { 0 }$ , and environment dynamics $x _ { t + 1 } , r _ { t } , d _ { t } \sim p ( x _ { t + 1 } , r _ { t } , d _ { t } \mid x _ { \leq t } , a _ { \leq t } )$ . The reinforcement learning objective is to train a policy $\pi$ that yields actions maximizing the expected sum of rewards $\begin{array} { r } { \mathbb { E } _ { \pi } [ \sum _ { t \ge 0 } \gamma ^ { \bar { t } } r _ { t } ] } \end{array}$ .
36
+
37
+ Our method relies on the three standard components to learn in imagination (Sutton & Barto, 2018): experience collection, world model learning, and behavior learning. In the vein of Ha & Schmidhuber (2018); Kaiser et al. (2020); Hafner et al. (2020; 2021), our agent learns to act exclusively within its world model, and we only make use of real experience to learn the environment dynamics.
38
+
39
+ We repeatedly perform the three following steps:
40
+
41
+ • collect_experience: gather experience in the real environment with the current policy.
42
+ • update_world_model: improve rewards, episode ends and next observations predictions.
43
+ • update_behavior: in imagination, improve the policy and value functions.
44
+
45
+ The world model is composed of a discrete autoencoder (Van Den Oord et al., 2017), to convert an image to tokens and back, and a GPT-like autoregressive Transformer (Vaswani et al., 2017; Radford et al., 2019; Brown et al., 2020b), whose task is to capture environment dynamics. Figure 1 illustrates the interplay between the policy and these two components during imagination. We first describe the autoencoder and the Transformer in Sections 2.1 and 2.2, respectively. Section 2.3 then details the procedure to learn the policy and value functions in imagination. Appendix A provides a comprehensive description of model architectures and hyperparameters. Algorithm 1 summarizes the training protocol.
46
+
47
+ # 2.1 FROM IMAGE OBSERVATIONS TO TOKENS
48
+
49
+ The discrete autoencoder $( E , D )$ learns a symbolic language of its own to represent high-dimensional images as a small number of tokens. The back and forth between frames and tokens is illustrated with green arrows in Figure 1.
50
+
51
+ ![](images/cf908a17f2f0e987d055822a42e60010df408a9dfccbe5d18ef0bc5b81439629.jpg)
52
+ Figure 3: Pixel perfect predictions in Pong. The top row displays a test trajectory collected in the real environment. The bottom row depicts the reenactment of that trajectory inside the world model. More precisely, we condition the world model with the first two frames of the true sequence, in green. We then sequentially feed it the true actions and let it imagine the subsequent frames. After only 120 games of training, the world model perfectly simulates the ball’s trajectory and players’ movements. Notably, it also captures the game mechanic of updating the scoreboard after winning an exchange, as shown in the blue box.
53
+
54
+ More precisely, the encoder $E : \mathbb { R } ^ { h \times w \times 3 } \{ 1 , \dots , N \} ^ { K }$ converts an input image $x _ { t }$ into $K$ tokens from a vocabulary of size $N$ . Let $\mathcal { E } = \{ \bar { e } _ { i } \} _ { i = 1 } ^ { N } \in \bar { \mathbb { R } } ^ { N \times d }$ be the corresponding embedding table of $d$ -dimensional vectors. The input image $x _ { t }$ is first passed through a Convolutional Neural Network (CNN) (LeCun et al., 1989) producing output $\bar { y _ { t } } \in \mathbb { R } ^ { K \times d }$ . We then obtain the output tokens $z _ { t } = ( z _ { t } ^ { 1 } , \dots , z _ { t } ^ { K } ) \in \{ 1 , \dots , { \dot { N } } \} ^ { K }$ as $z _ { t } ^ { \bar { k } } = \mathrm { \bar { a r g m i n } } _ { i } \| y _ { t } ^ { k } - e _ { i } \| _ { 2 }$ , the index of the closest embedding vector in $\mathcal { E }$ (Van Den Oord et al., 2017; Esser et al., 2021). Conversely, the CNN decoder $D : \{ 1 , \ldots , N \} ^ { K } \to \mathbb { R } ^ { \dot { h } \times w \times 3 }$ turns $K$ tokens back into an image.
55
+
56
+ This discrete autoencoder is trained on previously collected frames, with an equally weighted combination of a $L _ { 1 }$ reconstruction loss, a commitment loss (Van Den Oord et al., 2017; Esser et al., 2021), and a perceptual loss (Esser et al., 2021; Johnson et al., 2016; Larsen et al., 2016). We use a straight-through estimator (Bengio et al., 2013) to enable backpropagation training.
57
+
58
+ # 2.2 MODELING DYNAMICS
59
+
60
+ At a high level, the Transformer $G$ captures the environment dynamics by modeling the language of the discrete autoencoder over time. Its central role of unfolding imagination is highlighted with the blue arrows in Figure 1.
61
+
62
+ Specifically, $G$ operates over sequences of interleaved frame and action tokens. An input sequence $( z _ { 0 } ^ { \bar { 1 } } , \ldots , \bar { z } _ { 0 } ^ { K } , a _ { 0 } , z _ { 1 } ^ { 1 } , \ldots , z _ { 1 } ^ { K } , a _ { 1 } , \ldots , z _ { t } ^ { 1 } , \ldots , z _ { t } ^ { K } , a _ { t } )$ is obtained from the raw sequence $( x _ { 0 } , a _ { 0 } , x _ { 1 } , a _ { 1 } , \dots , x _ { t } , a _ { t } )$ by encoding the frames with $E$ , as described in Section 2.1.
63
+
64
+ At each time step $t$ , the Transformer models the three following distributions:
65
+
66
+ $$
67
+ \begin{array} { r l } & { \mathrm { T r a n s i t i o n : } \quad \hat { z } _ { t + 1 } \sim p _ { G } \big ( \hat { z } _ { t + 1 } \big | z _ { \le t } , a _ { \le t } \big ) \mathrm { w i t h } \hat { z } _ { t + 1 } ^ { k } \sim p _ { G } \big ( \hat { z } _ { t + 1 } ^ { k } \mid z _ { \le t } , a _ { \le t } , z _ { t + 1 } ^ { < k } \big ) } \\ & { \mathrm { R e w a r d : } \quad \quad \hat { r } _ { t } \sim p _ { G } \big ( \hat { r } _ { t } \mid z _ { \le t } , a _ { \le t } \big ) } \\ & { \mathrm { T e r m i n a t i o n : } \quad \hat { d } _ { t } \sim p _ { G } \big ( \hat { d } _ { t } \mid z _ { \le t } , a _ { \le t } \big ) } \end{array}
68
+ $$
69
+
70
+ Note that the conditioning for the $k$ -th token also includes $z _ { t + 1 } ^ { < k } : = ( z _ { t + 1 } ^ { 1 } , \dots , z _ { t + 1 } ^ { k - 1 } )$ , the tokens that
71
+
72
+ We train $G$ in a self-supervised manner on segments of $L$ time steps, sampled from past experience. We use a cross-entropy loss for the transition and termination predictors, and a mean-squared error loss or a cross-entropy loss for the reward predictor, depending on the reward function.
73
+
74
+ # 2.3 LEARNING IN IMAGINATION
75
+
76
+ Together, the discrete autoencoder $( E , D )$ and the Transformer $G$ form a world model, capable of imagination. The policy $\pi$ , depicted with purple arrows in Figure 1, exclusively learns in this imagination MDP.
77
+
78
+ ![](images/38730f40fa882948b9610ee92a0ffac78f19d740108d41e5bcf2b2cf84e1e86b.jpg)
79
+ Figure 4: Imagining rewards and episode ends in Breakout (top) and Gopher (bottom). Each row depicts an imagined trajectory initialized with a single frame from the real environment. Yellow boxes indicate frames where the world model predicts a positive reward. In Breakout, it captures that breaking a brick yields rewards, and the brick is correctly removed from the following frames. In Gopher, the player has to protect the carrots from rodents. The world model successfully internalizes that plugging a hole or killing an enemy leads to rewards. Predicted episode terminations are highlighted with red boxes. The world model accurately reflects that missing the ball in Breakout, or letting an enemy reach the carrots in Gopher, will result in the end of an episode.
80
+
81
+ At time step $t$ , the policy observes a reconstructed image observation $\hat { x } _ { t }$ and samples action $a _ { t } \sim$ $\pi ( \boldsymbol { a } _ { t } | \hat { \boldsymbol { x } } _ { \le t } )$ . The world model then predicts the reward $\hat { r } _ { t }$ , the episode end $\hat { d } _ { t }$ , and the next observation $\hat { x } _ { t + 1 } = \overset { - } { D } ( \hat { z } _ { t + 1 } )$ , with $\hat { z } _ { t + 1 } \sim p _ { G } ( \hat { z } _ { t + 1 } \mid z _ { 0 } , a _ { 0 } , \hat { z } _ { 1 } , a _ { 1 } , \dots , \hat { z } _ { t } , a _ { t } )$ . This imagination procedure is initialized with a real observation $x _ { 0 }$ sampled from past experience, and is rolled out for $H$ steps, the imagination horizon hyperparameter. We stop if an episode end is predicted before reaching the horizon. Figure 1 illustrates the imagination procedure.
82
+
83
+ As we roll out imagination for a fixed number of steps, we cannot simply use a Monte Carlo estimate for the expected return. Hence, to bootstrap the rewards that the agent would get beyond a given time step, we have a value network $V$ that estimates $\begin{array} { r } { V ( \hat { x } _ { t } ) \simeq \mathbb { E } _ { \pi } \big [ \sum _ { \tau \geq t } \gamma ^ { \tau - t } \hat { r } _ { \tau } \big ] } \end{array}$ .
84
+
85
+ Many actor-critic methods could be employed to train $\pi$ and $V$ in imagination (Sutton & Barto, 2018; Kaiser et al., 2020; Hafner et al., 2020). For the sake of simplicity, we opt for the learning objectives and hyperparameters of DreamerV2 (Hafner et al., 2021), that delivered strong performance in Atari games. Appendix B gives a detailed breakdown of the reinforcement learning objectives.
86
+
87
+ # 3 EXPERIMENTS
88
+
89
+ Sample-efficient reinforcement learning is a growing field with multiple benchmarks in complex visual environments (Hafner, 2022; Kanervisto et al., 2022). In this work, we focus on the well established Atari 100k benchmark (Kaiser et al., 2020). We present the benchmark and its baselines in Section 3.1. We describe the evaluation protocol and discuss the results in Section 3.2. Qualitative examples of the world model’s capabilities are given in Section 3.3.
90
+
91
+ Table 1: Returns on the 26 games of Atari $1 0 0 \mathrm { k }$ after 2 hours of real-time experience, and humannormalized aggregate metrics. Bold numbers indicate the top methods without lookahead search while underlined numbers specify the overall best methods. IRIS outperforms learning-only methods in terms of number of superhuman games, mean, interquartile mean (IQM), and optimality gap.
92
+
93
+ <table><tr><td colspan="3"></td><td colspan="2">Lookahead search</td><td colspan="5">No lookahead search</td></tr><tr><td>Game</td><td>Random</td><td>Human</td><td>MuZero</td><td>EfficientZero</td><td>SimPLe</td><td>CURL</td><td>DrQ</td><td>SPR</td><td>IRIS (ours)</td></tr><tr><td>Alien</td><td>227.8</td><td>7127.7</td><td>530.0</td><td>808.5</td><td>616.9</td><td>711.0</td><td>865.2</td><td>841.9</td><td>420.0</td></tr><tr><td>Amidar</td><td>5.8</td><td>1719.5</td><td>38.8</td><td>148.6</td><td>74.3</td><td>113.7</td><td>137.8</td><td>179.7</td><td>143.0</td></tr><tr><td>Assault</td><td>222.4</td><td>742.0</td><td>500.1</td><td>1263.1</td><td>527.2</td><td>500.9</td><td>579.6</td><td>565.6</td><td>1524.4</td></tr><tr><td>Asterix</td><td>210.0</td><td>8503.3</td><td>1734.0</td><td>25557.8</td><td>1128.3</td><td>567.2</td><td>763.6</td><td>962.5</td><td>853.6</td></tr><tr><td>BankHeist</td><td>14.2</td><td>753.1</td><td>192.5</td><td>351.0</td><td>34.2</td><td>65.3</td><td>232.9</td><td>345.4</td><td>53.1</td></tr><tr><td>BattleZone</td><td>2360.0</td><td>37187.5</td><td>7687.5</td><td>13871.2</td><td>4031.2</td><td>8997.8</td><td>10165.3</td><td>14834.1</td><td>13074.0</td></tr><tr><td>Boxing</td><td>0.1</td><td>12.1</td><td>15.1</td><td>52.7</td><td>7.8</td><td>0.9</td><td>9.0</td><td>35.7</td><td>70.1</td></tr><tr><td>Breakout</td><td>1.7</td><td>30.5</td><td>48.0</td><td>414.1</td><td>16.4</td><td>2.6</td><td>19.8</td><td>19.6</td><td>83.7</td></tr><tr><td>ChopperCommand</td><td>811.0</td><td>7387.8</td><td>1350.0</td><td>1117.3</td><td>979.4</td><td>783.5</td><td>844.6</td><td>946.3</td><td>1565.0</td></tr><tr><td>CrazyClimber</td><td>10780.5</td><td>35829.4</td><td>56937.0</td><td>83940.2</td><td>62583.6</td><td>9154.4</td><td>21539.0</td><td>36700.5</td><td>59324.2</td></tr><tr><td>DemonAttack</td><td>152.1</td><td>1971.0</td><td>3527.0</td><td>13003.9</td><td>208.1</td><td>646.5</td><td>1321.5</td><td>517.6</td><td>2034.4</td></tr><tr><td>Freeway</td><td>0.0</td><td>29.6</td><td>21.8</td><td>21.8</td><td>16.7</td><td>28.3</td><td>20.3</td><td>19.3</td><td>31.1</td></tr><tr><td>Frostbite</td><td>65.2</td><td>4334.7</td><td>255.0</td><td>296.3</td><td>236.9</td><td>1226.5</td><td>1014.2</td><td>1170.7</td><td>259.1</td></tr><tr><td>Gopher</td><td>257.6</td><td>2412.5</td><td>1256.0</td><td>3260.3</td><td>596.8</td><td>400.9</td><td>621.6</td><td>660.6</td><td>2236.1</td></tr><tr><td>Hero</td><td>1027.0</td><td>30826.4</td><td>3095.0</td><td>9315.9</td><td>2656.6</td><td>4987.7</td><td>4167.9</td><td>5858.6</td><td>7037.4</td></tr><tr><td>Jamesbond</td><td>29.0</td><td>302.8</td><td>87.5</td><td>517.0</td><td>100.5</td><td>331.0</td><td>349.1</td><td>366.5</td><td>462.7</td></tr><tr><td>Kangaroo</td><td>52.0</td><td>3035.0</td><td>62.5</td><td>724.1</td><td>51.2</td><td>740.2</td><td>1088.4</td><td>3617.4</td><td>838.2</td></tr><tr><td>Krull</td><td>1598.0</td><td>2665.5</td><td>4890.8</td><td>5663.3</td><td>2204.8</td><td>3049.2</td><td>4402.1</td><td>3681.6</td><td>6616.4</td></tr><tr><td>KungFuMaster</td><td>258.5</td><td>22736.3</td><td>18813.0</td><td>30944.8</td><td>14862.5</td><td>8155.6</td><td>11467.4</td><td>14783.2</td><td>21759.8</td></tr><tr><td>MsPacman</td><td>307.3</td><td>6951.6</td><td>1265.6</td><td>1281.2</td><td>1480.0</td><td>1064.0</td><td>1218.1</td><td>1318.4</td><td>999.1</td></tr><tr><td>Pong</td><td>-20.7</td><td>14.6</td><td>-6.7</td><td>20.1</td><td>12.8</td><td>-18.5</td><td>-9.1</td><td>-5.4</td><td>14.6</td></tr><tr><td>PrivateEye</td><td>24.9</td><td>69571.3</td><td>56.3</td><td>96.7</td><td>35.0</td><td>81.9</td><td>3.5</td><td>86.0</td><td>100.0</td></tr><tr><td>Qbert</td><td>163.9</td><td>13455.0</td><td>3952.0</td><td>13781.9</td><td>1288.8</td><td>727.0</td><td>1810.7</td><td>866.3</td><td>745.7</td></tr><tr><td>RoadRunner</td><td>11.5</td><td>7845.0</td><td>2500.0</td><td>17751.3</td><td>5640.6</td><td>5006.1</td><td>11211.4</td><td>12213.1</td><td>9614.6</td></tr><tr><td>Seaquest</td><td>68.4</td><td>42054.7</td><td>208.0</td><td>1100.2</td><td>683.3</td><td>315.2</td><td>352.3</td><td>558.1</td><td>661.3</td></tr><tr><td>UpNDown</td><td>533.4</td><td>11693.2</td><td>2896.9</td><td>17264.2</td><td>3350.3</td><td>2646.4</td><td>4324.5</td><td>10859.2</td><td>3546.2</td></tr><tr><td>#Superhuman (↑)</td><td>0</td><td>N/A</td><td>5</td><td>14</td><td>1</td><td>2</td><td>3</td><td>6</td><td>10</td></tr><tr><td>Mean (↑)</td><td>0.000</td><td>1.000</td><td>0.562</td><td>1.943</td><td>0.332</td><td>0.261</td><td>0.465</td><td>0.616</td><td>1.046</td></tr><tr><td>Median (↑)</td><td>0.000</td><td>1.000</td><td>0.227</td><td>1.090</td><td>0.134</td><td>0.092</td><td>0.313</td><td>0.396</td><td>0.289</td></tr><tr><td>IQM (↑)</td><td>0.000</td><td>1.000</td><td>N/A</td><td>N/A</td><td>0.130</td><td>0.113</td><td>0.280</td><td>0.337</td><td>0.501</td></tr><tr><td>Optimality Gap (↓)</td><td>1.000</td><td>0.000</td><td>N/A</td><td>N/A</td><td>0.729</td><td>0.768</td><td>0.631</td><td>0.577</td><td>0.512</td></tr></table>
94
+
95
+ # 3.1 BENCHMARK AND BASELINES
96
+
97
+ Atari $1 0 0 \mathrm { k }$ consists of 26 Atari games (Bellemare et al., 2013a) with various mechanics, evaluating a wide range of agent capabilities. In this benchmark, an agent is only allowed $1 0 0 \mathrm { k }$ actions in each environment. This constraint is roughly equivalent to 2 hours of human gameplay. By way of comparison, unconstrained Atari agents are usually trained for 50 million steps, a 500 fold increase in experience.
98
+
99
+ Multiple baselines were compared on the Atari $1 0 0 \mathrm { k }$ benchmark. SimPLe (Kaiser et al., 2020) trains a policy with PPO (Schulman et al., 2017) in a video generation model. CURL (Laskin et al., 2020) develops off-policy agents from high-level image features obtained with contrastive learning. DrQ (Yarats et al., 2021) augments input images and averages Q-value estimates over several transformations. SPR (Schwarzer et al., 2021) enforces consistent representations of input images across augmented views and neighbouring time steps. The aforementioned baselines carry additional techniques to improve performance, such as prioritized experience replay (Schaul et al., 2016), epsilon-greedy scheduling, or data augmentation.
100
+
101
+ We make a distinction between methods with and without lookahead search. Indeed, algorithms relying on search at decision time (Silver et al., 2016; 2018; Schrittwieser et al., 2020) can vastly improve agent performance, but they come at a premium in computational resources and code complexity. MuZero (Schrittwieser et al., 2020) and EfficientZero (Ye et al., 2021) are the current standard for search-based methods in Atari 100k. MuZero leverages Monte Carlo Tree Search (MCTS) (Kocsis & Szepesvári, 2006; Coulom, 2007) as a policy improvement operator, by unrolling multiple hypothetical trajectories in the latent space of a world model. EfficientZero improves upon MuZero by introducing a self-supervised consistency loss, predicting returns over short horizons in one shot, and correcting off-policy trajectories with its world model.
102
+
103
+ ![](images/ca7e5d04425677b6749a6330b5e40609554692de8dd4f2bacccead0c45322d21.jpg)
104
+ Figure 5: Mean, median, and interquartile mean human normalized scores, computed with stratified bootstrap confidence intervals. 5 runs for IRIS and SimPLe, 100 runs for SPR, CURL, and $_ \mathrm { D r Q }$ (Agarwal et al., 2021).
105
+
106
+ ![](images/e8907b9ad2ffe6c7768e78221a70f85c1653a0f8857bf48919d84c54e74b7c87.jpg)
107
+
108
+ ![](images/63aae36330bd375d4ff6d603ec2fe857fae857cb9cbba47d4cd2d259d61667f6.jpg)
109
+
110
+ (a) Performance profiles, i.e. fraction of runs above a given human normalized score.
111
+
112
+ (b) Probabilities of improvement, i.e. how likely it is for IRIS to outperform baselines on any game.
113
+
114
+ Figure 6: Performance profiles (left) and probabilities of improvement (right) (Agarwal et al., 2021).
115
+
116
+ # 3.2 RESULTS
117
+
118
+ The human normalized score is the established measure of performance in Atari 100k. It is defined as $\frac { s c o r e _ { - } a g e n t - s c o r e _ { - } r a n d o m } { s c o r e _ { - } h u m a n - s c o r e _ { - } r a n d o m }$ , where score_random comes from a random policy, and score_human is obtained from human players (Wang et al., 2016).
119
+
120
+ Table 1 displays returns across games and human-normalized aggregate metrics. For MuZero and EfficientZero, we report the averaged results published by Ye et al. (2021) (3 runs). We use results from the Atari 100k case study conducted by Agarwal et al. (2021) for the other baselines (100 new runs for CURL, DrQ, SPR, and 5 existing runs for SimPLe). Finally, we evaluate IRIS by computing an average over 100 episodes collected at the end of training for each game (5 runs).
121
+
122
+ Agarwal et al. (2021) discuss the limitations of mean and median scores, and show that substantial discrepancies arise between standard point estimates and interval estimates in RL benchmarks. Following their recommendations, we summarize in Figure 5 the human normalized scores with stratified bootstrap confidence intervals for mean, median, and interquartile mean (IQM). For finer comparisons, we also provide performance profiles and probabilities of improvement in Figure 6.
123
+
124
+ With the equivalent of only two hours of gameplay, IRIS achieves a superhuman mean score of 1.046 $( + 7 0 \% )$ , an IQM of 0.501 $( + 4 9 \% )$ , an optimality gap of 0.512 $( + 1 1 \% )$ , and outperforms human players on 10 out of 26 games $( + 6 7 \% )$ , where the relative improvements are computed with respect to SPR (Schwarzer et al., 2021). These results constitute a new state of the art for methods without lookahead search in the Atari 100k benchmark. We also note that IRIS outperforms MuZero, although the latter was not designed for the sample-efficient regime.
125
+
126
+ ![](images/b79b3711c6ebcd8a035be66b49570f1b820306b9d86c63bb14fc07c7b9212939.jpg)
127
+ Figure 7: Three consecutive levels in the games Frostbite (left) and Krull (right). In our experiments, the world model struggles to simulate subsequent levels in Frostbite, but not in Krull. Indeed, exiting the first level in Frostbite requires a long and unlikely sequence of actions to first build the igloo, and then go back to it from the bottom of the screen. Such rare events prevent the world model from internalizing new aspects of the game, which will therefore not be experienced by the policy in imagination. While Krull features more diverse levels, the world model successfully reflects this variety, and IRIS even sets a new state of the art in this environment. This is likely due to more frequent transitions from one stage to the next in Krull, resulting in a sufficient coverage of each level.
128
+
129
+ In addition, performance profiles (Figure 6a) reveal that IRIS is on par with the strongest baselines for its bottom $50 \%$ of games, at which point it stochastically dominates (Agarwal et al., 2021; Dror et al., 2019) the other methods. Similarly, the probability of improvement is greater than 0.5 for all baselines (Figure 6b).
130
+
131
+ In terms of median score, IRIS overlaps with other methods (Figure 5). Interestingly, Schwarzer et al. (2021) note that the median is only influenced by a few decisive games, as evidenced by the width of the confidence intervals for median scores, even with 100 runs for DrQ, CURL and SPR.
132
+
133
+ We observe that IRIS is particularly strong in games that do not suffer from distributional shifts as the training progresses. Examples of such games include Pong, Breakout, and Boxing. On the contrary, the agent struggles when a new level or game mechanic is unlocked through an unlikely event. This sheds light on a double exploration problem. IRIS has to first discover a new aspect of the game for its world model to internalize it. Only then may the policy rediscover and exploit it. Figure 7 details this phenomenon in Frostbite and Krull, two games with multiple levels. In summary, as long as transitions between levels do not depend on low-probability events, the double exploration problem does not hinder performance.
134
+
135
+ Another kind of games difficult to simulate are visually challenging environments where capturing small details is important. As discussed in Appendix E, increasing the number of tokens to encode frames improves performance, albeit at the cost of increased computation.
136
+
137
+ # 3.3 WORLD MODEL ANALYSIS
138
+
139
+ As IRIS learns behaviors entirely in its imagination, the quality of the world model is the cornerstone of our approach. For instance, it is key that the discrete autoencoder correctly reconstructs elements like a ball, a player, or an enemy. Similarly, the potential inability of the Transformer to capture important game mechanics, like reward attribution or episode termination, can severely hamper the agent’s performance. Hence, no matter the amount of imagined trajectories, the agent will learn suboptimal policies if the world model is flawed.
140
+
141
+ While Section 3.2 provides a quantitative evaluation, we aim to complement the analysis with qualitative examples of the abilities of the world model. Figure 2 shows the generation of many plausible futures in the face of uncertainty. Figure 3 depicts pixel-perfect predictions in Pong. Finally, we illustrate in Figure 4 predictions for rewards and episode terminations, which are crucial to the reinforcement learning objective.
142
+
143
+ # 4 RELATED WORK
144
+
145
+ # LEARNING IN THE IMAGINATION OF WORLD MODELS
146
+
147
+ The idea of training policies in a learnt model of the world was first investigated in tabular environments (Sutton & Barto, 2018). Ha & Schmidhuber (2018) showed that simple visual environments could be simulated with autoencoders and recurrent networks. SimPLe (Kaiser et al., 2020) demonstrated that a PPO policy (Schulman et al., 2017) trained in a video prediction model outperformed humans in some Atari games. Improving upon Dreamer (Hafner et al., 2020), DreamerV2 (Hafner et al., 2021) was the first agent learning in imagination to achieve human-level performance in the Atari 50M benchmark. Its world model combines a convolutional autoencoder with a recurrent state-space model (RSSM) (Hafner et al., 2019) for latent dynamics learning. More recently, Chen et al. (2022) explored a variant of DreamerV2 where a Transformer replaces the recurrent network in the RSSM and Seo et al. (2022) enhance DreamerV2 in the setting where an offline dataset of videos is available for pretraining.
148
+
149
+ # REINFORCEMENT LEARNING WITH TRANSFORMERS
150
+
151
+ Following spectacular advances in natural language processing (Manning & Goldie, 2022), the reinforcement learning community has recently stepped into the realm of Transformers. Parisotto et al. (2020) make the observation that the standard Transformer architecture is difficult to optimize with RL objectives. The authors propose to replace residual connections by gating layers to stabilize the learning procedure. Our world model does not require such modifications, which is most likely due to its self-supervised learning objective. The Trajectory Transformer (Janner et al., 2021) and the Decision Transformer (Chen et al., 2021) represent offline trajectories as a static dataset of sequences, and the Online Decision Transformer (Zheng et al., 2022) extends the latter to the online setting. The Trajectory Transformer is trained to predict future returns, states and actions. At inference time, it can thus plan for the optimal action with a reward-driven beam search, yet the approach is limited to low-dimensional states. On the contrary, Decision Transformers can handle image inputs but cannot be easily extended as world models. Ozair et al. (2021) introduce an offline variant of MuZero (Schrittwieser et al., 2020) capable of handling stochastic environments by performing an hybrid search with a Transformer over both actions and trajectory-level discrete latent variables.
152
+
153
+ # IDEO GENERATION WITH DISCRETE AUTOENCODERS AND TRANSFORMER
154
+
155
+ VQGAN (Esser et al., 2021) and DALL-E (Ramesh et al., 2021) use discrete autoencoders to compress a frame into a small sequence of tokens, that a transformer can then model autoregressively. Other works extend the approach to video generation. GODIVA (Wu et al., 2021) models sequences of frames instead of a single frame for text conditional video generation. VideoGPT (Yan et al., 2021) introduces video-level discrete autoencoders, and Transformers with spatial and temporal attention patterns, for unconditional and action conditional video generation.
156
+
157
+ # 5 CONCLUSION
158
+
159
+ We introduced IRIS, an agent that learns purely in the imagination of a world model composed of a discrete autoencoder and an autoregressive Transformer. IRIS sets a new state of the art in the Atari $1 0 0 \mathrm { k }$ benchmark for methods without lookahead search. We showed that its world model acquires a deep understanding of game mechanics, resulting in pixel perfect predictions in some games. We also illustrated the generative capabilities of the world model, providing a rich gameplay experience when training in imagination. Ultimately, with minimal tuning compared to existing battle-hardened agents, IRIS opens a new path towards efficiently solving complex environments.
160
+
161
+ In the future, IRIS could be scaled up to computationally demanding and challenging tasks that would benefit from the speed of its world model. Besides, its policy currently learns from reconstructed frames, but it could probably leverage the internal representations of the world model. Another exciting avenue of research would be to combine learning in imagination with MCTS. Indeed, both approaches deliver impressive results, and their contributions to agent performance might be complementary.
162
+
163
+ # REPRODUCIBILITY STATEMENT
164
+
165
+ The different components and their training objectives are introduced in Section 2 and Appendix B. We describe model architectures and list hyperparameters in Appendix A. We specify the resources used to produce our results in Appendix G. Algorithm 1 makes explicit the interplay between components in the training loop. In Section 3.2, we provide the source of the reported results for the baselines, as well as the evaluation protocol.
166
+
167
+ The code is part of the supplementary materials, and will be open-sourced to ensure reproducible results and foster future research. Minimal dependencies are required to run the codebase and we provide a thorough user guide to get started. Training and evaluation can be launched with simple commands, customization is possible with configuration files, and we include scripts to visualize agents playing and let users interact with the world model.
168
+
169
+ # ETHICS STATEMENT
170
+
171
+ The development of autonomous agents for real-world environments raises many safety and environmental concerns. During its training period, an agent may cause serious harm to individuals and damage its surroundings. It is our belief that learning in the imagination of world models greatly reduces the risks associated with training new autonomous agents. Indeed, in this work, we propose a world model architecture capable of accurately modeling environments with very few samples. However, in a future line of research, one could go one step further and leverage existing data to eliminate the necessity of interacting with the real world.
172
+
173
+ # ACKNOWLEDGMENTS
174
+
175
+ We would like to thank Maxim Peter, Bálint Máté, Daniele Paliotta, Atul Sinha, and Alexandre Dupuis for insightful discussions and comments. Vincent Micheli was supported by the Swiss National Science Foundation under grant number FNS-187494.
176
+
177
+ # REFERENCES
178
+
179
+ Rishabh Agarwal, Max Schwarzer, Pablo Samuel Castro, Aaron C Courville, and Marc Bellemare. Deep reinforcement learning at the edge of the statistical precipice. Advances in neural information processing systems, 34:29304–29320, 2021.
180
+
181
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47: 253–279, 2013a.
182
+
183
+ Marc G Bellemare, Yavar Naddaf, Joel Veness, and Michael Bowling. The arcade learning environment: An evaluation platform for general agents. Journal of Artificial Intelligence Research, 47: 253–279, 2013b.
184
+
185
+ Yoshua Bengio, Nicholas Léonard, and Aaron Courville. Estimating or propagating gradients through stochastic neurons for conditional computation. arXiv preprint arXiv:1308.3432, 2013.
186
+
187
+ Christopher Berner, Greg Brockman, Brooke Chan, Vicki Cheung, Przemysław D˛ebiak, Christy Dennison, David Farhi, Quirin Fischer, Shariq Hashme, Chris Hesse, et al. Dota 2 with large scale deep reinforcement learning. arXiv preprint arXiv:1912.06680, 2019.
188
+
189
+ Noam Brown, Anton Bakhtin, Adam Lerer, and Qucheng Gong. Combining deep reinforcement learning and search for imperfect-information games. Advances in neural information processing systems, 33:17057–17069, 2020a.
190
+
191
+ Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020b.
192
+
193
+ Chang Chen, Yi-Fu Wu, Jaesik Yoon, and Sungjin Ahn. Transdreamer: Reinforcement learning with transformer world models. arXiv preprint arXiv:2202.09481, 2022.
194
+
195
+ Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Misha Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. Advances in neural information processing systems, 34, 2021.
196
+
197
+ Rémi Coulom. Computing “elo ratings” of move patterns in the game of go. ICGA journal, 30(4): 198–208, 2007.
198
+
199
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), 2019.
200
+
201
+ 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.
202
+
203
+ Rotem Dror, Segev Shlomov, and Roi Reichart. Deep dominance-how to properly compare deep neural models. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pp. 2773–2785, 2019.
204
+
205
+ 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.
206
+
207
+ F. A. Gers, J. Schmidhuber, and F. Cummins. Learning to forget: Continual prediction with LSTM. Neural Computation, 12(10):2451–2471, 2000.
208
+
209
+ David Ha and Jürgen Schmidhuber. Recurrent world models facilitate policy evolution. Advances in neural information processing systems, 31, 2018.
210
+
211
+ Danijar Hafner. Benchmarking the spectrum of agent capabilities. In International Conference on Learning Representations, 2022.
212
+
213
+ Danijar Hafner, Timothy Lillicrap, Ian Fischer, Ruben Villegas, David Ha, Honglak Lee, and James Davidson. Learning latent dynamics for planning from pixels. In International conference on machine learning, pp. 2555–2565. PMLR, 2019.
214
+
215
+ Danijar Hafner, Timothy Lillicrap, Jimmy Ba, and Mohammad Norouzi. Dream to control: Learning behaviors by latent imagination. In International Conference on Learning Representations, 2020.
216
+
217
+ Danijar Hafner, Timothy P Lillicrap, Mohammad Norouzi, and Jimmy Ba. Mastering atari with discrete world models. In International Conference on Learning Representations, 2021.
218
+
219
+ Kaiming He, Xinlei Chen, Saining Xie, Yanghao Li, Piotr Dollár, and Ross Girshick. Masked autoencoders are scalable vision learners. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 16000–16009, 2022.
220
+
221
+ Matteo Hessel, Joseph Modayil, Hado Van Hasselt, Tom Schaul, Georg Ostrovski, Will Dabney, Dan Horgan, Bilal Piot, Mohammad Azar, and David Silver. Rainbow: Combining improvements in deep reinforcement learning. In Thirty-second AAAI conference on artificial intelligence, 2018.
222
+
223
+ Sepp Hochreiter and Jürgen Schmidhuber. Long short-term memory. Neural Computation, 9(8): 1735–1780, 1997.
224
+
225
+ Michael Janner, Qiyang Li, and Sergey Levine. Offline reinforcement learning as one big sequence modeling problem. Advances in neural information processing systems, 34, 2021.
226
+
227
+ Justin Johnson, Alexandre Alahi, and Li Fei-Fei. Perceptual losses for real-time style transfer and super-resolution. In European conference on computer vision, pp. 694–711. Springer, 2016.
228
+
229
+ Łukasz Kaiser, Mohammad Babaeizadeh, Piotr Miłos, Błazej Osi ˙ nski, Roy H Campbell, Konrad ´ Czechowski, Dumitru Erhan, Chelsea Finn, Piotr Kozakowski, Sergey Levine, et al. Model based reinforcement learning for atari. In International Conference on Learning Representations, 2020.
230
+
231
+ Anssi Kanervisto, Stephanie Milani, Karolis Ramanauskas, Nicholay Topin, Zichuan Lin, Junyou Li, Jianing Shi, Deheng Ye, Qiang Fu, Wei Yang, Weijun Hong, Zhongyue Huang, Haicheng Chen, Guangjun Zeng, Yue Lin, Vincent Micheli, Eloi Alonso, François Fleuret, Alexander Nikulin, Yury Belousov, Oleg Svidchenko, and Aleksei Shpilman. Minerl diamond 2021 competition: Overview, results, and lessons learned. In Proceedings of the NeurIPS 2021 Competitions and Demonstrations Track, Proceedings of Machine Learning Research, 2022. URL https://proceedings.mlr. press/v176/kanervisto22a.html.
232
+
233
+ Steven Kapturowski, Georg Ostrovski, John Quan, Remi Munos, and Will Dabney. Recurrent experience replay in distributed reinforcement learning. In International conference on learning representations, 2019.
234
+
235
+ Andrej Karpathy. minGPT: A minimal PyTorch re-implementation of the OpenAI GPT (Generative Pretrained Transformer) training, 2020. URL https://github.com/karpathy/minGPT.
236
+
237
+ Levente Kocsis and Csaba Szepesvári. Bandit based monte-carlo planning. In European conference on machine learning, 2006.
238
+
239
+ Taku Kudo and John Richardson. Sentencepiece: A simple and language independent subword tokenizer and detokenizer for neural text processing. In Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing: System Demonstrations, pp. 66–71, 2018.
240
+
241
+ Anders Boesen Lindbo Larsen, Søren Kaae Sønderby, Hugo Larochelle, and Ole Winther. Autoencoding beyond pixels using a learned similarity metric. In International conference on machine learning, pp. 1558–1566. PMLR, 2016.
242
+
243
+ Michael Laskin, Aravind Srinivas, and Pieter Abbeel. CURL: Contrastive unsupervised representations for reinforcement learning. In International Conference on Machine Learning, pp. 5639–5650. PMLR, 2020.
244
+
245
+ Yann LeCun, Bernhard Boser, John S Denker, Donnie Henderson, Richard E Howard, Wayne Hubbard, and Lawrence D Jackel. Backpropagation applied to handwritten zip code recognition. Neural computation, 1(4):541–551, 1989.
246
+
247
+ Christopher Manning and Anna Goldie. Cs224n natural language processing with deep learning, 2022.
248
+
249
+ Volodymyr Mnih, Koray Kavukcuoglu, David Silver, Andrei A Rusu, Joel Veness, Marc G Bellemare, Alex Graves, Martin Riedmiller, Andreas K Fidjeland, Georg Ostrovski, et al. Human-level control through deep reinforcement learning. Nature, 518(7540):529–533, 2015.
250
+
251
+ Volodymyr Mnih, Adria Puigdomenech Badia, Mehdi Mirza, Alex Graves, Timothy Lillicrap, Tim Harley, David Silver, and Koray Kavukcuoglu. Asynchronous methods for deep reinforcement learning. In International conference on machine learning, pp. 1928–1937. PMLR, 2016.
252
+
253
+ Sherjil Ozair, Yazhe Li, Ali Razavi, Ioannis Antonoglou, Aaron Van Den Oord, and Oriol Vinyals. Vector quantized models for planning. In International Conference on Machine Learning, pp. 8302–8313. PMLR, 2021.
254
+
255
+ Emilio Parisotto, Francis Song, Jack Rae, Razvan Pascanu, Caglar Gulcehre, Siddhant Jayakumar, Max Jaderberg, Raphael Lopez Kaufman, Aidan Clark, Seb Noury, et al. Stabilizing transformers for reinforcement learning. In International Conference on Machine Learning, pp. 7487–7498. PMLR, 2020.
256
+
257
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training, 2018.
258
+
259
+ Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners, 2019.
260
+
261
+ Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of Machine Learning Research, 21:1–67, 2020.
262
+
263
+ Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. In International Conference on Machine Learning, pp. 8821–8831. PMLR, 2021.
264
+
265
+ Tom Schaul, John Quan, Ioannis Antonoglou, and David Silver. Prioritized experience replay. In International Conference on Learning Representations, 2016.
266
+
267
+ Martin Schmid, Matej Moravcik, Neil Burch, Rudolf Kadlec, Josh Davidson, Kevin Waugh, Nolan Bard, Finbarr Timbers, Marc Lanctot, Zach Holland, et al. Player of games. arXiv preprint arXiv:2112.03178, 2021.
268
+
269
+ Julian Schrittwieser, Ioannis Antonoglou, Thomas Hubert, Karen Simonyan, L. Sifre, Simon Schmitt, Arthur Guez, Edward Lockhart, Demis Hassabis, Thore Graepel, Timothy P. Lillicrap, and David Silver. Mastering atari, go, chess and shogi by planning with a learned model. Nature, 588(7839): 604–609, 2020.
270
+
271
+ John Schulman, Filip Wolski, Prafulla Dhariwal, Alec Radford, and Oleg Klimov. Proximal policy optimization algorithms. arXiv preprint arXiv:1707.06347, 2017.
272
+
273
+ Mike Schuster and Kaisuke Nakajima. Japanese and korean voice search. In 2012 IEEE international conference on acoustics, speech and signal processing (ICASSP), pp. 5149–5152. IEEE, 2012.
274
+
275
+ Max Schwarzer, Ankesh Anand, Rishab Goel, R Devon Hjelm, Aaron Courville, and Philip Bachman. Data-efficient reinforcement learning with self-predictive representations. In International Conference on Learning Representations, 2021.
276
+
277
+ Younggyo Seo, Kimin Lee, Stephen L James, and Pieter Abbeel. Reinforcement learning with actionfree pre-training from videos. In International Conference on Machine Learning, pp. 19561–19579. PMLR, 2022.
278
+
279
+ David Silver, Aja Huang, Chris J Maddison, Arthur Guez, Laurent Sifre, George Van Den Driessche, Julian Schrittwieser, Ioannis Antonoglou, Veda Panneershelvam, Marc Lanctot, et al. Mastering the game of go with deep neural networks and tree search. Nature, 529(7587):484–489, 2016.
280
+
281
+ David Silver, Thomas Hubert, Julian Schrittwieser, Ioannis Antonoglou, Matthew Lai, Arthur Guez, Marc Lanctot, Laurent Sifre, Dharshan Kumaran, Thore Graepel, et al. A general reinforcement learning algorithm that masters chess, shogi, and go through self-play. Science, 362(6419): 1140–1144, 2018.
282
+
283
+ Richard S. Sutton and Andrew G. Barto. Reinforcement Learning: An Introduction. A Bradford Book, Cambridge, MA, USA, 2018.
284
+
285
+ Aaron Van Den Oord, Oriol Vinyals, et al. Neural discrete representation learning. Advances in neural information processing systems, 30, 2017.
286
+
287
+ 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.
288
+
289
+ Oriol Vinyals, Igor Babuschkin, Wojciech M Czarnecki, Michaël Mathieu, Andrew Dudzik, Junyoung Chung, David H Choi, Richard Powell, Timo Ewalds, Petko Georgiev, et al. Grandmaster level in StarCraft II using multi-agent reinforcement learning. Nature, 575(7782):350–354, 2019.
290
+
291
+ Ziyu Wang, Tom Schaul, Matteo Hessel, Hado Hasselt, Marc Lanctot, and Nando Freitas. Dueling network architectures for deep reinforcement learning. In International conference on machine learning, pp. 1995–2003. PMLR, 2016.
292
+
293
+ Chenfei Wu, Lun Huang, Qianxi Zhang, Binyang Li, Lei Ji, Fan Yang, Guillermo Sapiro, and Nan Duan. Godiva: Generating open-domain videos from natural descriptions. arXiv preprint arXiv:2104.14806, 2021.
294
+
295
+ Roman V Yampolskiy. Artificial Intelligence Safety and Security. Chapman & Hall/CRC, 2018.
296
+
297
+ Wilson Yan, Yunzhi Zhang, Pieter Abbeel, and Aravind Srinivas. Videogpt: Video generation using vq-vae and transformers. arXiv preprint arXiv:2104.10157, 2021.
298
+
299
+ Denis Yarats, Ilya Kostrikov, and Rob Fergus. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. In International Conference on Learning Representations, 2021.
300
+
301
+ Weirui Ye, Shaohuai Liu, Thanard Kurutach, Pieter Abbeel, and Yang Gao. Mastering atari games with limited data. Advances in neural information processing systems, 34, 2021.
302
+
303
+ Qinqing Zheng, Amy Zhang, and Aditya Grover. Online decision transformer. In International Conference on Machine Learning, pp. 27042–27059. PMLR, 2022.
304
+
305
+ # A MODELS AND HYPERPARAMETERS
306
+
307
+ # A.1 DISCRETE AUTOENCODER
308
+
309
+ Our discrete autoencoder is based on the implementation of VQGAN (Esser et al., 2021). We removed the discriminator, essentially turning the VQGAN into a vanilla VQVAE (Van Den Oord et al., 2017) with an additional perceptual loss (Johnson et al., 2016; Larsen et al., 2016).
310
+
311
+ The training objective is the following:
312
+
313
+ $$
314
+ \begin{array} { r } { \dot { z } ( E , D , \mathcal { E } ) = \left\| x - D ( z ) \right\| _ { 1 } + \left\| \operatorname { s g } ( E ( x ) ) - \mathcal { E } ( z ) \right\| _ { 2 } ^ { 2 } + \left\| \operatorname { s g } ( \mathcal { E } ( z ) ) - E ( x ) \right\| _ { 2 } ^ { 2 } + \mathcal { L } _ { p e r c e p t u a l } ( x , D ( z ) ) } \end{array}
315
+ $$
316
+
317
+ Here, the first term is the reconstruction loss, the next two terms constitute the commitment loss (where $\operatorname { s g } ( \cdot )$ is the stop-gradient operator), and the last term is the perceptual loss.
318
+
319
+ Table 2: Encoder / Decoder hyperparameters. We list the hyperparameters for the encoder, the same ones apply for the decoder.
320
+
321
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Frame dimensions (h,w)</td><td>64 × 64</td></tr><tr><td>Layers</td><td>4</td></tr><tr><td>Residual blocks per layer</td><td>2</td></tr><tr><td>Channels in convolutions</td><td>64</td></tr><tr><td>Self-attention layers at resolution</td><td>8/16</td></tr></table>
322
+
323
+ Table 3: Embedding table hyperparameters.
324
+
325
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Vocabulary size (N)</td><td>512</td></tr><tr><td>Tokens per frame (K)</td><td>16</td></tr><tr><td>Token embedding dimension (d)</td><td>512</td></tr></table>
326
+
327
+ Note that during experience collection in the real environment, frames still go through the autoencoder to keep the input distribution of the policy unchanged. See Algorithm 1 for details.
328
+
329
+ # A.2 TRANSFORMER
330
+
331
+ Our autoregressive Transformer is based on the implementation of minGPT (Karpathy, 2020). It takes as input a sequence of $L ( K + 1 )$ tokens and embeds it into a $L ( K + 1 ) \times D$ tensor using an $A \times D$ embedding table for actions, and a $N \times D$ embedding table for frames tokens. This tensor is forwarded through $M$ Transformer blocks. We use GPT2-like blocks (Radford et al., 2019), i.e. each block consists of a self-attention module with layer normalization of the input, wrapped with a residual connection, followed by a per-position multi-layer perceptron with layer normalization of the input, wrapped with another residual connection.
332
+
333
+ Table 4: Transformer hyperparameters
334
+
335
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Timesteps (L)</td><td>20</td></tr><tr><td>Embedding dimension (D)</td><td>256</td></tr><tr><td>Layers (M)</td><td>10</td></tr><tr><td>Attention heads</td><td>4</td></tr><tr><td>Weight decay</td><td>0.01</td></tr><tr><td>Embedding dropout</td><td>0.1</td></tr><tr><td>Attention dropout</td><td>0.1</td></tr><tr><td>Residual dropout</td><td>0.1</td></tr></table>
336
+
337
+ # A.3 ACTOR-CRITIC
338
+
339
+ The weights of the actor and critic are shared except for the last layer. The actor-critic takes as input a $6 4 \times 6 4 \times 3$ frame, and forwards it through a convolutional block followed by an LSTM cell (Mnih et al., 2016; Hochreiter & Schmidhuber, 1997; Gers et al., 2000). The convolutional block consists of the same layer repeated four times: a 3x3 convolution with stride 1 and padding 1, a ReLU activation, and $2 \mathbf { x } 2$ max-pooling with stride 2. The dimension of the LSTM hidden state is 512. Before starting the imagination procedure from a given frame, we burn-in (Kapturowski et al., 2019) the 20 previous frames to initialize the hidden state.
340
+
341
+ Table 5: Training loop & Shared hyperparameters
342
+
343
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Epochs # Collection epochs Environment steps per epoch</td><td>600 500</td></tr><tr><td>Collection epsilon-greedy Eval sampling temperature Start autoencoder after epochs Start transformer after epochs Start actor-critic after epochs Autoencoder batch size Transformer batch size</td><td>200 0.01 0.5 5 25 50 256 64</td></tr><tr><td>Actor-critic batch size Training steps per epoch Learning rate Optimizer Adam β1 Adam β2 Max gradient norm</td><td>64 200 1e-4 Adam 0.9 0.999 10.0</td></tr></table>
344
+
345
+ # B ACTOR-CRITIC LEARNING OBJECTIVES
346
+
347
+ We follow Dreamer (Hafner et al., 2020; 2021) in using the generic $\lambda$ -return, that balances bias and variance, as the regression target for the value network. Given an imagined trajectory $( \hat { x } _ { 0 } , a _ { 0 } , \hat { r } _ { 0 } , \hat { d } _ { 0 } , \dots , \hat { x } _ { H - 1 } , a _ { H - 1 } , \hat { r } _ { H - 1 } , \hat { \dot { d } } _ { H - 1 } , \hat { x } _ { H } )$ , the $\lambda$ -return can be defined recursively as follows:
348
+
349
+ $$
350
+ \Lambda _ { t } = \left\{ \begin{array} { l l l } { \hat { r } _ { t } + \gamma ( 1 - \hat { d } _ { t } ) \Big [ ( 1 - \lambda ) V ( \hat { x } _ { t + 1 } ) + \lambda \Lambda _ { t + 1 } \Big ] } & { \mathrm { i f } } & { t < H } \\ { V ( \hat { x } _ { H } ) } & { \mathrm { i f } } & { t = H } \end{array} \right.
351
+ $$
352
+
353
+ The value network $V$ is trained to minimize ${ \mathcal { L } } _ { V }$ , the expected squared difference with $\lambda$ -returns over imagined trajectories.
354
+
355
+ $$
356
+ \mathcal { L } _ { V } = \mathbb { E } _ { \pi } \Big [ \sum _ { t = 0 } ^ { H - 1 } \big ( V ( \hat { x } _ { t } ) - \mathrm { s g } ( \Lambda _ { t } ) \big ) ^ { 2 } \Big ]
357
+ $$
358
+
359
+ Here, $\operatorname { s g } ( \cdot )$ denotes the gradient stopping operation, meaning that the target is a constant in the gradient-based optimization, as classically established in the literature (Mnih et al., 2015; Hessel et al., 2018; Hafner et al., 2020).
360
+
361
+ As large amounts of trajectories are generated in the imagination MDP, we can use a straightforward reinforcement learning objective for the policy, such as REINFORCE (Sutton & Barto, 2018). To reduce the variance of REINFORCE gradients, we use the value $V ( \hat { x } _ { t } )$ as a baseline (Sutton & Barto, 2018). We also add a weighted entropy maximization objective to maintain a sufficient exploration. The actor is trained to minimize the following REINFORCE objective over imagined trajectories:
362
+
363
+ $$
364
+ \mathcal { L } _ { \pi } = - \mathbb { E } _ { \pi } \Big [ \sum _ { t = 0 } ^ { H - 1 } \log ( \pi ( a _ { t } | \hat { x } _ { \le t } ) ) \mathrm { s g } ( \Lambda _ { t } - V ( \hat { x } _ { t } ) ) + \eta \mathcal { H } ( \pi ( a _ { t } | \hat { x } _ { \le t } ) ) \Big ]
365
+ $$
366
+
367
+ Table 6: RL training hyperparameters
368
+
369
+ <table><tr><td>Hyperparameter</td><td>Value</td></tr><tr><td>Imagination horizon (H)</td><td>20</td></tr><tr><td>Y</td><td>0.995</td></tr><tr><td>入</td><td>0.95</td></tr><tr><td>m</td><td>0.001</td></tr></table>
370
+
371
+ # C OPTIMALITY GAP
372
+
373
+ ![](images/c64a9e4bd73202ca0fbc593f6ed780aadb95d4bba0ccf138c0966f3fd4430366.jpg)
374
+ Figure 8: Optimality gap, lower is better. The amount by which the algorithm fails to reach a human-level score (Agarwal et al., 2021).
375
+
376
+ # D IRIS ALGORITHM
377
+
378
+ # Algorithm 1: IRIS
379
+
380
+ Procedure training_loop(): for epochs do collect_experience(steps_collect) for steps_world_model do update_world_model() for steps_behavior do update_behavior()
381
+
382
+ Procedure collect_experience $( n )$ : $x _ { 0 } \gets$ env.reset() for $t = 0$ to $n - 1$ do $\hat { x } _ { t } \gets D ( E ( x _ { t } ) )$ // forward frame through discrete autoencoder Sample $a _ { t } \sim \pi ( a _ { t } | \hat { x } _ { t } )$ $x _ { t + 1 } , r _ { t } , d _ { t } \gets \mathsf { e n v . s t e p } ( a _ { t } )$ if $d _ { t } = 1$ then $\lfloor x _ { t + 1 } \gets \mathrm { e n v . r e s e t \ ( ) }$ ) $\mathcal { D } \mathcal { D } \cup \{ x _ { t } , a _ { t } , r _ { t } , d _ { t } \} _ { t = 0 } ^ { n - 1 }$
383
+
384
+ Procedure update_world_model():
385
+
386
+ Sample Compu $\{ x _ { t } , a _ { t } , r _ { t } , d _ { t } \} _ { t = \tau } ^ { \tau + L - 1 } \sim \mathcal { D }$ for $z _ { t } : = E ( x _ { t } )$ $\hat { x } _ { t } : = D ( z _ { t } )$ $t = \tau , \dots , \tau + L - 1$
387
+ Update $E$ and $D$
388
+ Compute $p _ { G } ( \hat { z } _ { t + 1 } , \hat { r } _ { t } , \hat { d } _ { t } \mid z _ { \tau } , a _ { \tau } , \ldots , z _ { t } , a _ { t } ) \mathrm { f o r } t = \tau , \ldots , \tau + L - 1$
389
+ Update $G$
390
+
391
+ Procedure update_behavior():
392
+
393
+ Sample $x _ { 0 } \sim \mathcal { D }$
394
+ $z _ { 0 } \gets E ( x _ { 0 } )$
395
+ $\hat { x } _ { 0 } \gets D ( z _ { 0 } )$
396
+ for $t = 0$ to $H - 1$ do Sample $a _ { t } \sim \pi ( a _ { t } | \hat { x } _ { t } )$ Sample $\hat { z } _ { t + 1 } , \hat { r } _ { t } , \hat { d } _ { t } \sim p _ { G } ( \hat { z } _ { t + 1 } , \hat { r } _ { t } , \hat { d } _ { t } \mid z _ { 0 } , a _ { 0 } , \ldots , \hat { z } _ { t } , a _ { t } )$ $\hat { x } _ { t + 1 } \gets D ( \hat { z } _ { t + 1 } )$
397
+ Compute $V ( \hat { x } _ { t } )$ for $t = 0 , \ldots , H$
398
+ Update $\pi$ and $V$
399
+
400
+ The sequence length of the Transformer is determined by the number of tokens used to encode a single frame and the number of timesteps in memory. Increasing the number of tokens per frame results in better reconstructions, although it requires more compute and memory.
401
+
402
+ This tradeoff is particularly important in visually challenging games with a high number of possible configurations, where the discrete autoencoder struggles to properly encode frames with only 16 tokens. For instance, Figure 9 shows that, when increasing the number of tokens per frame to 64 in Alien, the discrete autoencoder correctly reconstructs the player, its enemies, and rewards.
403
+
404
+ ![](images/2cb1ad8ce9a69ae586c09a8d299af51d6d3bca617c48db3bbfb0c63ef72f5423.jpg)
405
+ Figure 9: Tradeoff between the number of tokens per frame and reconstructions quality in Alien. Each column displays a $6 4 \times 6 4$ frame from the real environment (top), its reconstruction with a discrete encoding of 16 tokens (center), and its reconstruction with a discrete encoding of 64 tokens (bottom). In Alien, the player is the dark blue character, and the enemies are the large colored sprites. With 16 tokens per frame, the autoencoder often erases the player, switches colors, and misplaces rewards. When increasing the amount of tokens, it properly reconstructs the frame.
406
+
407
+ Table 7 displays the final performance of IRIS trained with 64 tokens per frame in three games. Interestingly, even though the world model is more accurate, the performance in Alien only increases marginally $( + 3 6 \% )$ . This observation suggests that Alien poses a hard reinforcement learning problem, as evidenced by the low performance of other baselines in that game. On the contrary, IRIS greatly benefits from having more tokens per frame for Asterix $( + 1 2 1 \% )$ and BankHeist $( + 4 3 2 \% )$ ).
408
+
409
+ Table 7: Returns on Alien, Asterix, and BankHeist with 64 tokens per frame instead of 16.
410
+
411
+ <table><tr><td>Game</td><td>Random</td><td>Human</td><td>SimPLe</td><td>CURL</td><td>DrQ</td><td>SPR</td><td>IRIS (16 tokens)</td><td>IRIS (64 tokens)</td></tr><tr><td>Alien</td><td>227.8</td><td>7127.7</td><td>616.9</td><td>711.0</td><td>865.2</td><td>841.9</td><td>420.0</td><td>570.0</td></tr><tr><td>Asterix</td><td>210.0</td><td>8503.3</td><td>1128.3</td><td>567.2</td><td>763.6</td><td>962.5</td><td>853.6</td><td>1890.4</td></tr><tr><td>BankHeist</td><td>14.2</td><td>753.1</td><td>34.2</td><td>65.3</td><td>232.9</td><td>345.4</td><td>53.1</td><td>282.5</td></tr></table>
412
+
413
+ # F BEYOND THE SAMPLE-EFFICIENT SETTING
414
+
415
+ IRIS can be scaled up by increasing the number of tokens used to encode frames, adding capacity to the model, taking more optimization steps per environment steps, or using more data. In this experiment, we investigate data scaling properties by increasing the number of environment steps from $1 0 0 \mathrm { k }$ to 10M. However, to maintain a training time within our computational resources, we lower the ratio of optimization steps per environment steps from 1:1 to 1:50. As a consequence, the results of this experiment at $1 0 0 \mathrm { k }$ frames would be worse than those reported in the paper.
416
+
417
+ Table 8: Increasing the number of environment steps from 100k to 10M.
418
+
419
+ <table><tr><td>Game</td><td>Random</td><td>Human</td><td>IRIS (100k)</td><td>IRIS (10M)</td></tr><tr><td>Alien</td><td>227.8</td><td>7127.7</td><td>420.0</td><td>1003.1</td></tr><tr><td>Amidar</td><td>5.8</td><td>1719.5</td><td>143.0</td><td>213.4</td></tr><tr><td>Assault</td><td>222.4</td><td>742.0</td><td>1524.4</td><td>9355.6</td></tr><tr><td>Asterix</td><td>210.0</td><td>8503.3</td><td>853.6</td><td>6861.0</td></tr><tr><td>BankHeist</td><td>14.2</td><td>753.1</td><td>53.1</td><td>921.6</td></tr><tr><td>BattleZone</td><td>2360.0</td><td>37187.5</td><td>13074.0</td><td>34562.5</td></tr><tr><td>Boxing</td><td>0.1</td><td>12.1</td><td>70.1</td><td>98.0</td></tr><tr><td>Breakout</td><td>1.7</td><td>30.5</td><td>83.7</td><td>493.9</td></tr><tr><td>ChopperCommand</td><td>811.0</td><td>7387.8</td><td>1565.0</td><td>9814.0</td></tr><tr><td>CrazyClimber</td><td>10780.5</td><td>35829.4</td><td>59324.2</td><td>111068.8</td></tr><tr><td>DemonAttack</td><td>152.1</td><td>1971.0</td><td>2034.4</td><td>96218.6</td></tr><tr><td>Freeway</td><td>0.0</td><td>29.6</td><td>31.1</td><td>34.0</td></tr><tr><td>Frostbite</td><td>65.2</td><td>4334.7</td><td>259.1</td><td>290.3</td></tr><tr><td>Gopher</td><td>257.6</td><td>2412.5</td><td>2236.1</td><td>97370.6</td></tr><tr><td>Hero</td><td>1027.0</td><td>30826.4</td><td>7037.4</td><td>19212.0</td></tr><tr><td>Jamesbond</td><td>29.0</td><td>302.8</td><td>462.7</td><td>5534.4</td></tr><tr><td>Kangaroo</td><td>52.0</td><td>3035.0</td><td>838.2</td><td>1793.8</td></tr><tr><td>Krull</td><td>1598.0</td><td>2665.5</td><td>6616.4</td><td>7344.0</td></tr><tr><td>KungFuMaster</td><td>258.5</td><td>22736.3</td><td>21759.8</td><td>39643.8</td></tr><tr><td>MsPacman</td><td>307.3</td><td>6951.6</td><td>999.1</td><td>1233.0</td></tr><tr><td>Pong</td><td>-20.7</td><td>14.6</td><td>14.6</td><td>21.0</td></tr><tr><td>PrivateEye</td><td>24.9</td><td>69571.3</td><td>100.0</td><td>100.0</td></tr><tr><td>Qbert</td><td>163.9</td><td>13455.0</td><td>745.7</td><td>4012.1</td></tr><tr><td>RoadRunner</td><td>11.5</td><td>7845.0</td><td>9614.6</td><td>30609.4</td></tr><tr><td>Seaquest</td><td>68.4</td><td>42054.7</td><td>661.3</td><td>1815.0</td></tr><tr><td>UpNDown</td><td>533.4</td><td>11693.2</td><td>3546.2</td><td>114690.1</td></tr><tr><td>#Superhuman (↑)</td><td>0</td><td>N/A</td><td>10</td><td>15</td></tr><tr><td>Mean (↑)</td><td>0.000</td><td>1.000</td><td>1.046</td><td>7.488</td></tr><tr><td>Median (↑)</td><td>0.000</td><td>1.000</td><td>0.289</td><td>1.207</td></tr><tr><td>IQM (↑)</td><td>0.000</td><td>1.000</td><td>0.501</td><td>2.239</td></tr><tr><td>Optimality Gap (↓)</td><td>1.000</td><td>0.000</td><td>0.512</td><td>0.282</td></tr></table>
420
+
421
+ Table 8 illustrates that increasing the number of environment steps from $1 0 0 \mathrm { k }$ to 10M drastically improves performance for most games, providing evidence that IRIS could be scaled up beyond the sample-efficient regime. On some games, more data only yields marginal improvements, most likely due to hard exploration problems or visually challenging domains that would benefit from a higher number of tokens to encode frames (Appendix E).
422
+
423
+ # G COMPUTATIONAL RESOURCES
424
+
425
+ For each Atari environment, we repeatedly trained IRIS with 5 different random seeds. We ran our experiments with 8 Nvidia A100 40GB GPUs. With two Atari environments running on the same GPU, training takes around 7 days, resulting in an average of 3.5 days per environment.
426
+
427
+ SimPLe (Kaiser et al., 2020), the only baseline that involves learning in imagination, trains for 3 weeks with a P100 GPU on a single environment. As for SPR (Schwarzer et al., 2021), the strongest baseline without lookahead search, it trains notably fast in 4.6 hours with a P100 GPU.
428
+
429
+ Regarding baselines with lookahead search, MuZero (Schrittwieser et al., 2020) originally used 40 TPUs for 12 hours to train in a single Atari environment. Ye et al. (2021) train both EfficientZero and their reimplementation of MuZero in 7 hours with 4 RTX 3090 GPUs. EfficientZero’s implementation relies on a distributed infrastructure with CPU and GPU threads running in parallel, and a $\mathrm { C } { + } { + } I$ Cython implementation of MCTS. By contrast, IRIS and the baselines without lookahead search rely on straightforward single GPU / single CPU implementations.
430
+
431
+ # H EXPLORATION IN FREEWAY
432
+
433
+ The reward function in Freeway is sparse since the agent is only rewarded when it completely crosses the road. In addition, bumping into cars will drag it down, preventing it from smoothly ascending the highway. This poses an exploration problem for newly initialized agents because a random policy will almost surely never obtain a non-zero reward with a $1 0 0 \mathrm { k }$ frames budget.
434
+
435
+ ![](images/676fa0be6259e8d392e4880b54a96a08e8f9585755fcdad6d6d5346cb65c2b09.jpg)
436
+ Figure 10: A game of Freeway. Cars will bump the player down, making it very unlikely to cross the road and be rewarded for random policies.
437
+
438
+ The solution to this problem is actually straightforward and simply requires stretches of time when the UP action is oversampled. Most Atari $1 0 0 \mathrm { k }$ baselines fix the issue with epsilon-greedy schedules and argmax action selection, where at some point the network configuration will be such that the UP action is heavily favored. In this work, we opted for the simpler strategy of having a fixed epsilon-greedy parameter and sampling from the policy. However, we lowered the sampling temperature from 1 to 0.01 for Freeway, in order to avoid random walks that would not be conducive to learning in the early stages of training. As a consequence, once it received its first few rewards through exploration, IRIS was able to internalize the sparse reward function in its world model.
md/dev/vruwp11pWnO/vruwp11pWnO.md ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # IMPROVING AND ASSESSING ANOMALY DETECTORS FOR LARGE-SCALE SETTINGS
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ Detecting out-of-distribution examples is important for safety-critical machine learning applications such as detecting novel biological phenomena and self-driving cars. However, existing research mainly focuses on simple small-scale settings. To set the stage for more realistic out-of-distribution detection, we depart from small-scale settings and explore large-scale multiclass and multi-label settings with high-resolution images and thousands of classes. To make future work in real-world settings possible, we create new benchmarks for three large-scale settings. To test ImageNet multiclass anomaly detectors, we introduce a new dataset of anomalous species. We leverage ImageNet-21K to evaluate PASCAL VOC and COCO multilabel anomaly detectors. Third, we introduce a new benchmark for anomaly segmentation by introducing a segmentation benchmark with road anomalies. We conduct extensive experiments in these more realistic settings for out-of-distribution detection and find that a surprisingly simple detector based on the maximum logit outperforms prior methods in all the large-scale multi-class, multi-label, and segmentation tasks, establishing a simple new baseline for future work.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Out-of-distribution (OOD) detection is a valuable tool for developing safe and reliable machine learning (ML) systems. Detecting anomalous inputs allows systems to initiate a conservative fallback policy or defer to human judgment. As an important component of ML Safety (Hendrycks et al., 2021), OOD detection is important for safety-critical applications such as self-driving cars and detecting novel microorganisms. Accordingly, research on out-of-distribution detection has a rich history spanning several decades (Schölkopf et al., 1999; Breunig et al., 2000; Emmott et al., 2015). Recent work leverages deep neural representations for out-of-distribution detection in complex domains, such as image data (Hendrycks & Gimpel, 2017; Lee et al., 2018a; Mohseni et al., 2020; Hendrycks et al., 2019b). However, these works still primarily use small-scale datasets with low-resolution images and few classes. As the community moves towards more realistic, large-scale settings, strong baselines and high-quality benchmarks are imperative for future progress.
12
+
13
+ Large-scale datasets such as ImageNet (Deng et al., 2009) and Places365 (Zhou et al., 2017) present unique challenges not seen in small-scale settings, such as a plethora of fine-grained object classes. We demonstrate that the maximum softmax probability (MSP) detector, a state-of-the-art method for small-scale problems, does not scale well to these challenging conditions. Through extensive experiments, we identify a detector based on the maximum logit (MaxLogit) that greatly outperforms the MSP and other strong baselines in large-scale multi-class anomaly segmentation. To facilitate further research in this setting, we also collect a new out-of-distribution test dataset suitable for models trained on highly diverse datasets. Shown in Figure 2, our Species dataset contains diverse, anomalous species that do not overlap ImageNet-21K which has approximately twenty two thousand classes. Species avoids data leakage and enables a stricter evaluation methodology for ImageNet-21K models. Using Species to conduct more controlled experiments without train-test overlap, we find that contrary to prior claims (Fort et al., 2021; Koner et al., 2021), Vision Transformers (Dosovitskiy et al., 2021a) pre-trained on ImageNet-21K are not substantially better at out-of-distribution detection.
14
+
15
+ Moreover, in the common real-world case of multi-label data, the MSP detector cannot naturally be applied in the first place, as it requires softmax probabilities. To enable research into the multi-label setting for anomaly detection, we contribute a multi-label experimental setup and explore various methods on large-scale multi-label datasets. We find that the MaxLogit detector from our investigation into the large-scale multi-class setting generalizes well to multi-label data and again outperforms all other baselines.
16
+
17
+ ![](images/8595abd6b64885b25129dadf2053a7309f448d326b5e56de08cc3f4b6a1ec9f1.jpg)
18
+ Figure 1: We scale up out-of-distribution detection to large-scale multi-class datasets with thousands of classes, multi-label datasets with complex scenes, and anomaly segmentation in driving environments. We introduce new benchmarks for all three settings. In all of these settings, we find that an OOD detector based on the maximum logit outperforms previous methods, establishing a strong and versatile baseline for future work on large-scale OOD detection. The bottom-right shows a scene from our new anomaly segmentation benchmark and the predicted anomaly using a state-of-the-art detector.
19
+
20
+ In addition to focusing on small-scale datasets, most existing benchmarks for anomaly detection treat entire images as anomalies. In practice, an image could be anomalous in localized regions while being in-distribution elsewhere. Knowing which regions of an image are anomalous could allow for safer handling of unfamiliar objects in the case of self-driving cars. Creating a benchmark for this task is difficult, though, as simply cutting and pasting anomalous objects into images introduces various unnatural giveaway cues such as edge effects, mismatched orientation, and lighting, all of which trivialize the task of anomaly segmentation (Blum et al., 2019).
21
+
22
+ To overcome these issues, we utilize a simulated driving environment to create the novel StreetHazards dataset for anomaly segmentation. Using the Unreal Engine and the open-source CARLA simulation environment (Dosovitskiy et al., 2017), we insert a diverse array of foreign objects into driving scenes and re-render the scenes with these novel objects. This enables integration of the foreign objects into their surrounding context with correct lighting and orientation, sidestepping giveaway cues.
23
+
24
+ To complement the StreetHazards dataset, we convert the BDD100K semantic segmentation dataset (Yu et al., 2018) into an anomaly segmentation dataset, which we call BDD-Anomaly. By leveraging the large scale of BDD100K, we reserve infrequent object classes to be anomalies. We combine this dataset with StreetHazards to form the Combined Anomalous Object Segmentation (CAOS) benchmark. The CAOS benchmark improves over previous evaluations for anomaly segmentation in driving scenes by evaluating detectors on realistic and diverse anomalies. We evaluate several baselines on the CAOS benchmark and discuss problems with porting existing approaches from earlier formulations of out-of-distribution detection.
25
+
26
+ Despite its simplicity, we find that the MaxLogit detector outperforms all baselines on Species, our multi-class benchmark, and CAOS. In each of these three settings, we discuss why MaxLogit provides superior performance, and we show that these gains are hidden if one looks at small-scale problems alone. The code for our experiments and the Species and CAOS datasets are available at [anonymized]. Our new baseline combined with Species and CAOS benchmarks pave the way for future research on large-scale out-of-distribution detection.
27
+
28
+ # Anomalous Species Dataset
29
+
30
+ ![](images/654db4cbaa3ed751b6c6dce51acbc564fb80912d3bccb104063743fd809b6f2d.jpg)
31
+ Figure 2: The Species out-of-distribution dataset is designed for large-scale anomaly detectors pretrained on datasets as diverse as ImageNet-21K. When models are pretrained on ImageNet-21K, many previous OOD detection datasets may overlap with the pretraining set, resulting in erroneous evaluations. To rectify this, Species is comprised of hundreds of anomalous species that are disjoint from ImageNet-21K classes and enables the evaluation of cutting-edge models.
32
+
33
+ # 2 RELATED WORK
34
+
35
+ Multi-Class Out-of-Distribution Detection. A recent line of work leverages deep neural representations from multi-class classifiers to perform out-of-distribution (OOD) detection on highdimensional data, including images, text, and speech data. Hendrycks & Gimpel (2017) formulate the task and propose the simple baseline of using the maximum softmax probability of the classifier on an input to gauge whether the input is out-of-distribution. In particular, they formulate the task as distinguishing between examples from an in-distribution dataset and various OOD datasets. Importantly, entire images are treated as out-of-distribution.
36
+
37
+ Continuing this line of work, Lee et al. (2018a) propose to improve the neural representation of the classifier to better separate OOD examples. They use generative adversarial networks to produce neardistribution examples and induce uniform posteriors on these synthetic OOD examples. Hendrycks et al. (2019b) observe that outliers are often easy to obtain in large quantity from diverse, realistic datasets and demonstrate that OOD detectors trained on these outliers generalize to unseen classes of anomalies. Other work investigates improving the anomaly detectors themselves given a fixed classifier (DeVries & Taylor, 2018; Liang et al., 2018). However, as Hendrycks et al. (2019b) observe, many of these works tune hyperparameters on a particular type of anomaly that is also seen at test time, so their evaluation setting is more lenient. In this paper, all anomalies seen at test time come from entirely unseen categories and are not tuned on in any way. Hence, we do not compare to techniques such as ODIN (Liang et al., 2018). Additionally, in a point of departure from prior work, we focus primarily on large-scale images and datasets with many classes.
38
+
39
+ Recent work has suggested that stronger representations from Vision Transformers pre-trained on ImageNet-21K can make out-of-distribution detection trivial (Fort et al., 2021; Koner et al., 2021). They evaluate models on detecting CIFAR-10 when fine-tuned on CIFAR-100 or vice versa, using models pretrained on ImageNet-21K. However, over 1,000 classes in ImageNet-21K overlap with CIFAR-10, so it is still unclear how Vision Transformers perform at detecting entirely unseen OOD categories. We create a new OOD test dataset of anomalous species to investigate how well Vision Transformers perform in controlled OOD detection settings without data leakage and overlap. We find that Vision Transformers pre-trained on ImageNet-21K are far from solving OOD detection in large-scale settings.
40
+
41
+ <table><tr><td></td><td colspan="3">FPR95↓</td><td colspan="3">AUROC↑</td><td colspan="3">AUPR↑</td></tr><tr><td>Din</td><td>MSP</td><td>DeVries</td><td>MaxLogit</td><td>MSP</td><td>DeVries MaxLogit</td><td></td><td>MSP</td><td>DeVries</td><td>MaxLogit</td></tr><tr><td>ImageNet</td><td>44.2</td><td>46.0</td><td>35.8</td><td>84.6</td><td>76.9</td><td>87.2</td><td>38.2</td><td>30.5</td><td>45.8</td></tr><tr><td>Places365</td><td>52.6</td><td>85.8</td><td>36.6</td><td>76.0</td><td>31.1</td><td>85.8</td><td>8.2</td><td>2.0</td><td>19.2</td></tr></table>
42
+
43
+ Table 1: Multi-class out-of-distribution detection results using the maximum softmax probability (MSP) baseline (Hendrycks & Gimpel, 2017), the confidence branch detector of DeVries & Taylor (2018), and our maximum logit baseline. All values are percentages and average across five out-ofdistribution test datasets. Full results on individual OOD test datasets are in the Appendix.
44
+
45
+ Anomaly Segmentation. Several prior works explore segmenting anomalous image regions. One line of work uses the WildDash dataset (Zendel et al., 2018), which contains numerous annotated driving scenes in conditions such as snow, fog, and rain. The WildDash test set contains fifteen “negative images” from different domains for which the goal is to mark the entire image as out-ofdistribution. Thus, while the task is segmentation, the anomalies do not exist as objects within an otherwise in-distribution scene. This setting is similar to that explored by Hendrycks & Gimpel (2017), in which whole images from other datasets serve as out-of-distribution examples.
46
+
47
+ To approach anomaly segmentation on WildDash, Krešo et al. (2018) train on multiple semantic segmentation domains and treat regions of images from the WildDash driving dataset as out-ofdistribution if they are segmented as regions from different domains, i.e. indoor classes. Bevandic´ et al. (2018) use ILSVRC 2012 images and train their network to segment the entirety of these images as out-of-distribution.
48
+
49
+ In medical anomaly segmentation and product fault detection, anomalies are regions of otherwise in-distribution images. Baur et al. (2019) segment anomalous regions in brain MRIs using pixelwise reconstruction loss. Similarly, Haselmann et al. (2018) perform product fault detection using pixel-wise reconstruction loss and introduce an expansive dataset for segmentation of product faults. In these relatively simple domains, reconstruction-based approaches work well. In contrast to medical anomaly segmentation and fault detection, we consider complex images from street scenes. These images have high variability in scene layout and lighting, and hence are less amenable to reconstruction-based techniques.
50
+
51
+ The two works closest to our own are the Lost and Found (Pinggera et al., 2016) and Fishyscapes (Blum et al., 2019) datasets. The Lost and Found dataset consists of real images in a driving environment with small road hazards. The images were collected to mirror the Cityscapes dataset (Cordts et al., 2016) but are only collected from one city and so have less diversity. The dataset contains 35 unique anomalous objects, and methods are allowed to train on many of these. For Lost and Found, only nine unique objects are truly unseen at test time. Crucially, this is a different evaluation setting from our own, where anomalous objects are not revealed at training time, so their dataset is not directly comparable. Nevertheless, the BDD-Anomaly dataset fills several gaps in Lost and Found. First, the images are more diverse, because they are sourced from a more recent and comprehensive semantic segmentation dataset. Second, the anomalies are not restricted to small, sparse road hazards. Concretely, anomalous regions in Lost and Found take up $0 . 1 1 \%$ of the image on average, whereas anomalous regions in the BDD-Anomaly dataset are larger and fill $0 . 8 3 \%$ of the image on average. Finally, although the BDD-Anomaly dataset treats three categories as anomalous, compared to Lost and Found it has far more unique anomalous objects.
52
+
53
+ The Fishyscapes benchmark for anomaly segmentation consists of cut-and-paste anomalies from out-of-distribution domains. This is problematic, because the anomalies stand out as clearly unnatural in context. For instance, the orientation of anomalous objects is unnatural, and the lighting of the cut-and-paste patch differs from the lighting in the original image, providing an unnatural cue to anomaly detectors that would not exist for real anomalies. Figure 7 shows an example of these inconsistencies. Techniques for detecting image manipulation (Zhou et al., 2018; Johnson & Farid, 2005) are competent at detecting artificial image elements of this kind. Our StreetHazards dataset overcomes these issues by leveraging a simulated driving environment to naturally insert anomalous 3D models into a scene rather than overlaying 2D images. These anomalies are integrated into the scene with proper lighting and orientation, mimicking real-world anomalies and making them significantly more difficult to detect.
54
+
55
+ ![](images/c3e38c3fa532816e71e5ccfdee9b5bd80f517c0c2915dee5bd921821eb1372be.jpg)
56
+ Figure 3: Small-scale datasets such as CIFAR-10 have relatively disjoint classes, but larger-scale datasets including ImageNet-1K have several classes with high visual similarity to other classes. This implies that large-scale classifiers disperse probability mass among several classes. If the prediction confidence is used for out-of-distribution detection, then images which have similarities to other classes will often wrongly be deemed out-of-distribution due to low and dispersed confidence. This motivates our MaxLogit out-of-distribution detector.
57
+
58
+ # 3 MULTI-CLASS PREDICTION FOR OOD DETECTION
59
+
60
+ Problem with existing baselines. Existing baselines for anomaly detection can work well in small-scale settings. However, in more realistic settings image classification networks are often tasked with distinguishing hundreds or thousands of classes, possibly with subtle differences. This is problematic for the maximum softmax probability (MSP) baseline (Hendrycks & Gimpel, 2017), which uses the negative maximum softmax probability as the anomaly score, or $\begin{array} { r } { \dot { { \bf \varphi } } - \operatorname* { m a x } _ { k } \exp f ( x ) _ { k } / \sum _ { i } \exp f ( \bar { x _ { i } } ) _ { i } = - \operatorname* { m a x } _ { k } \hat { p } ( y = k \mid x ) } \end{array}$ , where $f ( x )$ is the unnormalized logits of classifier $f$ on input $x$ . Classifiers tend to have higher confidence on in-distribution examples than out-of-distribution examples, enabling OOD detection. Assuming single-model evaluation and no access to other anomalies or test-time adaptation, the MSP attains state-of-the-art anomaly detection performance in small-scale settings. However, we show that the MSP is problematic for realistic in-distribution datasets with many classes, such as ImageNet and Places365 (Zhou et al., 2017). Probability mass can be dispersed among visually similar classes, as shown in Figure 3. Consequently, a classifier may produce a low confidence prediction for an in-distribution image, not because the image is unfamiliar, but because the object’s exact class is difficult to determine. To circumvent this problem, we propose using the negative of the maximum unnormalized logit for an anomaly score $- \operatorname* { m a x } _ { k } f ( x ) _ { k }$ , which we call MaxLogit. Since the logits are unnormalized, they are not affected by the number of classes and can serve as a better baseline for large-scale out-of-distribution detection.
61
+
62
+ The Species Out-Of-Distribution Dataset. To enable controlled experiments and high-quality evaluations of anomaly detectors in large-scale settings, we create the Species dataset, a new outof-distribution test dataset that has no overlapping classes with ImageNet-21K. The Species dataset is comprised of images scraped from the iNaturalist website and contains hundreds of anomalous species grouped into seven high-level categories: Plants, Microorganisms, Amphibians, Protozoa, Fungi, Arachnids, and Insects. Example images from the Species dataset are in Figure 2.
63
+
64
+ Setup. To evaluate the MSP baseline out-of-distribution detector and the MaxLogit detector, we use ImageNet-21K as the in-distribution dataset $\mathcal { D } _ { \mathrm { i n } }$ . To obtain representations for anomaly detection, we use models trained on ImageNet-21K-P, a cleaned version of ImageNet-21K with a train/val split (Ridnik et al., 2021a). We evaluate a TResNet-M, ViT-B-16, and Mixer-B-16 (Ridnik et al., 2021b; Dosovitskiy et al., 2021b; Tolstikhin et al., 2021), and the validation split is used for obtaining in-distribution scores. For out-of-distribution test datasets $\mathcal { D } _ { \mathrm { o u t } }$ , we use categories from the Species dataset, all of which are unseen during training. Results for these experiments are in Table 2. We also use ImageNet-1K and Places365 as in-distribution datasets $\mathcal { D } _ { \mathrm { i n } }$ , for which we use pretrained ResNet-50 models and use several out-of-distribution test datasets $\mathcal { D } _ { \mathrm { o u t } }$ . Full results with ImageNet and Places365 as in-distribution are in the Appendix.
65
+
66
+ Table 2: Results on Species. Models and the processed version of ImageNet-21K (ImageNet-21K-P) are from Ridnik et al. (2021a). All values are percent AUROC. Species enables evaluating anomaly detectors trained on ImageNet-21K and evades class overlap issues present in prior work. Using Species to conduct more controlled experiments without class overlap issues, we find that contrary to recent claims (Fort et al., 2021), simply scaling up Vision Transformers does not make OOD detection trivial.
67
+
68
+ <table><tr><td></td><td></td><td colspan="2">ResNet</td><td colspan="2">ViT</td><td colspan="2">MLPMixer</td></tr><tr><td>Din</td><td>Dtest out</td><td>MSP</td><td>MaxLogit</td><td>MSP</td><td>MaxLogit</td><td>MSP</td><td>MaxLogit</td></tr><tr><td></td><td>Plants</td><td>80.3</td><td>87.8</td><td>78.2</td><td>84.8</td><td>80.3</td><td>85.0</td></tr><tr><td></td><td>Microorganisms</td><td>77.4</td><td>83.4</td><td>71.1</td><td>82.4</td><td>74.4</td><td>86.0</td></tr><tr><td></td><td>Amphibians</td><td>41.8</td><td>48.6</td><td>41.9</td><td>48.8</td><td>44.4</td><td>51.7</td></tr><tr><td></td><td>Protozoa</td><td>70.7</td><td>80.4</td><td>69.3</td><td>80.9</td><td>68.0</td><td>77.7</td></tr><tr><td></td><td>Fungi</td><td>66.4</td><td>77.4</td><td>64.7</td><td>76.1</td><td>64.1</td><td>76.9</td></tr><tr><td>het</td><td>Arachnids</td><td>46.9</td><td>56.7</td><td>46.6</td><td>56.8</td><td>48.9</td><td>58.8</td></tr><tr><td></td><td>Insects</td><td>47.6</td><td>56.4</td><td>48.0</td><td>54.6</td><td>48.6</td><td>53.8</td></tr><tr><td></td><td>Mean</td><td>61.6</td><td>70.1</td><td>60.0</td><td>69.2</td><td>61.2</td><td>70.0</td></tr></table>
69
+
70
+ Metrics. To evaluate out-of-distribution detectors in large-scale settings, we use three standard metrics of detection performance: area under the ROC curve (AUROC), false positive rate at $9 5 \%$ recall (FPR95), and area under the precision-recall curve (AUPR). The AUROC and AUPR are important metrics, because they give a holistic measure of performance when the cutoff for detecting anomalies is not a priori obvious or when we want to represent the performance of a detection method across several different cutoffs.
71
+
72
+ The AUROC can be thought of as the probability that an anomalous example is given a higher score than an ordinary example. Thus, a higher score is better, and an uninformative detector has a AUROC of $50 \%$ . AUPR provides a metric more attuned to class imbalances, which is relevant in anomaly and failure detection, when the number of anomalies or failures may be relatively small. Last, the FPR95 metric consists of measuring the false positive rate at $9 5 \%$ . Since these measures are correlated, we occasionally solely present the AUROC for brevity and to preserve space.
73
+
74
+ Results. Results on Species are shown in Table 2. Results with ImageNet-1K and Places365 as in-distribution datasets are in Table 1. We find that the proposed MaxLogit method outperforms the maximum softmax probability baseline on all out-of-distribution test datasets $\mathcal { D } _ { \mathrm { o u t } }$ . This holds true for all three models trained on ImageNet-21K. The MSP baseline is not much better than random and is has similar performance for all three model classes. This suggests that contrary to recent claims, (Fort et al., 2021) simply scaling up Vision Transformers does not make OOD detection trivial.
75
+
76
+ # 4 MULTI-LABEL PREDICTION FOR OOD DETECTION
77
+
78
+ Current work on out-of-distribution detection primarily considers multi-class or unsupervised settings. Yet as classifiers become more useful in realistic settings, the multi-label formulation becomes increasingly natural. To investigate out-of-distribution detection in multi-label settings, we provide a baseline and evaluation setup.
79
+
80
+ Setup. For multi-label classification we use PASCAL VOC (Everingham et al., 2009) and MSCOCO (Lin et al., 2014) as in-distribution data. To evaluate anomaly detectors for these in-distribution datasets, we use 20 out-of-distribution classes from ImageNet-21K. These classes have no overlap with ImageNet-1K, PASCAL VOC, or MS-COCO. The 20 classes are chosen not to overlap with ImageNet-1K since the multi-label classifiers models are pre-trained on ImageNet-1K. We list the class WordNet IDs in the Appendix.
81
+
82
+ Methods. For our experiments, we use a ResNet-101 backbone architecture pre-trained on ImageNet-1K. We replace the final layer with 2 fully connected layers and apply the logistic sigmoid function for multi-label prediction. During training we freeze the batch normalization parameters due to an insufficient number of images for proper mean and variance estimation. We train each model for 50 epochs using the Adam optimizer (Kingma & Ba, 2014) with hyperparameter values $1 0 ^ { - 4 }$ and
83
+
84
+ Table 3: Multi-label out-of-distribution detection comparison of the Isolation Forest (iForest), Local Outlier Factor (LOF), Dropout, logit average, maximum softmax probability, and maximum logit anomaly detectors on PASCAL VOC and MS-COCO. The same network architecture is used for all three detectors. All results shown are percentages.
85
+
86
+ <table><tr><td colspan="3"></td><td>iForest</td><td>LOF</td><td>Dropout</td><td>LogitAvg</td><td>MSP</td><td>MaxLogit</td></tr><tr><td rowspan="3">PASCAL VOC</td><td>FPR95</td><td></td><td>98.6</td><td>84.0</td><td>97.2</td><td>98.2</td><td>82.3</td><td>35.6</td></tr><tr><td>AUROC</td><td></td><td>46.3</td><td>68.4</td><td>49.2</td><td>47.9</td><td>74.2</td><td>90.9</td></tr><tr><td>AUPR</td><td>→↑↑</td><td>37.1</td><td>58.4</td><td>45.3</td><td>41.3</td><td>65.5</td><td>81.2</td></tr><tr><td rowspan="3">COCO</td><td>FPR95</td><td>√</td><td>95.6</td><td>78.4</td><td>93.3</td><td>94.5</td><td>81.8</td><td>40.4</td></tr><tr><td>AUROC</td><td>个</td><td>41.4</td><td>70.2</td><td>58.0</td><td>55.5</td><td>70.7</td><td>90.3</td></tr><tr><td>AUPR</td><td>个</td><td>63.7</td><td>82.0</td><td>76.3</td><td>74.0</td><td>82.9</td><td>94.0</td></tr></table>
87
+
88
+ $1 0 ^ { - 5 }$ for $\beta _ { 1 }$ and $\beta _ { 2 }$ respectively. For data augmentation we use standard resizing, random crops, and random flips to obtain images of size $2 5 6 \times 2 5 6 \times 3$ . As a result of this training procedure, the mAP of the ResNet-101 on PASCAL VOC is $8 9 . 1 1 \%$ and $7 2 . 0 \%$ for MS-COCO.
89
+
90
+ As there has been little work on out-of-distribution detection in multilabel settings, we include comparisons to classic anomaly detectors for general settings. Isolation Forest, denoted by iForest, works by randomly partitioning the space into half spaces to form a decision tree. The score is determined by how close a point is to the root of the tree. The local outlier factor (LOF) (Breunig et al., 2000) computes a local density ratio between every element and its neighbors. We set the number of neighbors as 20. iForest and LOF are both computed on features from the penultimate layer of the networks. MSP denotes a natural extension of the maximum softmax probability detector in the multi-label setting, obtained by taking the sigmoid of each output score $f ( { \boldsymbol { x } } ) _ { i }$ and computing $- \operatorname* { m a x } _ { i } \sigma ( f ( x ) _ { i } )$ . Alternatively, one can average the logit values, denoted by LogitAvg. These serve as our baseline detectors for multi-label OOD detection. We compare these baselines to the MaxLogit detector that we introduce in Section 3. As in the multi-class case, the MaxLogit anomaly score for multi-label classification is $- \operatorname* { m a x } _ { i } f ( x ) _ { i }$ .
91
+
92
+ Results. Results are shown in Table 3. We find that MaxLogit obtains the highest performance in all cases. MaxLogit bears similarity to the MSP baseline (Hendrycks & Gimpel, 2017) but is naturally applicable to multi-label problems. These results establish the MaxLogit as an effective and natural baseline for large-scale multi-label problems. Further, the evaluation setup enables future work in out-of-distribution detection with multi-label datasets.
93
+
94
+ # 5 THE CAOS BENCHMARK
95
+
96
+ The Combined Anomalous Object Segmentation (CAOS) benchmark is comprised of two complementary datasets for evaluating anomaly segmentation systems on diverse, realistic anomalies. First is the StreetHazards dataset, which leverages simulation to provide a large variety of anomalous objects realistically inserted into driving scenes. Second is the BDD-Anomaly dataset, which consists of real images taken from the BDD100K dataset (Yu et al., 2018). StreetHazards contains a highly diverse array of anomalies; BDD-Anomaly contains anomalies in real-world images. Together, these datasets allow researchers to judge techniques on their ability to segment diverse anomalies as well as anomalies in real images. All images have $7 2 0 \times 1 2 8 0$ resolution.
97
+
98
+ The StreetHazards Dataset. StreetHazards is an anomaly segmentation dataset that leverages simulation to provide diverse, realistically-inserted anomalous objects. To create the StreetHazards dataset, we use the Unreal Engine along with the CARLA simulation environment (Dosovitskiy et al., 2017). From several months of development and testing including customization of the Unreal Engine and CARLA, we can insert foreign entities into a scene while having them be properly integrated. Unlike previous work, this avoids the issues of inconsistent chromatic aberration, inconsistent lighting, edge effects, and other simple cues that an object is anomalous. Additionally, using a simulated environment allows us to dynamically insert diverse anomalous objects in any location and have them render properly with changes to lighting and weather including time of day, cloudy skies, and rain.
99
+
100
+ We use 3 towns from CARLA for training, from which we collect RGB images and their respective semantic segmentation maps to serve as training data for semantic segmentation models. We generate a validation set from the fourth town. Finally, we reserve the fifth and sixth town as our test set. We insert anomalies taken from the Digimation Model Bank Library and semantic ShapeNet (ShapeNetSem) (Savva et al., 2015) into the test set in order to evaluate methods for out-of-distribution detection. In total, we use 250 unique anomaly models of diverse types. There are 12 classes used for training: background, road, street lines, traffic signs, sidewalk, pedestrian, vehicle, building, wall, pole, fence, and vegetation. The thirteenth class is the anomaly class that is only used at test time. We collect 5,125 image and semantic segmentation ground truth pairs for training, 1,031 pairs without anomalies for validation, and 1,500 test pairs with anomalies.
101
+
102
+ ![](images/9f6a01add5da434aa775b1cb401e714b45aeff0bd523f7abf8d24e9f6ac738fc.jpg)
103
+ Figure 4: A sample of anomalous scenes from the CAOS benchmark with model predictions and anomaly scores. The anomaly scores are thresholded to the top $10 \%$ of values for visualization. GT is ground truth, the autoencoder model is based on the spatial autoencoder used in Baur et al. (2019), MSP is the maximum softmax probability baseline (Hendrycks & Gimpel, 2017), and MaxLogit is the method we propose as a new baseline for large-scale settings. Compared to baselines, the MaxLogit detector places lower scores on in-distribution image regions, including object outlines, while also doing a better job of highlighting anomalous objects.
104
+
105
+ The BDD-Anomaly Dataset. BDD-Anomaly is an anomaly segmentation dataset with real images in diverse conditions. We source BDD-Anomaly from BDD100K (Yu et al., 2018), a large-scale semantic segmentation dataset with diverse driving conditions. The original data consists in 7,000 images for training and 1,000 for validation. There are 18 original classes. We choose motorcycle, train, and bicycle as the anomalous object classes and remove all images with these objects from the training and validation sets. This yields 6,280 training pairs, 910 validation pairs without anomalies, and 810 testing pairs with anomalous objects.
106
+
107
+ # 5.1 EXPERIMENTS
108
+
109
+ Evaluation. In anomaly segmentation experiments, each pixel is treated as a prediction, resulting in many predictions to evaluate. To fit these in memory, we compute the metrics on each image and average over the images to obtain final values.
110
+
111
+ Methods. Our first baseline is pixel-wise Maximum Softmax Probability (MSP). Introduced by Hendrycks & Gimpel (2017) for multi-class out-of-distribution detection, we directly port this baseline to anomaly segmentation. Alternatively, the background class might serve as an anomaly detector, because it contains everything not in the other classes. To test this hypothesis, “Background” uses the posterior probability of the background class as the anomaly score. The Dropout method leverages MC Dropout (Gal & Ghahramani, 2016) to obtain an epistemic uncertainty estimate. Following Kendall et al. (2015), we compute the pixel-wise posterior variance over multiple dropout masks and average across all classes, which serves as the anomaly score. We also experiment with an autoencoder baseline similar to Baur et al. (2019); Haselmann et al. (2018) where pixel-wise reconstruction loss is used as the anomaly score. This method is called AE. The “Branch” method is a direct port of the confidence branch detector from DeVries & Taylor (2018) to pixel-wise prediction. Finally, we use the MaxLogit method described in earlier sections independently on each pixel.
112
+
113
+ Table 4: Results on the CAOS benchmark. AUPR is low across the board due to the large class imbalance, but all methods perform substantially better than chance. MaxLogit obtains the best performance. All results are percentages.
114
+
115
+ <table><tr><td></td><td></td><td>MSP</td><td>Branch</td><td>Background</td><td>Dropout</td><td>AE</td><td>MaxLogit</td></tr><tr><td rowspan="3">StreetHazards</td><td>FPR95</td><td>33.7</td><td>68.4</td><td>69.0</td><td>79.4</td><td>91.7</td><td>26.5</td></tr><tr><td>AUROC</td><td>87.7</td><td>65.7</td><td>58.6</td><td>69.9</td><td>66.1</td><td>89.3</td></tr><tr><td>↓↑ AUPR 个</td><td>6.6</td><td>1.5</td><td>4.5</td><td>7.5</td><td>2.2</td><td>10.6</td></tr><tr><td rowspan="3">BDD-Anomaly AUROC</td><td>FPR95</td><td>24.5</td><td>25.6</td><td>40.1</td><td>16.6</td><td>74.1</td><td>14.0</td></tr><tr><td></td><td>87.7</td><td>85.6</td><td>69.7</td><td>90.8</td><td>64.0</td><td>92.6</td></tr><tr><td>AUPR</td><td>3.7</td><td>3.9</td><td>1.1</td><td>4.3</td><td>0.7</td><td>5.4</td></tr></table>
116
+
117
+ For all of the baselines except the autoencoder, we train a PSPNet (Zhao et al., 2017) decoder with a ResNet-101 encoder (He et al., 2015) for 20 epochs. We train both the encoder and decoder using SGD with momentum of 0.9, a learning rate of $2 \times 1 0 ^ { - 2 }$ , and learning rate decay of $1 0 ^ { - 4 }$ . For AE, we use a 4-layer U-Net (Ronneberger et al., 2015) with a spatial latent code as in Baur et al. (2019). The U-Net also uses batch norm and is trained for 10 epochs. Results are in Table 4.
118
+
119
+ Results and Analysis. MaxLogit outperforms all other methods across the board by a substantial margin. The intuitive baseline of using the posterior for the background class to detect anomalies performs poorly, which suggests that the background class may not align with rare visual features. Even though reconstruction-based scores succeed in product fault segmentation, we find that the AE method performs poorly on the CAOS benchmark, which may be due to the more complex domain. AUPR for all methods is low, indicating that the large class imbalance presents a serious challenge. However, the substantial improvements with the MaxLogit method suggest that progress on this task is possible and there is much room for improvement. A comparison with other datasets is in Figure 5 (Pinggera et al., 2016; Blum et al., 2019; Jung et al., 2021).
120
+
121
+ Figure 5: Auxiliary analysis of the MSP and the MaxLogit AUROCs using prior less comprehensive anomaly segmentation datasets.
122
+
123
+ <table><tr><td>Method</td><td>MSP</td><td>MaxLogit</td></tr><tr><td>FS Lost and Found</td><td>87.0%</td><td>92.0%</td></tr><tr><td>Road Anomaly</td><td>73.8%</td><td>78.0%</td></tr></table>
124
+
125
+ In Figure 4, we see that both MaxLogit and MSP have many false positives, as they assign high anomaly scores to semantic boundaries, a problem also observed in the recent works of (Blum et al., 2019; Angus, 2019). However, the problem is less severe with MaxLogit. A potential explanation for this is that even when the prediction confidence dips at semantic boundaries, the maximum logit can remain the same in a ‘hand-off’ procedure between the classes. Thus, MaxLogit provides a natural mechanism to combat semantic boundary artifacts that could be further explored in future work.
126
+
127
+ # 6 CONCLUSION
128
+
129
+ We scaled out-of-distribution detection to settings with thousands of classes and high-resolution images. We identified an issue faced by existing baselines when scaling to these settings and proposed the maximum logit detector as a natural solution. We introduced the Species dataset to enable more controlled experiments without class overlap and also investigated using multi-label classifiers for OOD detection, establishing an experimental setup for this previously unexplored setting. Finally, we introduced the CAOS benchmark for anomaly segmentation, consisting of diverse, naturally-integrated anomalous objects in driving scenes. Baseline methods on the CAOS benchmark substantially improve on random guessing but are still lacking, indicating potential for future work. Interestingly, the MaxLogit detector also provides consistent and significant gains in the multi-label and anomaly segmentation settings, thereby establishing it as a new baseline in place of the maximum softmax probability baseline on large-scale OOD detection problems. In all, we we hope that our contributions will enable further research on out-of-distribution detection for real-world safety-critical environments.
130
+
131
+ # REFERENCES
132
+
133
+ Matt Angus. Towards pixel-level ood detection for semantic segmentation, 2019.
134
+
135
+ Christoph Baur, Benedikt Wiestler, Shadi Albarqouni, and Nassir Navab. Deep autoencoding models for unsupervised anomaly segmentation in brain mr images. Lecture Notes in Computer Science, pp. 161–169, 2019. ISSN 1611-3349. doi: 10.1007/978-3-030-11723-8_16.
136
+
137
+ Petra Bevandic, Ivan Krešo, Marin Orši ´ c, and Siniša Šegvi ´ c. Discriminative out-of-distribution ´ detection for semantic segmentation, 2018.
138
+
139
+ Hermann Blum, Paul-Edouard Sarlin, Juan Nieto, Roland Siegwart, and Cesar Cadena. The fishyscapes benchmark: Measuring blind spots in semantic segmentation, 2019.
140
+
141
+ Markus M Breunig, Hans-Peter Kriegel, Raymond T $\mathrm { N g }$ , and Jörg Sander. Lof: identifying densitybased local outliers. In ACM sigmod record, volume 29, pp. 93–104. ACM, 2000.
142
+
143
+ M. Cimpoi, S. Maji, I. Kokkinos, S. Mohamed, , and A. Vedaldi. Describing textures in the wild. In Computer Vision and Pattern Recognition, 2014.
144
+
145
+ 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.
146
+
147
+ J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A Large-Scale Hierarchical Image Database. In CVPR09, 2009.
148
+
149
+ Terrance DeVries and Graham W Taylor. Learning confidence for out-of-distribution detection in neural networks. arXiv preprint arXiv:1802.04865, 2018.
150
+
151
+ Alexey Dosovitskiy, German Ros, Felipe Codevilla, Antonio Lopez, and Vladlen Koltun. CARLA: An open urban driving simulator. In Proceedings of the 1st Annual Conference on Robot Learning, pp. 1–16, 2017.
152
+
153
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. ArXiv, abs/2010.11929, 2021a.
154
+
155
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021b. URL https://openreview. net/forum?id ${ . } = { }$ YicbFdNTTy.
156
+
157
+ Andrew Emmott, Shubhomoy Das, Thomas Dietterich, Alan Fern, and Weng-Keen Wong. A meta-analysis of the anomaly detection problem, 2015.
158
+
159
+ Mark Everingham, Luc Van Gool, Christopher K. I. Williams, John M. Winn, and Andrew Zisserman. The pascal visual object classes (voc) challenge. International Journal of Computer Vision, 88: 303–338, 2009.
160
+
161
+ Stanislav Fort, Jie Ren, and Balaji Lakshminarayanan. Exploring the limits of out-of-distribution detection. arXiv preprint arXiv:2106.03004, 2021.
162
+
163
+ Yarin Gal and Zoubin Ghahramani. Dropout as a bayesian approximation: Representing model uncertainty in deep learning. International Conference on Machine Learning, 2016.
164
+
165
+ Matthias Haselmann, Dieter P Gruber, and Paul Tabatabai. Anomaly detection using deep learning based image completion. In 2018 17th IEEE International Conference on Machine Learning and Applications (ICMLA), pp. 1237–1242. IEEE, 2018.
166
+
167
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. CVPR, 2015.
168
+
169
+ Dan Hendrycks and Kevin Gimpel. A baseline for detecting misclassified and out-of-distribution examples in neural networks. ICLR, 2017.
170
+
171
+ Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. Proceedings of the International Conference on Learning Representations, 2019a.
172
+
173
+ Dan Hendrycks, Mantas Mazeika, and Thomas Dietterich. Deep anomaly detection with outlier exposure. In International Conference on Learning Representations, 2019b.
174
+
175
+ Dan Hendrycks, Mantas Mazeika, Saurav Kadavath, and Dawn Song. Using self-supervised learning can improve model robustness and uncertainty. In NeurIPS, 2019c.
176
+
177
+ Dan Hendrycks, Nicholas Carlini, John Schulman, and Jacob Steinhardt. Unsolved problems in ml safety. ArXiv, abs/2109.13916, 2021.
178
+
179
+ Micah K Johnson and Hany Farid. Exposing digital forgeries by detecting inconsistencies in lighting. In Proceedings of the 7th workshop on Multimedia and security, pp. 1–10, 2005.
180
+
181
+ Sanghun Jung, Jungsoo Lee, Daehoon Gwak, Sungha Choi, and Jaegul Choo. Standardized max logits: A simple yet effective approach for identifying unexpected road obstacles in urban-scene segmentation. ArXiv, abs/2107.11264, 2021.
182
+
183
+ Alex Kendall, Vijay Badrinarayanan, and Roberto Cipolla. Bayesian segnet: Model uncertainty in deep convolutional encoder-decoder architectures for scene understanding. ArXiv, abs/1511.02680, 2015.
184
+
185
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. ICLR, 2014.
186
+
187
+ Rajat Koner, Poulami Sinhamahapatra, Karsten Roscher, Stephan Günnemann, and Volker Tresp. Oodformer: Out-of-distribution detection transformer. ArXiv, 2021.
188
+
189
+ Ivan Krešo, Marin Oršic, Petra Bevandi ´ c, and Siniša Šegvi ´ c. Robust semantic segmentation with ´ ladder-densenet models, 2018.
190
+
191
+ Kimin Lee, Honglak Lee, Kibok Lee, and Jinwoo Shin. Training confidence-calibrated classifiers for detecting out-of-distribution samples. International Conference on Learning Representations, 2018a.
192
+
193
+ Kimin Lee, Kibok Lee, Honglak Lee, and Jinwoo Shin. A simple unified framework for detecting out-of-distribution samples and adversarial attacks. ArXiv, abs/1807.03888, 2018b.
194
+
195
+ Shiyu Liang, Yixuan Li, and R. Srikant. Enhancing the reliability of out-of-distribution image detection in neural networks. International Conference on Learning Representations, 2018.
196
+
197
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, Lubomir Bourdev, Ross Girshick, James Hays, Pietro Perona, Deva Ramanan, C. Lawrence Zitnick, and Piotr Dollar. Microsoft COCO: Common objects in context. ECCV, 2014.
198
+
199
+ Sina Mohseni, Mandar Pitale, Jbs Yadawa, and Zhangyang Wang. Self-supervised learning for generalizable out-of-distribution detection. In AAAI, 2020.
200
+
201
+ Peter Pinggera, Sebastian Ramos, Stefan K. Gehrig, Uwe Franke, Carsten Rother, and Rudolf Mester. Lost and found: Detecting small road hazards for self-driving vehicles. 2016 IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS), pp. 1099–1106, 2016.
202
+
203
+ T. Ridnik, Emanuel Ben-Baruch, Asaf Noy, and Lihi Zelnik-Manor. Imagenet-21k pretraining for the masses. ArXiv, abs/2104.10972, 2021a.
204
+
205
+ Tal Ridnik, Hussam Lawen, Asaf Noy, Emanuel Ben Baruch, Gilad Sharir, and Itamar Friedman. Tresnet: High performance gpu-dedicated architecture. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision, pp. 1400–1409, 2021b.
206
+
207
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. Medical Image Computing and Computer-Assisted Intervention – MICCAI 2015, pp. 234–241, 2015. ISSN 1611-3349. doi: 10.1007/978-3-319-24574-4_28.
208
+
209
+ Manolis Savva, Angel X. Chang, and Pat Hanrahan. Semantically-Enriched 3D Models for Commonsense Knowledge. CVPR 2015 Workshop on Functionality, Physics, Intentionality and Causality, 2015.
210
+
211
+ Bernhard Schölkopf, Robert Williamson, Alex Smola, John Shawe-Taylor, and John Platt. Support vector method for novelty detection. In Proceedings of the 12th International Conference on Neural Information Processing Systems, NIPS’99, pp. 582–588, Cambridge, MA, USA, 1999. MIT Press.
212
+
213
+ 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.
214
+
215
+ Fisher Yu, Yinda Zhang, Shuran Song, Ari Seff, and Jianxiong Xiao. LSUN: construction of a large-scale image dataset using deep learning with humans in the loop. CoRR, 2015.
216
+
217
+ Fisher Yu, Wenqi Xian, Yingying Chen, Fangchen Liu, Mike Liao, Vashisht Madhavan, and Trevor Darrell. BDD100K: A diverse driving video database with scalable annotation tooling. CoRR, abs/1805.04687, 2018.
218
+
219
+ Oliver Zendel, Katrin Honauer, Markus Murschitz, Daniel Steininger, and Gustavo Fernandez Dominguez. Wilddash-creating hazard-aware benchmarks. In Proceedings of the European Conference on Computer Vision (ECCV), pp. 402–416, 2018.
220
+
221
+ Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, and Jiaya Jia. Pyramid scene parsing network. 2017 IEEE Conference on Computer Vision and Pattern Recognition (CVPR), pp. 6230–6239, 2017.
222
+
223
+ Bolei Zhou, Agata Lapedriza, Aditya Khosla, Aude Oliva, and Antonio Torralba. Places: A 10 million image database for scene recognition. PAMI, 2017.
224
+
225
+ Peng Zhou, Xintong Han, Vlad I Morariu, and Larry S Davis. Learning rich features for image manipulation detection. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 1053–1061, 2018.
226
+
227
+ # A APPENDIX
228
+
229
+ Table 5: B is for the maximum softmax probability baseline, M is for maximum logit, D is for the method in DeVries & Taylor (2018), and K is our own KL method described below. Both M and K are ours. Results are on ImageNet and Places365. All values are percentages and are rounded so that 99.95 rounds to 100.
230
+
231
+ <table><tr><td>Dest</td><td></td><td colspan="3">FPR95↓</td><td colspan="3">AUROC ↑</td><td colspan="4">AUPR↑</td></tr><tr><td>Din</td><td></td><td>B</td><td>M D</td><td>K</td><td>B</td><td>M</td><td>D</td><td>K</td><td>B</td><td>M</td><td>D</td><td>K</td></tr><tr><td></td><td>Gaussian</td><td>2</td><td>0</td><td>5</td><td>4</td><td>100</td><td>100 97</td><td>98</td><td>329252521</td><td>98</td><td>55</td><td>79</td></tr><tr><td>1eeeeee</td><td>Rademacher</td><td>21</td><td>4</td><td>4</td><td>15</td><td>89</td><td>98 98</td><td>93</td><td></td><td>70</td><td>62</td><td>54</td></tr><tr><td></td><td>Blobs</td><td>26</td><td>32</td><td>72</td><td>8</td><td>80</td><td>79 37</td><td>99</td><td></td><td>17</td><td>7</td><td>93</td></tr><tr><td></td><td>Textures</td><td>68</td><td>56</td><td>74</td><td>59</td><td>80</td><td>87 76</td><td>85</td><td></td><td>36</td><td>16</td><td>48</td></tr><tr><td>LSUN</td><td></td><td>66</td><td>63</td><td>59</td><td>60</td><td>75 77</td><td>76</td><td>79</td><td></td><td>22</td><td>19</td><td>38</td></tr><tr><td></td><td>Places365</td><td>64</td><td>59</td><td>63</td><td>72</td><td>79 83</td><td>79</td><td>79</td><td>27</td><td>32</td><td>24</td><td>46</td></tr><tr><td></td><td>Mean</td><td>41.3</td><td>35.8</td><td>46</td><td>36.1</td><td>85.2</td><td>87.2</td><td>76.9</td><td>88.7 37</td><td>45.8</td><td>30.5</td><td>59.7</td></tr><tr><td>PPssse536</td><td>Gaussian</td><td>10</td><td>6</td><td>71</td><td>12</td><td>93</td><td>96 35</td><td>93</td><td>16</td><td>24</td><td>2</td><td>16</td></tr><tr><td></td><td>Rademacher</td><td>20</td><td>10</td><td>91</td><td>1</td><td>89</td><td>93 10</td><td>100</td><td>11 5</td><td>15.9</td><td>1.6</td><td>88</td></tr><tr><td>Blobs</td><td></td><td>59</td><td>6</td><td>88</td><td>27</td><td>72</td><td>98 15</td><td>93</td><td></td><td>41</td><td>2</td><td>31</td></tr><tr><td></td><td>Textures</td><td>86</td><td>72</td><td>87</td><td>74</td><td>65</td><td>79</td><td>43 79</td><td></td><td>11</td><td>1</td><td>12</td></tr><tr><td></td><td>Places69</td><td>88</td><td>89</td><td>92</td><td>91</td><td>61</td><td>64</td><td>52 65</td><td></td><td>6</td><td>3</td><td>6</td></tr><tr><td></td><td>Mean</td><td>53</td><td>36.6</td><td>85.8</td><td>40.9</td><td>76</td><td>85.8</td><td>31.1</td><td>85.8</td><td>19.2</td><td>2</td><td>30.5</td></tr></table>
232
+
233
+ # B FULL MULTICLASS OOD DETECTION RESULTS
234
+
235
+ Datasets. To evaluate the MSP baseline out-of-distribution detector and the MaxLogit detector, we use the ImageNet-1K object recognition dataset and Places365 scene recognition dataset as in-distribution datasets $\mathcal { D } _ { \mathrm { i n } }$ . We use several out-of-distribution test datasets $\mathcal { D } _ { \mathrm { o u t } }$ , all of which are unseen during training. The first out-of-distribution dataset is Gaussian noise, where each example’s pixels are i.i.d. sampled from $\mathcal { N } ( 0 , 0 . 5 )$ and clipped to be contained within $[ - 1 , 1 ]$ . Another type of test-time noise is Rademacher noise, in which each pixel is i.i.d. sampled from 2 · Bernoulli $( 0 . 5 ) - 1$ , i.e. each pixel is 1 or $- 1$ with equal probability. Blob examples are more structured than noise; they are algorithmically generated blob images. Meanwhile, Textures is a dataset consisting in images of describable textures (Cimpoi et al., 2014). When evaluating the ImageNet-1K detector, we use LSUN images, a scene recognition dataset (Yu et al., 2015). Our final $\mathcal { D } _ { \mathrm { o u t } }$ is Places69, a scene classification dataset that does not share classes with Places365. In all, we evaluate against out-of-distribution examples spanning synthetic and realistic images.
236
+
237
+ KL Matching Method. To verify our intuitions that led us to develop the MaxLogit detector, we developed a less convenient but similarly powerful technique applicable for the multiclass setting. Recall that some classes tend to be predicted with low confidence and others high confidence. The shape of predicted posterior distributions is often class dependent.
238
+
239
+ We capture the typical shape of each class’s posterior distribution and form posterior distribution templates for each class. During test time, the network’s softmax posterior distribution is compared to these templates and an anomaly score is generated. More concretely, we compute $k$ different distributions $d _ { k }$ , one for each class. We write $d _ { k } = \mathbb { E } _ { x ^ { \prime } \sim \mathcal { X } _ { \mathrm { v a l } } } [ p ( y | x ^ { \prime } ) ]$ where $k = \mathrm { a r g m a x } _ { k } p ( y =$ $k \mid x ^ { \prime } )$ . Then for a new test input $x$ , we calculate the anomaly score $\mathrm { { \ddot { m i n } } } _ { k } ~ \mathrm { K L } [ p ( y \mid x ) \mid \mid d _ { k } ]$ rather than the MSP baseline $- \operatorname* { m a x } _ { k } p ( y = k \mid x ) .$ . Note that we utilize the validation dataset, but our KL matching method does not require the validation dataset’s labels. That said, our KL matching method is less convenient than our MaxLogit technique, and the two perform similarly. Since this technique requires more data than MaxLogit, we opt to simply use the MaxLogit in the main paper.
240
+
241
+ Results. Observe that the proposed MaxLogit method outperforms the maximum softmax probability baseline for all three metrics on both ImageNet and Places365. These results were computed using a ResNet-50 trained on either ImageNet-1K or Places365. In the case of Places365, the AUROC improvement is over $10 \%$ . We note that the utility of the maximum logit could not be appreciated as easily in previous work’s small-scale settings. For example, using the small-scale CIFAR-10 setup of
242
+
243
+ Hendrycks et al. Hendrycks et al. (2019a), the MSP attains an average AUROC of $9 0 . 0 8 \%$ while the maximum logit attains $9 0 . 2 2 \%$ , a minor $0 . 1 4 \%$ difference. However, in a large-scale setting, the difference can be over $10 \%$ on individual $\mathcal { D } _ { \mathrm { o u t } }$ datasets. We are not claiming that utilizing the maximum logit is a mathematically innovative formulation, only that it serves as a consistently powerful baseline for large-scale settings that went unappreciated in small-scale settings. In consequence, we suggest using the maximum logit as a new baseline for large-scale multi-class out-of-distribution detection.
244
+
245
+ Overview of Other Detection Methods. There are other techniques in out-of-distribution detection which require other assumptions such as more training data. For instance, Hendrycks et al. (2019a); Mohseni et al. (2020) use additional training data labeled as out-of-distribution, and the MaxLogit technique can be naturally extended should such data be available. Hendrycks et al. (2019c) use rotation prediction and self-supervised learning, but we found that scaling this to the ImageNet multiclass setting did not produce strong results. The MSP baseline trained with auxiliary rotation prediction has an AUROC of $5 9 . 1 \%$ , and with MaxLogit it attains a $7 3 . 6 \%$ AUROC, over a $10 \%$ absolute improvement with MaxLogit. Nonetheless this technique did not straightforwardly scale, as the network is better without auxiliary rotation prediction. Likewise, Lee et al. (2018b) propose to use Mahalanobis distances, but in scaling this to 1000 classes, we consistently encountered NaN errors due to high condition numbers. This shows the importance of ensuring that out-of-distribution techniques can scale.
246
+
247
+ ODIN Liang et al. (2018) assumes that, for each OOD example source, we can tune hyperparameters for detection. For this reason we do not evaluate with ODIN in the rest of the paper. However, for thoroughness, we evaluate it here. ODIN uses temperature scaling and adds an epsilon perturbation to the input in order to separate the softmax posteriors between in- and out-of-distribution images; we set these hyperparameters following DeVries & Taylor (2018). Then, MaxLogit combined with ODIN results in an FPR95 of 33.6, an AUROC of 88.8 and an AUPR of 51.3 on ImageNet. On Places365, the FPR95 is 35.3, the AUROC is 86.5, and the AUPR is 24.2. Consequently, techniques built with different assumptions can integrate well with MaxLogit. We do not train ImageNet-21K models from scratch with these methods due to limited compute.
248
+
249
+ # C MULTI-LABEL OUT-OF-DISTRIBUTION DATASET LIST
250
+
251
+ For multi-label classification experiments, we choose the following classes from ImageNet-21K to serve as out-of-distribution data: dolphin (n02069412), deer (n02431122), bat (n02139199), rhino (n02392434), raccoon (n02508213), octopus (n01970164), giant clam (n01959492), leech (n01937909), Venus flytrap (n12782915), cherry tree (n12641413), Japanese cherry blossoms (n12649317), red wood (n12285512), sunflower (n11978713), croissant (n07691650), stick cinnamon (n07814390), cotton (n12176953), rice (n12126084), sugar cane (n12132956), bamboo (n12147226), and tumeric (n12356395). These classes were hand-chosen so that they are distinct from VOC and COCO classes.
252
+
253
+ # D OOD SEGMENTATION
254
+
255
+ ![](images/e830f93c8a5dee8cff942f66fbb348ee36c59204cff44e668c2183b5e4494531.jpg)
256
+ Figure 6: ROC curve with VOC as $( \mathcal { D } _ { \mathrm { i n } } )$ and non-overlapping ImageNet classes as $( \mathcal { D } _ { \mathrm { o u t } } ^ { \mathrm { t e s t } } )$ . Curves correspond to an uninformative “Random” detector, Local Outlier Factor, and the MaxLogit detector.
257
+
258
+ We cover methods used in the paper in more depth and the modifications necessary to make the methods work with OOD detection in semantic segmentation. We use $f$ to denote the function typically a neural network, $x$ is the input image, and $y _ { i , j }$ is the prediction for pixel $i , j$ . We will denote the output probability distribution per pixel as $P$ and locations $i , j$ as the location of the respective pixel in the output. $f ( x ) _ { i , j }$ denotes the ith row and $j ^ { ; }$ ’th column of the output.
259
+
260
+ Confidence Estimation. The method proposed in DeVries & Taylor (2018) works by training a confidence branch added at the end of the neural network. We denote the network predictions as both $P$ and $\hat { c }$ whereby every pixel is assigned a confidence value.
261
+
262
+ $$
263
+ \begin{array} { c } { b \sim B ( 0 . 5 ) } \\ { c : = \hat { c } \cdot b + ( 1 - b ) } \\ { P : = P \cdot c + ( 1 - c ) y } \end{array}
264
+ $$
265
+
266
+ The confidence estimation denoted by $c$ is given “hints” during training to guide what it is learning. The $B$ is a beta distribution and acts as a regularizer similar to dropout so that the network $f$ does not exclusively rely on the true labels being present. The final loss is modified to include the extra term below:
267
+
268
+ ![](images/e831207f61f4f9d875c0b02663677b918f457e3a8c337ddc1935c65b9e381231.jpg)
269
+ Figure 7: A comparison of lighting consistency in the Fishyscapes anomaly segmentation benchmark and our new StreetHazards dataset. The arrows point in the manually estimated direction of light on parts of the scene. In Fishyscapes, inconsistent lighting allows forensics techniques to detect the anomaly (Johnson & Farid, 2005). Unlike cutand-paste anomalies, the anomalies in our StreetHazards dataset are naturally integrated into their environment with proper lighting and orientation, making them more difficult to detect.
270
+
271
+ $$
272
+ \begin{array} { l } { \displaystyle \mathcal { L } _ { \boldsymbol { p } } = \frac { 1 } { | P | } \sum _ { i } - \log ( p _ { i } ) y _ { i } } \\ { \displaystyle \mathcal { L } _ { \boldsymbol { c } } = \frac { 1 } { | P | } \sum _ { i } - \log ( \hat { c } _ { i } ) } \\ { \displaystyle \mathcal { L } = \mathcal { L } _ { \boldsymbol { p } } + \lambda \mathcal { L } _ { \boldsymbol { c } } } \end{array}
273
+ $$
274
+
275
+ The reasoning for $\mathcal { L } _ { c }$ is to encourage the network to output confident predictions. Finally $\lambda$ is initialized to 0.1 and is updated by a “budget” parameter which is set to the default of 0.3. The update equation:
276
+
277
+ $$
278
+ \left\{ \begin{array} { l l } { { \lambda } / { 0 . 9 9 } } & { \sum \hat { c } _ { i } \leq \mathrm { b u d g e t } } \\ { { \lambda } / { 1 . 0 1 } } & { \sum \hat { c } _ { i } > \mathrm { b u d g e t } } \end{array} \right.
279
+ $$
280
+
281
+ This adaptively adjusts the weighting between the two losses and experimentally the update is not sensitive to the budget parameter.
282
+
283
+ Semantic Segmentation BDD Anomalies Dataset List. The BDD100K dataset contains 180 instances of the train class, 4296 instances of the motorcycle class, and 10229 instances of the bicycle class.
284
+
285
+ StreetHazards 3D Models Dataset List. For semantic segmentation experiments, we choose to use the following classes 3D models from Model Bank Library to serve as out-of-distribution data: Meta-categories: Animals, Vehicles, Weapons, Appliances, Household items (furniture, and kitchen items), Electronics, Instruments, and miscellaneous. The specific animals used are kangaroos, whales, dolphins, cows, lions, frogs, bats, insects, mongooses, scorpions, fish, camels, flamingos, apes, horses, mice, spider, dinosaurs, elephants, moose, shrimps, bats, butterflies, turtles, hippopotamuses, dogs, cats, sheep, seahorse, snail and zebra. The specific vehicles used are military trucks, motorcycles, naval ships, pirate ships, submarines, sailing ships, trolleys, trains, airplanes, helicopters, jets, zeppelin, radar tower, construction vehicles (loaders, dump trucks, bulldozer), farming vehicles (harvester, gantry crane, tractor), fire truck, tank, combat vehicles, and trailers. The specific weapons used are guns, missiles, rocket launchers, and grenades. The appliances used are refrigerators, stoves, washing machines, and ovens. The household items used are cabinets, armoire, grandfather clocks, bathtubs, bureaus, night stand, table, bed, bookcase, office desk, glasses (drinking), throne chair, kitchen utensils (knives, forks, spoons), sofa, clothing iron, plates, sewing machine, and dressing mirror. The electronics used are computer monitor, computer mouse, hair dryer, The instruments category includes bassoon, clarinet, drums, guitar, violin, harp, and keyboard. The miscellaneous category includes rocket, space capsule, space shuttle, lunar module, glasses (wearable), weight machine, balance beam, bench press, bowling ball and pins, and pens. Several categories and instances were excluded from Model Bank Library due to their occurrence in the simulation environment such as playground equipment and various types of foliage and trees. The sizes of instances used in the dataset might not reflect the actual scale that would otherwise naturally occur. Similarly the location of instances in the dataset are not necessarily reflective of where they are likely to occur in nature.
md/dev/zDbsSscmuj/zDbsSscmuj.md ADDED
@@ -0,0 +1,250 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Leveraging Pre-trained Large Language Models to Construct and Utilize World Models for Model-based Task Planning
2
+
3
+ Lin Guan ∗
4
+ School of Computing & AI
5
+ Arizona State University
6
+ Tempe, AZ 85281
7
+ lguan9@asu.edu Karthik Valmeekam ∗
8
+ School of Computing & AI
9
+ Arizona State University Tempe, AZ 85281 kvalmeek@asu.edu
10
+
11
+ Sarath Sreedharan Department of Computer Science Colorado State University Fort Collins, CO 80523 sarath.sreedharan@colostate.edu
12
+
13
+ Subbarao Kambhampati
14
+ School of Computing & AI
15
+ Arizona State University Tempe, AZ 85281 rao@asu.edu
16
+
17
+ # Abstract
18
+
19
+ There is a growing interest in applying pre-trained large language models (LLMs) to planning problems. However, methods that use LLMs directly as planners are currently impractical due to several factors, including limited correctness of plans, strong reliance on feedback from interactions with simulators or even the actual environment, and the inefficiency in utilizing human feedback. In this work, we introduce a novel alternative paradigm that constructs an explicit world (domain) model in planning domain definition language (PDDL) and then uses it to plan with sound domain-independent planners. To address the fact that LLMs may not generate a fully functional PDDL model initially, we employ LLMs as an interface between PDDL and sources of corrective feedback, such as PDDL validators and humans. For users who lack a background in PDDL, we show that LLMs can translate PDDL into natural language and effectively encode corrective feedback back to the underlying domain model. Our framework not only enjoys the correctness guarantee offered by the external planners but also reduces human involvement by allowing users to correct domain models at the beginning, rather than inspecting and correcting (through interactive prompting) every generated plan as in previous work. On two IPC domains and a Household domain that is more complicated than commonly used benchmarks such as ALFWorld, we demonstrate that GPT-4 can be leveraged to produce high-quality PDDL models for over 40 actions, and the corrected PDDL models are then used to successfully solve 48 challenging planning tasks. Resources, including the source code, are released at: https://guansuns.github.io/pages/llm-dm.
20
+
21
+ # 1 Introduction
22
+
23
+ The field of artificial intelligence has been revolutionized with the advent of large pre-trained models. Of particular significance are transformer-based large language models (LLMs) which have showcased remarkable performance in natural language processing tasks. Along with these tasks, LLMs have been tested to perform another widely-studied crucial aspect of AI agents, namely, sequential decisionmaking or planning. Preliminary studies suggest that, in some everyday domains, LLMs are capable of suggesting sensible action plans [19, 1]. However, the correctness and executability of these plans are often limited. For instance, LLMs may regularly overlook the physical plausibility of actions in certain states and may not effectively handle long-term dependencies across multiple actions. Several approaches have been proposed to improve the planning capabilities of LLMs. One promising approach involves collecting feedback from the environment during plan execution and subsequently refining the plans. By incorporating various forms of feedback, such as sensory information [20], human corrections [60], or information of unmet preconditions [42, 56], the planners can re-plan and produce plans that are closer to a satisficing plan.
24
+
25
+ Despite the improvements in planning performance, LLMs are still far from being a usable and reliable planner due to various factors:
26
+
27
+ (a) LLMs have not yet demonstrated sufficient capabilities in reasoning and planning [24, 55, 53, 54, 31]. Recent investigations show that even when provided with detailed descriptions of actions, such as a PDDL domain model [33] or a natural-language version of a PDDL model, LLMs still struggle to produce correct and executable plans [48, 55].
28
+ (b) Existing LLMs-planning paradigms only allow for feedback collection in a fully online manner, meaning that the feedback signals are only available after the agent has started executing the plan. However, when a faithful simulator is not available or is expensive to use, collecting feedback through actual plan execution can be costly and may not fully exploit the advantages of provably sound planning, as seen in classical-planning literature [11, 13].
29
+ (c) LLMs exhibit complex behaviors that are not yet fully understood, particularly with respect to error occurrences. LLM planners are prone to repeating the same mistakes in slightly different scenarios. Repeatedly providing the same feedback can lead to frustration for end users.
30
+
31
+ To overcome these limitations, rather than using LLMs directly as planners, we advocate a modelbased paradigm, wherein a PDDL world model is teased out of LLMs. We follow the identical problem setup as existing approaches, which involves providing the planner with a set of actions and their brief natural language descriptions. However, instead of directly mapping user commands to plans, we utilize LLMs to extract a symbolic representation of the actions in the form of PDDL action models. This intermediate output can be used with an external domain-independent planner to reliably search for feasible plans, or it can be used to validate and correct "heuristic" plans generated by an LLM planner. Additionally, our modular method essentially divides the planning process into two distinct parts, namely modeling the causal dependencies of actions and determining the appropriate sequence of actions to accomplish the goals. LLMs, which have been trained on extensive web-scale knowledge, exhibit greater proficiency in the former task rather than the latter.
32
+
33
+ Nevertheless, we still take into account the fact that the LLMs may not be able to generate error-free PDDL models at the outset. To address this, we show that LLMs can also serve as an interface between PDDL and any feedback sources that can provide corrective feedback in natural language, such as humans and the PDDL validator in VAL [18]. The LLM middle layer translates PDDL representation to natural language and presents it to users for inspection. The acquired feedback is then incorporated and archived back to the PDDL models. This conceals the complexity of PDDL from users who do not have prior knowledge of PDDL, and enables seamless inclusion of feedback. We conducted an extensive evaluation of our methodology on two IPC domains [22] from classical planning literature and a household domain that has a more diverse set of actions and constraints than commonly used benchmarks such as ALFWORLD [47]. We assess the quality of the generated PDDL models through manual evaluation. Results show that GPT-4 [37] generates high-quality PDDL domain models with over 400 literals for 41 actions in total. Then, by replaying and continuing the PDDL-construction dialogue, we show that GPT-4 can readily correct all the errors according to natural language feedback from PDDL validators and humans.
34
+
35
+ We consider two use cases of the generated PDDL action models for downstream planning tasks. For one, by utilizing an LLM to translate user instructions into goal specifications in PDDL [58, 30], we can use any standard domain-independent planner to search for a plan. On the other hand, the extracted PDDL model can be used to validate plans suggested by an LLM planner and to provide corrective feedback in the form of unmet preconditions or goal conditions. In this case, the PDDL model is essentially serving as an inexpensive high-level simulator or a human proxy to ensure plan correctness.
36
+
37
+ This reduces the reliance on faithful simulators or extensive manual inspection of plans by domain experts. Compared to the first approach, the second approach potentially offers better flexibility in incorporating both explicit and implicit user constraints in common-sense domains because of the LLM planner. For instance, the LLM planner can directly incorporate ordering constraints such as "heat the potato first before mashing it" and "bring me a fork first, then a plate." On the contrary, an approach purely based on classical planners would require extra steps, such as introducing extra state variables in the PDDL models, in order to accommodate such constraints. However, as demonstrated in our experiments, although the validation feedback significantly improves the plan correctness on average, the performance of the second approach is still limited by the "planning capability" of LLMs.
38
+
39
+ # 2 Related Work
40
+
41
+ LLMs and planning. The growing interest in evaluating the emergent abilities of LLMs paved way into exploring their abilities in sequential decision-making tasks. Preliminary studies [24, 55] have shown that off-the-shelf LLMs are currently incapable of producing accurate plans. But their plans can be used as heuristics or seeds to either an external planner or a human in the loop [55, 48]. SayCan [1] and Text2Motion [29] employ an LLM as a heuristic by utilizing it to score high-level actions, followed by a low-level planner that grounds these actions to determine the executability in the physical world. In a similar vein, [28, 50] use LLMs to generate plans represented in Python-style code. Other works have aimed to improve the planning performance of LLMs through prompt engineering [60] or collecting various forms of feedback such as sensory information [51, 20, 34], human corrections [60], self-corrections [46] or information of unmet preconditions [42, 56].
42
+
43
+ Training transformers for sequential decision-making tasks. Along with using off-the-shelf LLMs, there are works that either fine-tune LLMs [55, 38] or train sequence models [62, 27, 7, 43] for sequential decision making tasks. Experiments in [26] have shown that training sequence models on a specific task gives rise to an internal world representation within the model. In this work, we use off-the-shelf LLMs to construct symbolic world models without performing any extra training.
44
+
45
+ Learning/acquiring symbolic domain models. In classical planning, the community has explored numerous learning-based methods [59, 61, 9, 25, 4] and interactive editor-based methods [49] for acquiring symbolic domain models. For a more comprehensive survey, we refer the reader to [2, 6]. Here, we are interested in leveraging the common-world knowledge embedded in LLMs and their in-context learning ability for constructing domain models. Recent studies have shown the efficacy of LLMs in translating natural language to formal descriptions [35] or constructing PDDL goals from natural-language instructions [58, 32]. Moreover, a contemporary work [15] considers the use of LLM as a parametric world model and plan critic. However, unlike a symbolic model that can simulate plan outcomes with guaranteed correctness, using LLMs directly as a world model actually adds another layer of errors. There is evidence that autoregressive models lack reliable capacity for reasoning about action effects [3, 31] and capturing errors in candidate plans [53, 54].
46
+
47
+ Language models with access to external tools. Since LLMs are approximately omniscient, they may not always outperform specialized models or tools in specific downstream tasks. To address this limitation, frameworks have been developed to enable LLMs to utilize external tools for performing sub-tasks like arithmetic [45] and logical reasoning [39, 57]. In this context, our work can be regarded as an exercise in employing external sound planners to augment the capacity of LLMs for more reliable plan generation.
48
+
49
+ # 3 Problem Setting and Background
50
+
51
+ Our work focuses on a scenario where an intelligent agent receives high-level instructions or tasks, denoted as $i$ , from a user. The agent is capable of only executing skills or operations that are part of a skill library $\Pi$ , where each skill $k$ has a short language description $l _ { k }$ . We assume that the agent is equipped with the low-level control policies corresponding to these high-level skills. In order to achieve the goal conditions specified in $i$ , a planner, which can be either an LLM or an external planner [16, 12, 17], needs to come up with a sequence of high-level skills that the agent can execute. This type of problem is referred to as a sequential decision-making or planning problem. Similar to previous works such as [60, 20], we also allow for human-in-the-loop feedback during both the domain-model construction and plan execution stages. In the next subsections, we describe the formalism behind planning problems and a standard way in the literature to specify them.
52
+
53
+ # 3.1 Classical planning problems
54
+
55
+ The most fundamental planning formalism is goal-directed deterministic planning problem, referred to as a classical planning problem in the planning literature. A classical planning problem [44] can be formally represented with a tuple $\bar { \mathcal { P } } = \langle \mathcal { D } , \mathcal { I } , \mathcal { G } \rangle$ . $\mathcal { D }$ is referred to as the domain, $I$ is the initial state, and $\mathcal { G }$ is the goal specification. The state space of a planning problem consists of the truth assignments for predicates. The domain $\mathcal { D }$ is further defined by the tuple ${ \mathcal { D } } = \langle { \mathcal { F } } , A \rangle$ . $\mathcal { F }$ corresponds to the set of fluents, i.e., the state variables used to define the state space with each fluent corresponding to a predicate with some arity. $\mathcal { A }$ corresponds to the set of actions that can be performed. Each action $a _ { i } [ \mathcal { V } ] \in \mathcal { A }$ (where $\nu$ is the set of variables used by the operator $a _ { i }$ and each variable could be mapped to an object) can be further defined by two components, the precondition $\mathsf { p r e c } [ \mathcal { V } ]$ which describes when an action can be executed, and the effects eff $[ \nu ]$ which defines what happens when an action is executed. We assume that prec $[ \nu ]$ consists of a set of predicates defined over the variables $\nu$ . An action is assumed to be executable only if its preconditions are met, i.e, the predicates in the precondition hold in the given state. The effect set eff $[ \nu ]$ is further defined by the tuple $\langle \mathsf { a d d } [ \mathcal { V } ] , \mathsf { d e l } [ \mathcal { V } ] \rangle$ , where $\mathsf { a d d } [ \nu ]$ is the set of predicates that will be set true by the action and $\mathsf { d e l } [ \nu ]$ is the set of predicates that will be set false by the action. An action is said to be grounded if we replace each of the variables with an object, else it is referred to as a lifted action model. A solution to a planning problem is called a plan, and it is a sequence of actions that once executed in the initial state would lead to a state where the goal specification holds. Classical planning problems are one of the simpler classes in planning and there are multiple extensions with more complex forms of preconditions, conditional effects, and also support for richer planning formalisms.
56
+
57
+ # 3.2 PDDL
58
+
59
+ Planning Definition and Domain Language (PDDL) [33], is the standard encoding language for classical planning problems. Here is an example of a lifted action in PDDL which corresponds to putting a block onto the table in the classical Blocksworld domain:
60
+
61
+ (:action PutDownBlock :parameters (?x - block) :precondition (and (robot-holding $? \mathbf { x } )$ ) :effect (and (not (robot-holding $? \mathbf { x } )$ ) (block-clear ?x) (robot-hand-empty) (block-on-table $? { \bf x } )$ ))
62
+
63
+ The parameters line provides the possible variable(s), and in this case, $\ ? \mathbf { x }$ represents the block to put down. The precondition states that the robot must be holding the block in its gripper. The effects line describes the expected outcome of this action.
64
+
65
+ # 4 Methodology
66
+
67
+ PDDL provides a succinct and standardized way to represent a world model. Once a PDDL model is constructed, it can be seamlessly used by any domain-independent planner developed in the automated planning community to search for a plan given the initial state and goal conditions. In this section, we will introduce our solution for constructing PDDL models using LLMs. We then discuss techniques for correcting errors in the generated PDDL models. Finally, we present the full pipeline for utilizing the generated PDDL models to solve planning problems.
68
+
69
+ # 4.1 Constructing PDDL models with LLMs
70
+
71
+ Our approach involves prompting pre-trained LLMs with the following information: (a) detailed instructions for the PDDL generation task, outlining components of upcoming inputs and desired outputs; (b) one or two examples from other domains (e.g., the classical Blocksworld domain) for illustrating the input and output formats; (c) a description of the current domain, including contextual information about the agent’s tasks and physical constraints due to the specific embodiment of the agent; (d) a description of the agent’s action; and (e) a dynamically updated list of predicates that the LLM can reuse to maintain consistent use of symbols across multiple actions. Note that the predicate list is initialized to an empty list, and thus all predicates are introduced by the LLM. The structure of the prompt is illustrated in Fig. 2, and a complete prompt for the household-robot domain can be found at Appx. A.6.1.
72
+
73
+ ![](images/07144245efd6d17b9a3f71bf358d907857248bc85cbcf0a3600c058743ac31c7.jpg)
74
+ Figure 1: An overview of our framework and existing methods that use LLMs directly as planners.
75
+
76
+ Depending on the information included in the action description or the domain context, users may gain varying levels of control over the extracted PDDL or receive differing levels of support from the LLMs. On one hand, when the user provides only a minimal description of the action, such as "this action enables the robot to use a microwave to heat food," we not only use the LLM as a PDDL constructor but also leverage the common world knowledge encoded within the model for knowledge acquisition. This is particularly useful when expanding the set of actions for an AI agent. For example, a robot engineer could set up a training environment for skill learning by following the suggested preconditions and effects. On the other hand, when some preconditions or effects are explicitly mentioned in the prompt, we rely more on the LLM’s ability to parse the knowledge provided in natural language and to precisely represent it by devising a collection of predicates. This capability is useful when there could be different initial setups of a skill, and the engineers have already made some assumptions on the preconditions at the time of designing the skill. This capability is also crucial when constructing PDDL for specialized domains. For instance, robots such as Fetch and Spot Robot have only one robot arm, which is less flexible than a human arm, and are therefore subject to many uncommon physical constraints.
77
+
78
+ The desired output comprises the following elements: (a) the list of arguments for the action; (b) the preconditions and effects expressed in PDDL; and (c) a list of any newly defined predicates and their descriptions in natural language, if applicable. An example output is shown in Fig. 2. Our algorithm generates PDDL models for each action separately, one at a time, by iterating over the set of actions. Any newly defined predicates will be added to an actively maintained predicate list, such that the LLM can reuse existing predicates in subsequent actions without creating redundant ones. Once we obtain the initial PDDL models and the full predicate list, we repeat the entire process but with all of the extracted predicates presented to the LLM. Running the generation process twice is useful because the LLMs may be unaware of some precondition(s) during the first iteration, especially if the precondition(s) are not explicitly mentioned. For instance, the LLM may overlook the fact that a furniture piece can be openable, but a predicate created in the "open a furniture piece or appliance" skill can inform the LLM of this fact. One alternative to this action-by-action generation could be to include descriptions of all the actions in the prompt and require the LLM to construct the entire domain model in a single dialogue. An additional discussion on this can be found at Sec. A.2 in Appendix.
79
+
80
+ It is worth noting that every time a new predicate is defined, the LLM is required to give the natural language description of it. As we will see in the following sections, this is crucial for enabling any user to easily understand and inspect the generated PDDL models without having to delve into the low-level symbolic representation. Additionally, natural language descriptions allow the predicate values of the initial state to be automatically grounded by using LLMs to translate environment description in natural language to PDDL [30], or leveraging pre-trained vision-language models
81
+
82
+ Instructions for the PDDL generation task
83
+ You are defining the preconditions and effects (represented in PDDL format) of an AI agent's $\hookrightarrow$ actions. Information about the AI agent will be provided in the domain description ... One or two examples from other domains for illustrating the input and output formats
84
+ Here are two examples from the classical BlocksWorld domain for demonstrating the output format. Here is the task.
85
+
86
+ A natural language description of the domain
87
+
88
+ Domain information: The AI agent here is a household robot that can navigate to various large and $\hookrightarrow$ normally immovable furniture pieces or appliances in the house to carry out household tasks $\hookrightarrow$
89
+
90
+ A natural language description of the action
91
+
92
+ Action: This action enables the robot to toggle small appliances (like humidifiers and light $\hookrightarrow$ bulbs) which are toggleable to switch them on
93
+
94
+ The dynamically updated list of predicates
95
+
96
+ You can create and define new predicates, but you may also reuse the following predicates:
97
+
98
+ 1. (robot-at ?r - robot ?f - furnitureAppliance): true if the robot $\mathord { ? } \mathbf { r }$ is at the furniture or $\hookrightarrow$ appliance ?f
99
+
100
+ 2. (object-in-on ?o - householdObject ?f - furnitureAppliance): true if the object ?o is in or on $\hookrightarrow$ the furniture or appliance ?f
101
+
102
+ Parameters:
103
+
104
+ # The LLM:
105
+
106
+ ![](images/d901b4063bc05cf5435f6666e2be758e7e524efd02219a279a79281f33d84b2f.jpg)
107
+ Figure 2: The prompt template for PDDL construction and an example of the LLM output for the household domain.
108
+
109
+ [41, 37, 10] and querying them in a question-answering manner, based on observations from the environment.
110
+
111
+ # 4.2 Correcting errors in the initial PDDL models
112
+
113
+ As with any use case involving LLMs, there is no guarantee that the output is completely error-free. Therefore, it is essential to incorporate error-correction mechanisms. While it may be easy for PDDL experts to directly inspect and correct the generated PDDL models, we cannot assume that all end users possess this level of expertise. Our solution is to use the LLM as a middle layer or interface between the underlying PDDL model and any feedback source that can provide corrective feedback in natural language. We consider two feedback sources in this work, namely the PDDL model validation tools (e.g., the one in VAL [18]) and human domain experts. The former is used to detect basic syntax errors, while the latter is mainly responsible for catching factual errors, such as missing effects. It is worth noting that the feedback sources are not limited to those mentioned above, and we leave the investigation of other sources for future research.
114
+
115
+ For corrective feedback from PDDL validators, a generated PDDL model is directly presented to the validator to obtain brief but readable error messages. Examples of feedback messages for syntax errors are shown in Appx. A.3. For corrective feedback from users, a PDDL model is translated into its natural-language version based on the natural language descriptions of the predicates and parameters (Sec. 4.1). The user can then examine potentially erroneous action models. Human corrections can occur both during the construction of PDDL models and after the models have been used for planning. Although there are techniques available to assist users to locate errors in the models (as discussed in
116
+
117
+ Appx. A.4), this is beyond the scope of this work, since the focus here is to investigate the feasibility of using LLMs to correct PDDL models based on feedback. We also note that correcting action models is not more cognitively demanding than correcting plans or the "reasoning traces" of an LLM planner [60]. In fact, when correcting plans, humans must also maintain the action models and their causal chains in mind in order to validate the plans. More importantly, once the action models are corrected, users no longer need to provide similar feedback repeatedly. Finally, corrective feedback is integrated by replaying and continuing the PDDL-construction dialogue. Examples of such dialogues can be found in Sec. A.7, Sec. A.9, and Sec. A.11 in Appendix.
118
+
119
+ # 4.3 Generating plans with the extracted PDDL models
120
+
121
+ Recall that given the set of extracted predicates and their natural language descriptions, we can get the grounded initial state by using LLMs to translate descriptions of the environment to PDDL, or by observing the environment and querying pre-trained vision-language models. Besides, the goal specification can be obtained by using an LLM to parse the user’s command and convert it into a symbolic form, as done previously in [30, 58, 32]. With this setup, the following two methods can be used to generate the final plans.
122
+
123
+ Classical planner with LLM-acquired PDDL model. One straightforward approach is to employ a standard domain-independent planner to reliably find a satisficing or even optimal plan for the specified goal. In common-sense domains where LLMs may generate meaningful "heuristics", the LLM plans may also be used as seed plans for a local-search planner such as LPG [12] to accelerate the plan searching. This is similar to the approach suggested in [55], but with a higher degree of automation.
124
+
125
+ LLM modulo planner backprompted by VAL using LLM-acquired PDDL model. As outlined in Sec. 1, we can also use the extracted PDDL as a symbolic simulator or human proxy to provide corrective feedback based on validation information to an LLM planner. With this setup, the planner can iteratively refine the plans through re-prompting [42].
126
+
127
+ It is worth noting that depending on the specific problem settings, the extracted PDDL model can also be used for tasks other than task planning. For instance, in cases where reinforcement learning is permissible, the domain model can be used to guide skill learning [21, 8] or exploration even if the model is not fully situated [14].
128
+
129
+ # 5 Empirical Evaluation
130
+
131
+ We conduct our experiments 2 on an everyday household-robot domain and two more specialized IPC domains (i.e., Tyreworld and Logistics). The Household domain is similar to other commonly used benchmarks like ALFWORLD [47] and VirtualHome [40]. However, in our household domain, a single-arm robot is equipped with a more diverse and extended set of 22 mobile and manipulation skills. In addition, we apply more rigorous physical-plausibility constraints to each skill. A detailed description of this domain can be found at Appx. A.5. In our experiments, we first evaluate the quality of PDDL models generated by the LLMs. Next, we assess the ability of the LLMs to incorporate corrective feedback from both PDDL validators and users in order to obtain error-free PDDL models. Lastly, we showcase multiple ways to use the corrected PDDL model for downstream planning tasks. We present the results of GPT-4 [37] and GPT-3.5-Turbo [36] for PDDL construction (we also conducted experiments with GPT-3 [5], and observe that its performance is comparable to that of GPT-3.5-Turbo).
132
+
133
+ # 5.1 Constructing PDDL
134
+
135
+ In PDDL construction tasks, we aim to investigate the extent to which LLMs can construct accurate PDDL models before getting corrective feedback from domain experts. For all the domains, two actions from the classical Blocksworld domain are used as demonstrations in the prompt so that the end user is not required to come up with any domain-specific example. To evaluate the degree of correctness, we recruit multiple graduate students who possess expertise in PDDL. These experts are responsible for annotating and correcting any errors present in the generated PDDL models. As an evaluation metric, we count and report the total number of annotations, which may include the removal of irrelevant preconditions, the addition of missing preconditions, the replacement of incorrect predicates, the inclusion of missing parameters, and other commonly made corrections. Note that the number of annotations can be viewed as the approximate distance between a generated PDDL model and its corrected version. In order to provide the reader with a comprehensive understanding of the quality of the generated models, we also list all the models and collected annotations in Appendix. In each of the figures, errors that affect the functionality of the PDDL model are highlighted in yellow, while minor issues are highlighted in green. One example of a minor issue is the redundant inclusion of (pickupable ?o) in preconditions when (robot-holding ?o) has already been listed. The former is unnecessary because it can be implied by the latter, but this only affects conciseness rather than functionality.
136
+
137
+ Table 1: The number of errors in the domain models produced by the LLMs for each of the domains. A $" + "$ mark indicates that the generated model is excessively noisy, making it challenging to determine an exact number of errors.
138
+
139
+ <table><tr><td>Domain</td><td># of actions</td><td># of params and literals</td><td># of GPT-4 errors</td><td># of GPT-3.5-Turbo errors</td></tr><tr><td>Household</td><td>22</td><td>271</td><td>53</td><td>218+</td></tr><tr><td>Logistics</td><td>6</td><td>54</td><td>2</td><td>38</td></tr><tr><td>Tyreworld</td><td>13</td><td>108</td><td>4</td><td>94+</td></tr></table>
140
+
141
+ We first evaluate the PDDL models generated when partial constraint information is given, as this is closer to most of the practical use cases where constraints on skills in the library $\Pi$ are often pre-specified. In this setting, our evaluation focuses on the LLMs’ ability to accurately recover a "ground truth PDDL" that captures the mentioned constraints and underlying dependencies among skills. Our results indicate that GPT-4 can produce high-quality PDDL models with significantly fewer errors when compared to GPT-3.5-Turbo. Table 1 presents the number of errors in the generated domain models for each domain. To help the readers understand the complexities of the action models, we additionally report the total number of parameters and literals in the final corrected domain models produced by GPT-4. Out of the total 59 errors made by GPT-4, three of them are syntax errors and the rest are factual errors such as missing preconditions and effects. This observation suggests that while GPT-4 demonstrates proficiency in adhering to the grammar of PDDL, it may still have an inaccurate understanding of the actions. By examining the set of predicates (listed in the Appendix), we also find that GPT-4 can devise a set of intuitively-named predicates that can concisely and precisely describe the states of objects and events in the domain. In contrast, GPT-3.5-Turbo produces highly noisy outputs with over 350 errors. This suggests that our framework relies heavily on GPT-4’s improved capability in understanding symbols, and future work may investigate how to enable the use of more lightweight models (e.g., by fine-tuning on some PDDL datasets). Furthermore, recall that when the action description contains minimal information, LLMs could also be utilized to propose preconditions and effects to assist with knowledge acquisition. To verify this hypothesis, we conduct additional experiments on the Household domain that can have a more open-ended action design. In this setting, the correctness of the action models is determined based on whether the preconditions and effects establish correct connections among the actions. Our results show that GPT-4 can suggest meaningful action models, and the generated PDDL models have only around 45 errors.
142
+
143
+ Although GPT-4 has shown improved performance in the PDDL construction task, our experiments still uncover some limitations. Firstly, GPT-4 still exhibits a shallow understanding of the causal relationships between actions, particularly when it comes to tasks involving reasoning skills such as spatial reasoning. For instance, when constructing the model of action "pick up an object from a furniture piece," GPT-4 fails to consider that there could be other objects stacked on top of the target object, even if relevant predicates are provided (which were created in the action "stack objects"). In addition, although it occurs rarely, GPT-4 may output contradictory effects. For instance, in the action of mashing food with a blender, GPT-4 lists both (not (object-in-receptacle ...)) and (object-in-receptacle ...) as effects at the same time.
144
+
145
+ # 5.2 Correcting PDDL with domain experts
146
+
147
+ We proceed with the PDDL models generated by GPT-4 when the constraint information is partially given. Our objective is to demonstrate the feasibility of using GPT-4 as a middle layer to incorporate natural-language feedback and correct the PDDL models. As discussed in Sec. 4.2, we use PDDL validators to capture basic syntax errors. In the Household domain, there are two syntax errors associated with improper usage of relevant predicates due to issues with the object types of parameters . As shown in Appx. A.7.1, by continuing the PDDL-construction dialogue with a feedback message "the second parameter of object-on should be a furnitureAppliance but a householdObject was given," GPT-4 can locate the inaccurate PDDL snippet and replace it with a correct one. For the other factual errors, GPT-4 successfully corrects all of them based on the natural language feedback. An example feedback message on factual errors is "there is a missing effect: the item is no longer pickupable after being mashed." More PDDL-correction conversations can be found in Appendix. We also experiment with feedback written in various ways, and GPT-4 is able to understand all the messages and successfully correct the models. To quantify how effectively GPT-4 utilizes feedback from domain experts, we count the number of feedback messages concerning factual errors. Our result shows that GPT-4 required 59 feedback messages to address a total of 56 factual errors. There are three instances where additional feedback was needed. One case involved the user reiterating the error, while the other two cases involved GPT-4 introducing new errors. Furthermore, we attempt to correct the same errors using GPT-3.5-Turbo. Results show that GPT-3.5-Turbo not only fails to correct all the errors but also occasionally introduces new errors, again confirming its lack of ability to manipulate symbols. Some examples can be found in Appendix starting from Sec. A.7.3.
148
+
149
+ # 5.3 Generating plans with the extracted PDDL models
150
+
151
+ For planning tasks (i.e., user instructions and initial states), we use the Household domain and Logistics domain, where state-of-the-art LLM planners struggle to find valid plans. We sampled 27 tasks for Household and 21 for Logistics. For the initial states, we assume the grounding is provided, and for the goals, we leverage GPT-4 to translate user instructions into PDDL goal specifications in terms of the extracted predicates (an example prompt can be found at Appx. A.13), and send it over to a standard STRIPS planner which already has access to the domain model acquired through LLMs. With this setup, a classical planner Fast Downward [16] can effectively find valid plans in $9 5 \%$ of the cases (the failures were only due to goal translation errors). Note that in contrast to earlier methods such as [30] that use LLMs only as a mechanism for translating user goals to PDDL format, and throw that over to external sound planners with hand-crafted correct PDDL domain models, our approach uses LLMs themselves to develop the PDDL world model driving the external planner.
152
+
153
+ On the other hand, for the approach that utilizes PDDL models to validate LLM plans (i.e., LLM modulo planner back-prompted by VAL using LLMacquired domain model), we employ the state-of-the-art algorithm ReAct [60] with GPT-4 as the underlying LLM planner. However, we made two modifications to the prompt design. Firstly, we provide a detailed description of all actions in natural language, including parameters, preconditions, and effects. These descriptions are ob
154
+
155
+ Table 2: Success rates of different planning approaches in the Household domain and the Logistics domain.
156
+
157
+ <table><tr><td>Planner Type</td><td>Household</td><td>Logistics</td></tr><tr><td>Only LLMPlanner</td><td>15%</td><td>0%</td></tr><tr><td>Fast Downward with LLM-acquired PDDL model</td><td>95%</td><td>100%</td></tr><tr><td>LLM backprompted by VAL using LLM-acquired PDDL model</td><td>48%</td><td>33%</td></tr></table>
158
+
159
+ tained by using another LLM to translate the generated PDDL domain model into natural language. Secondly, we use only two fixed examples for each domain because end users might not always be able to provide a large pool of examples, and the planner should rely on the action model information. The LLM plans, symbolic goal specifications, initial states and domain models are passed to a plan validation system (i.e., VAL) to check for unmet precondition(s) or goal condition(s). The validation results (given in PDDL) are then translated into natural language with GPT-4 and provided to the LLM planner by continuing the planning dialogue (see Appx. A.12.1 for examples). In our experiments, we limit the number of feedbacks per task to 8 due to the restricted access to GPT-4. Table 2 provides a summary of the average success rates of all approaches. Not surprisingly, the vanilla LLM planner constantly overlooks action preconditions and achieves an extremely low success rate. With the integration of validation feedback, we observe a notable improvement in plan correctness. Despite this improvement, the overall performance is still not satisfactory, as the success rate remains below
160
+
161
+ $50 \%$ . Furthermore, we have observed that GPT-4 fails to effectively utilize the feedback, often getting stuck in a loop by repeatedly generating the same plan. In some cases, it may also introduce new errors while attempting to rectify the plans.
162
+
163
+ Beyond the notion of correctness, the experiments also uncover intriguing properties of the LLM planner. In the Household domain, we intentionally introduce ordering constraints in some instructions that cannot be expressed using existing predicates (refer to Appx. A.12 for examples). Remarkably, upon manual examination of the generated plans, we observe that all LLM plans adhere to the specified ordering, despite not being entirely correct or executable. Furthermore, also in the Household domain, we observe that classical planners occasionally generate physically plausible but unconventional actions, such as placing a knife on a toaster when the knife is not being used. In contrast, the LLM planner rarely exhibits such actions, suggesting that LLMs possess knowledge of implicit human preferences. It would be meaningful to explore methods that more effectively combine the strengths of LLM planners and the correctness guarantee provided by symbolic domain models, particularly in determining which information from LLM plans should be preserved.
164
+
165
+ # 6 Conclusion
166
+
167
+ We introduce a new paradigm for leveraging LLMs in planning tasks, which involves maintaining an explicit world model instead of directly mapping user prompts to plans. This is motivated by the insight that LLMs, while incapable of the combinatorial search needed to produce correct plans, may be better suited as the source of world models. We present a complete pipeline that begins with generating high-quality PDDL models using GPT-4, then corrects the PDDL models with naturallanguage feedback, and finally utilizes the extracted domain models to reliably plan in multiple ways. Our experiments demonstrate that pairing LLMs with an external planner significantly outperforms existing methods when applied to two IPC domains and a household-robot domain that has more action-wise constraints than commonly used benchmarks such as ALFWorld. Apart from directions for further research that we have previously mentioned, there are several exciting opportunities for extending this work. Firstly, the complexity of our evaluation domains is still lower than that of many domains used in the classical planning literature. It remains to be seen whether LLMs can effectively scale to write PDDL models that express more intricate logic. Secondly, our framework assumes full observability, meaning that the agent must fully explore the environment to acquire object states at the beginning. It would be useful to support partial observability. Finally, our experiments assume the grounding of predicate values is done perfectly. However, it would be useful to take into account that perception can be noisy in practice.
168
+
169
+ # Acknowledgement
170
+
171
+ This research was supported by ONR grants N00014-18-1-2442, N00014-18-1-2840, N00014- 19-1-2119 and N00014-23-1-2409, AFOSR grant FA9550-18-1-0067, DARPA SAIL-ON grant W911NF-19-2-0006, and a JP Morgan AI Faculty Research Grant to Kambhampati. Sreedharan was supported in part by NSF grant 2303019.
172
+
173
+ # References
174
+
175
+ [1] Michael Ahn, Anthony Brohan, Noah Brown, Yevgen Chebotar, Omar Cortes, Byron David, Chelsea Finn, Keerthana Gopalakrishnan, Karol Hausman, Alex Herzog, et al. Do as i can, not as i say: Grounding language in robotic affordances. arXiv preprint arXiv:2204.01691, 2022.
176
+ [2] Ankuj Arora, Humbert Fiorino, Damien Pellier, Marc Métivier, and Sylvie Pesty. A review of learning planning action models. The Knowledge Engineering Review, 33:e20, 2018.
177
+ [3] Pratyay Banerjee, Chitta Baral, Man Luo, Arindam Mitra, Kuntal Pal, Tran C Son, and Neeraj Varshney. Can transformers reason about effects of actions? arXiv preprint arXiv:2012.09938, 2020.
178
+ [4] Blai Bonet and Hector Geffner. Learning first-order symbolic representations for planning from the structure of the state space. arXiv preprint arXiv:1909.05546, 2019.
179
+ [5] Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. Language models are few-shot learners. Advances in neural information processing systems, 33:1877–1901, 2020. [6] Ethan Callanan, Rebecca De Venezia, Victoria Armstrong, Alison Paredes, Tathagata Chakraborti, and Christian Muise. Macq: A holistic view of model acquisition techniques. In The ICAPS Workshop on Knowledge Engineering for Planning and Scheduling (KEPS), 2022. [7] Hongyi Chen, Yilun Du, Yiye Chen, Joshua B. Tenenbaum, and Patricio A. Vela. Planning with sequence models through iterative energy minimization. In The Eleventh International Conference on Learning Representations, 2023. [8] Shuo Cheng and Danfei Xu. Guided skill learning and abstraction for long-horizon manipulation. arXiv preprint arXiv:2210.12631, 2022. [9] Stephen N Cresswell, Thomas L McCluskey, and Margaret M West. Acquiring planning domain models using locm. The Knowledge Engineering Review, 28(2):195–213, 2013.
180
+ [10] 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.
181
+ [11] Richard E Fikes and Nils J Nilsson. Strips: A new approach to the application of theorem proving to problem solving. Artificial intelligence, 2(3-4):189–208, 1971.
182
+ [12] Alfonso Gerevini and Ivan Serina. Lpg: A planner based on local search for planning graphs with action costs. In AIPS, volume 2, pages 281–290, 2002.
183
+ [13] Malik Ghallab, Dana Nau, and Paolo Traverso. Automated Planning: theory and practice. Elsevier, 2004.
184
+ [14] Lin Guan, Sarath Sreedharan, and Subbarao Kambhampati. Leveraging approximate symbolic models for reinforcement learning via skill diversity. In International Conference on Machine Learning, pages 7949–7967. PMLR, 2022.
185
+ [15] Shibo Hao, Yi Gu, Haodi Ma, Joshua Jiahua Hong, Zhen Wang, Daisy Zhe Wang, and Zhiting Hu. Reasoning with language model is planning with world model. arXiv preprint arXiv:2305.14992, 2023.
186
+ [16] Malte Helmert. The fast downward planning system. Journal of Artificial Intelligence Research, 26:191–246, 2006.
187
+ [17] Jörg Hoffmann and Bernhard Nebel. The ff planning system: Fast plan generation through heuristic search. Journal of Artificial Intelligence Research, 14:253–302, 2001.
188
+ [18] Richard Howey, Derek Long, and Maria Fox. Val: Automatic plan validation, continuous effects and mixed initiative planning using pddl. In 16th IEEE International Conference on Tools with Artificial Intelligence, pages 294–301. IEEE, 2004.
189
+ [19] Wenlong Huang, Pieter Abbeel, Deepak Pathak, and Igor Mordatch. Language models as zero-shot planners: Extracting actionable knowledge for embodied agents. In International Conference on Machine Learning, pages 9118–9147. PMLR, 2022.
190
+ [20] Wenlong Huang, Fei Xia, Ted Xiao, Harris Chan, Jacky Liang, Pete Florence, Andy Zeng, Jonathan Tompson, Igor Mordatch, Yevgen Chebotar, et al. Inner monologue: Embodied reasoning through planning with language models. arXiv preprint arXiv:2207.05608, 2022.
191
+ [21] León Illanes, Xi Yan, Rodrigo Toro Icarte, and Sheila A McIlraith. Symbolic plans as high-level instructions for reinforcement learning. In Proceedings of the international conference on automated planning and scheduling, volume 30, pages 540–550, 2020.
192
+ [22] IPC. International planning competition, 1998.
193
+ [23] Subbarao Kambhampati, Sarath Sreedharan, Mudit Verma, Yantian Zha, and Lin Guan. Symbols as a lingua franca for bridging human-ai chasm for explainable and advisable ai systems. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 36, pages 12262–12267, 2022.
194
+
195
+ [24] Subbarao Kambhampati, Karthik Valmeekam, Matthew Marquez, and Lin Guan. On the role of large language models in planning, July 2023. Tutorial presented at the International Conference on Automated Planning and Scheduling (ICAPS), Prague. https://yochan-lab.github. io/tutorial/ICAPS-2023/.
196
+
197
+ [25] George Konidaris, Leslie Pack Kaelbling, and Tomas Lozano-Perez. From skills to symbols: Learning symbolic representations for abstract high-level planning. Journal of Artificial Intelligence Research, 61:215–289, 2018.
198
+
199
+ [26] Kenneth Li, Aspen K Hopkins, David Bau, Fernanda Viégas, Hanspeter Pfister, and Martin Wattenberg. Emergent world representations: Exploring a sequence model trained on a synthetic task. In The Eleventh International Conference on Learning Representations, 2023.
200
+
201
+ [27] Shuang Li, Xavier Puig, Chris Paxton, Yilun Du, Clinton Wang, Linxi Fan, Tao Chen, De-An Huang, Ekin Akyürek, Anima Anandkumar, et al. Pre-trained language models for interactive decision-making. Advances in Neural Information Processing Systems, 35:31199–31212, 2022.
202
+
203
+ [28] Jacky Liang, Wenlong Huang, Fei Xia, Peng Xu, Karol Hausman, Brian Ichter, Pete Florence, and Andy Zeng. Code as policies: Language model programs for embodied control. arXiv preprint arXiv:2209.07753, 2022.
204
+
205
+ [29] Kevin Lin, Christopher Agia, Toki Migimatsu, Marco Pavone, and Jeannette Bohg. Text2motion: From natural language instructions to feasible plans. arXiv preprint arXiv:2303.12153, 2023.
206
+
207
+ [30] Bo Liu, Yuqian Jiang, Xiaohan Zhang, Qiang Liu, Shiqi Zhang, Joydeep Biswas, and Peter Stone. Llm+ p: Empowering large language models with optimal planning proficiency. arXiv preprint arXiv:2304.11477, 2023.
208
+
209
+ [31] Man Luo, Shrinidhi Kumbhar, Mihir Parmar, Neeraj Varshney, Pratyay Banerjee, Somak Aditya, Chitta Baral, et al. Towards logiglue: A brief survey and a benchmark for analyzing logical reasoning capabilities of language models. arXiv preprint arXiv:2310.00836, 2023.
210
+
211
+ [32] Qing Lyu, Shreya Havaldar, Adam Stein, Li Zhang, Delip Rao, Eric Wong, Marianna Apidianaki, and Chris Callison-Burch. Faithful chain-of-thought reasoning. arXiv preprint arXiv:2301.13379, 2023.
212
+
213
+ [33] Drew McDermott, Malik Ghallab, Adele E. Howe, Craig A. Knoblock, Ashwin Ram, Manuela M. Veloso, Daniel S. Weld, and David E. Wilkins. Pddl-the planning domain definition language. 1998.
214
+
215
+ [34] Kolby Nottingham, Prithviraj Ammanabrolu, Alane Suhr, Yejin Choi, Hannaneh Hajishirzi, Sameer Singh, and Roy Fox. Do embodied agents dream of pixelated sheep?: Embodied decision making using language guided world modelling. arXiv preprint arXiv:2301.12050, 2023.
216
+
217
+ [35] Alberto Olmo, Sarath Sreedharan, and Subbarao Kambhampati. Gpt3-to-plan: Extracting plans from text using gpt-3. arXiv preprint arXiv:2106.07131, 2021.
218
+
219
+ [36] OpenAI. Introducing chatgpt by openai, 2022.
220
+
221
+ [37] OpenAI. Gpt-4 technical report, 2023.
222
+
223
+ [38] Vishal Pallagani, Bharath Muppasani, Keerthiram Murugesan, Francesca Rossi, Lior Horesh, Biplav Srivastava, Francesco Fabiano, and Andrea Loreggia. Plansformer: Generating symbolic plans using transformers. arXiv preprint arXiv:2212.08681, 2022.
224
+
225
+ [39] Liangming Pan, Alon Albalak, Xinyi Wang, and William Yang Wang. Logic-lm: Empowering large language models with symbolic solvers for faithful logical reasoning. arXiv preprint arXiv:2305.12295, 2023.
226
+
227
+ [40] Xavier Puig, Kevin Ra, Marko Boben, Jiaman Li, Tingwu Wang, Sanja Fidler, and Antonio Torralba. Virtualhome: Simulating household activities via programs. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pages 8494–8502, 2018.
228
+
229
+ [41] Alec Radford, Jong Wook Kim, Chris Hallacy, Aditya Ramesh, Gabriel Goh, Sandhini Agarwal, Girish Sastry, Amanda Askell, Pamela Mishkin, Jack Clark, et al. Learning transferable visual models from natural language supervision. In International conference on machine learning, pages 8748–8763. PMLR, 2021.
230
+ [42] Shreyas Sundara Raman, Vanya Cohen, Eric Rosen, Ifrah Idrees, David Paulius, and Stefanie Tellex. Planning with large language models via corrective re-prompting. arXiv preprint arXiv:2211.09935, 2022.
231
+ [43] 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.
232
+ [44] Stuart Jonathan Russell. Norvig (2003). Artificial intelligence: a modern approach, 25:26, 2003.
233
+ [45] Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Luke Zettlemoyer, Nicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools. arXiv preprint arXiv:2302.04761, 2023.
234
+ [46] Noah Shinn, Beck Labash, and Ashwin Gopinath. Reflexion: an autonomous agent with dynamic memory and self-reflection. arXiv preprint arXiv:2303.11366, 2023.
235
+ [47] Mohit Shridhar, Xingdi Yuan, Marc-Alexandre Côté, Yonatan Bisk, Adam Trischler, and Matthew Hausknecht. ALFWorld: Aligning Text and Embodied Environments for Interactive Learning. In Proceedings of the International Conference on Learning Representations (ICLR), 2021.
236
+ [48] Tom Silver, Varun Hariprasad, Reece S Shuttleworth, Nishanth Kumar, Tomás Lozano-Pérez, and Leslie Pack Kaelbling. Pddl planning with pretrained large language models. In NeurIPS 2022 Foundation Models for Decision Making Workshop, 2022.
237
+ [49] Ron M Simpson, Diane E Kitchin, and Thomas Leo McCluskey. Planning domain definition using gipo. The Knowledge Engineering Review, 22(2):117–134, 2007.
238
+ [50] Ishika Singh, Valts Blukis, Arsalan Mousavian, Ankit Goyal, Danfei Xu, Jonathan Tremblay, Dieter Fox, Jesse Thomason, and Animesh Garg. Progprompt: Generating situated robot task plans using large language models. arXiv preprint arXiv:2209.11302, 2022.
239
+ [51] Chan Hee Song, Jiaman Wu, Clayton Washington, Brian M Sadler, Wei-Lun Chao, and Yu Su. Llm-planner: Few-shot grounded planning for embodied agents with large language models. arXiv preprint arXiv:2212.04088, 2022.
240
+ [52] Sarath Sreedharan, Tathagata Chakraborti, Christian Muise, Yasaman Khazaeni, and Subbarao Kambhampati. –d3wa+–a case study of xaip in a model acquisition task for dialogue planning. In Proceedings of the International Conference on Automated Planning and Scheduling, volume 30, pages 488–497, 2020.
241
+ [53] Kaya Stechly, Matthew Marquez, and Subbarao Kambhampati. Gpt-4 doesn’t know it’s wrong: An analysis of iterative prompting for reasoning problems. arXiv preprint arXiv:2310.12397, 2023.
242
+ [54] Karthik Valmeekam, Matthew Marquez, and Subbarao Kambhampati. Can large language models really improve by self-critiquing their own plans? arXiv preprint arXiv:2310.08118, 2023.
243
+ [55] Karthik Valmeekam, Matthew Marquez, Sarath Sreedharan, and Subbarao Kambhampati. On the planning abilities of large language models–a critical investigation. arXiv preprint arXiv:2305.15771, 2023.
244
+ [56] Zihao Wang, Shaofei Cai, Anji Liu, Xiaojian Ma, and Yitao Liang. Describe, explain, plan and select: Interactive planning with large language models enables open-world multi-task agents. arXiv preprint arXiv:2302.01560, 2023.
245
+ [57] Lionel Wong, Gabriel Grand, Alexander K Lew, Noah D Goodman, Vikash K Mansinghka, Jacob Andreas, and Joshua B Tenenbaum. From word models to world models: Translating from natural language to the probabilistic language of thought. arXiv preprint arXiv:2306.12672, 2023.
246
+ [58] Yaqi Xie, Chen Yu, Tongyao Zhu, Jinbin Bai, Ze Gong, and Harold Soh. Translating natural language to planning goals with large-language models. arXiv preprint arXiv:2302.05128, 2023.
247
+ [59] Qiang Yang, Kangheng Wu, and Yunfei Jiang. Learning action models from plan examples using weighted max-sat. Artificial Intelligence, 171(2-3):107–143, 2007.
248
+ [60] Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik R Narasimhan, and Yuan Cao. React: Synergizing reasoning and acting in language models. In The Eleventh International Conference on Learning Representations, 2023.
249
+ [61] Hankz Hankui Zhuo, Qiang Yang, Derek Hao Hu, and Lei Li. Learning complex action models with quantifiers and logical implications. Artificial Intelligence, 174(18):1540–1569, 2010.
250
+ [62] Hankz Hankui Zhuo, Yantian Zha, Subbarao Kambhampati, and Xin Tian. Discovering underlying plans based on shallow models. ACM Transactions on Intelligent Systems and Technology (TIST), 11(2):1–30, 2020.