ZHANGYUXUAN-zR commited on
Commit
8025ad4
·
verified ·
1 Parent(s): 23c037c

Add files using upload-large-folder tool

Browse files
parse/dev/GMYWzWztDx5/GMYWzWztDx5_content_list.json ADDED
@@ -0,0 +1,1599 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "NORMFORMER: IMPROVED TRANSFORMER PRETRAINING WITH EXTRA NORMALIZATION ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 225,
8
+ 98,
9
+ 774,
10
+ 146
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "ABSTRACT ",
17
+ "text_level": 1,
18
+ "bbox": [
19
+ 454,
20
+ 227,
21
+ 544,
22
+ 242
23
+ ],
24
+ "page_idx": 0
25
+ },
26
+ {
27
+ "type": "text",
28
+ "text": "During pretraining, the Pre-LayerNorm transformer suffers from a gradient magnitude mismatch: gradients at early layers are much larger than at later layers. These issues can be alleviated by our proposed NormFormer architecture, which adds three normalization operations to each layer: a Layer Norm after self attention, head-wise scaling of self-attention outputs, and a Layer Norm after the first fully connected layer. The extra operations incur negligible compute cost $( + 0 . 4 \\%$ parameter increase), but improve pretraining perplexity and downstream task performance for both causal and masked language models ranging from 125 Million to 2.7 Billion parameters. For causal language modeling, adding NormFormer on top of our strongest 1.3B parameter baseline achieves equal performance with $79 \\%$ as much compute, and matches GPT-3 Large performance in $62 \\%$ of the cost. In the same compute budget, NormFormer comfortably beats both baselines in both pre-training perplexity and zero shot performance. For masked language modeling, NormFormer improves fine-tuned GLUE performance by $1 . 9 \\%$ on average. Code to train NormFormer models is available in REDACTED. ",
29
+ "bbox": [
30
+ 233,
31
+ 260,
32
+ 764,
33
+ 467
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "1 INTRODUCTION ",
40
+ "text_level": 1,
41
+ "bbox": [
42
+ 176,
43
+ 498,
44
+ 336,
45
+ 515
46
+ ],
47
+ "page_idx": 0
48
+ },
49
+ {
50
+ "type": "text",
51
+ "text": "The original transformer architecture (Vaswani et al., 2017) applies Layer Normalization (Ba et al., 2016) after each sublayer’s residual connection (“Post-LN”) in order to reduce the variance of the inputs to the following sublayer, i.e.: ",
52
+ "bbox": [
53
+ 174,
54
+ 536,
55
+ 825,
56
+ 579
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "equation",
62
+ "img_path": "images/b77c42e9e33859cfd85b6098040b5278d0810ecb207016f16325a1a9deffd61f.jpg",
63
+ "text": "$$\n\\mathrm { P o s t L N } ( x ) = \\mathrm { L a y e r N o r m } ( x + \\mathrm { S u b l a y e r } ( x ) ) ,\n$$",
64
+ "text_format": "latex",
65
+ "bbox": [
66
+ 343,
67
+ 587,
68
+ 653,
69
+ 603
70
+ ],
71
+ "page_idx": 0
72
+ },
73
+ {
74
+ "type": "text",
75
+ "text": "with ",
76
+ "bbox": [
77
+ 173,
78
+ 611,
79
+ 205,
80
+ 625
81
+ ],
82
+ "page_idx": 0
83
+ },
84
+ {
85
+ "type": "equation",
86
+ "img_path": "images/7d4f7946cb0758afd0a765ec728ab816f139692aa37f7d9b53a4b0ed42183af6.jpg",
87
+ "text": "$$\n\\mathrm { L a y e r N o r m } ( x ) = \\frac { x - E [ x ] } { \\sqrt { V a r [ x ] + \\epsilon } } \\cdot \\gamma + \\beta ,\n$$",
88
+ "text_format": "latex",
89
+ "bbox": [
90
+ 357,
91
+ 630,
92
+ 637,
93
+ 666
94
+ ],
95
+ "page_idx": 0
96
+ },
97
+ {
98
+ "type": "text",
99
+ "text": "where $\\gamma$ and $\\beta$ are trainable parameters, and $\\epsilon$ is a small constant. Recent work has shown empirically and theoretically that Post-LN transformers tend to have larger magnitude gradients in later layers compared to earlier layers (Xiong et al., 2020) and has advocated moving the LayerNorm operation to the beginning of each sublayer (“Pre-LN”; see Figure 1, left), i.e.: ",
100
+ "bbox": [
101
+ 173,
102
+ 672,
103
+ 825,
104
+ 729
105
+ ],
106
+ "page_idx": 0
107
+ },
108
+ {
109
+ "type": "equation",
110
+ "img_path": "images/dede7a7d6d250c1fe2bf575bba8d4f706bcf6bff240238a972c448fe423f6a1b.jpg",
111
+ "text": "$$\n\\operatorname { P r e L N } ( x ) = x + \\operatorname { S u b l a y e r } ( \\operatorname { L a y e r N o r m } ( x ) ) .\n$$",
112
+ "text_format": "latex",
113
+ "bbox": [
114
+ 346,
115
+ 736,
116
+ 650,
117
+ 753
118
+ ],
119
+ "page_idx": 0
120
+ },
121
+ {
122
+ "type": "text",
123
+ "text": "In practice Pre-LN transformers can be trained with larger learning rates, shorter learning rate warmup and often yield improved performance compared to Post-LN transformers (Xiong et al., 2020), so most recent, large pretrained language models tend to use Pre-LN transformers (Baevski & Auli, 2019; Radford et al., 2019; Raffel et al., 2020; Brown et al., 2020; Lieber et al., 2021). In this work we show that, while Pre-LN improves stability over Post-LN, it has the opposite side effect: gradients at earlier layers tend to be larger than gradients at later layers, thereby limiting the learning rate.1 We propose NormFormer, which alleviates the gradient magnitude mismatch by adding 3 normalization operations to each layer (see Figure 1, middle). These operations reduce gradients to early layers and increase gradients to later layers, bringing their magnitudes closer together. ",
124
+ "bbox": [
125
+ 173,
126
+ 760,
127
+ 825,
128
+ 887
129
+ ],
130
+ "page_idx": 0
131
+ },
132
+ {
133
+ "type": "image",
134
+ "img_path": "images/e432752f64d333fc81f82f72403fe579507153d1934fd7d710a6d5f0fe4e9794.jpg",
135
+ "image_caption": [
136
+ "Figure 1: Left: a baseline Pre-LayerNorm transformer layer. Center: NormFormer, with the three proposed additions in bold. Right: a single attention head with our proposed HeadScale operation applied prior to the output projection with trainable parameters $\\gamma _ { i }$ . \\* When applied, residual scaling impacts the second residual connection in each layer. "
137
+ ],
138
+ "image_footnote": [],
139
+ "bbox": [
140
+ 274,
141
+ 111,
142
+ 723,
143
+ 296
144
+ ],
145
+ "page_idx": 1
146
+ },
147
+ {
148
+ "type": "text",
149
+ "text": "Compared to compute-matched, well-tuned Pre-LN baselines, NormFormer models reach target pretraining perplexities faster and achieve better pretraining perplexities and downstream task performance. ",
150
+ "bbox": [
151
+ 176,
152
+ 405,
153
+ 823,
154
+ 446
155
+ ],
156
+ "page_idx": 1
157
+ },
158
+ {
159
+ "type": "text",
160
+ "text": "The rest of this paper is organized as follows: Section 2 describes the proposed modifications. Section 3 describes related work. Section 5 shows pretraining and downstream task performance for fully trained NormFormer models against well-tuned, compute-matched baselines. Section 6 shows the gradient mismatch introduced by Pre-LN and how NormFormer alleviates it. Section 6.1 analyzes residual scaling, a related technique proposed to stabilize Post-LN architectures (Xiong et al., 2020; Zhu et al., 2021). Section 7 shows that removing any of the added operations degrades performance and that NormFormer improves over the baseline at a wide range of hyperparameter configurations. Section 9.1 compares NormFormer to Related Work from other domains. ",
161
+ "bbox": [
162
+ 173,
163
+ 454,
164
+ 825,
165
+ 565
166
+ ],
167
+ "page_idx": 1
168
+ },
169
+ {
170
+ "type": "text",
171
+ "text": "2 APPROACH",
172
+ "text_level": 1,
173
+ "bbox": [
174
+ 174,
175
+ 589,
176
+ 299,
177
+ 606
178
+ ],
179
+ "page_idx": 1
180
+ },
181
+ {
182
+ "type": "text",
183
+ "text": "2.1 NORMFORMER ",
184
+ "text_level": 1,
185
+ "bbox": [
186
+ 174,
187
+ 628,
188
+ 320,
189
+ 643
190
+ ],
191
+ "page_idx": 1
192
+ },
193
+ {
194
+ "type": "text",
195
+ "text": "NormFormer includes three modifications to the Pre-LN transformer: First, we apply head-wise scaling inside the attention module and add two additional LayerNorm operations: one after the attention module and a second after the first fully connected layer. The modifications introduce a small number of additional learnable parameters, which provide a cost-effective way for each layer to change the magnitude of its features, and therefore the magnitude of the gradients to subsequent components. The changes are visualized in Figure 1 and described below. ",
196
+ "bbox": [
197
+ 173,
198
+ 656,
199
+ 825,
200
+ 741
201
+ ],
202
+ "page_idx": 1
203
+ },
204
+ {
205
+ "type": "text",
206
+ "text": "Scaling Attention Heads The standard multi-head attention operation is defined as: ",
207
+ "bbox": [
208
+ 171,
209
+ 762,
210
+ 736,
211
+ 777
212
+ ],
213
+ "page_idx": 1
214
+ },
215
+ {
216
+ "type": "equation",
217
+ "img_path": "images/56931694134fabefe46260ecfc20e305e8273f6275fb5a3c3e127de504fd3dc2.jpg",
218
+ "text": "$$\n\\begin{array} { r l } & { \\mathrm { M u l t i H e a d A t t e n t i o n } ( Q , K , V ) = \\mathrm { C o n c a t } ( \\mathrm { h } _ { 1 } , \\dots , \\mathrm { h } _ { n } ) W ^ { O } } \\\\ & { \\mathrm { h } _ { i } = \\mathrm { A t t e n t i o n } ( Q W _ { i } ^ { Q } , K W _ { i } ^ { K } , V W _ { i } ^ { V } ) } \\\\ & { \\mathrm { A t t e n t i o n } ( Q , K , V ) = \\mathrm { s o f t m a x } \\left( \\frac { Q K ^ { T } } { \\sqrt { d _ { k } } } \\right) V , } \\end{array}\n$$",
219
+ "text_format": "latex",
220
+ "bbox": [
221
+ 297,
222
+ 790,
223
+ 699,
224
+ 869
225
+ ],
226
+ "page_idx": 1
227
+ },
228
+ {
229
+ "type": "text",
230
+ "text": "and where $W ^ { O } , W _ { i } ^ { Q } , W _ { i } ^ { K } , W _ { i } ^ { V }$ $n$ is the number of heads, are learned projection matrices for the output, query, key and value, re- $i$ is the attention head index, $d _ { k }$ is the dimensionality of the keys spectively. ",
231
+ "bbox": [
232
+ 176,
233
+ 878,
234
+ 823,
235
+ 924
236
+ ],
237
+ "page_idx": 1
238
+ },
239
+ {
240
+ "type": "text",
241
+ "text": "We propose scaling the output of each attention head via learned scalar coefficients $\\gamma _ { i }$ ",
242
+ "bbox": [
243
+ 173,
244
+ 103,
245
+ 740,
246
+ 118
247
+ ],
248
+ "page_idx": 2
249
+ },
250
+ {
251
+ "type": "equation",
252
+ "img_path": "images/6ebadcd488ccdbadfde91fb9c569f4e2ec45e2e667e8fc3fb901032f4a3c5171.jpg",
253
+ "text": "$$\n\\mathrm { H e a d S c a l e M H A } ( Q , K , V ) = \\mathrm { C o n c a t } ( \\gamma _ { 1 } \\mathrm { h } _ { 1 } , \\dots , \\gamma _ { n } \\mathrm { h } _ { n } ) W ^ { O }\n$$",
254
+ "text_format": "latex",
255
+ "bbox": [
256
+ 297,
257
+ 122,
258
+ 697,
259
+ 140
260
+ ],
261
+ "page_idx": 2
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "where $\\gamma$ are learnable parameters initialized to 1. ",
266
+ "bbox": [
267
+ 174,
268
+ 142,
269
+ 495,
270
+ 157
271
+ ],
272
+ "page_idx": 2
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "Additional Layer Normalization and Putting it All Together In the Pre-LN transformer each layer $l$ modifies an input $x _ { l }$ as follows: ",
277
+ "bbox": [
278
+ 173,
279
+ 170,
280
+ 823,
281
+ 199
282
+ ],
283
+ "page_idx": 2
284
+ },
285
+ {
286
+ "type": "equation",
287
+ "img_path": "images/4221c0dcdf00db373aa5547f90e689f5ec54a57bdaf948205af38c5bc2769985.jpg",
288
+ "text": "$$\nx _ { l + 1 } ^ { \\mathtt { P r e L N } } = \\mathrm { F F N } ( \\mathrm { M H A } ( x _ { l } ) )\n$$",
289
+ "text_format": "latex",
290
+ "bbox": [
291
+ 343,
292
+ 202,
293
+ 524,
294
+ 220
295
+ ],
296
+ "page_idx": 2
297
+ },
298
+ {
299
+ "type": "equation",
300
+ "img_path": "images/0243a2e4b3d9e940fb5a9c4976514334da4c936d11e338ba9485bca2afa9a24b.jpg",
301
+ "text": "$$\n\\begin{array} { r l } & { \\mathrm { M H A } ( x ) = x + \\mathrm { M u l t i H e a d A t t e n t i o n } ( \\mathrm { L N } ( x ) , \\mathrm { L N } ( x ) , \\mathrm { L N } ( x ) ) } \\\\ & { \\mathrm { F F N } ( x ) = x + \\sigma ( \\mathrm { L N } ( x ) W _ { 1 } + b _ { 1 } ) W _ { 2 } + b _ { 2 } } \\\\ & { \\mathrm { L N } ( x ) = \\mathrm { L a y e r N o r m } ( x ) } \\end{array}\n$$",
302
+ "text_format": "latex",
303
+ "bbox": [
304
+ 320,
305
+ 239,
306
+ 746,
307
+ 292
308
+ ],
309
+ "page_idx": 2
310
+ },
311
+ {
312
+ "type": "text",
313
+ "text": "In this work $\\sigma$ is the GELU non-linear activation introduced in Hendrycks & Gimpel (2016). ",
314
+ "bbox": [
315
+ 171,
316
+ 295,
317
+ 781,
318
+ 310
319
+ ],
320
+ "page_idx": 2
321
+ },
322
+ {
323
+ "type": "text",
324
+ "text": "Our overall method, NormFormer, instead modifies each input $x _ { l }$ as: ",
325
+ "bbox": [
326
+ 176,
327
+ 316,
328
+ 650,
329
+ 330
330
+ ],
331
+ "page_idx": 2
332
+ },
333
+ {
334
+ "type": "equation",
335
+ "img_path": "images/677586398c22cb2e6d86645045fc78cb01e7853fa590eb6f4513642f2df72511.jpg",
336
+ "text": "$$\nx _ { l + 1 } ^ { \\mathrm { { N o r m F o r m e r } } } = \\mathrm { { N o r m F F N } } ( { \\mathrm { N o r m S c a l e d M H A } } ( x _ { l } ) )\n$$",
337
+ "text_format": "latex",
338
+ "bbox": [
339
+ 339,
340
+ 334,
341
+ 681,
342
+ 352
343
+ ],
344
+ "page_idx": 2
345
+ },
346
+ {
347
+ "type": "equation",
348
+ "img_path": "images/d70c184d57617b4b26c9abbf908b18ebce8e99d6916c78d85231d9fa9d727187.jpg",
349
+ "text": "$$\n\\mathrm { N o r m S c a l e d M H A } ( x ) = x + \\mathbf { L N } ( \\mathbf { H e a d S c a l e M H A } ( \\mathrm { L N } ( x ) , \\mathrm { L N } ( x ) , \\mathrm { L N } ( x ) )\n$$",
350
+ "text_format": "latex",
351
+ "bbox": [
352
+ 274,
353
+ 371,
354
+ 771,
355
+ 385
356
+ ],
357
+ "page_idx": 2
358
+ },
359
+ {
360
+ "type": "equation",
361
+ "img_path": "images/99a34a424e0ebad25964fa8b0931daa2b39c51ce0c44bc4c6b0034a2c417bc10.jpg",
362
+ "text": "$$\n\\mathrm { N o r m F F N } ( x ) = \\mathbf { \\delta x } + \\mathbf { L N } ( \\sigma ( \\mathrm { L N } ( x ) W _ { 1 } + b _ { 1 } ) ) W _ { 2 } + b _ { 2 }\n$$",
363
+ "text_format": "latex",
364
+ "bbox": [
365
+ 323,
366
+ 388,
367
+ 696,
368
+ 405
369
+ ],
370
+ "page_idx": 2
371
+ },
372
+ {
373
+ "type": "text",
374
+ "text": "where bolded operations are newly introduced. ",
375
+ "bbox": [
376
+ 174,
377
+ 409,
378
+ 480,
379
+ 422
380
+ ],
381
+ "page_idx": 2
382
+ },
383
+ {
384
+ "type": "text",
385
+ "text": "3 RELATED WORK ",
386
+ "text_level": 1,
387
+ "bbox": [
388
+ 176,
389
+ 446,
390
+ 344,
391
+ 463
392
+ ],
393
+ "page_idx": 2
394
+ },
395
+ {
396
+ "type": "text",
397
+ "text": "Architectural Modifications GradInit (Zhu et al., 2021) introduces a set of scalars and biases for initialization based on a variance heuristic, and Admin (Liu et al., 2020) applies a similar heuristic in profiling and initialization stages. These works also use variants of our ResScale operation, which we find helpful at small scale and harmful at large scale. Our approach, in contrast, only has new learnable parameters without variance heuristics, and has no extra stages or changes in initialization. ",
398
+ "bbox": [
399
+ 173,
400
+ 484,
401
+ 825,
402
+ 555
403
+ ],
404
+ "page_idx": 2
405
+ },
406
+ {
407
+ "type": "text",
408
+ "text": "Shazeer (2020) proposes FFN-GeGLU, which includes scaling but no normalization, in the same position as our FFN LN. Ding et al. (2021) propose related stabilization strategies for text to image generation tasks with larger models including a down-scaled embedding gradient, a slightly different LN formulation, LN after the final fully connected layer, and the same post-attention LN. Section 9.1 compares NormFormer to these proposals, as well as the T5 LayerNorm Variant (Raffel et al., 2020), which removes the bias and the mean subtraction from the normalization. ",
409
+ "bbox": [
410
+ 173,
411
+ 560,
412
+ 825,
413
+ 645
414
+ ],
415
+ "page_idx": 2
416
+ },
417
+ {
418
+ "type": "text",
419
+ "text": "Our HeadScale operation is related to that used in Chen et al. (2021), but used differently. Whereas that work prunes attention heads with low $\\gamma$ parameters, we use the $\\gamma$ parameters to improve pretraining performance. ",
420
+ "bbox": [
421
+ 176,
422
+ 651,
423
+ 820,
424
+ 694
425
+ ],
426
+ "page_idx": 2
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "Press et al. (2020a) proposes an architecture where instead of interleaving attention and feed forward sublayers, the attention all happens first. This increases the number of late FFN parameters, rather than increasing their importance and gradient norm, as our FFN LN does, and does not impact stability. ",
431
+ "bbox": [
432
+ 173,
433
+ 700,
434
+ 825,
435
+ 757
436
+ ],
437
+ "page_idx": 2
438
+ },
439
+ {
440
+ "type": "text",
441
+ "text": "Residual Scaling Standard Post-LN transformers simply sum the previous output (residual) with the new output. Recent work attempts to stabilize transformers by weighting the residual connection for each layer (Zhu et al., 2021; Liu et al., 2020; Touvron et al., 2021). We thus experiment with scaling the residual in each embedding dimension via learned scalar coefficients $( \\lambda _ { r e s i d } ) _ { i }$ : ",
442
+ "bbox": [
443
+ 173,
444
+ 771,
445
+ 825,
446
+ 828
447
+ ],
448
+ "page_idx": 2
449
+ },
450
+ {
451
+ "type": "equation",
452
+ "img_path": "images/b51e9edc2cba8038d865e52e80bc23b1dec318ca9ca8204a070327e2d8c9d69e.jpg",
453
+ "text": "$$\n{ \\mathrm { R e s S c a l e } } ( \\mathrm { x } ) = \\lambda _ { r e s i d } \\circ x + { \\mathrm { S u b l a y e r } } ( { \\mathrm { L a y e r N o r m } } ( x ) )\n$$",
454
+ "text_format": "latex",
455
+ "bbox": [
456
+ 313,
457
+ 832,
458
+ 683,
459
+ 848
460
+ ],
461
+ "page_idx": 2
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "where $\\circ$ is elementwise multiplication, and $\\lambda _ { r e s i d }$ are learned parameters initialized to ",
466
+ "bbox": [
467
+ 176,
468
+ 851,
469
+ 743,
470
+ 866
471
+ ],
472
+ "page_idx": 2
473
+ },
474
+ {
475
+ "type": "text",
476
+ "text": "While this can be applied at any normalization layer, we find it it most effective for normalizing the feedforward network (FFN) submodule for the smaller sized language models. In this setting, ",
477
+ "bbox": [
478
+ 176,
479
+ 872,
480
+ 828,
481
+ 901
482
+ ],
483
+ "page_idx": 2
484
+ },
485
+ {
486
+ "type": "equation",
487
+ "img_path": "images/0071908a4ef14a602ea85e4920ad76448cdf9edee36c394f0a1854f43f3916de.jpg",
488
+ "text": "$$\n\\begin{array} { r } { \\mathrm { N o r m F F N } ( x ) = \\lambda _ { r e s i d } \\circ x + \\mathbf { L N } ( \\sigma ( \\mathrm { L N } ( x ) W _ { 1 } + b _ { 1 } ) ) W _ { 2 } + b _ { 2 } } \\end{array}\n$$",
489
+ "text_format": "latex",
490
+ "bbox": [
491
+ 282,
492
+ 904,
493
+ 715,
494
+ 921
495
+ ],
496
+ "page_idx": 2
497
+ },
498
+ {
499
+ "type": "table",
500
+ "img_path": "images/a5533ae7a53bca2db21eddeb27ad34f7df4872bfbdb7d85dc4e27086b3d53d06.jpg",
501
+ "table_caption": [],
502
+ "table_footnote": [],
503
+ "table_body": "<table><tr><td>Model Size</td><td>GPT-3 Paper</td><td>Baseline</td><td>NormFormer</td></tr><tr><td>125M</td><td>6e-4</td><td>3e-3</td><td>3e-3</td></tr><tr><td>355M</td><td>3e-4</td><td>1e-3</td><td>1e-3</td></tr><tr><td>1.3B</td><td>2e-4</td><td>6e-4</td><td>6e-4</td></tr></table>",
504
+ "bbox": [
505
+ 316,
506
+ 101,
507
+ 681,
508
+ 172
509
+ ],
510
+ "page_idx": 3
511
+ },
512
+ {
513
+ "type": "text",
514
+ "text": "Table 1: Searching for learning rates on our dataset results in higher values than reported in Brown et al. (2020), providing stronger baselines to compare to our NormFormer architecture. ",
515
+ "bbox": [
516
+ 173,
517
+ 183,
518
+ 823,
519
+ 210
520
+ ],
521
+ "page_idx": 3
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": "For 1.3B parameter models and larger, scaling residuals hurts performance (see discussion in Section 6.1), so ResScale is not used in our 1.3B and 2.7B CLM results. Additionally, we experiment with initializing $\\lambda _ { r e s i d } = 1 e - 5$ , following (Touvron et al., 2021), as well replacing addition in residual connections with concatenation (Davis et al., 2021) in Section 9.1. ",
526
+ "bbox": [
527
+ 174,
528
+ 247,
529
+ 825,
530
+ 303
531
+ ],
532
+ "page_idx": 3
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "4 EXPERIMENTS ",
537
+ "text_level": 1,
538
+ "bbox": [
539
+ 176,
540
+ 327,
541
+ 326,
542
+ 343
543
+ ],
544
+ "page_idx": 3
545
+ },
546
+ {
547
+ "type": "text",
548
+ "text": "Causal Language Models We pretrain causal LMs (CLM) that roughly match the “Small” (125M parameter), “Medium” (355M), “Large” (1.3B) and “XL” (2.7B) sizes from Brown et al. (2020). ",
549
+ "bbox": [
550
+ 174,
551
+ 366,
552
+ 823,
553
+ 393
554
+ ],
555
+ "page_idx": 3
556
+ },
557
+ {
558
+ "type": "text",
559
+ "text": "Our model architecture differs from Brown et al. (2020) in two ways: (1) we use only dense attention, while they alternate between dense and locally banded sparse attention; (2) we train our models with sinusoidal positional embeddings, following Shortformer (Press et al., 2020b), since early experiments found this to produce comparable results with fewer learned parameters. ",
560
+ "bbox": [
561
+ 174,
562
+ 400,
563
+ 825,
564
+ 457
565
+ ],
566
+ "page_idx": 3
567
+ },
568
+ {
569
+ "type": "text",
570
+ "text": "We train the baseline models for 300 billion tokens. We train NormFormer models for an equivalent number of GPU hours, which typically results in $2 \\%$ fewer steps and tokens due to the additional overhead of the normalization operations. ",
571
+ "bbox": [
572
+ 176,
573
+ 463,
574
+ 820,
575
+ 506
576
+ ],
577
+ "page_idx": 3
578
+ },
579
+ {
580
+ "type": "text",
581
+ "text": "On our dataset, we find that the learning rates proposed in GPT-3 are suboptimally low.2 For both baseline and NormFormer at each size besides 2.7B, we tune the learning rate by training models for 50,000 steps and selecting the best performing learning rate among: $\\{ 1 \\mathrm { e } { - } 4 , 6 \\mathrm { e } { - } 4 , 3 \\mathrm { e } { - } 4 , 6 \\mathrm { e } { - } 4 , 1 \\mathrm { e } { - } 3 , 3 \\mathrm { e } { - } 3 \\}$ . The learning rates we obtained from this process, shown in Table 1, are 3-5 times larger than those used in the GPT-3 paper. Additionally, we have verified that the baseline and NormFormer both perform worse at the full training budget with the GPT-3 learning rates than with the higher learning rates. Other hyperparameters do not differ from GPT-3.3 ",
582
+ "bbox": [
583
+ 174,
584
+ 512,
585
+ 825,
586
+ 611
587
+ ],
588
+ "page_idx": 3
589
+ },
590
+ {
591
+ "type": "text",
592
+ "text": "Large scale experiments We also train three large-scale models with 2.7B parameters. Our first baseline is a replicated version of GPT-3-2.7B with GELU activations, the published learning rate (1.6e-4) and the same number of training steps and tokens (286K steps; 300B tokens). This model slightly exceeds the reference zero shot performance (Brown et al., 2020). Next, we train two variants of GPT3-2.7B with $R e l u ^ { 2 }$ activations (So et al., 2021), but use slightly fewer training steps $20 \\%$ less) for compute efficiency. The first of these uses the baseline learning rate (1.6e-4) and the second uses NormFormer-2.7B with a higher learning rate of 6e-4. We note that training baseline 2.7B CLMs (i.e., without NormFormer modifications) with a higher 6e-4 learning rate diverged and failed to train. However, as opposed to the smaller architectures, we did not exhaustively tune the learning rate, so it is possible that an intermediate value would perform better. ",
593
+ "bbox": [
594
+ 173,
595
+ 628,
596
+ 825,
597
+ 767
598
+ ],
599
+ "page_idx": 3
600
+ },
601
+ {
602
+ "type": "text",
603
+ "text": "Zero Shot Evaluation In addition to validation perplexity, we evaluate CLMs on a subset of the tasks that GPT3 evaluated on in a zero-shot setting (Brown et al., 2020), with the same prompts. We select WinoGrande (Sakaguchi et al., 2020), StoryCloze (Mostafazadeh et al., 2016), OpenBookQA (Mihaylov et al., 2018), HellaSwag (Zellers et al., 2019) and PIQA (Bisk et al., 2020) because GPT3 showed strong performance on these tasks at small scale, as well as consistently improving performance with scale. ",
604
+ "bbox": [
605
+ 174,
606
+ 785,
607
+ 825,
608
+ 868
609
+ ],
610
+ "page_idx": 3
611
+ },
612
+ {
613
+ "type": "image",
614
+ "img_path": "images/2704f10389bffb183e69eb7adad4b513173f711e17b73b09e5f1c1c2befe1cb4.jpg",
615
+ "image_caption": [
616
+ "Figure 2: Pretraining perplexity on held-out validation data for Causal and Masked Language Models as a function of training compute (GPU days). The blue stars show the point where a model matches the baseline’s lowest perplexity. "
617
+ ],
618
+ "image_footnote": [],
619
+ "bbox": [
620
+ 227,
621
+ 99,
622
+ 771,
623
+ 305
624
+ ],
625
+ "page_idx": 4
626
+ },
627
+ {
628
+ "type": "text",
629
+ "text": "Masked Language Models (MLM) We adopt the RoBERTa-base, Pre-LN architecture and hyperparameters used in Liu et al. (2019). For the baseline, we pretrain for 2 million batches of 1 million tokens, about $\\textstyle { \\frac { 1 } { 4 } }$ of the training budget of the original roberta-base. NormFormer runs through 1.92 million batches in the same amount of time. ",
630
+ "bbox": [
631
+ 174,
632
+ 385,
633
+ 823,
634
+ 440
635
+ ],
636
+ "page_idx": 4
637
+ },
638
+ {
639
+ "type": "text",
640
+ "text": "Fine-Tuning We fine-tune both the baseline MLM and NormFormer with learning rates $\\mathrm { 1 e { - } 5 , \\mathrm { 1 e { - } 4 , \\mathrm { 3 e { - } 4 , \\mathrm { 1 e { - } 3 , \\mathrm { 3 e { - } 3 , \\mathrm { 6 e { - } 3 } } } } } }$ and report the best performance on the validation set for each GLUE task (Wang et al., 2019), following Liu et al. (2019). Other fine-tuning hyperparameters match those used for roberta-base in Liu et al. (2019). ",
641
+ "bbox": [
642
+ 174,
643
+ 455,
644
+ 825,
645
+ 511
646
+ ],
647
+ "page_idx": 4
648
+ },
649
+ {
650
+ "type": "text",
651
+ "text": "Pretraining data We pretrain all models on a collection of English language text including the English portion of the CC100 corpus (Conneau et al., 2020) as well as the data from Liu et al. (2019), consisting of BookCorpus (Zhu et al., 2019), English Wikipedia and filtered subsets of Common Crawl. We encode our data with the byte-level Byte Pair Encoding (BPE) vocabulary from Liu et al. (2019), originally introduced in Radford et al. (2019). The combined dataset contains around 450GB of uncompressed text and 110B BPE tokens. We hold out 40M BPE tokens from this data as a validation set on which we report pretraining perplexities. ",
652
+ "bbox": [
653
+ 173,
654
+ 526,
655
+ 825,
656
+ 623
657
+ ],
658
+ "page_idx": 4
659
+ },
660
+ {
661
+ "type": "text",
662
+ "text": "Implementation details We train our causal and masked language models in fairseq (Ott et al., 2019; Paszke et al., 2019). Although NormFormer introduces fewer than $0 . 0 7 \\%$ additional parameters, it slows individual training updates and increases memory usage between $2 \\%$ (2.7B model) to $6 \\%$ (125M model) due to the FFN LNs. Accordingly, we compare NormFormer to baseline models trained for an equal amount of GPU time, i.e., controlling for compute rather than the number of training updates. Finally, we note that the HeadScale operation can be moved outside the self attention module to allow the use of the very efficient pytorch F.multihead attention. This change reduces overhead without noticeable performance degradation. ",
663
+ "bbox": [
664
+ 174,
665
+ 638,
666
+ 825,
667
+ 750
668
+ ],
669
+ "page_idx": 4
670
+ },
671
+ {
672
+ "type": "text",
673
+ "text": "5 RESULTS ",
674
+ "text_level": 1,
675
+ "bbox": [
676
+ 174,
677
+ 773,
678
+ 281,
679
+ 790
680
+ ],
681
+ "page_idx": 4
682
+ },
683
+ {
684
+ "type": "text",
685
+ "text": "We report pretraining perplexities for CLMs and MLMs as a function of training wall-time (GPU days) in Figure 2. We observe that NormFormer trains significantly faster and achieves better validation perplexities for a given training compute budget. The blue stars mark the first validation step where NormFormer matches the baseline’s lowest perplexity and shows that NormFormer matches Pre-LN models while needing only $60 \\%$ and $57 \\%$ as much compute for CLM and MLM models, respectively. This is particularly impressive since NormFormer models take $2 \\%$ longer for each training step and thus see less data than Pre-LN models in this comparison. The left side blue line in Figure 2 shows the failed attempt to add ResScale to NormFormer $^ { - 1 }$ .3B. ",
686
+ "bbox": [
687
+ 174,
688
+ 811,
689
+ 825,
690
+ 924
691
+ ],
692
+ "page_idx": 4
693
+ },
694
+ {
695
+ "type": "table",
696
+ "img_path": "images/0f782b2e0c09637175a5d8aa770e122527385c7235d812aa8c562be7f3918f8d.jpg",
697
+ "table_caption": [
698
+ "Table 2: Zero-Shot Accuracy for Causal LMs for the following tasks: HS: HellaSwag, PI: PIQA, WG: WinoGrande, SC: StoryCloze, OB: OpenBookQA. PPL is validation perplexity during pretraining. GPT-3 (paper) results taken from Brown et al. (2020). Horizontal lines group compute-matched runs. High LR corresponds to using a larger learning rate than reported in Brown et al. (2020). $\\lambda _ { r e s i d }$ indicates whether residual scaling was used. $\\lambda _ { r e s i d }$ did not help at 1.3B scale, as shown in 2, but that run is not compute matched so it is not included here. Model size $( | \\theta | )$ is reported in millions of parameters. "
699
+ ],
700
+ "table_footnote": [],
701
+ "table_body": "<table><tr><td></td><td></td><td>LR</td><td>Relu²</td><td>Xresid</td><td>Steps</td><td>PPL</td><td>HS</td><td>PI</td><td>WG</td><td>SC</td><td>OB</td><td>Avg</td></tr><tr><td>Random Baseline</td><td>-</td><td>-</td><td>-</td><td>=</td><td>-</td><td>-</td><td>25.0</td><td>50.0</td><td>50.0</td><td>50.0</td><td>25.0</td><td>40.0</td></tr><tr><td>GPT3-125M (paper)</td><td>124.4</td><td>6e-4</td><td></td><td></td><td>572K</td><td>-</td><td>33.7</td><td>64.6</td><td>52.0</td><td>63.3</td><td>35.6</td><td>49.8</td></tr><tr><td>GPT3-125M (replicated)</td><td>124.4</td><td>6e-4</td><td></td><td></td><td>572K</td><td>21.11</td><td>33.7</td><td>66.5</td><td>52.2</td><td>66.1</td><td>35.4</td><td>50.8</td></tr><tr><td>GPT3-125M (High LR)</td><td>124.4</td><td>3e-3</td><td></td><td></td><td>572K</td><td>21.09</td><td>35.3</td><td>67.5</td><td>50.5</td><td>66.3</td><td>35.0</td><td>50.9</td></tr><tr><td>NormFormer-125M</td><td>124.5</td><td>3e-3</td><td></td><td>=</td><td>540K</td><td>20.34</td><td>34.9</td><td>67.1</td><td>52.3</td><td>66.3</td><td>38.0</td><td>51.7</td></tr><tr><td>NormFormer-125M</td><td>124.5</td><td>3e-3</td><td></td><td></td><td>539K</td><td>20.11</td><td>34.9</td><td>65.9</td><td>53.4</td><td>67.5</td><td>40.0</td><td>52.3</td></tr><tr><td>GPT3-355M (paper)</td><td>354.7</td><td>3e-4</td><td>=</td><td></td><td>572K</td><td>-</td><td>43.6</td><td>70.2</td><td>52.1</td><td>68.5</td><td>43.2</td><td>55.5</td></tr><tr><td>GPT3-355M (replicated)</td><td>354.7</td><td>3e-4</td><td>=</td><td></td><td>572K</td><td>15.41</td><td>46.1</td><td>70.8</td><td>54.6</td><td>71.1</td><td>41.2</td><td>56.8</td></tr><tr><td>GPT3-355M (High LR)</td><td>354.7</td><td>1e-3</td><td></td><td></td><td>572K</td><td>14.85</td><td>48.4</td><td>71.7</td><td>53.8</td><td>73.3</td><td>43.4</td><td>58.1</td></tr><tr><td>NormFormer-355M</td><td>355.0</td><td>1e-3</td><td></td><td></td><td>552K</td><td>14.54</td><td>49.7</td><td>71.8</td><td>56.0</td><td>73.8</td><td>43.6</td><td>59.0</td></tr><tr><td>NormFormer-355M</td><td>355.0</td><td>1e-3</td><td></td><td></td><td>550K</td><td>14.52</td><td>49.7</td><td>72.0</td><td>56.7</td><td>73.2</td><td>43.8</td><td>59.1</td></tr><tr><td>GPT3-1.3B (paper)</td><td>1313.5</td><td>2e-4</td><td></td><td></td><td>286K</td><td>-</td><td>54.7</td><td>75.1</td><td>58.0</td><td>73.4</td><td>46.8</td><td>61.6</td></tr><tr><td>GPT3-1.3B (replicated)</td><td>1313.5</td><td>2e-4</td><td></td><td></td><td>286K</td><td>12.56</td><td>58.5</td><td>74.6</td><td>58.1</td><td>76.8</td><td>49.4</td><td>63.5</td></tr><tr><td>GPT3-1.3B (High LR)</td><td>1313.5</td><td>6e-4</td><td></td><td></td><td>286K</td><td>12.21</td><td>57.5</td><td>74.3</td><td>59.3</td><td>76.3</td><td>50.8</td><td>63.6</td></tr><tr><td>NormFormer-1.3B</td><td>1314.0</td><td>6e-4</td><td></td><td></td><td>275K</td><td>11.94</td><td>60.5</td><td>74.5</td><td>60.1</td><td>77.5</td><td>50.8</td><td>64.7</td></tr><tr><td>GPT3-2.7B (paper)</td><td>2648.7</td><td>1.6e-4</td><td></td><td></td><td>286K</td><td>=</td><td>62.8</td><td>75.6</td><td>62.3</td><td>77.2</td><td>53.0</td><td>66.2</td></tr><tr><td>GPT3-2.7B (replicated)</td><td>2648.7</td><td>1.6e-4</td><td></td><td></td><td>286K</td><td>10.92</td><td>65.9</td><td>76.6</td><td>61.4</td><td>78.2</td><td>49.6</td><td>66.3</td></tr><tr><td>NormFormer-2.7B</td><td>2649.5</td><td>6e-4</td><td></td><td></td><td>277K</td><td>10.55</td><td>68.1</td><td>78.1</td><td>64.4</td><td>79.4</td><td>53.4</td><td>68.7</td></tr><tr><td>GPT3-2.7B-Relu</td><td>2648.7</td><td>1.6e-4</td><td></td><td></td><td>230K</td><td>10.99</td><td>65.9</td><td>76.1</td><td>63.2</td><td>79.3</td><td>49.4</td><td>66.8</td></tr><tr><td>GPT3-2.7B-Relu</td><td>2648.7</td><td>6e-4</td><td></td><td></td><td>28K</td><td></td><td></td><td></td><td>diverged</td><td></td><td></td><td></td></tr><tr><td>NormFormer-2.7B</td><td>2649.5</td><td>6e-4</td><td></td><td></td><td>222K</td><td>10.73</td><td>67.4</td><td>77.2</td><td>64.4</td><td>78.9</td><td>52.6</td><td>68.1</td></tr></table>",
702
+ "bbox": [
703
+ 174,
704
+ 101,
705
+ 823,
706
+ 376
707
+ ],
708
+ "page_idx": 5
709
+ },
710
+ {
711
+ "type": "table",
712
+ "img_path": "images/9bef2e3ecf49263945ee0f6f59048fb73a855c5f050f93a0d29cd8146adc1389.jpg",
713
+ "table_caption": [],
714
+ "table_footnote": [],
715
+ "table_body": "<table><tr><td></td><td>Model Size</td><td>Xresid</td><td>PPL</td><td>CoLA</td><td>MNLI</td><td>MRPC</td><td>QNLI</td><td>QQP</td><td>RTE</td><td>SST-2</td><td>Avg</td></tr><tr><td>Baseline</td><td>125.42</td><td></td><td>3.42</td><td>74.3</td><td>85.9</td><td>84.6</td><td>91.6</td><td>90.7</td><td>66.4</td><td>92.9</td><td>83.77</td></tr><tr><td>NormFormer</td><td>125.50</td><td></td><td>3.31</td><td>82.6</td><td>86.3</td><td>86.0</td><td>91.9</td><td>91.3</td><td>67.9</td><td>93.8</td><td>85.69</td></tr><tr><td>NormFormer</td><td>125.51</td><td>&lt;</td><td>3.29</td><td>80.9</td><td>86.2</td><td>85.3</td><td>91.5</td><td>91.2</td><td>62.8</td><td>94.2</td><td>84.59</td></tr></table>",
716
+ "bbox": [
717
+ 176,
718
+ 501,
719
+ 821,
720
+ 561
721
+ ],
722
+ "page_idx": 5
723
+ },
724
+ {
725
+ "type": "text",
726
+ "text": "Table 3: Masked LM: Pretraining validation perplexity (PPL) and fine-tuned performance on GLUE tasks for Pre-LN and NormFormer models. Note that models are trained for an equal amount of compute, which is less than the publicly-released roberta-base models. ",
727
+ "bbox": [
728
+ 173,
729
+ 571,
730
+ 825,
731
+ 614
732
+ ],
733
+ "page_idx": 5
734
+ },
735
+ {
736
+ "type": "text",
737
+ "text": "We observe a similar trend on downstream tasks. In Table 2 we report zero shot accuracy for causal LMs using the tasks and prompts from Brown et al. (2020). NormFormer outperforms GPT-3 at all sizes. The gains from Normformer extra parameters operations outpace the gains from normal scaling laws. Changing the hidden dimension of a 125M parameter model from 768 to 780, for example, results in a 127 million parameter model that is only 0.08 perplexity better than the baseline whereas NormFormer-125M adds only 100,000 parameters and is 0.83 perplexity better than the baseline. ",
738
+ "bbox": [
739
+ 173,
740
+ 645,
741
+ 825,
742
+ 742
743
+ ],
744
+ "page_idx": 5
745
+ },
746
+ {
747
+ "type": "text",
748
+ "text": "For MLM models, we report fine-tuned accuracy on GLUE in Table 3. We again find that NormFormer MLM models outperform their Pre-LN counterparts on every task (rows 1 vs 2). Adding ResScale improves improves pre-training performance marginally (3.29 valid PPL vs 3.31), but the gains to do not translate to finetuned performance. ",
749
+ "bbox": [
750
+ 173,
751
+ 748,
752
+ 825,
753
+ 805
754
+ ],
755
+ "page_idx": 5
756
+ },
757
+ {
758
+ "type": "text",
759
+ "text": "6 ANALYSIS ",
760
+ "text_level": 1,
761
+ "bbox": [
762
+ 174,
763
+ 830,
764
+ 290,
765
+ 845
766
+ ],
767
+ "page_idx": 5
768
+ },
769
+ {
770
+ "type": "text",
771
+ "text": "Analysis of gradient norms by layer We begin by examining the magnitude of the gradients at different layers for Post-LN, Pre-LN and NormFormer models, since large magnitude differences in gradients across layers can destabilize training, particularly when training in mixed precision (Micikevicius et al., 2018). Figure 3 shows the average L1 norm of the gradients to the second fully connected weight in various layers for a 12 layer, 125M parameter CLM model at the beginning of training. As reported in past work (Xiong et al., 2020), we observe that the gradients to later layers in Post-LN models are much larger than for earlier layers, and that the gradients to early layers quickly vanish in the early stages of training. Pre-LN models have the opposite behavior, with early layers instead receiving significantly larger gradients than later layers. NormFormer brings the average gradient norms closer together for different layers in the network. ",
772
+ "bbox": [
773
+ 174,
774
+ 867,
775
+ 823,
776
+ 924
777
+ ],
778
+ "page_idx": 5
779
+ },
780
+ {
781
+ "type": "image",
782
+ "img_path": "images/0484dfb5fe2c68a209eb020937e3c584826364b33328067390a2107769155977.jpg",
783
+ "image_caption": [
784
+ "Figure 3: Average L1 norm of gradients to the second fully connected weight for layers 0,1,6,10 and 11, early in training. "
785
+ ],
786
+ "image_footnote": [],
787
+ "bbox": [
788
+ 174,
789
+ 99,
790
+ 818,
791
+ 261
792
+ ],
793
+ "page_idx": 6
794
+ },
795
+ {
796
+ "type": "image",
797
+ "img_path": "images/34840cb49fcd642e68cd84e903c875aced1e6b39cb10a666ea97ff26ca69eaa9.jpg",
798
+ "image_caption": [
799
+ "Figure 4: Distribution of learned scaling parameters in three of the added operations. For FFN LN, earlier layers receive downscaled inputs, keeping their gradients in the same range as the gradients of later layers. This plot is discussed in detail in Section 6. "
800
+ ],
801
+ "image_footnote": [],
802
+ "bbox": [
803
+ 184,
804
+ 321,
805
+ 813,
806
+ 483
807
+ ],
808
+ "page_idx": 6
809
+ },
810
+ {
811
+ "type": "text",
812
+ "text": "",
813
+ "bbox": [
814
+ 174,
815
+ 570,
816
+ 825,
817
+ 654
818
+ ],
819
+ "page_idx": 6
820
+ },
821
+ {
822
+ "type": "text",
823
+ "text": "In Figure 4 we present the distribution of scaling parameters learned by NormFormer models. For the FFN LN, the $\\gamma$ parameters are smaller for earlier layers, reducing the magnitude of the inputs to early fully connected parameters, thereby decreasing the magnitude of their gradients. The post attention LN, in the middle of Figure 4, all layers have $\\gamma$ coefficients below 1, indicating downscaling.4 The HeadScale $\\gamma$ parameters, shown in the rightmost plot in Figure 4 vary more than the others, and have no relationship with depth in the network. We interpret this as evidence that the HeadScale parameters dynamically increase the importance of well initialized attention heads, as suggested in Chen et al. (2021). ",
824
+ "bbox": [
825
+ 174,
826
+ 661,
827
+ 825,
828
+ 772
829
+ ],
830
+ "page_idx": 6
831
+ },
832
+ {
833
+ "type": "text",
834
+ "text": "Reducing gradient mismatch allows training stably with larger learning rates. To measure the stability of an architecture, we train it on a learning rate schedule with a very large peak learning rate, so that the learning rate increases a little each step until the loss explodes. Figure 5 shows that NormFormer models can survive for more updates in this environment than the baseline. For the baseline 125M model (the left most blue dot), the loss eventually explodes, with the activations from multiplying the query and key features at layer 0 overflowing the FP16 range. The down scaling of the attention outputs allows NormFormer to avoid this issue and remain stable with larger learning rates. Figure 5 also shows that $\\lambda _ { r e s i d }$ reduces the stability improvement at all sizes. ",
835
+ "bbox": [
836
+ 174,
837
+ 779,
838
+ 825,
839
+ 863
840
+ ],
841
+ "page_idx": 6
842
+ },
843
+ {
844
+ "type": "image",
845
+ "img_path": "images/1a08004f938b39d9c3b9868aa7559a8537cfa8299fe874ad9ae7c9cff9a75e2c.jpg",
846
+ "image_caption": [
847
+ "Figure 5: LR Stability Test: learning rate starts from 0 and linearly increases by $5 \\in - 5$ at each training step until training destabilizes. NormFormer reaches a higher learning rate before destabilizing. Each data point is the median of 3 runs with a different random seed. "
848
+ ],
849
+ "image_footnote": [],
850
+ "bbox": [
851
+ 204,
852
+ 102,
853
+ 795,
854
+ 347
855
+ ],
856
+ "page_idx": 7
857
+ },
858
+ {
859
+ "type": "text",
860
+ "text": "",
861
+ "bbox": [
862
+ 173,
863
+ 430,
864
+ 823,
865
+ 458
866
+ ],
867
+ "page_idx": 7
868
+ },
869
+ {
870
+ "type": "text",
871
+ "text": "6.1 RESIDUAL SCALING ",
872
+ "text_level": 1,
873
+ "bbox": [
874
+ 176,
875
+ 477,
876
+ 354,
877
+ 491
878
+ ],
879
+ "page_idx": 7
880
+ },
881
+ {
882
+ "type": "text",
883
+ "text": "By comparing adjacent NormFormer-125M and NormFormer-355M rows in Table 2 we can see that adding ResScale to NormFormer improves perplexity and zero shot performance for small scale CLMs. For 125M parameter MLM, ResScale improves pre-training perplexity marginally, but hurts fine-tuned performance. At 1.3 billion parameter scale, however, adding ResScale to NormFormer does not improve performance (Figure 2). Although it’s not included in our tables, we find that ResScale without NormFormer is stronger than the baseline at small scale, but not large scale. This suggests that the negative result is caused by scale, rather than interaction with NormFormer. ",
884
+ "bbox": [
885
+ 174,
886
+ 502,
887
+ 825,
888
+ 614
889
+ ],
890
+ "page_idx": 7
891
+ },
892
+ {
893
+ "type": "text",
894
+ "text": "Figure 6 in the appendix shows the average $\\lambda _ { r e s i d }$ weights at each layer of different sized CLMs. We can see that at 125M and 355M parameters, the weights in the later layers are lower, indicating down weighting of the residual connection, whereas at the largest scale, 1.3B, the weights are larger deeper into the network. Adding the $\\lambda _ { r e s i d }$ parameters to the other (earlier) residual connection in each layer, or using a scalar instead of a vector for each $\\lambda _ { r e s i d }$ , does not fix the large scale issue, but hurts small scale performance marginally. Additionally, Table 8 shows that initializing the network to place no weight on the layer outputs, and all the weight on residual connections, as proposed in (Touvron et al., 2021), does not improve performance. ",
895
+ "bbox": [
896
+ 174,
897
+ 621,
898
+ 825,
899
+ 733
900
+ ],
901
+ "page_idx": 7
902
+ },
903
+ {
904
+ "type": "text",
905
+ "text": "7 ABLATIONS ",
906
+ "text_level": 1,
907
+ "bbox": [
908
+ 176,
909
+ 757,
910
+ 303,
911
+ 772
912
+ ],
913
+ "page_idx": 7
914
+ },
915
+ {
916
+ "type": "text",
917
+ "text": "This section provides evidence that removing any of our additions to the transformer block degrades performance on language modeling tasks, and that our additions improve language modeling performance across a wide range of hyperparameter settings. Experiments use 125M parameter CLMs, and are run with the default hyperparameters given in Table 7 in the appendix for 470 V100 Hours (100,000 updates for the baseline) unless otherwise mentioned. ",
918
+ "bbox": [
919
+ 174,
920
+ 795,
921
+ 825,
922
+ 864
923
+ ],
924
+ "page_idx": 7
925
+ },
926
+ {
927
+ "type": "text",
928
+ "text": "Removing any of the added operations hurts performance Table 4 shows that none of the four introduced operations can be removed without degrading performance. Rows 2-5 remove each operation one at a time. In all cases perplexity increases, with the removal of HeadScale being the most damaging and the removal of the Post-Attn LN being the least damaging. In Row 6 $\\left( + \\ 3 \\right.$ More LN) we try to introduce more normalization inside self attention, applying LN to the query, key and value features in addition to our 3 other operations, for a total of 6 new operations. In this setting, every other parameterized operation inside the transformer layer is an LN. We find that this does not change perplexities at a fixed number of updates, but reduces training speed by another $5 \\%$ . This result suggests that there is not much upside to adding even more normalization on top of NormFormer. ",
929
+ "bbox": [
930
+ 176,
931
+ 882,
932
+ 823,
933
+ 924
934
+ ],
935
+ "page_idx": 7
936
+ },
937
+ {
938
+ "type": "table",
939
+ "img_path": "images/a2ba136604c01e4758cd5d572d3d0c0acfc0a5f74c822ea26fc1848ed21332d3.jpg",
940
+ "table_caption": [
941
+ "Table 4: 125M parameter Language Modeling Validation perplexities after 470 V100 Hours of pretraining. Removing any of our proposed additions degrades performance (Rows 2-5). Adding more normalization inside the Multi Headed Attention (Row 6) does not impact perplexity at a fixed number of updates, but reduces throughput such that the model can only complete 87,500 updates vs. 92,500 for Rows 1-5 and 100,000 for Row 7. Note that these PPL scores are not directly comparable to other tables – they use a different validation set. "
942
+ ],
943
+ "table_footnote": [],
944
+ "table_body": "<table><tr><td colspan=\"2\">Architecture Valid PPL</td></tr><tr><td>NormFormer+ResScale</td><td>15.88</td></tr><tr><td>- Post-Attn LN</td><td>15.92</td></tr><tr><td> - FFN LN</td><td>16.14</td></tr><tr><td> - Head Scale</td><td>16.22</td></tr><tr><td> - Res Scale</td><td>16.20</td></tr><tr><td>+ 3 More LN</td><td>15.88</td></tr><tr><td>Baseline</td><td>16.37</td></tr></table>",
945
+ "bbox": [
946
+ 375,
947
+ 101,
948
+ 622,
949
+ 234
950
+ ],
951
+ "page_idx": 8
952
+ },
953
+ {
954
+ "type": "text",
955
+ "text": "",
956
+ "bbox": [
957
+ 174,
958
+ 361,
959
+ 825,
960
+ 458
961
+ ],
962
+ "page_idx": 8
963
+ },
964
+ {
965
+ "type": "text",
966
+ "text": "Other Experiments Table 8 in the appendix compares NormFormer CLMs to related architectural modifications, both in terms of the stability and pre-training perplexity at 1.3B parameter scale. Table 5 in the appendix shows language modeling perplexities for 7 different hyperparameter configurations at 125M parameter scale, separated by horizontal lines. NormFormer outperforms the baselines in all settings. ",
967
+ "bbox": [
968
+ 174,
969
+ 473,
970
+ 825,
971
+ 544
972
+ ],
973
+ "page_idx": 8
974
+ },
975
+ {
976
+ "type": "text",
977
+ "text": "8 CONCLUSION ",
978
+ "text_level": 1,
979
+ "bbox": [
980
+ 176,
981
+ 568,
982
+ 318,
983
+ 584
984
+ ],
985
+ "page_idx": 8
986
+ },
987
+ {
988
+ "type": "text",
989
+ "text": "We identify a mismatch in the gradients of Pre-LN transformer weights: earlier layers receive much larger gradients than later layers, while the optimal scaling of residuals is larger at earlier layers than at later layers. We propose NormFormer, which alleviates these issues by adding 3 extra operations to each transformer layer. These modifications help the gradient mismatch for fully connected parameters and improve validation perplexity and downstream task performance for both causal and masked language models. None can be removed without degrading performance back towards the baseline, and adding more normalization – at least of the types we have tried – does not improve performance. Since NormFormer primarily addresses the gradient mismatch by increasing the gradients to the last FFN layers while decreasing the gradient magnitudes in other parts of the network, future work could examine whether all 3 operations need to be added to every layer. Additionally, the small computational overhead associated with NormFormer could be alleviated by fusing the FFN LN with the preceding fully connected layer, with or without the mean centering and bias, which do not appear to improve pretraining perplexity. In general, we have shown that adding small numbers of learnable parameters in the right places in our architectures can alleviate certain issues in current state of the art networks. Future work should ascertain if there are additional similarly efficient modifications that can bring gains, while helping us understand current deficiencies further. ",
990
+ "bbox": [
991
+ 174,
992
+ 607,
993
+ 825,
994
+ 828
995
+ ],
996
+ "page_idx": 8
997
+ },
998
+ {
999
+ "type": "text",
1000
+ "text": "9 APPENDIX ",
1001
+ "text_level": 1,
1002
+ "bbox": [
1003
+ 174,
1004
+ 102,
1005
+ 294,
1006
+ 117
1007
+ ],
1008
+ "page_idx": 9
1009
+ },
1010
+ {
1011
+ "type": "image",
1012
+ "img_path": "images/71938c0dd898d8095a4f2ff61f2f077f721903eb75346d31a712f8ccffeec329.jpg",
1013
+ "image_caption": [
1014
+ "Figure 6: Average $\\lambda _ { r e s i d }$ weights at each layer of different sized CLMs in the NormFormer+λresid setting. Depth is layer number / total layers. "
1015
+ ],
1016
+ "image_footnote": [],
1017
+ "bbox": [
1018
+ 364,
1019
+ 151,
1020
+ 629,
1021
+ 344
1022
+ ],
1023
+ "page_idx": 9
1024
+ },
1025
+ {
1026
+ "type": "table",
1027
+ "img_path": "images/8fe3d9507dedc4f4c5ab7ea2c397c9ad72baff5848bcbd73ea631360691067e1.jpg",
1028
+ "table_caption": [
1029
+ "Table 5: Longer Warmup: increase LR Warmup to 6,000 steps (from 500). GPT3: increase sequence length to 2048, increase dropout to 0.1, increase training budget to $1 { , } 0 0 0 \\mathrm { V } 1 0 0$ hours. Grad Clip: clip gradient norms at 0.1. NormFormer outperforms the baseline in all settings. "
1030
+ ],
1031
+ "table_footnote": [],
1032
+ "table_body": "<table><tr><td></td><td>Learning Rate</td><td> Setting Changes</td><td>Valid PPL</td></tr><tr><td rowspan=\"2\">Baseline NormFormer</td><td>0.001</td><td></td><td>16.80</td></tr><tr><td>0.001</td><td>■</td><td>16.33</td></tr><tr><td rowspan=\"2\">Baseline NormFormer</td><td>0.003</td><td></td><td>16.37</td></tr><tr><td>0.003</td><td></td><td>15.88</td></tr><tr><td rowspan=\"2\">Baseline NormFormer</td><td>0.006</td><td></td><td>16.58</td></tr><tr><td>0.006</td><td>-</td><td>16.22</td></tr><tr><td rowspan=\"2\">Baseline NormFormer</td><td>0.003</td><td>Longer Warmup</td><td>16.50</td></tr><tr><td>0.003</td><td>Longer Warmup</td><td>16.06</td></tr><tr><td rowspan=\"2\">Baseline NormFormer</td><td>0.003</td><td>GPT3</td><td>16.29</td></tr><tr><td>0.003</td><td>GPT3</td><td>15.88</td></tr><tr><td rowspan=\"2\">Baseline NormFormer</td><td>0.003</td><td>Clip Grad Norms at 0.1</td><td>16.46</td></tr><tr><td>0.003</td><td>Clip Grad Norms at 0.1</td><td>16.14</td></tr></table>",
1033
+ "bbox": [
1034
+ 266,
1035
+ 405,
1036
+ 730,
1037
+ 632
1038
+ ],
1039
+ "page_idx": 9
1040
+ },
1041
+ {
1042
+ "type": "text",
1043
+ "text": "Wikitext103 Table 6 shows that NormFormer can also provide gains on top of a well tuned language model in settings with much less data. We simply add our three operations to the architecture and hyperparameters of Baevski & Auli (2019). Convergence perplexity improves, and we reach the baseline perplexity in $70 \\%$ as many steps. In this setting, NormFormer does not improve in the last $30 \\%$ of training, which suggests that with more tuning the perplexity gap could be widened. ",
1044
+ "bbox": [
1045
+ 174,
1046
+ 713,
1047
+ 825,
1048
+ 785
1049
+ ],
1050
+ "page_idx": 9
1051
+ },
1052
+ {
1053
+ "type": "text",
1054
+ "text": "9.1 COMPARISON TO RELATED WORK ",
1055
+ "text_level": 1,
1056
+ "bbox": [
1057
+ 176,
1058
+ 800,
1059
+ 450,
1060
+ 814
1061
+ ],
1062
+ "page_idx": 9
1063
+ },
1064
+ {
1065
+ "type": "text",
1066
+ "text": "Understanding Table 8 The two right most columns of Table 8 contains describes the result of two experiments from the same 1.3B parameter architecture: Stability indicates how many steps the experiment survived in the ”LR Stability Test”, where we increase LR from 0 to 0.1 linearly over 1,000 steps and Perf, where available, describes the validation perplexity of the model trained for $6 4 ~ \\mathrm { A 1 0 0 }$ days with sequence length 512. The table is sorted by Stability, with more stable configurations lower in the table. The left columns of the table indicate configuration. Row 14, which has completely empty configuration columns, is the baseline. The final row is NormFormer. ",
1067
+ "bbox": [
1068
+ 173,
1069
+ 825,
1070
+ 825,
1071
+ 924
1072
+ ],
1073
+ "page_idx": 9
1074
+ },
1075
+ {
1076
+ "type": "table",
1077
+ "img_path": "images/5e0b6bc9cace6264d4c1a7b282d2dd89e44338dbc356bde686c4e4099783ac0e.jpg",
1078
+ "table_caption": [],
1079
+ "table_footnote": [],
1080
+ "table_body": "<table><tr><td></td><td> Steps to Target PPL</td><td>Final PPL</td><td>A100 Hours</td></tr><tr><td>Baseline</td><td>279.893</td><td>18.70</td><td>288</td></tr><tr><td>NormFormer</td><td>223.904</td><td>18.65</td><td>237</td></tr></table>",
1081
+ "bbox": [
1082
+ 276,
1083
+ 101,
1084
+ 718,
1085
+ 159
1086
+ ],
1087
+ "page_idx": 10
1088
+ },
1089
+ {
1090
+ "type": "text",
1091
+ "text": "Table 6: Wikitext 103 results following Baevski & Auli (2019). Steps to Target PPL: at what percentage of the 280K steps did the model reach 18.70 perplexity. Final PPL: Best Perplexity ",
1092
+ "bbox": [
1093
+ 174,
1094
+ 169,
1095
+ 825,
1096
+ 210
1097
+ ],
1098
+ "page_idx": 10
1099
+ },
1100
+ {
1101
+ "type": "text",
1102
+ "text": ". A100 Hours Cost of reaching Target PPL. ",
1103
+ "bbox": [
1104
+ 346,
1105
+ 210,
1106
+ 645,
1107
+ 226
1108
+ ],
1109
+ "page_idx": 10
1110
+ },
1111
+ {
1112
+ "type": "image",
1113
+ "img_path": "images/58a85b6a09ae00bd61c570b98cb068da3d78b05aadb0a34a7d93ff84eb241bfa.jpg",
1114
+ "image_caption": [
1115
+ "Figure 7: Change in grad norm with each operation of NormFormer compared to the baseline. Norms are the average between step 950 and 1000, normalized to control for different losses. 2.0 on the Y axis means the gradient to a parameter is twice as large as the baseline, on average. The NormFormer increases the norm to fully connected parameters in later layers, while reducing the gradient norm to attention parameters at all layers. The results are discussed in detail in Section 6. "
1116
+ ],
1117
+ "image_footnote": [],
1118
+ "bbox": [
1119
+ 331,
1120
+ 239,
1121
+ 665,
1122
+ 429
1123
+ ],
1124
+ "page_idx": 10
1125
+ },
1126
+ {
1127
+ "type": "text",
1128
+ "text": "The Architecture and LN Variant columns show whether we changed the model architecture completely and/or used a non-standard LayerNorm algorithm. ",
1129
+ "bbox": [
1130
+ 174,
1131
+ 535,
1132
+ 821,
1133
+ 564
1134
+ ],
1135
+ "page_idx": 10
1136
+ },
1137
+ {
1138
+ "type": "text",
1139
+ "text": "1. CogView[1] (Ding et al., 2021): implement all of the changes proposed in Section 2.4: (1) reduce the gradients to the embeddings by a factor of 10, (2) add an LN after attention, (3) add an LN after the second fully connected layer (not the first, like NormFormer) (4) change the layer norm formula to $\\overset { \\cdot } { L } N \\bigl ( \\frac { X } { M a x ( X ) } \\bigr )$ . fairseq already uses the attention score stabilization trick by default. In rows 19 and 25 where Arch is blank, we use the proposed LayerNorm formula but none of the other changes. \n2. CatFormer[2] (Davis et al., 2021): Since no code was released, we re-implement CatFormer and set $\\epsilon = 2$ and $\\overline { { \\overline { { \\mathbf { \\alpha } } } } } ^ { 4 4 8 }$ to match 1.3B parameters. We guessed that the number of attention heads should be fixed in each layer and that LN positioning should not move, but these details are not clear from the paper. \n3. LayerScale[3] (Touvron et al., 2021): We use the layer scale formulation from Section 2, which is similar to the $\\lambda _ { r e s i d }$ discussed earlier, but with a weight on each layer’s contribution to the main branch initialized at 1e-5, instead of a weight on the residual’s input to the main branch initialized at 1. \n4. FFNGeglu[4] (Shazeer, 2020): replace the FFN LayerNorm with ‘FFNGeglu‘. Although this is proposed as an activation function, it is also equivalent to just using the $\\gamma$ of LayerNorm, with no normalization or bias. \n5. T5[5] (Raffel et al., 2020): Switch LNs to the T5 variant, which removes the mean centering and bias. \n6. PowerNorm[6] (Shen et al., 2020): Switch LN to PowerNorm, which is a variant of BatchNorm that shows promising results for smaller NLP models. \n7. DeepInit[7] (Zhang et al., 2019): Multiply the initialization of each weight parameter by a factor of √l , where $l$ is the layer number starting from 1. ",
1140
+ "bbox": [
1141
+ 209,
1142
+ 575,
1143
+ 825,
1144
+ 926
1145
+ ],
1146
+ "page_idx": 10
1147
+ },
1148
+ {
1149
+ "type": "table",
1150
+ "img_path": "images/796902a9536665fb9e2cd3dd1e100cabe20c7352c12ef250cc01b5360eca4da1.jpg",
1151
+ "table_caption": [],
1152
+ "table_footnote": [
1153
+ "Table 7: Hyperparameters for ablations in Tables 4 and 7. This train budget allows the baseline model to run for 100,000 updates. "
1154
+ ],
1155
+ "table_body": "<table><tr><td>Learning Rate</td><td>0.003</td></tr><tr><td>Batch Size</td><td>524KTokens</td></tr><tr><td>Parameters</td><td>124M+</td></tr><tr><td>Layers</td><td>12</td></tr><tr><td>Layer Dimension</td><td>768</td></tr><tr><td>Dropout</td><td>0</td></tr><tr><td>LR Warmup Updates</td><td>500</td></tr><tr><td>LR Scheduler</td><td>Linear Decay</td></tr><tr><td>Sequence Length</td><td>1024</td></tr><tr><td>Train Budget</td><td>470 V100 Hours</td></tr></table>",
1156
+ "bbox": [
1157
+ 375,
1158
+ 127,
1159
+ 622,
1160
+ 263
1161
+ ],
1162
+ "page_idx": 11
1163
+ },
1164
+ {
1165
+ "type": "table",
1166
+ "img_path": "images/44fdf8942d4466d6612c69790c90c5e1492506b6965a027eb38be5dfc25749c7.jpg",
1167
+ "table_caption": [
1168
+ "Table 8: Stability and Performance for different architectures for 1.3B parameter CLMs, see Section 9.1 for details. "
1169
+ ],
1170
+ "table_footnote": [],
1171
+ "table_body": "<table><tr><td>ID</td><td>Arch.</td><td>Scale FC</td><td>Scale Attn</td><td>XResid</td><td>Scale Heads</td><td>LN Variant</td><td>Stability</td><td>Perf</td></tr><tr><td>0</td><td></td><td></td><td>【</td><td></td><td>「</td><td>PowerNorm[6]</td><td>15</td><td>-</td></tr><tr><td>1</td><td>CatFormer[2]</td><td></td><td></td><td></td><td></td><td>-</td><td>34</td><td>=</td></tr><tr><td>2</td><td></td><td></td><td></td><td>√</td><td></td><td></td><td>52</td><td>=</td></tr><tr><td>3</td><td>DeepInit[7]</td><td></td><td></td><td></td><td></td><td></td><td>52</td><td></td></tr><tr><td>4</td><td>DeepInit[7]</td><td>?</td><td></td><td></td><td>&lt;</td><td></td><td>58</td><td>=</td></tr><tr><td>5</td><td>=</td><td></td><td></td><td></td><td></td><td>FFNGeglu[4]</td><td>67</td><td>17.1</td></tr><tr><td>6</td><td></td><td></td><td></td><td></td><td></td><td></td><td>69</td><td>=</td></tr><tr><td>7</td><td>LayerScale[3]</td><td></td><td></td><td></td><td></td><td></td><td>76</td><td>17.5</td></tr><tr><td>8</td><td></td><td></td><td></td><td></td><td></td><td></td><td>76</td><td>17.1</td></tr><tr><td>9</td><td></td><td></td><td></td><td></td><td></td><td></td><td>81</td><td>17.1</td></tr><tr><td>10</td><td>CogView[1]</td><td></td><td></td><td></td><td></td><td>CogView[1]</td><td>86</td><td>-</td></tr><tr><td>11</td><td></td><td></td><td></td><td></td><td></td><td>=</td><td>91</td><td></td></tr><tr><td>12</td><td></td><td></td><td></td><td></td><td></td><td>T5[5]</td><td>93</td><td></td></tr><tr><td>13</td><td></td><td></td><td></td><td></td><td></td><td>FFNGeglu[4]</td><td>94</td><td>=</td></tr><tr><td>14</td><td></td><td></td><td></td><td></td><td></td><td></td><td>94</td><td>17.1</td></tr><tr><td>15</td><td></td><td></td><td></td><td></td><td></td><td>No Bias or γ</td><td>95</td><td>1</td></tr><tr><td>16</td><td></td><td></td><td></td><td></td><td></td><td>No Bias</td><td>96</td><td>=</td></tr><tr><td>17</td><td></td><td></td><td></td><td></td><td></td><td>No γ</td><td>98</td><td>=</td></tr><tr><td>18</td><td></td><td></td><td></td><td></td><td></td><td></td><td>112</td><td>16.8</td></tr><tr><td>19</td><td>CogView[1]</td><td></td><td></td><td></td><td></td><td>CogView[1]</td><td>118</td><td>17.1</td></tr><tr><td>20</td><td></td><td></td><td></td><td></td><td></td><td>CogView[1]</td><td>122</td><td>=</td></tr><tr><td>21</td><td>CogView[1]</td><td></td><td></td><td></td><td></td><td>CogView[1]</td><td>124</td><td></td></tr><tr><td>22</td><td></td><td></td><td></td><td></td><td></td><td>=</td><td>128</td><td></td></tr><tr><td>23</td><td></td><td></td><td></td><td></td><td></td><td>PowerNorm[6]</td><td>135</td><td></td></tr><tr><td>24</td><td>LayerScale[3]</td><td></td><td></td><td></td><td></td><td>-</td><td>148</td><td></td></tr><tr><td>25</td><td></td><td></td><td></td><td></td><td></td><td>No Y</td><td>157</td><td></td></tr><tr><td>26</td><td></td><td></td><td></td><td></td><td></td><td>CogView[1]</td><td>165</td><td></td></tr><tr><td>27</td><td></td><td></td><td></td><td></td><td></td><td>No Bias or γ</td><td>178</td><td>16.9</td></tr><tr><td>28</td><td></td><td></td><td></td><td></td><td></td><td>No Bias</td><td>184</td><td>-</td></tr><tr><td>29</td><td></td><td></td><td></td><td></td><td></td><td>T5[5]</td><td>189</td><td>=</td></tr><tr><td>30</td><td></td><td></td><td></td><td></td><td></td><td>1</td><td>192</td><td>16.7</td></tr><tr><td>31</td><td></td><td></td><td></td><td></td><td></td><td>、</td><td>200</td><td>16.6</td></tr></table>",
1172
+ "bbox": [
1173
+ 178,
1174
+ 369,
1175
+ 892,
1176
+ 854
1177
+ ],
1178
+ "page_idx": 11
1179
+ },
1180
+ {
1181
+ "type": "text",
1182
+ "text": "8. No $\\gamma$ : Freeze $\\gamma = 1$ in LN ",
1183
+ "bbox": [
1184
+ 212,
1185
+ 103,
1186
+ 408,
1187
+ 118
1188
+ ],
1189
+ "page_idx": 12
1190
+ },
1191
+ {
1192
+ "type": "text",
1193
+ "text": "9. No Bias or $\\gamma$ : Freeze $\\gamma = 1$ , bias ${ } = 0$ in LN ",
1194
+ "bbox": [
1195
+ 214,
1196
+ 122,
1197
+ 509,
1198
+ 137
1199
+ ],
1200
+ "page_idx": 12
1201
+ },
1202
+ {
1203
+ "type": "text",
1204
+ "text": "10. No Bias: Freeze bias ${ } = 0$ in LN. ",
1205
+ "bbox": [
1206
+ 205,
1207
+ 141,
1208
+ 434,
1209
+ 156
1210
+ ],
1211
+ "page_idx": 12
1212
+ },
1213
+ {
1214
+ "type": "text",
1215
+ "text": "Results The results suggest that other proposals to mitigate instability in other domains, like vision, text to image generation and reinforcement learning do not improve stability or pre-training performance in the CLM setting. ",
1216
+ "bbox": [
1217
+ 176,
1218
+ 171,
1219
+ 825,
1220
+ 213
1221
+ ],
1222
+ "page_idx": 12
1223
+ },
1224
+ {
1225
+ "type": "text",
1226
+ "text": "REFERENCES ",
1227
+ "text_level": 1,
1228
+ "bbox": [
1229
+ 176,
1230
+ 102,
1231
+ 285,
1232
+ 118
1233
+ ],
1234
+ "page_idx": 13
1235
+ },
1236
+ {
1237
+ "type": "text",
1238
+ "text": "Jimmy Lei Ba, Jamie Ryan Kiros, and Geoffrey E. Hinton. Layer normalization, 2016. ",
1239
+ "bbox": [
1240
+ 173,
1241
+ 140,
1242
+ 740,
1243
+ 155
1244
+ ],
1245
+ "page_idx": 13
1246
+ },
1247
+ {
1248
+ "type": "text",
1249
+ "text": "Alexei Baevski and Michael Auli. Adaptive input representations for neural language modeling. In International Conference on Learning Representations, 2019. URL https://openreview. net/forum?id ${ . } = { }$ ByxZX20qFQ. ",
1250
+ "bbox": [
1251
+ 173,
1252
+ 162,
1253
+ 823,
1254
+ 205
1255
+ ],
1256
+ "page_idx": 13
1257
+ },
1258
+ {
1259
+ "type": "text",
1260
+ "text": "Yonatan Bisk, Rowan Zellers, Ronan Le bras, Jianfeng Gao, and Yejin Choi. Piqa: Reasoning about physical commonsense in natural language. Proceedings of the AAAI Conference on Artificial Intelligence, 34(05):7432–7439, Apr. 2020. doi: 10.1609/aaai.v34i05.6239. URL https:// ojs.aaai.org/index.php/AAAI/article/view/6239. ",
1261
+ "bbox": [
1262
+ 176,
1263
+ 213,
1264
+ 825,
1265
+ 270
1266
+ ],
1267
+ "page_idx": 13
1268
+ },
1269
+ {
1270
+ "type": "text",
1271
+ "text": "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. ",
1272
+ "bbox": [
1273
+ 173,
1274
+ 279,
1275
+ 825,
1276
+ 417
1277
+ ],
1278
+ "page_idx": 13
1279
+ },
1280
+ {
1281
+ "type": "text",
1282
+ "text": "Xiaohan Chen, Yu Cheng, Shuohang Wang, Zhe Gan, Zhangyang Wang, and Jingjing Liu. Earlybert: Efficient bert training via early-bird lottery tickets, 2021. ",
1283
+ "bbox": [
1284
+ 171,
1285
+ 426,
1286
+ 823,
1287
+ 454
1288
+ ],
1289
+ "page_idx": 13
1290
+ },
1291
+ {
1292
+ "type": "text",
1293
+ "text": "Alexis Conneau, Kartikay Khandelwal, Naman Goyal, Vishrav Chaudhary, Guillaume Wenzek, Francisco Guzman, Edouard Grave, Myle Ott, Luke Zettlemoyer, and Veselin Stoyanov. Un-´ supervised cross-lingual representation learning at scale. 2020. ",
1294
+ "bbox": [
1295
+ 176,
1296
+ 462,
1297
+ 823,
1298
+ 505
1299
+ ],
1300
+ "page_idx": 13
1301
+ },
1302
+ {
1303
+ "type": "text",
1304
+ "text": "Jared Q Davis, Albert Gu, Krzysztof Choromanski, Tri Dao, Christopher Re, Chelsea Finn, and Percy Liang. Catformer: Designing stable transformers via sensitivity analysis. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 2489–2499. PMLR, 18–24 Jul 2021. URL https://proceedings.mlr.press/v139/davis21a.html. ",
1305
+ "bbox": [
1306
+ 173,
1307
+ 512,
1308
+ 825,
1309
+ 583
1310
+ ],
1311
+ "page_idx": 13
1312
+ },
1313
+ {
1314
+ "type": "text",
1315
+ "text": "Ming Ding, Zhuoyi Yang, Wenyi Hong, Wendi Zheng, Chang Zhou, Da Yin, Junyang Lin, Xu Zou, Zhou Shao, Hongxia Yang, et al. Cogview: Mastering text-to-image generation via transformers. arXiv preprint arXiv:2105.13290, 2021. ",
1316
+ "bbox": [
1317
+ 174,
1318
+ 590,
1319
+ 825,
1320
+ 633
1321
+ ],
1322
+ "page_idx": 13
1323
+ },
1324
+ {
1325
+ "type": "text",
1326
+ "text": "Dan Hendrycks and Kevin Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. ",
1327
+ "bbox": [
1328
+ 169,
1329
+ 642,
1330
+ 825,
1331
+ 670
1332
+ ],
1333
+ "page_idx": 13
1334
+ },
1335
+ {
1336
+ "type": "text",
1337
+ "text": "Opher Lieber, Or Sharir, Barak Lenz, and Yoav Shoham. Jurassic-1: Technical details and evaluation. Technical report, AI21 Labs, August 2021. ",
1338
+ "bbox": [
1339
+ 173,
1340
+ 679,
1341
+ 823,
1342
+ 708
1343
+ ],
1344
+ "page_idx": 13
1345
+ },
1346
+ {
1347
+ "type": "text",
1348
+ "text": "Liyuan Liu, Xiaodong Liu, Jianfeng Gao, Weizhu Chen, and Jiawei Han. Understanding the difficulty of training transformers. arXiv preprint arXiv:2004.08249, 2020. ",
1349
+ "bbox": [
1350
+ 171,
1351
+ 715,
1352
+ 821,
1353
+ 744
1354
+ ],
1355
+ "page_idx": 13
1356
+ },
1357
+ {
1358
+ "type": "text",
1359
+ "text": "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. ",
1360
+ "bbox": [
1361
+ 176,
1362
+ 752,
1363
+ 823,
1364
+ 795
1365
+ ],
1366
+ "page_idx": 13
1367
+ },
1368
+ {
1369
+ "type": "text",
1370
+ "text": "Paulius Micikevicius, Sharan Narang, Jonah Alben, Gregory Diamos, Erich Elsen, David Garcia, Boris Ginsburg, Michael Houston, Oleksii Kuchaiev, Ganesh Venkatesh, and Hao Wu. Mixed precision training. In International Conference on Learning Representations, 2018. ",
1371
+ "bbox": [
1372
+ 176,
1373
+ 803,
1374
+ 825,
1375
+ 845
1376
+ ],
1377
+ "page_idx": 13
1378
+ },
1379
+ {
1380
+ "type": "text",
1381
+ "text": "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 Proceedings of the 2018 Conference on Empirical Methods in Natural Language Processing, pp. 2381–2391, Brussels, Belgium, October-November 2018. Association for Computational Linguistics. doi: 10.18653/v1/D18-1260. URL https://www.aclweb.org/anthology/D18-1260. ",
1382
+ "bbox": [
1383
+ 176,
1384
+ 854,
1385
+ 825,
1386
+ 924
1387
+ ],
1388
+ "page_idx": 13
1389
+ },
1390
+ {
1391
+ "type": "text",
1392
+ "text": "Nasrin Mostafazadeh, Nathanael Chambers, Xiaodong He, Devi Parikh, Dhruv Batra, Lucy Vanderwende, Pushmeet Kohli, and James Allen. A corpus and cloze evaluation for deeper understanding of commonsense stories. In Proceedings of the 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pp. 839–849, San Diego, California, June 2016. Association for Computational Linguistics. doi: 10.18653/v1/N16-1098. URL https://www.aclweb.org/anthology/N16-1098. ",
1393
+ "bbox": [
1394
+ 174,
1395
+ 103,
1396
+ 825,
1397
+ 188
1398
+ ],
1399
+ "page_idx": 14
1400
+ },
1401
+ {
1402
+ "type": "text",
1403
+ "text": "Myle Ott, Sergey Edunov, Alexei Baevski, Angela Fan, Sam Gross, Nathan Ng, David Grangier, and Michael Auli. FAIRSEQ: A fast, extensible toolkit for sequence modeling. 2019. ",
1404
+ "bbox": [
1405
+ 174,
1406
+ 195,
1407
+ 823,
1408
+ 224
1409
+ ],
1410
+ "page_idx": 14
1411
+ },
1412
+ {
1413
+ "type": "text",
1414
+ "text": "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. pp. 8024–8035, 2019. ",
1415
+ "bbox": [
1416
+ 174,
1417
+ 233,
1418
+ 825,
1419
+ 304
1420
+ ],
1421
+ "page_idx": 14
1422
+ },
1423
+ {
1424
+ "type": "text",
1425
+ "text": "Ofir Press, Noah A. Smith, and Omer Levy. Improving transformer models by reordering their sublayers, 2020a. ",
1426
+ "bbox": [
1427
+ 173,
1428
+ 313,
1429
+ 821,
1430
+ 342
1431
+ ],
1432
+ "page_idx": 14
1433
+ },
1434
+ {
1435
+ "type": "text",
1436
+ "text": "Ofir Press, Noah A Smith, and Mike Lewis. Shortformer: Better language modeling using shorter inputs. arXiv preprint arXiv:2012.15832, 2020b. ",
1437
+ "bbox": [
1438
+ 173,
1439
+ 349,
1440
+ 823,
1441
+ 378
1442
+ ],
1443
+ "page_idx": 14
1444
+ },
1445
+ {
1446
+ "type": "text",
1447
+ "text": "Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. Technical report, OpenAI, 2019. ",
1448
+ "bbox": [
1449
+ 173,
1450
+ 387,
1451
+ 823,
1452
+ 416
1453
+ ],
1454
+ "page_idx": 14
1455
+ },
1456
+ {
1457
+ "type": "text",
1458
+ "text": "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. 21:1–67, 2020. ",
1459
+ "bbox": [
1460
+ 173,
1461
+ 424,
1462
+ 825,
1463
+ 467
1464
+ ],
1465
+ "page_idx": 14
1466
+ },
1467
+ {
1468
+ "type": "text",
1469
+ "text": "Keisuke Sakaguchi, Ronan Le Bras, Chandra Bhagavatula, and Yejin Choi. Winogrande: An adversarial winograd schema challenge at scale. Proceedings of the AAAI Conference on Artificial Intelligence, 34(05):8732–8740, Apr. 2020. doi: 10.1609/aaai.v34i05.6399. URL https: //ojs.aaai.org/index.php/AAAI/article/view/6399. ",
1470
+ "bbox": [
1471
+ 174,
1472
+ 476,
1473
+ 825,
1474
+ 532
1475
+ ],
1476
+ "page_idx": 14
1477
+ },
1478
+ {
1479
+ "type": "text",
1480
+ "text": "Noam Shazeer. Glu variants improve transformer, 2020. ",
1481
+ "bbox": [
1482
+ 173,
1483
+ 540,
1484
+ 542,
1485
+ 555
1486
+ ],
1487
+ "page_idx": 14
1488
+ },
1489
+ {
1490
+ "type": "text",
1491
+ "text": "Sheng Shen, Zhewei Yao, Amir Gholami, Michael W. Mahoney, and Kurt Keutzer. Powernorm: Rethinking batch normalization in transformers, 2020. ",
1492
+ "bbox": [
1493
+ 171,
1494
+ 564,
1495
+ 823,
1496
+ 593
1497
+ ],
1498
+ "page_idx": 14
1499
+ },
1500
+ {
1501
+ "type": "text",
1502
+ "text": "David R. So, Wojciech Manke, Hanxiao Liu, Zihang Dai, Noam Shazeer, and Quoc V. Le. Primer:´ Searching for efficient transformers for language modeling, 2021. ",
1503
+ "bbox": [
1504
+ 171,
1505
+ 602,
1506
+ 823,
1507
+ 631
1508
+ ],
1509
+ "page_idx": 14
1510
+ },
1511
+ {
1512
+ "type": "text",
1513
+ "text": "Hugo Touvron, Matthieu Cord, Alexandre Sablayrolles, Gabriel Synnaeve, and Herve J ´ egou. Going ´ deeper with image transformers, 2021. ",
1514
+ "bbox": [
1515
+ 171,
1516
+ 638,
1517
+ 825,
1518
+ 667
1519
+ ],
1520
+ "page_idx": 14
1521
+ },
1522
+ {
1523
+ "type": "text",
1524
+ "text": "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. ",
1525
+ "bbox": [
1526
+ 173,
1527
+ 676,
1528
+ 825,
1529
+ 719
1530
+ ],
1531
+ "page_idx": 14
1532
+ },
1533
+ {
1534
+ "type": "text",
1535
+ "text": "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. 2019. ",
1536
+ "bbox": [
1537
+ 169,
1538
+ 727,
1539
+ 823,
1540
+ 757
1541
+ ],
1542
+ "page_idx": 14
1543
+ },
1544
+ {
1545
+ "type": "text",
1546
+ "text": "Ruibin Xiong, Yunchang Yang, Di He, Kai Zheng, Shuxin Zheng, Chen Xing, Huishuai Zhang, Yanyan Lan, Liwei Wang, and Tie-Yan Liu. On layer normalization in the transformer architecture, 2020. ",
1547
+ "bbox": [
1548
+ 173,
1549
+ 765,
1550
+ 823,
1551
+ 808
1552
+ ],
1553
+ "page_idx": 14
1554
+ },
1555
+ {
1556
+ "type": "text",
1557
+ "text": "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, pp. 4791–4800, Florence, Italy, July 2019. Association for Computational Linguistics. doi: 10.18653/v1/P19-1472. URL https://www.aclweb.org/ anthology/P19-1472. ",
1558
+ "bbox": [
1559
+ 173,
1560
+ 816,
1561
+ 825,
1562
+ 886
1563
+ ],
1564
+ "page_idx": 14
1565
+ },
1566
+ {
1567
+ "type": "text",
1568
+ "text": "Biao Zhang, Ivan Titov, and Rico Sennrich. Improving deep transformer with depth-scaled initialization and merged attention, 2019. ",
1569
+ "bbox": [
1570
+ 174,
1571
+ 895,
1572
+ 820,
1573
+ 924
1574
+ ],
1575
+ "page_idx": 14
1576
+ },
1577
+ {
1578
+ "type": "text",
1579
+ "text": "Chen Zhu, Renkun Ni, Zheng Xu, Kezhi Kong, W Ronny Huang, and Tom Goldstein. Gradinit: Learning to initialize neural networks for stable and efficient training. arXiv preprint arXiv:2102.08098, 2021. ",
1580
+ "bbox": [
1581
+ 174,
1582
+ 103,
1583
+ 821,
1584
+ 145
1585
+ ],
1586
+ "page_idx": 15
1587
+ },
1588
+ {
1589
+ "type": "text",
1590
+ "text": "Yukun Zhu, Ryan Kiros, Richard Zemel, Ruslan Salakhutdinov, Raquel Urtasun, Antonio Torralba, and Sanja Fidler. Aligning books and movies: Towards story-like visual explanations by watching movies and reading books. arXiv preprint arXiv:1506.06724, 2019. ",
1591
+ "bbox": [
1592
+ 178,
1593
+ 155,
1594
+ 821,
1595
+ 196
1596
+ ],
1597
+ "page_idx": 15
1598
+ }
1599
+ ]
parse/dev/GMYWzWztDx5/GMYWzWztDx5_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/GMYWzWztDx5/GMYWzWztDx5_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/GUrhfTuf_3/GUrhfTuf_3.md ADDED
@@ -0,0 +1,345 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SIMVLM: SIMPLE VISUAL LANGUAGE MODEL PRETRAINING WITH WEAK SUPERVISION
2
+
3
+ Zirui Wang1,2∗, Jiahui $\mathbf { Y u } ^ { 2 }$ , Adams Wei $\mathbf { Y u } ^ { 2 }$ , Zihang Dai2, Yulia Tsvetkov3, Yuan Cao2
4
+
5
+ 1Carnegie Mellon University
6
+ {ziruiw}@cs.cmu.edu
7
+ 2Google Research, Brain Team
8
+ {jiahuiyu,adamsyuwei,zihangd,yuancao}@google.com
9
+ 3University of Washington
10
+ {yuliats}@cs.washington.edu
11
+
12
+ # ABSTRACT
13
+
14
+ With recent progress in joint modeling of visual and textual representations, Vision-Language Pretraining (VLP) has achieved impressive performance on many multimodal downstream tasks. However, the requirement for expensive annotations including clean image captions and regional labels limits the scalability of existing approaches, and complicates the pretraining procedure with the introduction of multiple dataset-specific objectives. In this work, we relax these constraints and present a minimalist pretraining framework, named Simple Visual Language Model (SimVLM). Unlike prior work, SimVLM reduces the training complexity by exploiting large-scale weak supervision, and is trained end-to-end with a single prefix language modeling objective. Without utilizing extra data or task-specific customization, the resulting model significantly outperforms previous pretraining methods and achieves new state-of-the-art results on a wide range of discriminative and generative vision-language benchmarks, including VQA $( + 3 . 7 4 \%$ vqa-score), NLVR2 $( + 1 . 1 7 \%$ accuracy), SNLI-VE $( + 1 . 3 7 \%$ accuracy) and image captioning tasks $( + 1 0 . 1 \%$ average CIDEr score). Furthermore, we demonstrate that SimVLM acquires strong generalization and transfer ability, enabling zero-shot behavior including open-ended visual question answering and cross-modality transfer.
15
+
16
+ # 1 INTRODUCTION
17
+
18
+ Self-supervised textual representation learning (Devlin et al., 2018; Radford et al., 2018; 2019; Liu et al., 2019; Yang et al., 2019; Raffel et al., 2019; Brown et al., 2020) based on Transformers (Vaswani et al., 2017) has pushed the state of the art on a wide range of natural language processing (NLP) tasks (Rajpurkar et al., 2016; Wang et al., 2018; Sarlin et al., 2020). One successful approach is to first pretrain the model (e.g. BERT) on large-scale unlabled text corpora using masked language modeling (MLM) objective (Devlin et al., 2018), followed by finetuning on downstream tasks. While this pretraining-finetuning paradigm has been widely adopted, recent work on autoregressive language models (LM) (Radford et al., 2019; Brown et al., 2020) such as GPT-3 has shown strong performance without finetuning by utilizing few-shot prompts (Liu et al., 2021), suggesting the text guided zero-shot generalization is a promising alternative.
19
+
20
+ Motivated by the success of textual representation pretraining, various efforts have been made to build the multi-modal (visual and textual) counterpart. A line of work (Tan & Bansal, 2019; Lu et al., 2019; Li et al., 2019; Chen et al., 2020b; Li et al., 2020; Su et al., 2020; Zhang et al., 2021) has explored vision-language pretraining (VLP) that learns a joint representation of both modalities to be finetuned on vision-language (VL) benchmarks, such as visual question answering (VQA) (Goyal et al., 2017). In order to capture the alignment between images and text, previous methods have extensively exploited two types of human-labeled datasets from multiple sources, which typically consist of the following steps. Firstly, object detection datasets are used to train a supervised object detector (OD) which allows further extracting region-of-interest (ROI) features from images. Next, datasets with aligned image-text pairs are used for MLM pretraining of a fusion model that usually takes as input the concatenation of the extracted ROI features and the paired text. In addition, due to the limited scale of human annotated data, various task-specific auxiliary losses have been introduced in order to improve performance. These design choices complicate the pretraining protocol of VLP, creating a bottleneck for further quality improvement. What is more, such pretraining-finetuning based approaches usually lack the zero-shot capability, just like their language counterparts. In comparison, another line of work (Radford et al., 2021; Ramesh et al., 2021; Jia et al., 2021) utilizes weakly labeled/aligned data crawled from the web to perform pretraining, achieving good performance and certain zero-shot learning capability on image classification and image-text retrieval. Nonetheless, these methods mainly focus on specific tasks of consideration and thus may not serve as a generic pretraining-finetuning representation for VL benchmarks.
21
+
22
+ In light of these disadvantages of the existing techniques, we are interested in building a VLP model that: (1) can be seamlessly plugged into the pretraining-finetuning paradigm and achieve competitive performance on standard VL benchmarks; (2) does not require a complicated pretraining protocol as in previous methods; and (3) has the potential towards text guided zero-shot generalization in cross-modal settings. To this end, we propose SimVLM, standing for Simple Visual Language Model, which significantly simplifies VLP by solely exploiting language modeling objectives on weakly aligned image-text pairs (Jia et al., 2021). In a nutshell, SimVLM consists of the following components:
23
+
24
+ • Objective. It is trained end-to-end from scratch with a single objective of Prefix Language
25
+ Modeling (PrefixLM), which can not only naturally perform text generation as GPT-3, but also process contextual information in a bidirectional manner as BERT does.
26
+ • Architecture. The framework employs ViT/CoAtNet (Dosovitskiy et al., 2021; Dai et al.,
27
+ 2021) and directly takes raw images as inputs. These models can also fit the large-scale data and are readily compatible with the PrefixLM objective.
28
+ Data. These setups relieve the requirement for object detection and allow the model to
29
+ utilize the large-scale weakly labeled dataset, which has better potential towards zero-shot
30
+ generalization.
31
+
32
+ Not only is SimVLM simpler, requiring neither object detection pretraining nor auxiliary losses, but it also obtains better performance than previous work. Empirically, SimVLM consistently outperforms existing VLP models and achieves new state-of-the-art results on 6 VL benchmarks without additional data nor task-specific customization. Besides, it acquires stronger generalization in visual-language understanding that empowers zero-shot image captioning and open-ended VQA. In particular, SimVLM learns unified multimodal representation that enables zero-shot cross-modality transfer, where the model is finetuned on text-only data and directly evaluated on image-and-text test examples without further training. Our results suggest that generative VLP can not only match existing MLM-based methods on VL tasks but also demonstrate promising zero-shot potential.
33
+
34
+ # 2 RELATED WORK
35
+
36
+ Recent years have seen a rapid progress made in vision-language pretraining (Uppal et al., 2020; Han et al., 2021; Khan et al., 2021). While a variety of approaches have been proposed, a large portion of them require object detection for image region feature regression or tagging as part of the pre-training objectives (Tan & Bansal, 2019; Su et al., 2020; Li et al., 2019; Chen et al., 2020b; Gan et al., 2020; Li et al., 2020; Yu et al., 2021; Li et al., 2021; Zhang et al., 2021; Hu et al., 2021; Cho et al., 2021). These methods rely on a strong object detection model like Fast(er) R-CNN (Ren et al., 2015), which is often trained on human annotated data sets like Visual Genome (Krishna et al., 2016). Using such labeled training data as a prerequisite increases the cost of building the training pipeline, and makes the approach less scalable. Some recent efforts have also explored VLP without object detection module (Xu et al., 2021; Kim et al., 2021; Huang et al., 2021), but they only use clean pretraining data with small scales and thus their zero-shot capability is limited.
37
+
38
+ On the other hand, multiple cross-modality loss functions have been proposed as part of the training objectives, for example image-text matching (Tan & Bansal, 2019; Lu et al., 2019; Xu et al., 2021), masked region classification/feature regression (Tan & Bansal, 2019; Chen et al., 2020b), object attribute prediction (Xu et al., 2021), contrastive loss (Li et al., 2020; 2021), word-region alignment (Chen et al., 2020b) word-patch alignment (Kim et al., 2021). They are often mixed with other objectives including image caption generation and masked language modeling to form compound pre-training losses. This creates the challenge of balancing among different losses and datasets, and thus complicates the optimization procedure.
39
+
40
+ ![](images/e827c64d1d645458d694e88950b02c4e209c70121a7c8ba4e0a6a0de1a73a2b2.jpg)
41
+ Figure 1: Illustration of the SimVLM model. This shows an example of training with PrefixLM of an image-text pair. For text-only corpora, it is straightforward to remove the image patches and utilize textual tokens only.
42
+
43
+ Our work by contrast, follows a minimalist approach that takes raw image inputs and makes use of only the language modeling loss, without resorting to auxiliary models like faster R-CNN for image region detection. Motivated by recent works (Radford et al., 2021; Ramesh et al., 2021; Jia et al., 2021; Tsimpoukelli et al., 2021) that illustrate zero-shot learning in certain image-text tasks, we train our model using large-scale weakly labeled data only. While concurrent work (Shen et al., 2021) has explored building on top of models pretrained with such dataset, we focus on pretraining from scratch to explore the limit of generative VLP.
44
+
45
+ # 3 SIMVLM
46
+
47
+ # 3.1 BACKGROUND
48
+
49
+ The bidirectional Masked Language Modeling (MLM) has been one of the most popular selfsupervised training objectives for textual representation learning. As demonstrated by BERT (Devlin et al., 2018), it is based on the idea of denoising autoencoder such that the model is trained to recover the corrupted tokens in a document. Specifically, given a text sequence $\mathbf { X }$ , a subset of tokens $\mathbf { X } _ { m }$ are randomly sampled and a corrupted sequence ${ \bf x } _ { \backslash m }$ is constructed by replacing tokens in $\mathbf { x } _ { m }$ with a special [MASK] token. The training objective is to reconstruct $\mathbf { X } _ { m }$ from the context ${ \bf x } _ { \backslash m }$ by minimizing the negative log-likelihood:
50
+
51
+ $$
52
+ \begin{array} { r } { \mathcal { L } _ { \mathrm { M L M } } ( \theta ) = - \mathbb { E } _ { \mathbf { x } \sim D } \left[ \log P _ { \theta } ( \mathbf { x } _ { m } \vert \mathbf { x } _ { \backslash m } ) \right] , } \end{array}
53
+ $$
54
+
55
+ where $\theta$ is the trainable parameters of the model and $D$ is the pretraining data. This approach learns contextualized representations that can be further finetuned for downstream tasks. The MLM-style pretraining has been widely adopted in previous VLP models, whereby the input is an image-text pair and the model needs to predict masked tokens by leveraging image ROI features.
56
+
57
+ Alternatively, the unidirectional Language Modeling (LM) trains the model to directly maximize the likelihood of the sequence $\mathbf { X }$ under the forward autoregressive factorization:
58
+
59
+ $$
60
+ \mathcal { L } _ { \mathrm { L M } } ( \theta ) = - \mathbb { E } _ { { \mathbf { x } } \sim D } \left[ \log P _ { \theta } ( \mathbf { x } ) \right] = - \mathbb { E } _ { { \mathbf { x } } \sim D } \left[ \sum _ { t = 1 } ^ { T } \log P _ { \theta } ( \mathbf { x } _ { t } | \mathbf { x } _ { < t } ) \right] .
61
+ $$
62
+
63
+ Compared with MLM, the LM pretraining has also been shown to be highly effective for multiple NLP tasks (Radford et al., 2018). More importantly, it facilitates the model with strong generation
64
+
65
+ capability that enables text induced zero-shot generalization without finetuning (Brown et al., 2020). While MLM has become the de facto approach in VLP models reviewed above, the generative LM has been understudied.
66
+
67
+ # 3.2 PROPOSED OBJECTIVE: PREFIX LANGUAGE MODELING
68
+
69
+ Motivated by the zero-shot capability introduced by pre-training with LM loss, we propose to pretain vision-language representation using the Prefix Language Modeling (PrefixLM). PrefixLM differs from the standard LM such that it enables bi-directional attention on the prefix sequence (e.g. $\mathbf { X } { < } T _ { p }$ in Eq. (3)), and only conducts autoregressive factorization on the remaining tokens (e.g. $\mathbf { X } _ { \geq T _ { p } }$ in Eq. (3)). During pretraining, a prefix sequence of tokens of (a randomly selected) length $T _ { p }$ is truncated from input sequence and the training objective becomes:
70
+
71
+ $$
72
+ \mathcal { L } _ { \mathrm { P r e f i x L M } } ( \theta ) = - \mathbb { E } _ { { \mathbf { x } } \sim D } \left[ \log P _ { \theta } ( \mathbf { x } _ { \ge T _ { p } } | \mathbf { x } _ { < T _ { p } } ) \right] = - \mathbb { E } _ { { \mathbf { x } } \sim D } \left[ \sum _ { t = T _ { p } } ^ { T } \log P _ { \theta } ( \mathbf { x } _ { t } | \mathbf { x } _ { [ T _ { p } , t ] } , \mathbf { x } _ { < T _ { p } } ) \right] .
73
+ $$
74
+
75
+ Intuitively, images can be considered as prefix for their textual descriptions as they often appear before text in a web document. Therefore, for a given image-text pair, we prepend image feature sequence of length $T _ { i }$ to the text sequence, and enforce the model to sample a prefix of length $T _ { p } \geq T _ { i }$ to calculate LM loss on text data only (an example is shown in Figure 1). Compared to prior MLM style VLP methods, our PrefixLM model under the sequence-to-sequence framework not only enjoys the bidirectional contextualized representation as in MLM, but also can perform text generation similar to LM.
76
+
77
+ # 3.3 ARCHITECTURE
78
+
79
+ We adopt Transformer as the backbone of our model due to its success for both language and vision tasks (Devlin et al., 2018; Dosovitskiy et al., 2021). Differently from standard LM, PrefixLM enables bidirectional attention within the prefix sequence, and thus it is applicable for both decoder-only and encoder-decoder sequence-to-sequence language models. In our preliminary experiments, we found that the inductive bias introduced by encoder-decoder model which decouples encoding from generation is conducive to the improvement of downstream task.
80
+
81
+ An overview of our model architecture is depicted in Figure 1. For the visual modality, inspired by ViT (Dosovitskiy et al., 2021) and CoAtNet (Dai et al., 2021), our model receives the raw image $\mathbf { x } \in \mathbb { R } ^ { H \times W \times C }$ and maps it into flattened 1D sequence of patches $\mathbf { x } _ { p } \in \mathbb { R } ^ { T _ { i } \times D }$ as input for the transformer, where $D$ is the fixed hidden size of the transformer layers and $\begin{array} { r } { T _ { i } = \frac { H W } { P ^ { 2 } } } \end{array}$ is the length of the image tokens for a given patch size $P$ . Following Dai et al. (2021), we use a convolution (Conv) stage consist of the first three blocks of ResNet (He et al., 2016) to extract contextualized patches, which we find advantageous over the naive linear projection (equivalent to $1 \times 1$ Conv layer) used in ViT, consistent with the observation from (Xiao et al., 2021). For the textual modality, we follow the standard practice to tokenize the input sentence into sub-word tokens (Kudo & Richardson, 2018), and the embeddings are learned for a fixed vocabulary. To retain positional information, we add two trainable 1D positional embeddings for image and text inputs separately, and we additionally add 2D relative attention for the image patches within transformer layers (Dai et al., 2021). Notice that we do not add extra modality type embeddings for which we found no improvement in our experiment. We study the effects of various components of the model in Section 4.4.
82
+
83
+ # 3.4 DATASETS
84
+
85
+ Since our approach does not rely on an object detection module and only operates with raw image patch inputs, we pretrain all model parameters from scratch using large-scale noisy image-text data, which has better potential for zero-shot generalization. Specifically, we use the image and alt-text pairs introduced in Jia et al. (2021), which are crawled from the web with minimal post-processing. On the other hand, our formulation of PrefixLM is modality-agnostic and thus we can additionally include text-only corpora to compensate for noisy text supervision in the alt-text data. As shown later in our experiments, this unified PrefixLM formulation reduces the modality discrepancy and improves the model quality.
86
+
87
+ Table 1: Single model results for vision-language pretraining methods on popular VL banchmarks. We report vqa-score for VQA, accuracy for NLVR2 and SNLI-VE, BLEU $@ 4$ for Multi30k and various metrics for image captioning $\mathrm { B } @ 4$ : BLEU $@ 4$ , M: METEOR, C: CIDEr, S: SPICE).
88
+
89
+ <table><tr><td></td><td colspan="2">VQA</td><td colspan="2">NLVR2</td><td colspan="2">SNLI-VE</td><td colspan="3">CoCo Caption</td><td colspan="2">NoCaps</td><td rowspan="2">Multi30k En-De</td></tr><tr><td></td><td>test-dev</td><td>test-std</td><td>dev</td><td>test-P</td><td>dev test</td><td>B@4</td><td>M</td><td>C</td><td>S</td><td>C</td><td>S</td></tr><tr><td colspan="10">Base-sized Models</td><td colspan="3"></td></tr><tr><td>LXMERT</td><td>72.42</td><td>72.54</td><td>74.90</td><td>74.50</td><td>-</td><td></td><td></td><td>=</td><td>-</td><td></td><td></td><td></td><td>=</td></tr><tr><td>VL-T5</td><td>-</td><td>70.30</td><td>74.6</td><td>73.6</td><td>-</td><td></td><td></td><td></td><td>116.5</td><td>-</td><td>-</td><td>-</td><td>45.5</td></tr><tr><td>SOHO</td><td>73.25</td><td>73.47</td><td>76.37</td><td>77.32</td><td>85.00</td><td>84.95</td><td></td><td></td><td>=</td><td>=</td><td>=</td><td>-</td><td></td></tr><tr><td>SimVLMbase</td><td>77.87</td><td>78.14</td><td>81.72</td><td>81.77</td><td>84.20</td><td>84.15</td><td>39.0</td><td>32.9</td><td>134.8</td><td>24.0</td><td>94.8</td><td>13.1</td><td>46.6</td></tr><tr><td colspan="10">Large-sized Models</td><td colspan="3"></td></tr><tr><td>UNITER</td><td>73.82</td><td>74.02</td><td>79.12</td><td>79.98</td><td>79.39</td><td>79.38</td><td>=</td><td></td><td>=</td><td></td><td></td><td>=</td><td>-</td></tr><tr><td>OSCAR</td><td>73.61</td><td>73.82</td><td>79.12</td><td>80.37</td><td>=</td><td>=</td><td>41.7</td><td>30.6</td><td>140.0</td><td>24.5</td><td>80.9</td><td>11.3</td><td>=</td></tr><tr><td>Villa</td><td>74.69</td><td>74.87</td><td>79.76</td><td>81.47</td><td>80.18</td><td>80.02</td><td>-</td><td></td><td></td><td>=</td><td>-</td><td>-</td><td>=</td></tr><tr><td>UNIMO</td><td>75.06</td><td>75.27</td><td>-</td><td>=</td><td>81.11</td><td>80.63</td><td>39.6</td><td>-</td><td>127.7</td><td>-</td><td>-</td><td>-</td><td>=</td></tr><tr><td>VinVL SimVLMlarge</td><td>76.56</td><td>76.60 79.56</td><td>82.67 84.13</td><td>83.98</td><td></td><td>=</td><td>41.0</td><td>31.1</td><td>140.9</td><td>25.2</td><td>92.5</td><td>13.1</td><td></td></tr><tr><td></td><td>79.32</td><td></td><td></td><td>84.84</td><td>85.68</td><td>85.62</td><td>40.3</td><td>33.4</td><td>142.6</td><td>24.7</td><td>108.5</td><td>14.2</td><td>47.5</td></tr><tr><td colspan="10">Huge-sized Models</td><td colspan="3"></td></tr><tr><td>SimVLMhuge</td><td>80.03</td><td>80.34</td><td>84.53</td><td>85.15</td><td>86.21</td><td>86.32</td><td>40.6</td><td>33.7</td><td>143.3</td><td>25.4</td><td>110.3</td><td>14.5</td><td>47.6</td></tr></table>
90
+
91
+ Compared to prior VLP methods consisting of two pretraining stages and multiple auxiliary objectives, our model only requires one-pass pretraining using a single language modeling loss in an end-to-end manner, hence the name Simple Visual Language Model (SimVLM).
92
+
93
+ # 4 EXPERIMENTS
94
+
95
+ We conduct systematic experiments on a diversified set of visual-linguistic benchmarks, including visual question answering, image captioning, visual reasoning, visual entailment, and multimodal translation. We not only examine our model as a general-purpose VL representation learning in the pretraining-finetuning paradigm, but also study its zero-shot generalization towards open-ended VL understanding.
96
+
97
+ # 4.1 SETUP
98
+
99
+ Our models are implemented with the Lingvo framework (Shen et al., 2019). We follow the setup in ViT (Dosovitskiy et al., 2021) to explore 3 variants of SimVLM, namely “Base”, “Large”, and “Huge”, such that each variant follows the same setting as its corresponding ViT variant. All models are pretrained from scratch for about 1M steps on the training set of ALIGN (Jia et al., 2021) and the Colossal Clean Crawled Corpus (C4) dataset presented in Raffel et al. (2019). We mix the two pretraining datasets within each batch, which contains 4,096 image-text pairs (ALIGN) and 512 text-only documents (C4), sharded across 512 TPU v3 chips (Jouppi et al., 2017). More pretraining settings are detailed in Appendix B.1.
100
+
101
+ After pretrained, our model is finetuned and evaluated on six vision-language benchmarks, including three discriminative tasks: VQA v2 (Goyal et al., 2017), SNLI-VE (Xie et al., 2019), and NLVR2 (Suhr et al., 2018); as well as three generative tasks: CoCo captioning (Chen et al., 2015), NoCaps (Agrawal et al., 2019), and Multi30k (Elliott et al., 2016). We additionally examine its zero-shot generalization and performance on single-modality tasks. Details of tasks considered and the finetuning process are outlined in Appendix B.2.
102
+
103
+ # 4.2 COMPARISON WITH EXISTING APPROACHES
104
+
105
+ To examine the quality of vision-language pretraining, we first compare SimVLM on the popular multi-modal tasks with state-of-the-art (SOTA) VLP methods including LXMERT (Tan & Bansal, 2019), VL-T5 (Cho et al., 2021), UNITER (Chen et al., 2020b), OSCAR (Li et al., 2020), Villa (Gan et al., 2020), SOHO (Huang et al., 2021), UNIMO (Li et al., 2021), and VinVL (Zhang et al., 2021).
106
+
107
+ As can be seen in Table 1, SimVLM outperforms all existing models and achieves new SOTA results on all tasks considered, often by a significant margin. This demonstrates our generative pretraining approach is competitive with MLM-based models and that simple framework with weak supervision is sufficient to learn high-quality multi-modal representations.
108
+
109
+ Table 2: Image captioning results on CoCo Karpathy-test split and NoCaps validation split. For NoCaps, $\{ \mathrm { I n } . $ , Near, $\mathrm { O u t } \}$ refer to in-domain, near-domain and out-of-domain respectively. † indicates Cider optimization. Model references: aAnderson et al. (2018) bHuang et al. (2019) $\mathrm { c } _ { \vert }$ Cornia et al. (2020).
110
+
111
+ <table><tr><td rowspan="2"></td><td rowspan="2">Setup</td><td colspan="4">CoCo Caption</td><td colspan="4">NoCaps</td></tr><tr><td>B@4</td><td>M</td><td>C</td><td>S</td><td>In</td><td>Near</td><td>Out</td><td>Overall</td></tr><tr><td>BUTDa</td><td rowspan="3">supervised</td><td>36.3</td><td>27.7</td><td>120.1</td><td>21.4</td><td>-</td><td></td><td>-</td><td>-</td></tr><tr><td>AoANetbt</td><td>39.5</td><td>29.3</td><td>129.3</td><td>23.2</td><td>-</td><td>=</td><td>-</td><td>-</td></tr><tr><td>M2 Transformerc†</td><td>39.1</td><td>29.2</td><td>131.2</td><td>22.6</td><td>81.2</td><td>-</td><td>69.4</td><td>75.0</td></tr><tr><td>SimVLMbase</td><td rowspan="3">zero-shot</td><td>9.5</td><td>11.5</td><td>24.0</td><td>7.5</td><td>83.2</td><td>84.1</td><td>82.5</td><td>83.5</td></tr><tr><td>SimVLMlarge</td><td>10.5</td><td>12.0</td><td>24.9</td><td>8.3</td><td>97.6</td><td>96.5</td><td>96.3</td><td>96.6</td></tr><tr><td>SimVLMhuge</td><td>11.2</td><td>14.7</td><td>32.2</td><td>8.5</td><td>101.2</td><td>100.4</td><td>102.3</td><td>101.4</td></tr><tr><td>SimVLMbase</td><td rowspan="3">few-shot</td><td>34.7</td><td>29.2</td><td>118.7</td><td>21.9</td><td>95.0</td><td>91.9</td><td>98.5</td><td>93.7</td></tr><tr><td>SimVLMIarge</td><td>35.4</td><td>30.2</td><td>124.1</td><td>22.7</td><td>102.5</td><td>100.9</td><td>106.0</td><td>102.2</td></tr><tr><td>SimVLMhuge</td><td>36.8</td><td>31.5</td><td>131.3</td><td>24.0</td><td>111.8</td><td>110.6</td><td>111.0</td><td>110.4</td></tr><tr><td>OSCAR+</td><td rowspan="3">pretrain-finetune</td><td>41.7</td><td>30.6</td><td>140.0</td><td>24.5</td><td>85.4</td><td>84.0</td><td>80.3</td><td>83.4</td></tr><tr><td>VinVL†</td><td>41.0</td><td>31.1</td><td>140.9</td><td>25.2</td><td>103.7</td><td>95.6</td><td>83.8</td><td>94.3</td></tr><tr><td>SimVLMhuge</td><td>40.6</td><td>33.7</td><td>143.3</td><td>25.4</td><td>113.7</td><td>110.9</td><td>115.2</td><td>112.2</td></tr></table>
112
+
113
+ For the discriminative tasks, the $\mathrm { S i m V L M _ { b a s e } }$ already outperforms all prior methods while using less capacity, and the $\mathrm { S i m V L M _ { h u g e } }$ obtains almost 4 points absolute score improvement compared to the previous SOTA (VinVL), pushing the single model performance above $80 \%$ on VQA for the first time. In addition, SimVLM also consistently outperforms prior methods on NLVR2 and SNLI-VE, illustrating its capability of processing more complex visual-linguistic reasoning. For the generation tasks including image captioning and image translation, SimVLM also shows large improvements using naive finetuning techniques. Our model outperforms on 3 out of 4 metrics on the public “Karpathy” 5k test split of CoCo captioning as well as the NoCaps benchmark than prior methods trained with more complex reinforcement learning approach of CIDEr optimization (Rennie et al., 2017). Finally, SimVLM is also effective for image translation of Multi30k from English to German. These experiments demonstrate that our model can be seamlessly plugged into the pretraining-finetuning paradigm with superior performance, utilizing minimalist pretraining and finetuning procedures.
114
+
115
+ # 4.3 ZERO-SHOT GENERALIZATION
116
+
117
+ A crucial benefit of generative modeling and scaling with weak supervision is the potential of zeroshot generalization. Models (Brown et al., 2020; Radford et al., 2021; Jia et al., 2021) have been shown capable of performing few-shot or zero-shot transfer from pretrained models to downstream datasets, even across language boundaries (Lample & Conneau, 2019). In this section, we showcase three different settings of zero-shot applications less explored in prior VLP work, including transferring to unseen tasks, modalities and/or testing instances.
118
+
119
+ # 4.3.1 ZERO-SHOT/FEW-SHOT IMAGE CAPTIONING
120
+
121
+ The pretraining procedure of SimVLM can be interpreted as a noisy image captioning objective on real-world web corpus. Thus, it is natural to ask how well this caption ability generalizes to other datasets in a zero-shot/few-shot manner. To this end, we take the pretrained SimVLM model, and directly decode on image captioning benchmarks for the zero-shot setting while finetune on $1 \%$ training data for 5 epochs for the few-shot setting. We also found that using a prefix prompt “A picture of” improves the quality of decoded captions, similar to the finding in Radford et al. (2021).
122
+
123
+ As shown in Table 2, the zero-shot/few-shot performance (Appendix D) of SimVLM is competitive with fully supervised baselines on CoCo, and it also demonstrates strong generalization on the concept-rich NoCaps benchmark by achieving better scores than pretrained models. Figure 2 (a) illustrates sample captions generated by our model (Appendix A). SimVLM is able to not only capture real-world concepts but also provide a detailed description of the visual input. For example, the decoded samples are able to explain complex scenes with multiple objects (e.g. “people”, “table with drinks”, “dark restaurant”). Besides, the model also shows understanding of fine-grained abstraction such as specific car brand and model (e.g. “Aston Martin”, “Vantage”). SimVLM even performs robustly on challenging images that could be tricky for human, such as abstract or dark pictures. These all illustrate that our model learns a wide range of real-world concepts that generalize well in a zero-shot manner.
124
+
125
+ Table 3: Zero-shot cross-modality transfer results on SNLI-VE and Multi30k. For SNLI-VE, the zero-shot model is finetuned on three source datasets: text-only SNLI-VE (Xie et al., 2019), SNLI (Bowman et al., 2015), and MNLI (Williams et al., 2017). For Multi30k, the model is finetuned on text-only Multi30k data. Model reference: a(Specia et al., 2016).
126
+
127
+ <table><tr><td></td><td>SNLI-VE (T)</td><td>SNLI-VE SNLI AcCdev/AcCtest</td><td>MNLI</td><td>Multi30k Multi30k (T) B@4</td><td>M</td></tr><tr><td colspan="6">Fully Supervised Baseline</td></tr><tr><td>EVE-Image</td><td colspan="3">71.56 /71.16</td><td></td><td></td></tr><tr><td>UNITER</td><td colspan="3">78.59 /78.28</td><td></td><td>■</td></tr><tr><td>SOHO</td><td colspan="3">85.00 /84.95</td><td>■</td><td>■</td></tr><tr><td>LIUMa</td><td colspan="3"></td><td>23.8</td><td>35.1</td></tr><tr><td>GroundedTransa</td><td colspan="3">■</td><td>15.8</td><td>31.2</td></tr><tr><td>Zero-Shot Cross-Modality Transfer</td><td colspan="3"></td><td></td><td></td></tr><tr><td>SimVLMbase</td><td>71.35 /71.02</td><td>72.65 /72.24</td><td>64.37 /63.98</td><td>15.0</td><td>24.8</td></tr><tr><td>SimVLMlarge</td><td>72.85 /72.44</td><td>73.62/73.23</td><td>66.97 / 66.31</td><td>17.7</td><td>30.1</td></tr><tr><td>SimVLMhuge</td><td>73.56 /73.08</td><td>74.24 /73.86</td><td>67.45 /66.97</td><td>18.2</td><td>32.6</td></tr></table>
128
+
129
+ # 4.3.2 ZERO-SHOT CROSS-MODALITY TRANSFER
130
+
131
+ Existing pretraining methods have been shown to be successful in transferring knowledge across heterogeneous data spaces. For example, multilingual language models (Devlin et al., 2018; Lample & Conneau, 2019) enable zero-shot cross-lingual transfer such that the model is only finetuned using training data from a source language (typically English) and evaluated on the target language without further training. Inspired by this setup, we explore a novel zero-shot cross-modality transfer paradigm of utilizing VLP models, and evaluate how well our model generalizes across modalities. Since text training data are usually cheaper to obtain compared to visual data, we finetune SimVLM on text-only downstream data and then directly evaluate the zero-shot transfer on joint VL tasks.
132
+
133
+ Specifically, We utilize SNLI-VE and Multi30k to examine the zero-shot transfer performance. For SNLI-VE, we finetune on three text-only NLI datasets such that the premise sentence is used as the encoder’s input while the hypothesis is fed to the decoder, and a similar classifier head is trained on the embedding of the last token in the decoder. At inference, the finetuned model is evaluated by taking the premise image as the encoder input and the corresponding hypothesis sentence to the decoder. As shown in Table 3, SimVLM performs competitively with fully supervised baselines including UNITER under the zero-shot setting. As a sanity check, we also mask out the image feature to predict using the hypothesis only, and find our models can only obtain results close to random guess (average scores of 34.31 / 34.62). This results in performance close to random guess hence demonstrating the effectiveness of SimVLM’s cross-modality transfer ability.
134
+
135
+ In addition, SimVLM is also capable of domain adaption by transferring from the MNLI dataset to SNLI-VE, whereby data comes not only from a different modality but also another domain. We also find it possible to transfer across different languages and modalities using SimVLM. Specifically, we utilize the German image captioning task from WMT 2016 of Multi30k for evaluation, where our model is finetuned on English-German text-only translation data followed by decoding with image-only input in the encoder. Table 3 shows that SimVLM is capable of transferring knowledge across modalities and languages in generative tasks, achieving comparable performance to supervised baselines (decoded examples shown in Figure 2 (b)). These results suggest zero-shot cross-modality transfer emerges with the scaling of weakly labeled data.
136
+
137
+ # 4.3.3 OPEN-ENDED VQA
138
+
139
+ On the VQA benchmark, the best performing models to date formulate the problem as a discriminative task of multi-label classification over a predefined 3,129 answer candidates, often consisting of short factual terms. In real-world applications, however, it is hard to define a closed set of candidate answers that covering all possible scenarios, making the true open-ended VQA a challenging setup.
140
+
141
+ Table 4: Comparison of discriminative and generative VQA methods. “Dev” refers to standard vqa-score on the VQA validation split. “Karpathy-test” is the setup used in Cho et al. (2021) for evaluation on the Karpathy split with rare answers. “Partial Train” refers to train the model only on partial training data which contain subset of all candidate answers.
142
+
143
+ <table><tr><td></td><td>Dev</td><td colspan="3">Karpathy-test</td><td colspan="3">Partial Train Out-domain</td></tr><tr><td>In-domain</td><td></td><td>Out-domain</td><td></td><td>Overall</td><td>In-domain</td><td></td><td>Overall</td></tr><tr><td colspan="8">Discriminative</td></tr><tr><td>UNITER</td><td>-</td><td>74.4</td><td>10.0</td><td>70.5</td><td></td><td></td><td></td></tr><tr><td>VL-T5</td><td>-</td><td>70.2</td><td>7.1</td><td>66.4</td><td></td><td>=</td><td>=</td></tr><tr><td>VL-BART SimVLMbase</td><td>-</td><td>69.4</td><td>7.0</td><td>65.7</td><td>=</td><td>-</td><td>=</td></tr><tr><td>SimVLMlarge</td><td>73.8 76.0</td><td>79.0 80.4</td><td>16.7 17.3</td><td>75.3 76.7</td><td>78.4 79.5</td><td>10.3</td><td>70.5</td></tr><tr><td>SimVLMhuge</td><td></td><td></td><td>17.5</td><td>77.2</td><td>80.2</td><td>11.0</td><td>71.8</td></tr><tr><td></td><td>76.5</td><td>81.0</td><td></td><td></td><td></td><td>11.1</td><td>72.2</td></tr><tr><td colspan="8">Generative</td></tr><tr><td>VL-T5</td><td>-</td><td>71.4</td><td>13.1</td><td>67.9</td><td>=</td><td>=</td><td>=</td></tr><tr><td>VL-BART</td><td>-</td><td>72.1</td><td>13.2</td><td>68.6</td><td>-</td><td>-</td><td>=</td></tr><tr><td>SimVLMbase</td><td>73.2</td><td>78.3</td><td>25.8</td><td>75.2</td><td>77.1</td><td>27.1</td><td>71.3</td></tr><tr><td>SimVLMlarge</td><td>75.2</td><td>79.5</td><td>29.6</td><td>76.5</td><td>78.7</td><td>28.4</td><td>72.5</td></tr><tr><td>SimVLMhuge</td><td>75.5</td><td>79.9</td><td>30.3</td><td>77.0</td><td>79.1</td><td>28.8</td><td>73.0</td></tr></table>
144
+
145
+ Generative models such as SimVLM provide an alternative solution towards this challenge by generating free-form textual answers without being constrained to predefined answers. To this end, we finetune SimVLM using the PrefixLM loss described above where we treat the concatenation of the image and the question as the prefix, and train the model to generate answers.
146
+
147
+ We then compare the generative approach with classification methods in Table 4. Firstly, we follow Cho et al. (2021) and evaluate model performance on questions with rare answers in the Karpathy-test split. Here, outof-domain questions are defined as those with best-scoring answer not included in the 3,129 candidates. Results show that SimVLM outperforms both discriminative and generative baselines on all splits. More importantly, the generative SimVLM significantly improves on the out-of-domain split by over 17 points, demonstrating its strong generalization. However, this setup mainly focuses on rare answers and it remains unclear how well the model generalizes to common unseen answers. We therefore pro
148
+
149
+ Table 5: Linear evaluation on ImageNet classification, compared to state-of-the-art representation learning methods.
150
+
151
+ <table><tr><td>Method</td><td>Acc@1</td></tr><tr><td>SimCLRv2 (Chen et al., 2020a)</td><td>79.8</td></tr><tr><td>DINO (Caron et al., 2021)</td><td>80.1</td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>85.4</td></tr><tr><td>ALIGN (Jia et al., 2021)</td><td>85.5</td></tr><tr><td>SimVLMbase SimVLMlarge</td><td>80.6</td></tr><tr><td>SimVLMhuge</td><td>82.3</td></tr><tr><td></td><td>83.6</td></tr></table>
152
+
153
+ ceed to investigate a more challenging setup where we randomly select 2,085 (about two-thirds of 3,129) in-domain answers and partition both train and validation sets into two splits based on whether their best-scoring answers are included in the selected set or not. We then only finetune SimVLM on the in-domain split of the train set and evaluate on the entire validation set. The “Partial Train” column in Table 4 shows that the generative $\mathrm { S i m V L M }$ is also competent in this setup by scoring reasonably well on over 1,000 unseen answers. Overall, we found the generative SimVLM performs competitively with its discriminative counterpart in the standard setup, and works generally better in the out-of-domain case.
154
+
155
+ Note that we use the exact matching between generated answers and human labels for score calculation in the above experiment, however it is possible that the model generates appropriate answers in different formats or synonyms. Therefore, in addition to the quantitative study above, we show qualitative generation results in Figure 2 (c). It can be observed that SimVLM is able to generate answers not included in the 3,129 candidate set (e.g. “surgeon” and “wood carving”), demonstrating that $\mathrm { S i m V L M }$ can transfer knowledge from the pretraining corpus to VQA. It is thus natural to ask whether SimVLM can perform zero-shot VQA without finetuning at all. In our experiments, we found that SimVLM is able to “answer” by completing prompting sentences, as shown in Figure 2 (d). Nonetheless, we also observed that the model falls short in generating meaningful answers to the real questions. We hypothesize that this is due to the low quality of the pretraining data in which most textual descriptions are short and noisy. To verify our assumption, we continue the pretraining process on the cleaner WIT dataset (Srinivasan et al., 2021) for $5 0 \mathrm { k }$ steps. Examples in Figure 2 (e)
156
+
157
+ show that open-ended VQA ability emerges in SimVLM such that it can generate related responses after finetuning on the knowledge-rich wikipedia dataset.
158
+
159
+ # 4.4 ANALYSIS
160
+
161
+ Single-Modality Tasks. Since SimVLM performs well on joint vision-language benchmarks, it is natural to ask how well the learned representations perform on tasks of single modality. We hope to gain deeper insights into the model behavior by examining its performance on these benchmarks, but it is not our intention to achieve state-of-the-art on singlemodality tasks. In Table 7 (Appendix C), we compare SimVLM with existing VLP models on the GLUE benchmark (Wang et al., 2018), where we mainly follow the text processing procedure in Raffel et al. (2019) and train our model to classify the fully formatted input without token type embeddings. SimVLM performs better than existing VLP methods and competitively with BERT, indicating that it has good language understanding ability. Additionally, we also compute the top-1 accuracy on ImageNet following the linear evaluation protocol in Table 5. Note that our model is not pretrained with a discriminative task such as the contrastive loss, hence we use an average pooling of encoder outputs as image features. Results verify that our model has also learned high-quality image representation.
162
+
163
+ Table 6: Ablation study on VQA. “w/ LM” and “w/ span corruption” denote replacing the proposed PrefixLM loss with a different pretraining objective. “Image2Text” and “Text2Text” refer to the noisy image-text data and the text-only data used for pretraining. “conv blks” denotes number of ResNet blocks.
164
+
165
+ <table><tr><td>Method</td><td> VQA score</td></tr><tr><td>No Pretraining</td><td>49.70</td></tr><tr><td>Decoder-only w/ LM</td><td>65.23 64.48</td></tr><tr><td>SimVLMsmall</td><td>67.43</td></tr><tr><td>w/o Image2Text w/o Text2Text</td><td>49.23</td></tr><tr><td></td><td>65.25</td></tr><tr><td>w/o conv stage</td><td>63.11</td></tr><tr><td>w/ span corruption</td><td>66.23</td></tr><tr><td>w/ 2 conv blks</td><td>65.57</td></tr><tr><td>w/ 4 conv blks</td><td>66.55</td></tr><tr><td>w/10% ALIGN</td><td>66.71</td></tr><tr><td></td><td></td></tr><tr><td>w/ CC-3M</td><td>63.32</td></tr></table>
166
+
167
+ Ablation Study. To study the contributions from each model component, we conduct ablation study on $\mathrm { S i m V L M _ { s m a l l } }$ models with an embedding dimension of 512 and 8 layers. We make comparisons on VQA in Table 6. First, we compare encoder-decoder models with decoder-only models of comparable model size, and find that decoder-only model performs significantly worse on VQA. This suggests the inductive bias of separating bidirectional encoding from unidirectional decoding is beneficial for joint VL representation learning. Next, we study the effectiveness of pretraining objectives and results show that the PrefixLM objective outperforms both span corruption (Raffel et al., 2019) and naive LM, illustrating the importance of using a unified objective formulation for both image-text and text-only data. Moreover, we ablate the contribution of datasets. While weakly aligned image-text data are required for bridging the gap between visual and textual representations, text-only corpora also improves the model quality. This is probably because textual signals are extremely noisy in the former and thus the model relies on the later to acquire better language understanding. In addition, we experimented with $10 \%$ ALIGN and CC-3M (Sharma et al., 2018) datasets, and confirms the importance of data scaling. We then study the effect of the convolution stage and find it critical for VL performance. Following Dai et al. (2021), we experiment with using either the first 2/3/4 ResNet Conv blocks, and empirically observe that the 3 conv block setup works best. This indicates that image and text have different levels of representation granularity and thus utilizing contextualized patches is beneficial.
168
+
169
+ # 5 CONCLUSION
170
+
171
+ In this work, we present a simple yet effective framework of vision-language pretraining. Unlike prior works using object proposal systems and auxiliary losses, our model processes whole image as patches and is trained end-to-end with a single prefix language modeling objective. Our work suggests a promising alternative to existing VLP paradigm and we hope our work may inspire future research on generative VLP.
172
+
173
+ # ACKNOWLEDGMENTS
174
+
175
+ We would like to thank Hieu Pham, Chao Jia, Andrew Dai, Bowen Zhang, Zhifeng Chen, Ruoming Pang, Douglas Eck, Claire Cui and Yonghui Wu for helpful discussions, Krishna Srinivasan, Samira Daruki, Nan Du and Aashi Jain for help with data preparation, Chao Jia, Zhen Li, Jonathan Shen, Colin Raffel and Sharan Narang for assistance on experimental settings, and others in the Google Brain team for support throughout this project.
176
+
177
+ # REFERENCES
178
+
179
+ 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 Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8948–8957, 2019.
180
+
181
+ Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6077–6086, 2018.
182
+
183
+ Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015.
184
+
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
+
187
+ Mathilde Caron, Hugo Touvron, Ishan Misra, Herve J ´ egou, Julien Mairal, Piotr Bojanowski, and ´ Armand Joulin. Emerging properties in self-supervised vision transformers. arXiv preprint arXiv:2104.14294, 2021.
188
+
189
+ Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E Hinton. Big self-supervised models are strong semi-supervised learners. Advances in Neural Information Processing Systems, 33:22243–22255, 2020a.
190
+
191
+ Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollar, and ´ C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015.
192
+
193
+ Yen-Chun Chen, Linjie Li, Licheng Yu, Ahmed El Kholy, Faisal Ahmed, Zhe Gan, Yu Cheng, and Jingjing Liu. Uniter: Universal image-text representation learning. In ECCV, 2020b.
194
+
195
+ Jaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. arXiv preprint arXiv:2102.02779, 2021.
196
+
197
+ Marcella Cornia, Matteo Stefanini, Lorenzo Baraldi, and Rita Cucchiara. Meshed-memory transformer for image captioning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10578–10587, 2020.
198
+
199
+ Zihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. arXiv preprint arXiv:2106.04803, 2021.
200
+
201
+ Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805, 2018.
202
+
203
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021. URL https: //openreview.net/forum?id $=$ YicbFdNTTy.
204
+
205
+ Desmond Elliott, Stella Frank, Khalil Sima’an, and Lucia Specia. Multi30k: Multilingual englishgerman image descriptions. arXiv preprint arXiv:1605.00459, 2016.
206
+
207
+ Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning. arXiv preprint arXiv:2006.06195, 2020.
208
+
209
+ Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6904–6913, 2017.
210
+
211
+ Kai Han, Yunhe Wang, Hanting Chen, Xinghao Chen, Jianyuan Guo, Zhenhua Liu, Yehui Tang, An Xiao, Chunjing Xu, Yixing Xu, Zhaohui Yang, Yiman Zhang, and Dacheng Tao. A survey on visual transformer, 2021.
212
+
213
+ 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.
214
+
215
+ Xiaowei Hu, Xi Yin, Kevin Lin, Lijuan Wang, Lei Zhang, Jianfeng Gao, and Zicheng Liu. Vivo: Surpassing human performance in novel object captioning with visual vocabulary pre-training. In AAAI, February 2021.
216
+
217
+ Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In European conference on computer vision, pp. 646–661. Springer, 2016.
218
+
219
+ Lun Huang, Wenmin Wang, Jie Chen, and Xiao-Yong Wei. Attention on attention for image captioning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4634–4643, 2019.
220
+
221
+ Zhicheng Huang, Zhaoyang Zeng, Yupan Huang, Bei Liu, Dongmei Fu, and Jianlong Fu. Seeing out of the box: End-to-end pre-training for vision-language representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12976–12985, 2021.
222
+
223
+ Taichi Iki and Akiko Aizawa. Effect of vision-and-language extensions on natural language understanding in vision-and-language models. arXiv preprint arXiv:2104.08066, 2021.
224
+
225
+ Chao Jia, Yinfei Yang, Ye Xia, Yi-Ting Chen, Zarana Parekh, Hieu Pham, Quoc V Le, Yunhsuan Sung, Zhen Li, and Tom Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. arXiv preprint arXiv:2102.05918, 2021.
226
+
227
+ Norman P. Jouppi, Cliff Young, Nishant Patil, David Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh Bhatia, Nan Boden, Al Borchers, Rick Boyle, Pierre luc Cantin, Clifford Chao, Chris Clark, Jeremy Coriell, Mike Daley, Matt Dau, Jeffrey Dean, Ben Gelb, Tara Vazir Ghaemmaghami, Rajendra Gottipati, William Gulland, Robert Hagmann, C. Richard Ho, Doug Hogberg, John Hu, Robert Hundt, Dan Hurt, Julian Ibarz, Aaron Jaffey, Alek Jaworski, Alexander Kaplan, Harshit Khaitan, Andy Koch, Naveen Kumar, Steve Lacy, James Laudon, James Law, Diemthu Le, Chris Leary, Zhuyuan Liu, Kyle Lucke, Alan Lundin, Gordon MacKean, Adriana Maggiore, Maire Mahony, Kieran Miller, Rahul Nagarajan, Ravi Narayanaswami, Ray Ni, Kathy Nix, Thomas Norrie, Mark Omernick, Narayana Penukonda, Andy Phelps, Jonathan Ross, Matt Ross, Amir Salek, Emad Samadiani, Chris Severn, Gregory Sizikov, Matthew Snelham, Jed Souter, Dan Steinberg, Andy Swing, Mercedes Tan, Gregory Thorson, Bo Tian, Horia Toma, Erick Tuttle, Vijay Vasudevan, Richard Walter, Walter Wang, Eric Wilcox, and Doe Hyun Yoon. In-datacenter performance analysis of a tensor processing unit, 2017.
228
+
229
+ Salman Khan, Muzammal Naseer, Munawar Hayat, Syed Waqas Zamir, Fahad Shahbaz Khan, and Mubarak Shah. Transformers in vision: A survey, 2021.
230
+
231
+ Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision, 2021.
232
+
233
+ Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, Michael Bernstein, and Li Fei-Fei. Visual genome: Connecting language and vision using crowdsourced dense image annotations. 2016. URL https://arxiv.org/abs/1602.07332.
234
+
235
+ 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.
236
+
237
+ Guillaume Lample and Alexis Conneau. Cross-lingual language model pretraining. arXiv preprint arXiv:1901.07291, 2019.
238
+
239
+ Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language, 2019.
240
+
241
+ Wei Li, Can Gao, Guocheng Niu, Xinyan Xiao, Hao Liu, Jiachen Liu, Hua Wu, and Haifeng Wang. UNIMO: Towards unified-modal understanding and generation via cross-modal contrastive learning. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 2592–2607, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.202. URL https://aclanthology.org/2021. acl-long.202.
242
+
243
+ Xiujun Li, Xi Yin, Chunyuan Li, Xiaowei Hu, Pengchuan Zhang, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, Yejin Choi, and Jianfeng Gao. Oscar: Object-semantics aligned pretraining for vision-language tasks. ECCV 2020, 2020.
244
+
245
+ Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing, 2021.
246
+
247
+ 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.
248
+
249
+ Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017.
250
+
251
+ Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and R. Garnett (eds.), ´ Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips. cc/paper/2019/file/c74d97b01eae257e44aa9d5bade97baf-Paper.pdf.
252
+
253
+ Ofir Press and Lior Wolf. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859, 2016.
254
+
255
+ Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018.
256
+
257
+ 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.
258
+
259
+ 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.
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. arXiv preprint arXiv:1910.10683, 2019.
262
+
263
+ Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016.
264
+
265
+ Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. arXiv preprint arXiv:2102.12092, 2021.
266
+
267
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 28. Curran Associates, Inc., 2015. URL https://proceedings.neurips.cc/paper/2015/file/ 14bfa6bb14875e45bba028a21ed38046-Paper.pdf.
268
+
269
+ Steven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. Self-critical sequence training for image captioning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7008–7024, 2017.
270
+
271
+ Paul-Edouard Sarlin, Daniel DeTone, Tomasz Malisiewicz, and Andrew Rabinovich. Superglue: Learning feature matching with graph neural networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4938–4947, 2020.
272
+
273
+ Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2556–2565, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1238. URL https://aclanthology.org/P18-1238.
274
+
275
+ Jonathan Shen, Patrick Nguyen, Yonghui Wu, Zhifeng Chen, et al. Lingvo: a modular and scalable framework for sequence-to-sequence modeling, 2019.
276
+
277
+ Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can clip benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021.
278
+
279
+ Lucia Specia, Stella Frank, Khalil Sima’An, and Desmond Elliott. A shared task on multimodal machine translation and crosslingual image description. In Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers, pp. 543–553, 2016.
280
+
281
+ Krishna Srinivasan, Karthik Raman, Jiecao Chen, Michael Bendersky, and Marc Najork. Wit: Wikipedia-based image text dataset for multimodal multilingual machine learning. arXiv preprint arXiv:2103.01913, 2021.
282
+
283
+ Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pretraining of generic visual-linguistic representations. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ SygXPaEYvH.
284
+
285
+ Alane Suhr, Stephanie Zhou, Ally Zhang, Iris Zhang, Huajun Bai, and Yoav Artzi. A corpus for reasoning about natural language grounded in photographs. arXiv preprint arXiv:1811.00491, 2018.
286
+
287
+ Hao Tan and Mohit Bansal. LXMERT: Learning cross-modality encoder representations from transformers. 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. 5100–5111, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1514. URL https://aclanthology.org/ D19-1514.
288
+
289
+ Maria Tsimpoukelli, Jacob 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, 2021.
290
+
291
+ Shagun Uppal, Sarthak Bhagat, Devamanyu Hazarika, Navonil Majumdar, Soujanya Poria, Roger Zimmermann, and Amir Zadeh. Multimodal research in vision and language: A review of current and emerging trends, 2020.
292
+
293
+ 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.
294
+
295
+ 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.
296
+ Adina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426, 2017.
297
+ Tete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dollar, and Ross Girshick. Early ´ convolutions help transformers see better, 2021.
298
+ Ning Xie, Farley Lai, Derek Doran, and Asim Kadav. Visual entailment: A novel task for finegrained image understanding. arXiv preprint arXiv:1901.06706, 2019.
299
+ Haiyang Xu, Ming Yan, Chenliang Li, Bin Bi, Songfang Huang, Wenming Xiao, and Fei Huang. E2E-VLP: End-to-end vision-language pre-training enhanced by visual learning. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 503–513, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/ 2021.acl-long.42. URL https://aclanthology.org/2021.acl-long.42.
300
+ Zhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pp. 5754–5764, 2019.
301
+ Fei Yu, Jiji Tang, Weichong Yin, Yu Sun, Hao Tian, Hua Wu, and Haifeng Wang. Ernie-vil: Knowledge enhanced vision-language representations through scene graphs. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 3208–3216, 2021.
302
+ Pengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5579– 5588, June 2021.
303
+
304
+ ![](images/6e00f6fcc1995e6ba3e0bc0f6c6219f6f118bf5a70c76493897cd8e0cf10939a.jpg)
305
+ Figure 2: Generated examples of SimVLM of various applications: (a) zero-shot image captioning (b) zero-shot cross-modality transfer on German image captioning (c) generative VQA (d) zero-shot visual text completion (e) zero-shot open-ended VQA.
306
+
307
+ # A GENERATED EXAMPLES
308
+
309
+ Examples generated by SimVLM of various types are shown in Figure 2. We use either image-only or image-text prefix inputs in the encoder, and use the decoder to generate suffix text.
310
+
311
+ Table 7: Text-only task performance on the GLUE benchmark (Dev set). Results for BERT and other VLP methods are obtained from Iki & Aizawa (2021). The overall best result is bolded while underline signifies the best VLP model.
312
+
313
+ <table><tr><td></td><td>CoLA</td><td>SST-2</td><td>RTE</td><td>MRPC</td><td>QQP</td><td>MNLI</td><td>QNLI</td><td>WNLI</td></tr><tr><td>BERT</td><td>54.6</td><td>92.5</td><td>62.5</td><td>81.9/87.6</td><td>90.6/87.4</td><td>84.2</td><td>91.0</td><td>48.8</td></tr><tr><td>VisualBERT</td><td>38.6</td><td>89.4</td><td>56.6</td><td>71.9/82.1</td><td>89.4/86.0</td><td>81.6</td><td>87.0</td><td>53.1</td></tr><tr><td>UNITER</td><td>37.4</td><td>89.7</td><td>55.6</td><td>69.3/80.3</td><td>89.2/85.7</td><td>80.9</td><td>86.0</td><td>55.4</td></tr><tr><td>VL-BERT</td><td>38.7</td><td>89.8</td><td>55.7</td><td>70.6/81.8</td><td>89.0/85.4</td><td>81.2</td><td>86.3</td><td>53.1</td></tr><tr><td>VilBERT</td><td>36.1</td><td>90.4</td><td>53.7</td><td>69.0/79.4</td><td>88.6/85.0</td><td>79.9</td><td>83.8</td><td>55.4</td></tr><tr><td>LXMERT</td><td>39.0</td><td>90.2</td><td>57.2</td><td>69.8/80.4</td><td>75.3/75.3</td><td>80.4</td><td>84.2</td><td>46.0</td></tr><tr><td>SimVLMbase</td><td>46.7</td><td>90.9</td><td>63.9</td><td>75.2/84.4</td><td>90.4/87.2</td><td>83.4</td><td>88.6</td><td>58.1</td></tr></table>
314
+
315
+ # B EXPERIMENTAL DETAILS
316
+
317
+ # B.1 PRETRAINING
318
+
319
+ Our models are pretrained according to the methodology described in Section 3. For the Transformer, each variant follows the same setting as its corresponding ViT variant. For the Conv stage, we use the first three blocks (excluding the Conv stem) of ResNet-101 and ResNet-152 (He et al., 2016) for our Base and Large models respectively, and a larger variant of ResNet-152 with more channels for the Huge model (matching its hidden dimension size). We always use a fixed patch size of $1 6 \times 1 6$ . During pretraining, we utilize the resolution of $2 2 4 \times 2 2 4$ , resulting in a patch sequence of length $1 4 \times 1 4$ as visual tokens. For the textual input, we use a vocabulary size of 32,000 and a max sequence length of 256 in both the encoder and the decoder. We also share parameters between the embedding and the decoder softmax output layer (Press & Wolf, 2016). All parameters are shared across visual and textual inputs except the Conv stage and positional embeddings.
320
+
321
+ We pretrain on large-scale web datasets for both image-text and text-only inputs. For joint vision and language data, we exploit the training set of ALIGN (Jia et al., 2021), which contains about 1.8B noisy image-text pairs. Notice that we do not use any extra data preprocessing or filtering, except simple random resized cropping. For the text-only copora, we use the Colossal Clean Crawled Corpus (C4) dataset presented in Raffel et al. (2019) and followed their preprocessing steps. The dataset contains about 800GB of web crawled documents.
322
+
323
+ All models are pretrained for about 1M steps from scratch to optimize for the single PrefixLM objective in Eq.3. We use the AdamW optimizer (Loshchilov & Hutter, 2017) with $\beta _ { 1 } = 0 . 9 , \beta _ { 2 } =$ 0.999 and weight decay of 0.01. We warm up the learning rate for the first $2 \%$ of updates to a peak value of $5 \times 1 0 ^ { - 4 }$ , and then linearly decay it afterwards. Dropout is not used during the pretraining stage. We mix the two pretraining datasets within each batch, which contains 4,096 image-text pairs and 512 text-only documents, sharded across 512 TPU v3 chips (Jouppi et al., 2017).
324
+
325
+ # B.2 FINETUNING
326
+
327
+ After pretraining, our model is finetuned on various downstream tasks. Similar to the pretraining stage, we use the AdamW optimizer with the same Beta values, while we tune the learning rate in $\{ 1 \times 1 0 ^ { - 5 }$ , $2 \times 1 0 ^ { - 5 }$ , $5 \times 1 0 ^ { - 5 } \}$ . We also enable regularization methods of Dropout (set to 0.1) and stochastic depth (only applied to Conv stage and encoder with a fixed dropout rate of 0.1) (Huang et al., 2016) during the finetuning stage. Following standard practice, we use the corresponding dev split to find the best setting and report the result on the test split. We consider 5 types of downstream tasks listed below:
328
+
329
+ Visual question answering: This task requires the model to answer questions about input images, and has been the most widely used VL benchmark. Following prior work, we use the VQA v2 (Goyal et al., 2017) and formulate the task as a classification problem over 3,129 most frequent answers in the training set. The raw image and the corresponding question are used as inputs to the encoder and the decoder respectively, and a task-specific linear classifier is trained to predict answer based on activation corresponding to the last question token from the decoder. We use a resolution of $4 8 0 \times 4 8 0$ for the image and all positional parameters are adapted using linear interpolation.
330
+
331
+ Visual entailment: The SNLI-VE (Xie et al., 2019) dataset is adapted from SNLI (Bowman et al., 2015), which is originally designed to predict the relation between a premise sentence and a hypothesis sentence as either entailment, neutral or contradiction, a task known as natural language inference (NLI). For the VL variant, the premise is based on the content of an image rather than textual descriptions. We finetune SimVLM similarly to VQA, such that the image and the sentence are fed to encoder and decoder separately, and the classifier is trained to predict the three relations.
332
+
333
+ Visual reasoning: The NLVR2 (Suhr et al., 2018) dataset tests the model’s ability of jointly reasoning over the language and multiple images by asking whether a textual description is true based on a pair of two images. Following Zhang et al. (2021), we create two input pairs, each consisting of one image and the textual description, and generate output embeddings for both using the same setup above. The two embeddings are then concatenated for final prediction.
334
+
335
+ Image captioning: The captioning task requires a model to generate natural language descriptions of input images. We consider two datasets CoCo (Chen et al., 2015) and NoCaps (Agrawal et al., 2019), both finetuned using the CoCo training data. For SimVLM, it is straightforward to first encode the image in the encoder and then generate captions using the decoder. Note that in contrast to prior work that apply task-specific tricks such as CIDEr optimization (Rennie et al., 2017), our model is trained with naive cross-entropy loss only.
336
+
337
+ Multimodal translation: The goal of multimodal translation is to translate image descriptions in source language to target language, for which image inputs can be taken advantage of as grounding signal. We train and evaluate on the Multi30k (Elliott et al., 2016) dataset. We utilize the PrefixLM described in previous sections such that the source sentence, together with the image inputs, are fed to the encoder, which will be translated to the target language by the decoder.
338
+
339
+ # C MODEL PERFORMANCE ON LANGUAGE-ONLY TASK
340
+
341
+ We compare our model with prior VLP methods on natural language understanding (NLU) tasks on the GLUE benchmark (Wang et al., 2018) in Table 7.
342
+
343
+ # D ERRATUM
344
+
345
+ We found an error in reporting the zero-shot COCO evaluations in the first version of this paper. This mistake does NOT affect all other results and the numbers have been updated. Meanwhile, we also added few-shot results in addition to zero-shot results on both MsCOCO and NoCaps in Table 2, to provide a more comprehensive view of capacities in SimVLM models. Hence, our main claims and conclusions still hold.
parse/dev/GUrhfTuf_3/GUrhfTuf_3_content_list.json ADDED
@@ -0,0 +1,1804 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "SIMVLM: SIMPLE VISUAL LANGUAGE MODEL PRETRAINING WITH WEAK SUPERVISION ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 176,
8
+ 98,
9
+ 821,
10
+ 146
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Zirui Wang1,2∗, Jiahui $\\mathbf { Y u } ^ { 2 }$ , Adams Wei $\\mathbf { Y u } ^ { 2 }$ , Zihang Dai2, Yulia Tsvetkov3, Yuan Cao2 ",
17
+ "bbox": [
18
+ 184,
19
+ 169,
20
+ 781,
21
+ 185
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "1Carnegie Mellon University \n{ziruiw}@cs.cmu.edu \n2Google Research, Brain Team \n{jiahuiyu,adamsyuwei,zihangd,yuancao}@google.com \n3University of Washington \n{yuliats}@cs.washington.edu ",
28
+ "bbox": [
29
+ 184,
30
+ 186,
31
+ 650,
32
+ 270
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "ABSTRACT ",
39
+ "text_level": 1,
40
+ "bbox": [
41
+ 454,
42
+ 306,
43
+ 544,
44
+ 320
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "With recent progress in joint modeling of visual and textual representations, Vision-Language Pretraining (VLP) has achieved impressive performance on many multimodal downstream tasks. However, the requirement for expensive annotations including clean image captions and regional labels limits the scalability of existing approaches, and complicates the pretraining procedure with the introduction of multiple dataset-specific objectives. In this work, we relax these constraints and present a minimalist pretraining framework, named Simple Visual Language Model (SimVLM). Unlike prior work, SimVLM reduces the training complexity by exploiting large-scale weak supervision, and is trained end-to-end with a single prefix language modeling objective. Without utilizing extra data or task-specific customization, the resulting model significantly outperforms previous pretraining methods and achieves new state-of-the-art results on a wide range of discriminative and generative vision-language benchmarks, including VQA $( + 3 . 7 4 \\%$ vqa-score), NLVR2 $( + 1 . 1 7 \\%$ accuracy), SNLI-VE $( + 1 . 3 7 \\%$ accuracy) and image captioning tasks $( + 1 0 . 1 \\%$ average CIDEr score). Furthermore, we demonstrate that SimVLM acquires strong generalization and transfer ability, enabling zero-shot behavior including open-ended visual question answering and cross-modality transfer. ",
51
+ "bbox": [
52
+ 233,
53
+ 337,
54
+ 764,
55
+ 587
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "1 INTRODUCTION ",
62
+ "text_level": 1,
63
+ "bbox": [
64
+ 176,
65
+ 613,
66
+ 336,
67
+ 628
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Self-supervised textual representation learning (Devlin et al., 2018; Radford et al., 2018; 2019; Liu et al., 2019; Yang et al., 2019; Raffel et al., 2019; Brown et al., 2020) based on Transformers (Vaswani et al., 2017) has pushed the state of the art on a wide range of natural language processing (NLP) tasks (Rajpurkar et al., 2016; Wang et al., 2018; Sarlin et al., 2020). One successful approach is to first pretrain the model (e.g. BERT) on large-scale unlabled text corpora using masked language modeling (MLM) objective (Devlin et al., 2018), followed by finetuning on downstream tasks. While this pretraining-finetuning paradigm has been widely adopted, recent work on autoregressive language models (LM) (Radford et al., 2019; Brown et al., 2020) such as GPT-3 has shown strong performance without finetuning by utilizing few-shot prompts (Liu et al., 2021), suggesting the text guided zero-shot generalization is a promising alternative. ",
74
+ "bbox": [
75
+ 173,
76
+ 645,
77
+ 825,
78
+ 784
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "Motivated by the success of textual representation pretraining, various efforts have been made to build the multi-modal (visual and textual) counterpart. A line of work (Tan & Bansal, 2019; Lu et al., 2019; Li et al., 2019; Chen et al., 2020b; Li et al., 2020; Su et al., 2020; Zhang et al., 2021) has explored vision-language pretraining (VLP) that learns a joint representation of both modalities to be finetuned on vision-language (VL) benchmarks, such as visual question answering (VQA) (Goyal et al., 2017). In order to capture the alignment between images and text, previous methods have extensively exploited two types of human-labeled datasets from multiple sources, which typically consist of the following steps. Firstly, object detection datasets are used to train a supervised object detector (OD) which allows further extracting region-of-interest (ROI) features from images. Next, datasets with aligned image-text pairs are used for MLM pretraining of a fusion model that usually takes as input the concatenation of the extracted ROI features and the paired text. In addition, due to the limited scale of human annotated data, various task-specific auxiliary losses have been introduced in order to improve performance. These design choices complicate the pretraining protocol of VLP, creating a bottleneck for further quality improvement. What is more, such pretraining-finetuning based approaches usually lack the zero-shot capability, just like their language counterparts. In comparison, another line of work (Radford et al., 2021; Ramesh et al., 2021; Jia et al., 2021) utilizes weakly labeled/aligned data crawled from the web to perform pretraining, achieving good performance and certain zero-shot learning capability on image classification and image-text retrieval. Nonetheless, these methods mainly focus on specific tasks of consideration and thus may not serve as a generic pretraining-finetuning representation for VL benchmarks. ",
85
+ "bbox": [
86
+ 174,
87
+ 790,
88
+ 825,
89
+ 901
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "",
96
+ "bbox": [
97
+ 174,
98
+ 103,
99
+ 825,
100
+ 270
101
+ ],
102
+ "page_idx": 1
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "In light of these disadvantages of the existing techniques, we are interested in building a VLP model that: (1) can be seamlessly plugged into the pretraining-finetuning paradigm and achieve competitive performance on standard VL benchmarks; (2) does not require a complicated pretraining protocol as in previous methods; and (3) has the potential towards text guided zero-shot generalization in cross-modal settings. To this end, we propose SimVLM, standing for Simple Visual Language Model, which significantly simplifies VLP by solely exploiting language modeling objectives on weakly aligned image-text pairs (Jia et al., 2021). In a nutshell, SimVLM consists of the following components: ",
107
+ "bbox": [
108
+ 174,
109
+ 276,
110
+ 825,
111
+ 388
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "• Objective. It is trained end-to-end from scratch with a single objective of Prefix Language \nModeling (PrefixLM), which can not only naturally perform text generation as GPT-3, but also process contextual information in a bidirectional manner as BERT does. \n• Architecture. The framework employs ViT/CoAtNet (Dosovitskiy et al., 2021; Dai et al., \n2021) and directly takes raw images as inputs. These models can also fit the large-scale data and are readily compatible with the PrefixLM objective. \nData. These setups relieve the requirement for object detection and allow the model to \nutilize the large-scale weakly labeled dataset, which has better potential towards zero-shot \ngeneralization. ",
118
+ "bbox": [
119
+ 217,
120
+ 400,
121
+ 825,
122
+ 534
123
+ ],
124
+ "page_idx": 1
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "Not only is SimVLM simpler, requiring neither object detection pretraining nor auxiliary losses, but it also obtains better performance than previous work. Empirically, SimVLM consistently outperforms existing VLP models and achieves new state-of-the-art results on 6 VL benchmarks without additional data nor task-specific customization. Besides, it acquires stronger generalization in visual-language understanding that empowers zero-shot image captioning and open-ended VQA. In particular, SimVLM learns unified multimodal representation that enables zero-shot cross-modality transfer, where the model is finetuned on text-only data and directly evaluated on image-and-text test examples without further training. Our results suggest that generative VLP can not only match existing MLM-based methods on VL tasks but also demonstrate promising zero-shot potential. ",
129
+ "bbox": [
130
+ 173,
131
+ 545,
132
+ 825,
133
+ 671
134
+ ],
135
+ "page_idx": 1
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "2 RELATED WORK ",
140
+ "text_level": 1,
141
+ "bbox": [
142
+ 176,
143
+ 690,
144
+ 344,
145
+ 707
146
+ ],
147
+ "page_idx": 1
148
+ },
149
+ {
150
+ "type": "text",
151
+ "text": "Recent years have seen a rapid progress made in vision-language pretraining (Uppal et al., 2020; Han et al., 2021; Khan et al., 2021). While a variety of approaches have been proposed, a large portion of them require object detection for image region feature regression or tagging as part of the pre-training objectives (Tan & Bansal, 2019; Su et al., 2020; Li et al., 2019; Chen et al., 2020b; Gan et al., 2020; Li et al., 2020; Yu et al., 2021; Li et al., 2021; Zhang et al., 2021; Hu et al., 2021; Cho et al., 2021). These methods rely on a strong object detection model like Fast(er) R-CNN (Ren et al., 2015), which is often trained on human annotated data sets like Visual Genome (Krishna et al., 2016). Using such labeled training data as a prerequisite increases the cost of building the training pipeline, and makes the approach less scalable. Some recent efforts have also explored VLP without object detection module (Xu et al., 2021; Kim et al., 2021; Huang et al., 2021), but they only use clean pretraining data with small scales and thus their zero-shot capability is limited. ",
152
+ "bbox": [
153
+ 174,
154
+ 722,
155
+ 825,
156
+ 875
157
+ ],
158
+ "page_idx": 1
159
+ },
160
+ {
161
+ "type": "text",
162
+ "text": "On the other hand, multiple cross-modality loss functions have been proposed as part of the training objectives, for example image-text matching (Tan & Bansal, 2019; Lu et al., 2019; Xu et al., 2021), masked region classification/feature regression (Tan & Bansal, 2019; Chen et al., 2020b), object attribute prediction (Xu et al., 2021), contrastive loss (Li et al., 2020; 2021), word-region alignment (Chen et al., 2020b) word-patch alignment (Kim et al., 2021). They are often mixed with other objectives including image caption generation and masked language modeling to form compound pre-training losses. This creates the challenge of balancing among different losses and datasets, and thus complicates the optimization procedure. ",
163
+ "bbox": [
164
+ 176,
165
+ 882,
166
+ 825,
167
+ 924
168
+ ],
169
+ "page_idx": 1
170
+ },
171
+ {
172
+ "type": "image",
173
+ "img_path": "images/e827c64d1d645458d694e88950b02c4e209c70121a7c8ba4e0a6a0de1a73a2b2.jpg",
174
+ "image_caption": [
175
+ "Figure 1: Illustration of the SimVLM model. This shows an example of training with PrefixLM of an image-text pair. For text-only corpora, it is straightforward to remove the image patches and utilize textual tokens only. "
176
+ ],
177
+ "image_footnote": [],
178
+ "bbox": [
179
+ 253,
180
+ 98,
181
+ 745,
182
+ 295
183
+ ],
184
+ "page_idx": 2
185
+ },
186
+ {
187
+ "type": "text",
188
+ "text": "",
189
+ "bbox": [
190
+ 174,
191
+ 381,
192
+ 825,
193
+ 450
194
+ ],
195
+ "page_idx": 2
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "Our work by contrast, follows a minimalist approach that takes raw image inputs and makes use of only the language modeling loss, without resorting to auxiliary models like faster R-CNN for image region detection. Motivated by recent works (Radford et al., 2021; Ramesh et al., 2021; Jia et al., 2021; Tsimpoukelli et al., 2021) that illustrate zero-shot learning in certain image-text tasks, we train our model using large-scale weakly labeled data only. While concurrent work (Shen et al., 2021) has explored building on top of models pretrained with such dataset, we focus on pretraining from scratch to explore the limit of generative VLP. ",
200
+ "bbox": [
201
+ 173,
202
+ 457,
203
+ 825,
204
+ 556
205
+ ],
206
+ "page_idx": 2
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "3 SIMVLM ",
211
+ "text_level": 1,
212
+ "bbox": [
213
+ 174,
214
+ 574,
215
+ 285,
216
+ 590
217
+ ],
218
+ "page_idx": 2
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "3.1 BACKGROUND ",
223
+ "text_level": 1,
224
+ "bbox": [
225
+ 176,
226
+ 606,
227
+ 315,
228
+ 621
229
+ ],
230
+ "page_idx": 2
231
+ },
232
+ {
233
+ "type": "text",
234
+ "text": "The bidirectional Masked Language Modeling (MLM) has been one of the most popular selfsupervised training objectives for textual representation learning. As demonstrated by BERT (Devlin et al., 2018), it is based on the idea of denoising autoencoder such that the model is trained to recover the corrupted tokens in a document. Specifically, given a text sequence $\\mathbf { X }$ , a subset of tokens $\\mathbf { X } _ { m }$ are randomly sampled and a corrupted sequence ${ \\bf x } _ { \\backslash m }$ is constructed by replacing tokens in $\\mathbf { x } _ { m }$ with a special [MASK] token. The training objective is to reconstruct $\\mathbf { X } _ { m }$ from the context ${ \\bf x } _ { \\backslash m }$ by minimizing the negative log-likelihood: ",
235
+ "bbox": [
236
+ 173,
237
+ 631,
238
+ 825,
239
+ 729
240
+ ],
241
+ "page_idx": 2
242
+ },
243
+ {
244
+ "type": "equation",
245
+ "img_path": "images/4d16af29546d44a48e22f95c3f8f7fc664fc05ed909afd8df9631865590a2b1b.jpg",
246
+ "text": "$$\n\\begin{array} { r } { \\mathcal { L } _ { \\mathrm { M L M } } ( \\theta ) = - \\mathbb { E } _ { \\mathbf { x } \\sim D } \\left[ \\log P _ { \\theta } ( \\mathbf { x } _ { m } \\vert \\mathbf { x } _ { \\backslash m } ) \\right] , } \\end{array}\n$$",
247
+ "text_format": "latex",
248
+ "bbox": [
249
+ 364,
250
+ 732,
251
+ 632,
252
+ 752
253
+ ],
254
+ "page_idx": 2
255
+ },
256
+ {
257
+ "type": "text",
258
+ "text": "where $\\theta$ is the trainable parameters of the model and $D$ is the pretraining data. This approach learns contextualized representations that can be further finetuned for downstream tasks. The MLM-style pretraining has been widely adopted in previous VLP models, whereby the input is an image-text pair and the model needs to predict masked tokens by leveraging image ROI features. ",
259
+ "bbox": [
260
+ 174,
261
+ 753,
262
+ 825,
263
+ 810
264
+ ],
265
+ "page_idx": 2
266
+ },
267
+ {
268
+ "type": "text",
269
+ "text": "Alternatively, the unidirectional Language Modeling (LM) trains the model to directly maximize the likelihood of the sequence $\\mathbf { X }$ under the forward autoregressive factorization: ",
270
+ "bbox": [
271
+ 171,
272
+ 816,
273
+ 823,
274
+ 845
275
+ ],
276
+ "page_idx": 2
277
+ },
278
+ {
279
+ "type": "equation",
280
+ "img_path": "images/05f53b6325cbb5ff77d5d762ad0a6e6d2fe511943c26f223b016fa73f7821a7b.jpg",
281
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { L M } } ( \\theta ) = - \\mathbb { E } _ { { \\mathbf { x } } \\sim D } \\left[ \\log P _ { \\theta } ( \\mathbf { x } ) \\right] = - \\mathbb { E } _ { { \\mathbf { x } } \\sim D } \\left[ \\sum _ { t = 1 } ^ { T } \\log P _ { \\theta } ( \\mathbf { x } _ { t } | \\mathbf { x } _ { < t } ) \\right] .\n$$",
282
+ "text_format": "latex",
283
+ "bbox": [
284
+ 285,
285
+ 848,
286
+ 712,
287
+ 893
288
+ ],
289
+ "page_idx": 2
290
+ },
291
+ {
292
+ "type": "text",
293
+ "text": "Compared with MLM, the LM pretraining has also been shown to be highly effective for multiple NLP tasks (Radford et al., 2018). More importantly, it facilitates the model with strong generation ",
294
+ "bbox": [
295
+ 174,
296
+ 895,
297
+ 823,
298
+ 924
299
+ ],
300
+ "page_idx": 2
301
+ },
302
+ {
303
+ "type": "text",
304
+ "text": "capability that enables text induced zero-shot generalization without finetuning (Brown et al., 2020). While MLM has become the de facto approach in VLP models reviewed above, the generative LM has been understudied. ",
305
+ "bbox": [
306
+ 174,
307
+ 103,
308
+ 825,
309
+ 146
310
+ ],
311
+ "page_idx": 3
312
+ },
313
+ {
314
+ "type": "text",
315
+ "text": "3.2 PROPOSED OBJECTIVE: PREFIX LANGUAGE MODELING ",
316
+ "text_level": 1,
317
+ "bbox": [
318
+ 174,
319
+ 164,
320
+ 601,
321
+ 179
322
+ ],
323
+ "page_idx": 3
324
+ },
325
+ {
326
+ "type": "text",
327
+ "text": "Motivated by the zero-shot capability introduced by pre-training with LM loss, we propose to pretain vision-language representation using the Prefix Language Modeling (PrefixLM). PrefixLM differs from the standard LM such that it enables bi-directional attention on the prefix sequence (e.g. $\\mathbf { X } { < } T _ { p }$ in Eq. (3)), and only conducts autoregressive factorization on the remaining tokens (e.g. $\\mathbf { X } _ { \\geq T _ { p } }$ in Eq. (3)). During pretraining, a prefix sequence of tokens of (a randomly selected) length $T _ { p }$ is truncated from input sequence and the training objective becomes: ",
328
+ "bbox": [
329
+ 174,
330
+ 190,
331
+ 825,
332
+ 275
333
+ ],
334
+ "page_idx": 3
335
+ },
336
+ {
337
+ "type": "equation",
338
+ "img_path": "images/92a9c371d7e0e5a0fe0b8a53844fd14276312d8798ff24713b644a4ea09f1fdb.jpg",
339
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { P r e f i x L M } } ( \\theta ) = - \\mathbb { E } _ { { \\mathbf { x } } \\sim D } \\left[ \\log P _ { \\theta } ( \\mathbf { x } _ { \\ge T _ { p } } | \\mathbf { x } _ { < T _ { p } } ) \\right] = - \\mathbb { E } _ { { \\mathbf { x } } \\sim D } \\left[ \\sum _ { t = T _ { p } } ^ { T } \\log P _ { \\theta } ( \\mathbf { x } _ { t } | \\mathbf { x } _ { [ T _ { p } , t ] } , \\mathbf { x } _ { < T _ { p } } ) \\right] .\n$$",
340
+ "text_format": "latex",
341
+ "bbox": [
342
+ 194,
343
+ 281,
344
+ 782,
345
+ 333
346
+ ],
347
+ "page_idx": 3
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "Intuitively, images can be considered as prefix for their textual descriptions as they often appear before text in a web document. Therefore, for a given image-text pair, we prepend image feature sequence of length $T _ { i }$ to the text sequence, and enforce the model to sample a prefix of length $T _ { p } \\geq T _ { i }$ to calculate LM loss on text data only (an example is shown in Figure 1). Compared to prior MLM style VLP methods, our PrefixLM model under the sequence-to-sequence framework not only enjoys the bidirectional contextualized representation as in MLM, but also can perform text generation similar to LM. ",
352
+ "bbox": [
353
+ 174,
354
+ 338,
355
+ 825,
356
+ 436
357
+ ],
358
+ "page_idx": 3
359
+ },
360
+ {
361
+ "type": "text",
362
+ "text": "3.3 ARCHITECTURE ",
363
+ "text_level": 1,
364
+ "bbox": [
365
+ 174,
366
+ 454,
367
+ 326,
368
+ 469
369
+ ],
370
+ "page_idx": 3
371
+ },
372
+ {
373
+ "type": "text",
374
+ "text": "We adopt Transformer as the backbone of our model due to its success for both language and vision tasks (Devlin et al., 2018; Dosovitskiy et al., 2021). Differently from standard LM, PrefixLM enables bidirectional attention within the prefix sequence, and thus it is applicable for both decoder-only and encoder-decoder sequence-to-sequence language models. In our preliminary experiments, we found that the inductive bias introduced by encoder-decoder model which decouples encoding from generation is conducive to the improvement of downstream task. ",
375
+ "bbox": [
376
+ 174,
377
+ 481,
378
+ 825,
379
+ 564
380
+ ],
381
+ "page_idx": 3
382
+ },
383
+ {
384
+ "type": "text",
385
+ "text": "An overview of our model architecture is depicted in Figure 1. For the visual modality, inspired by ViT (Dosovitskiy et al., 2021) and CoAtNet (Dai et al., 2021), our model receives the raw image $\\mathbf { x } \\in \\mathbb { R } ^ { H \\times W \\times C }$ and maps it into flattened 1D sequence of patches $\\mathbf { x } _ { p } \\in \\mathbb { R } ^ { T _ { i } \\times D }$ as input for the transformer, where $D$ is the fixed hidden size of the transformer layers and $\\begin{array} { r } { T _ { i } = \\frac { H W } { P ^ { 2 } } } \\end{array}$ is the length of the image tokens for a given patch size $P$ . Following Dai et al. (2021), we use a convolution (Conv) stage consist of the first three blocks of ResNet (He et al., 2016) to extract contextualized patches, which we find advantageous over the naive linear projection (equivalent to $1 \\times 1$ Conv layer) used in ViT, consistent with the observation from (Xiao et al., 2021). For the textual modality, we follow the standard practice to tokenize the input sentence into sub-word tokens (Kudo & Richardson, 2018), and the embeddings are learned for a fixed vocabulary. To retain positional information, we add two trainable 1D positional embeddings for image and text inputs separately, and we additionally add 2D relative attention for the image patches within transformer layers (Dai et al., 2021). Notice that we do not add extra modality type embeddings for which we found no improvement in our experiment. We study the effects of various components of the model in Section 4.4. ",
386
+ "bbox": [
387
+ 173,
388
+ 570,
389
+ 825,
390
+ 767
391
+ ],
392
+ "page_idx": 3
393
+ },
394
+ {
395
+ "type": "text",
396
+ "text": "3.4 DATASETS ",
397
+ "text_level": 1,
398
+ "bbox": [
399
+ 174,
400
+ 785,
401
+ 287,
402
+ 800
403
+ ],
404
+ "page_idx": 3
405
+ },
406
+ {
407
+ "type": "text",
408
+ "text": "Since our approach does not rely on an object detection module and only operates with raw image patch inputs, we pretrain all model parameters from scratch using large-scale noisy image-text data, which has better potential for zero-shot generalization. Specifically, we use the image and alt-text pairs introduced in Jia et al. (2021), which are crawled from the web with minimal post-processing. On the other hand, our formulation of PrefixLM is modality-agnostic and thus we can additionally include text-only corpora to compensate for noisy text supervision in the alt-text data. As shown later in our experiments, this unified PrefixLM formulation reduces the modality discrepancy and improves the model quality. ",
409
+ "bbox": [
410
+ 174,
411
+ 811,
412
+ 825,
413
+ 924
414
+ ],
415
+ "page_idx": 3
416
+ },
417
+ {
418
+ "type": "table",
419
+ "img_path": "images/627a6d8c4f17f38169199f6c2b9bdc46f2956b464e4ff50c496435758aa89db2.jpg",
420
+ "table_caption": [
421
+ "Table 1: Single model results for vision-language pretraining methods on popular VL banchmarks. We report vqa-score for VQA, accuracy for NLVR2 and SNLI-VE, BLEU $@ 4$ for Multi30k and various metrics for image captioning $\\mathrm { B } @ 4$ : BLEU $@ 4$ , M: METEOR, C: CIDEr, S: SPICE). "
422
+ ],
423
+ "table_footnote": [],
424
+ "table_body": "<table><tr><td></td><td colspan=\"2\">VQA</td><td colspan=\"2\">NLVR2</td><td colspan=\"2\">SNLI-VE</td><td colspan=\"3\">CoCo Caption</td><td colspan=\"2\">NoCaps</td><td rowspan=\"2\">Multi30k En-De</td></tr><tr><td></td><td>test-dev</td><td>test-std</td><td>dev</td><td>test-P</td><td>dev test</td><td>B@4</td><td>M</td><td>C</td><td>S</td><td>C</td><td>S</td></tr><tr><td colspan=\"10\">Base-sized Models</td><td colspan=\"3\"></td></tr><tr><td>LXMERT</td><td>72.42</td><td>72.54</td><td>74.90</td><td>74.50</td><td>-</td><td></td><td></td><td>=</td><td>-</td><td></td><td></td><td></td><td>=</td></tr><tr><td>VL-T5</td><td>-</td><td>70.30</td><td>74.6</td><td>73.6</td><td>-</td><td></td><td></td><td></td><td>116.5</td><td>-</td><td>-</td><td>-</td><td>45.5</td></tr><tr><td>SOHO</td><td>73.25</td><td>73.47</td><td>76.37</td><td>77.32</td><td>85.00</td><td>84.95</td><td></td><td></td><td>=</td><td>=</td><td>=</td><td>-</td><td></td></tr><tr><td>SimVLMbase</td><td>77.87</td><td>78.14</td><td>81.72</td><td>81.77</td><td>84.20</td><td>84.15</td><td>39.0</td><td>32.9</td><td>134.8</td><td>24.0</td><td>94.8</td><td>13.1</td><td>46.6</td></tr><tr><td colspan=\"10\">Large-sized Models</td><td colspan=\"3\"></td></tr><tr><td>UNITER</td><td>73.82</td><td>74.02</td><td>79.12</td><td>79.98</td><td>79.39</td><td>79.38</td><td>=</td><td></td><td>=</td><td></td><td></td><td>=</td><td>-</td></tr><tr><td>OSCAR</td><td>73.61</td><td>73.82</td><td>79.12</td><td>80.37</td><td>=</td><td>=</td><td>41.7</td><td>30.6</td><td>140.0</td><td>24.5</td><td>80.9</td><td>11.3</td><td>=</td></tr><tr><td>Villa</td><td>74.69</td><td>74.87</td><td>79.76</td><td>81.47</td><td>80.18</td><td>80.02</td><td>-</td><td></td><td></td><td>=</td><td>-</td><td>-</td><td>=</td></tr><tr><td>UNIMO</td><td>75.06</td><td>75.27</td><td>-</td><td>=</td><td>81.11</td><td>80.63</td><td>39.6</td><td>-</td><td>127.7</td><td>-</td><td>-</td><td>-</td><td>=</td></tr><tr><td>VinVL SimVLMlarge</td><td>76.56</td><td>76.60 79.56</td><td>82.67 84.13</td><td>83.98</td><td></td><td>=</td><td>41.0</td><td>31.1</td><td>140.9</td><td>25.2</td><td>92.5</td><td>13.1</td><td></td></tr><tr><td></td><td>79.32</td><td></td><td></td><td>84.84</td><td>85.68</td><td>85.62</td><td>40.3</td><td>33.4</td><td>142.6</td><td>24.7</td><td>108.5</td><td>14.2</td><td>47.5</td></tr><tr><td colspan=\"10\">Huge-sized Models</td><td colspan=\"3\"></td></tr><tr><td>SimVLMhuge</td><td>80.03</td><td>80.34</td><td>84.53</td><td>85.15</td><td>86.21</td><td>86.32</td><td>40.6</td><td>33.7</td><td>143.3</td><td>25.4</td><td>110.3</td><td>14.5</td><td>47.6</td></tr></table>",
425
+ "bbox": [
426
+ 205,
427
+ 101,
428
+ 790,
429
+ 273
430
+ ],
431
+ "page_idx": 4
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "Compared to prior VLP methods consisting of two pretraining stages and multiple auxiliary objectives, our model only requires one-pass pretraining using a single language modeling loss in an end-to-end manner, hence the name Simple Visual Language Model (SimVLM). ",
436
+ "bbox": [
437
+ 173,
438
+ 348,
439
+ 825,
440
+ 391
441
+ ],
442
+ "page_idx": 4
443
+ },
444
+ {
445
+ "type": "text",
446
+ "text": "4 EXPERIMENTS ",
447
+ "text_level": 1,
448
+ "bbox": [
449
+ 176,
450
+ 412,
451
+ 326,
452
+ 428
453
+ ],
454
+ "page_idx": 4
455
+ },
456
+ {
457
+ "type": "text",
458
+ "text": "We conduct systematic experiments on a diversified set of visual-linguistic benchmarks, including visual question answering, image captioning, visual reasoning, visual entailment, and multimodal translation. We not only examine our model as a general-purpose VL representation learning in the pretraining-finetuning paradigm, but also study its zero-shot generalization towards open-ended VL understanding. ",
459
+ "bbox": [
460
+ 174,
461
+ 444,
462
+ 825,
463
+ 515
464
+ ],
465
+ "page_idx": 4
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "4.1 SETUP ",
470
+ "text_level": 1,
471
+ "bbox": [
472
+ 174,
473
+ 531,
474
+ 261,
475
+ 546
476
+ ],
477
+ "page_idx": 4
478
+ },
479
+ {
480
+ "type": "text",
481
+ "text": "Our models are implemented with the Lingvo framework (Shen et al., 2019). We follow the setup in ViT (Dosovitskiy et al., 2021) to explore 3 variants of SimVLM, namely “Base”, “Large”, and “Huge”, such that each variant follows the same setting as its corresponding ViT variant. All models are pretrained from scratch for about 1M steps on the training set of ALIGN (Jia et al., 2021) and the Colossal Clean Crawled Corpus (C4) dataset presented in Raffel et al. (2019). We mix the two pretraining datasets within each batch, which contains 4,096 image-text pairs (ALIGN) and 512 text-only documents (C4), sharded across 512 TPU v3 chips (Jouppi et al., 2017). More pretraining settings are detailed in Appendix B.1. ",
482
+ "bbox": [
483
+ 174,
484
+ 558,
485
+ 825,
486
+ 670
487
+ ],
488
+ "page_idx": 4
489
+ },
490
+ {
491
+ "type": "text",
492
+ "text": "After pretrained, our model is finetuned and evaluated on six vision-language benchmarks, including three discriminative tasks: VQA v2 (Goyal et al., 2017), SNLI-VE (Xie et al., 2019), and NLVR2 (Suhr et al., 2018); as well as three generative tasks: CoCo captioning (Chen et al., 2015), NoCaps (Agrawal et al., 2019), and Multi30k (Elliott et al., 2016). We additionally examine its zero-shot generalization and performance on single-modality tasks. Details of tasks considered and the finetuning process are outlined in Appendix B.2. ",
493
+ "bbox": [
494
+ 174,
495
+ 676,
496
+ 825,
497
+ 761
498
+ ],
499
+ "page_idx": 4
500
+ },
501
+ {
502
+ "type": "text",
503
+ "text": "4.2 COMPARISON WITH EXISTING APPROACHES",
504
+ "text_level": 1,
505
+ "bbox": [
506
+ 178,
507
+ 779,
508
+ 514,
509
+ 792
510
+ ],
511
+ "page_idx": 4
512
+ },
513
+ {
514
+ "type": "text",
515
+ "text": "To examine the quality of vision-language pretraining, we first compare SimVLM on the popular multi-modal tasks with state-of-the-art (SOTA) VLP methods including LXMERT (Tan & Bansal, 2019), VL-T5 (Cho et al., 2021), UNITER (Chen et al., 2020b), OSCAR (Li et al., 2020), Villa (Gan et al., 2020), SOHO (Huang et al., 2021), UNIMO (Li et al., 2021), and VinVL (Zhang et al., 2021). ",
516
+ "bbox": [
517
+ 174,
518
+ 804,
519
+ 825,
520
+ 861
521
+ ],
522
+ "page_idx": 4
523
+ },
524
+ {
525
+ "type": "text",
526
+ "text": "As can be seen in Table 1, SimVLM outperforms all existing models and achieves new SOTA results on all tasks considered, often by a significant margin. This demonstrates our generative pretraining approach is competitive with MLM-based models and that simple framework with weak supervision is sufficient to learn high-quality multi-modal representations. ",
527
+ "bbox": [
528
+ 174,
529
+ 867,
530
+ 823,
531
+ 924
532
+ ],
533
+ "page_idx": 4
534
+ },
535
+ {
536
+ "type": "table",
537
+ "img_path": "images/0a8f8a4bf30cde0a6fe0c2065fb3843b435ae06ff11317f1107cf843084b4dc5.jpg",
538
+ "table_caption": [
539
+ "Table 2: Image captioning results on CoCo Karpathy-test split and NoCaps validation split. For NoCaps, $\\{ \\mathrm { I n } . $ , Near, $\\mathrm { O u t } \\}$ refer to in-domain, near-domain and out-of-domain respectively. † indicates Cider optimization. Model references: aAnderson et al. (2018) bHuang et al. (2019) $\\mathrm { c } _ { \\vert }$ Cornia et al. (2020). "
540
+ ],
541
+ "table_footnote": [],
542
+ "table_body": "<table><tr><td rowspan=\"2\"></td><td rowspan=\"2\">Setup</td><td colspan=\"4\">CoCo Caption</td><td colspan=\"4\">NoCaps</td></tr><tr><td>B@4</td><td>M</td><td>C</td><td>S</td><td>In</td><td>Near</td><td>Out</td><td>Overall</td></tr><tr><td>BUTDa</td><td rowspan=\"3\">supervised</td><td>36.3</td><td>27.7</td><td>120.1</td><td>21.4</td><td>-</td><td></td><td>-</td><td>-</td></tr><tr><td>AoANetbt</td><td>39.5</td><td>29.3</td><td>129.3</td><td>23.2</td><td>-</td><td>=</td><td>-</td><td>-</td></tr><tr><td>M2 Transformerc†</td><td>39.1</td><td>29.2</td><td>131.2</td><td>22.6</td><td>81.2</td><td>-</td><td>69.4</td><td>75.0</td></tr><tr><td>SimVLMbase</td><td rowspan=\"3\">zero-shot</td><td>9.5</td><td>11.5</td><td>24.0</td><td>7.5</td><td>83.2</td><td>84.1</td><td>82.5</td><td>83.5</td></tr><tr><td>SimVLMlarge</td><td>10.5</td><td>12.0</td><td>24.9</td><td>8.3</td><td>97.6</td><td>96.5</td><td>96.3</td><td>96.6</td></tr><tr><td>SimVLMhuge</td><td>11.2</td><td>14.7</td><td>32.2</td><td>8.5</td><td>101.2</td><td>100.4</td><td>102.3</td><td>101.4</td></tr><tr><td>SimVLMbase</td><td rowspan=\"3\">few-shot</td><td>34.7</td><td>29.2</td><td>118.7</td><td>21.9</td><td>95.0</td><td>91.9</td><td>98.5</td><td>93.7</td></tr><tr><td>SimVLMIarge</td><td>35.4</td><td>30.2</td><td>124.1</td><td>22.7</td><td>102.5</td><td>100.9</td><td>106.0</td><td>102.2</td></tr><tr><td>SimVLMhuge</td><td>36.8</td><td>31.5</td><td>131.3</td><td>24.0</td><td>111.8</td><td>110.6</td><td>111.0</td><td>110.4</td></tr><tr><td>OSCAR+</td><td rowspan=\"3\">pretrain-finetune</td><td>41.7</td><td>30.6</td><td>140.0</td><td>24.5</td><td>85.4</td><td>84.0</td><td>80.3</td><td>83.4</td></tr><tr><td>VinVL†</td><td>41.0</td><td>31.1</td><td>140.9</td><td>25.2</td><td>103.7</td><td>95.6</td><td>83.8</td><td>94.3</td></tr><tr><td>SimVLMhuge</td><td>40.6</td><td>33.7</td><td>143.3</td><td>25.4</td><td>113.7</td><td>110.9</td><td>115.2</td><td>112.2</td></tr></table>",
543
+ "bbox": [
544
+ 253,
545
+ 102,
546
+ 741,
547
+ 272
548
+ ],
549
+ "page_idx": 5
550
+ },
551
+ {
552
+ "type": "text",
553
+ "text": "For the discriminative tasks, the $\\mathrm { S i m V L M _ { b a s e } }$ already outperforms all prior methods while using less capacity, and the $\\mathrm { S i m V L M _ { h u g e } }$ obtains almost 4 points absolute score improvement compared to the previous SOTA (VinVL), pushing the single model performance above $80 \\%$ on VQA for the first time. In addition, SimVLM also consistently outperforms prior methods on NLVR2 and SNLI-VE, illustrating its capability of processing more complex visual-linguistic reasoning. For the generation tasks including image captioning and image translation, SimVLM also shows large improvements using naive finetuning techniques. Our model outperforms on 3 out of 4 metrics on the public “Karpathy” 5k test split of CoCo captioning as well as the NoCaps benchmark than prior methods trained with more complex reinforcement learning approach of CIDEr optimization (Rennie et al., 2017). Finally, SimVLM is also effective for image translation of Multi30k from English to German. These experiments demonstrate that our model can be seamlessly plugged into the pretraining-finetuning paradigm with superior performance, utilizing minimalist pretraining and finetuning procedures. ",
554
+ "bbox": [
555
+ 174,
556
+ 361,
557
+ 825,
558
+ 541
559
+ ],
560
+ "page_idx": 5
561
+ },
562
+ {
563
+ "type": "text",
564
+ "text": "4.3 ZERO-SHOT GENERALIZATION ",
565
+ "text_level": 1,
566
+ "bbox": [
567
+ 176,
568
+ 558,
569
+ 428,
570
+ 573
571
+ ],
572
+ "page_idx": 5
573
+ },
574
+ {
575
+ "type": "text",
576
+ "text": "A crucial benefit of generative modeling and scaling with weak supervision is the potential of zeroshot generalization. Models (Brown et al., 2020; Radford et al., 2021; Jia et al., 2021) have been shown capable of performing few-shot or zero-shot transfer from pretrained models to downstream datasets, even across language boundaries (Lample & Conneau, 2019). In this section, we showcase three different settings of zero-shot applications less explored in prior VLP work, including transferring to unseen tasks, modalities and/or testing instances. ",
577
+ "bbox": [
578
+ 174,
579
+ 584,
580
+ 825,
581
+ 667
582
+ ],
583
+ "page_idx": 5
584
+ },
585
+ {
586
+ "type": "text",
587
+ "text": "4.3.1 ZERO-SHOT/FEW-SHOT IMAGE CAPTIONING ",
588
+ "text_level": 1,
589
+ "bbox": [
590
+ 174,
591
+ 684,
592
+ 534,
593
+ 698
594
+ ],
595
+ "page_idx": 5
596
+ },
597
+ {
598
+ "type": "text",
599
+ "text": "The pretraining procedure of SimVLM can be interpreted as a noisy image captioning objective on real-world web corpus. Thus, it is natural to ask how well this caption ability generalizes to other datasets in a zero-shot/few-shot manner. To this end, we take the pretrained SimVLM model, and directly decode on image captioning benchmarks for the zero-shot setting while finetune on $1 \\%$ training data for 5 epochs for the few-shot setting. We also found that using a prefix prompt “A picture of” improves the quality of decoded captions, similar to the finding in Radford et al. (2021). ",
600
+ "bbox": [
601
+ 174,
602
+ 708,
603
+ 825,
604
+ 806
605
+ ],
606
+ "page_idx": 5
607
+ },
608
+ {
609
+ "type": "text",
610
+ "text": "As shown in Table 2, the zero-shot/few-shot performance (Appendix D) of SimVLM is competitive with fully supervised baselines on CoCo, and it also demonstrates strong generalization on the concept-rich NoCaps benchmark by achieving better scores than pretrained models. Figure 2 (a) illustrates sample captions generated by our model (Appendix A). SimVLM is able to not only capture real-world concepts but also provide a detailed description of the visual input. For example, the decoded samples are able to explain complex scenes with multiple objects (e.g. “people”, “table with drinks”, “dark restaurant”). Besides, the model also shows understanding of fine-grained abstraction such as specific car brand and model (e.g. “Aston Martin”, “Vantage”). SimVLM even performs robustly on challenging images that could be tricky for human, such as abstract or dark pictures. These all illustrate that our model learns a wide range of real-world concepts that generalize well in a zero-shot manner. ",
611
+ "bbox": [
612
+ 174,
613
+ 811,
614
+ 823,
615
+ 924
616
+ ],
617
+ "page_idx": 5
618
+ },
619
+ {
620
+ "type": "table",
621
+ "img_path": "images/e8f6248270c5c9a3b242844ae49a896fe9360df297afcdd4e94b89609bd1e814.jpg",
622
+ "table_caption": [
623
+ "Table 3: Zero-shot cross-modality transfer results on SNLI-VE and Multi30k. For SNLI-VE, the zero-shot model is finetuned on three source datasets: text-only SNLI-VE (Xie et al., 2019), SNLI (Bowman et al., 2015), and MNLI (Williams et al., 2017). For Multi30k, the model is finetuned on text-only Multi30k data. Model reference: a(Specia et al., 2016). "
624
+ ],
625
+ "table_footnote": [],
626
+ "table_body": "<table><tr><td></td><td>SNLI-VE (T)</td><td>SNLI-VE SNLI AcCdev/AcCtest</td><td>MNLI</td><td>Multi30k Multi30k (T) B@4</td><td>M</td></tr><tr><td colspan=\"6\">Fully Supervised Baseline</td></tr><tr><td>EVE-Image</td><td colspan=\"3\">71.56 /71.16</td><td></td><td></td></tr><tr><td>UNITER</td><td colspan=\"3\">78.59 /78.28</td><td></td><td>■</td></tr><tr><td>SOHO</td><td colspan=\"3\">85.00 /84.95</td><td>■</td><td>■</td></tr><tr><td>LIUMa</td><td colspan=\"3\"></td><td>23.8</td><td>35.1</td></tr><tr><td>GroundedTransa</td><td colspan=\"3\">■</td><td>15.8</td><td>31.2</td></tr><tr><td>Zero-Shot Cross-Modality Transfer</td><td colspan=\"3\"></td><td></td><td></td></tr><tr><td>SimVLMbase</td><td>71.35 /71.02</td><td>72.65 /72.24</td><td>64.37 /63.98</td><td>15.0</td><td>24.8</td></tr><tr><td>SimVLMlarge</td><td>72.85 /72.44</td><td>73.62/73.23</td><td>66.97 / 66.31</td><td>17.7</td><td>30.1</td></tr><tr><td>SimVLMhuge</td><td>73.56 /73.08</td><td>74.24 /73.86</td><td>67.45 /66.97</td><td>18.2</td><td>32.6</td></tr></table>",
627
+ "bbox": [
628
+ 269,
629
+ 101,
630
+ 725,
631
+ 267
632
+ ],
633
+ "page_idx": 6
634
+ },
635
+ {
636
+ "type": "text",
637
+ "text": "",
638
+ "bbox": [
639
+ 174,
640
+ 357,
641
+ 825,
642
+ 398
643
+ ],
644
+ "page_idx": 6
645
+ },
646
+ {
647
+ "type": "text",
648
+ "text": "4.3.2 ZERO-SHOT CROSS-MODALITY TRANSFER ",
649
+ "text_level": 1,
650
+ "bbox": [
651
+ 174,
652
+ 415,
653
+ 519,
654
+ 429
655
+ ],
656
+ "page_idx": 6
657
+ },
658
+ {
659
+ "type": "text",
660
+ "text": "Existing pretraining methods have been shown to be successful in transferring knowledge across heterogeneous data spaces. For example, multilingual language models (Devlin et al., 2018; Lample & Conneau, 2019) enable zero-shot cross-lingual transfer such that the model is only finetuned using training data from a source language (typically English) and evaluated on the target language without further training. Inspired by this setup, we explore a novel zero-shot cross-modality transfer paradigm of utilizing VLP models, and evaluate how well our model generalizes across modalities. Since text training data are usually cheaper to obtain compared to visual data, we finetune SimVLM on text-only downstream data and then directly evaluate the zero-shot transfer on joint VL tasks. ",
661
+ "bbox": [
662
+ 174,
663
+ 439,
664
+ 825,
665
+ 550
666
+ ],
667
+ "page_idx": 6
668
+ },
669
+ {
670
+ "type": "text",
671
+ "text": "Specifically, We utilize SNLI-VE and Multi30k to examine the zero-shot transfer performance. For SNLI-VE, we finetune on three text-only NLI datasets such that the premise sentence is used as the encoder’s input while the hypothesis is fed to the decoder, and a similar classifier head is trained on the embedding of the last token in the decoder. At inference, the finetuned model is evaluated by taking the premise image as the encoder input and the corresponding hypothesis sentence to the decoder. As shown in Table 3, SimVLM performs competitively with fully supervised baselines including UNITER under the zero-shot setting. As a sanity check, we also mask out the image feature to predict using the hypothesis only, and find our models can only obtain results close to random guess (average scores of 34.31 / 34.62). This results in performance close to random guess hence demonstrating the effectiveness of SimVLM’s cross-modality transfer ability. ",
672
+ "bbox": [
673
+ 174,
674
+ 558,
675
+ 825,
676
+ 696
677
+ ],
678
+ "page_idx": 6
679
+ },
680
+ {
681
+ "type": "text",
682
+ "text": "In addition, SimVLM is also capable of domain adaption by transferring from the MNLI dataset to SNLI-VE, whereby data comes not only from a different modality but also another domain. We also find it possible to transfer across different languages and modalities using SimVLM. Specifically, we utilize the German image captioning task from WMT 2016 of Multi30k for evaluation, where our model is finetuned on English-German text-only translation data followed by decoding with image-only input in the encoder. Table 3 shows that SimVLM is capable of transferring knowledge across modalities and languages in generative tasks, achieving comparable performance to supervised baselines (decoded examples shown in Figure 2 (b)). These results suggest zero-shot cross-modality transfer emerges with the scaling of weakly labeled data. ",
683
+ "bbox": [
684
+ 174,
685
+ 703,
686
+ 825,
687
+ 828
688
+ ],
689
+ "page_idx": 6
690
+ },
691
+ {
692
+ "type": "text",
693
+ "text": "4.3.3 OPEN-ENDED VQA ",
694
+ "text_level": 1,
695
+ "bbox": [
696
+ 176,
697
+ 843,
698
+ 362,
699
+ 858
700
+ ],
701
+ "page_idx": 6
702
+ },
703
+ {
704
+ "type": "text",
705
+ "text": "On the VQA benchmark, the best performing models to date formulate the problem as a discriminative task of multi-label classification over a predefined 3,129 answer candidates, often consisting of short factual terms. In real-world applications, however, it is hard to define a closed set of candidate answers that covering all possible scenarios, making the true open-ended VQA a challenging setup. ",
706
+ "bbox": [
707
+ 174,
708
+ 867,
709
+ 823,
710
+ 924
711
+ ],
712
+ "page_idx": 6
713
+ },
714
+ {
715
+ "type": "table",
716
+ "img_path": "images/95226e46f4a62d91dcb8ebe5aef4a350ca63be8e0013aa9fd91b75b7c3591d77.jpg",
717
+ "table_caption": [
718
+ "Table 4: Comparison of discriminative and generative VQA methods. “Dev” refers to standard vqa-score on the VQA validation split. “Karpathy-test” is the setup used in Cho et al. (2021) for evaluation on the Karpathy split with rare answers. “Partial Train” refers to train the model only on partial training data which contain subset of all candidate answers. "
719
+ ],
720
+ "table_footnote": [],
721
+ "table_body": "<table><tr><td></td><td>Dev</td><td colspan=\"3\">Karpathy-test</td><td colspan=\"3\">Partial Train Out-domain</td></tr><tr><td>In-domain</td><td></td><td>Out-domain</td><td></td><td>Overall</td><td>In-domain</td><td></td><td>Overall</td></tr><tr><td colspan=\"8\">Discriminative</td></tr><tr><td>UNITER</td><td>-</td><td>74.4</td><td>10.0</td><td>70.5</td><td></td><td></td><td></td></tr><tr><td>VL-T5</td><td>-</td><td>70.2</td><td>7.1</td><td>66.4</td><td></td><td>=</td><td>=</td></tr><tr><td>VL-BART SimVLMbase</td><td>-</td><td>69.4</td><td>7.0</td><td>65.7</td><td>=</td><td>-</td><td>=</td></tr><tr><td>SimVLMlarge</td><td>73.8 76.0</td><td>79.0 80.4</td><td>16.7 17.3</td><td>75.3 76.7</td><td>78.4 79.5</td><td>10.3</td><td>70.5</td></tr><tr><td>SimVLMhuge</td><td></td><td></td><td>17.5</td><td>77.2</td><td>80.2</td><td>11.0</td><td>71.8</td></tr><tr><td></td><td>76.5</td><td>81.0</td><td></td><td></td><td></td><td>11.1</td><td>72.2</td></tr><tr><td colspan=\"8\">Generative</td></tr><tr><td>VL-T5</td><td>-</td><td>71.4</td><td>13.1</td><td>67.9</td><td>=</td><td>=</td><td>=</td></tr><tr><td>VL-BART</td><td>-</td><td>72.1</td><td>13.2</td><td>68.6</td><td>-</td><td>-</td><td>=</td></tr><tr><td>SimVLMbase</td><td>73.2</td><td>78.3</td><td>25.8</td><td>75.2</td><td>77.1</td><td>27.1</td><td>71.3</td></tr><tr><td>SimVLMlarge</td><td>75.2</td><td>79.5</td><td>29.6</td><td>76.5</td><td>78.7</td><td>28.4</td><td>72.5</td></tr><tr><td>SimVLMhuge</td><td>75.5</td><td>79.9</td><td>30.3</td><td>77.0</td><td>79.1</td><td>28.8</td><td>73.0</td></tr></table>",
722
+ "bbox": [
723
+ 269,
724
+ 101,
725
+ 725,
726
+ 258
727
+ ],
728
+ "page_idx": 7
729
+ },
730
+ {
731
+ "type": "text",
732
+ "text": "Generative models such as SimVLM provide an alternative solution towards this challenge by generating free-form textual answers without being constrained to predefined answers. To this end, we finetune SimVLM using the PrefixLM loss described above where we treat the concatenation of the image and the question as the prefix, and train the model to generate answers. ",
733
+ "bbox": [
734
+ 174,
735
+ 354,
736
+ 825,
737
+ 410
738
+ ],
739
+ "page_idx": 7
740
+ },
741
+ {
742
+ "type": "text",
743
+ "text": "We then compare the generative approach with classification methods in Table 4. Firstly, we follow Cho et al. (2021) and evaluate model performance on questions with rare answers in the Karpathy-test split. Here, outof-domain questions are defined as those with best-scoring answer not included in the 3,129 candidates. Results show that SimVLM outperforms both discriminative and generative baselines on all splits. More importantly, the generative SimVLM significantly improves on the out-of-domain split by over 17 points, demonstrating its strong generalization. However, this setup mainly focuses on rare answers and it remains unclear how well the model generalizes to common unseen answers. We therefore pro",
744
+ "bbox": [
745
+ 174,
746
+ 417,
747
+ 483,
748
+ 638
749
+ ],
750
+ "page_idx": 7
751
+ },
752
+ {
753
+ "type": "table",
754
+ "img_path": "images/d8c2ba0813cecd3b5b1cc031ca69f38ba3f855ff1b0b4b528387f7e5973e8fbd.jpg",
755
+ "table_caption": [
756
+ "Table 5: Linear evaluation on ImageNet classification, compared to state-of-the-art representation learning methods. "
757
+ ],
758
+ "table_footnote": [],
759
+ "table_body": "<table><tr><td>Method</td><td>Acc@1</td></tr><tr><td>SimCLRv2 (Chen et al., 2020a)</td><td>79.8</td></tr><tr><td>DINO (Caron et al., 2021)</td><td>80.1</td></tr><tr><td>CLIP (Radford et al., 2021)</td><td>85.4</td></tr><tr><td>ALIGN (Jia et al., 2021)</td><td>85.5</td></tr><tr><td>SimVLMbase SimVLMlarge</td><td>80.6</td></tr><tr><td>SimVLMhuge</td><td>82.3</td></tr><tr><td></td><td>83.6</td></tr></table>",
760
+ "bbox": [
761
+ 522,
762
+ 440,
763
+ 797,
764
+ 561
765
+ ],
766
+ "page_idx": 7
767
+ },
768
+ {
769
+ "type": "text",
770
+ "text": "ceed to investigate a more challenging setup where we randomly select 2,085 (about two-thirds of 3,129) in-domain answers and partition both train and validation sets into two splits based on whether their best-scoring answers are included in the selected set or not. We then only finetune SimVLM on the in-domain split of the train set and evaluate on the entire validation set. The “Partial Train” column in Table 4 shows that the generative $\\mathrm { S i m V L M }$ is also competent in this setup by scoring reasonably well on over 1,000 unseen answers. Overall, we found the generative SimVLM performs competitively with its discriminative counterpart in the standard setup, and works generally better in the out-of-domain case. ",
771
+ "bbox": [
772
+ 174,
773
+ 638,
774
+ 825,
775
+ 750
776
+ ],
777
+ "page_idx": 7
778
+ },
779
+ {
780
+ "type": "text",
781
+ "text": "Note that we use the exact matching between generated answers and human labels for score calculation in the above experiment, however it is possible that the model generates appropriate answers in different formats or synonyms. Therefore, in addition to the quantitative study above, we show qualitative generation results in Figure 2 (c). It can be observed that SimVLM is able to generate answers not included in the 3,129 candidate set (e.g. “surgeon” and “wood carving”), demonstrating that $\\mathrm { S i m V L M }$ can transfer knowledge from the pretraining corpus to VQA. It is thus natural to ask whether SimVLM can perform zero-shot VQA without finetuning at all. In our experiments, we found that SimVLM is able to “answer” by completing prompting sentences, as shown in Figure 2 (d). Nonetheless, we also observed that the model falls short in generating meaningful answers to the real questions. We hypothesize that this is due to the low quality of the pretraining data in which most textual descriptions are short and noisy. To verify our assumption, we continue the pretraining process on the cleaner WIT dataset (Srinivasan et al., 2021) for $5 0 \\mathrm { k }$ steps. Examples in Figure 2 (e) ",
782
+ "bbox": [
783
+ 173,
784
+ 757,
785
+ 825,
786
+ 924
787
+ ],
788
+ "page_idx": 7
789
+ },
790
+ {
791
+ "type": "text",
792
+ "text": "show that open-ended VQA ability emerges in SimVLM such that it can generate related responses after finetuning on the knowledge-rich wikipedia dataset. ",
793
+ "bbox": [
794
+ 171,
795
+ 103,
796
+ 823,
797
+ 132
798
+ ],
799
+ "page_idx": 8
800
+ },
801
+ {
802
+ "type": "text",
803
+ "text": "4.4 ANALYSIS ",
804
+ "text_level": 1,
805
+ "bbox": [
806
+ 174,
807
+ 152,
808
+ 285,
809
+ 166
810
+ ],
811
+ "page_idx": 8
812
+ },
813
+ {
814
+ "type": "text",
815
+ "text": "Single-Modality Tasks. Since SimVLM performs well on joint vision-language benchmarks, it is natural to ask how well the learned representations perform on tasks of single modality. We hope to gain deeper insights into the model behavior by examining its performance on these benchmarks, but it is not our intention to achieve state-of-the-art on singlemodality tasks. In Table 7 (Appendix C), we compare SimVLM with existing VLP models on the GLUE benchmark (Wang et al., 2018), where we mainly follow the text processing procedure in Raffel et al. (2019) and train our model to classify the fully formatted input without token type embeddings. SimVLM performs better than existing VLP methods and competitively with BERT, indicating that it has good language understanding ability. Additionally, we also compute the top-1 accuracy on ImageNet following the linear evaluation protocol in Table 5. Note that our model is not pretrained with a discriminative task such as the contrastive loss, hence we use an average pooling of encoder outputs as image features. Results verify that our model has also learned high-quality image representation. ",
816
+ "bbox": [
817
+ 174,
818
+ 180,
819
+ 483,
820
+ 540
821
+ ],
822
+ "page_idx": 8
823
+ },
824
+ {
825
+ "type": "table",
826
+ "img_path": "images/6acc7276b8a6260bba3be5ad6553721564f50ac204c686e37ac6ba53e70069de.jpg",
827
+ "table_caption": [
828
+ "Table 6: Ablation study on VQA. “w/ LM” and “w/ span corruption” denote replacing the proposed PrefixLM loss with a different pretraining objective. “Image2Text” and “Text2Text” refer to the noisy image-text data and the text-only data used for pretraining. “conv blks” denotes number of ResNet blocks. "
829
+ ],
830
+ "table_footnote": [],
831
+ "table_body": "<table><tr><td>Method</td><td> VQA score</td></tr><tr><td>No Pretraining</td><td>49.70</td></tr><tr><td>Decoder-only w/ LM</td><td>65.23 64.48</td></tr><tr><td>SimVLMsmall</td><td>67.43</td></tr><tr><td>w/o Image2Text w/o Text2Text</td><td>49.23</td></tr><tr><td></td><td>65.25</td></tr><tr><td>w/o conv stage</td><td>63.11</td></tr><tr><td>w/ span corruption</td><td>66.23</td></tr><tr><td>w/ 2 conv blks</td><td>65.57</td></tr><tr><td>w/ 4 conv blks</td><td>66.55</td></tr><tr><td>w/10% ALIGN</td><td>66.71</td></tr><tr><td></td><td></td></tr><tr><td>w/ CC-3M</td><td>63.32</td></tr></table>",
832
+ "bbox": [
833
+ 542,
834
+ 203,
835
+ 777,
836
+ 397
837
+ ],
838
+ "page_idx": 8
839
+ },
840
+ {
841
+ "type": "text",
842
+ "text": "Ablation Study. To study the contributions from each model component, we conduct ablation study on $\\mathrm { S i m V L M _ { s m a l l } }$ models with an embedding dimension of 512 and 8 layers. We make comparisons on VQA in Table 6. First, we compare encoder-decoder models with decoder-only models of comparable model size, and find that decoder-only model performs significantly worse on VQA. This suggests the inductive bias of separating bidirectional encoding from unidirectional decoding is beneficial for joint VL representation learning. Next, we study the effectiveness of pretraining objectives and results show that the PrefixLM objective outperforms both span corruption (Raffel et al., 2019) and naive LM, illustrating the importance of using a unified objective formulation for both image-text and text-only data. Moreover, we ablate the contribution of datasets. While weakly aligned image-text data are required for bridging the gap between visual and textual representations, text-only corpora also improves the model quality. This is probably because textual signals are extremely noisy in the former and thus the model relies on the later to acquire better language understanding. In addition, we experimented with $10 \\%$ ALIGN and CC-3M (Sharma et al., 2018) datasets, and confirms the importance of data scaling. We then study the effect of the convolution stage and find it critical for VL performance. Following Dai et al. (2021), we experiment with using either the first 2/3/4 ResNet Conv blocks, and empirically observe that the 3 conv block setup works best. This indicates that image and text have different levels of representation granularity and thus utilizing contextualized patches is beneficial. ",
843
+ "bbox": [
844
+ 174,
845
+ 547,
846
+ 825,
847
+ 796
848
+ ],
849
+ "page_idx": 8
850
+ },
851
+ {
852
+ "type": "text",
853
+ "text": "5 CONCLUSION ",
854
+ "text_level": 1,
855
+ "bbox": [
856
+ 176,
857
+ 820,
858
+ 318,
859
+ 835
860
+ ],
861
+ "page_idx": 8
862
+ },
863
+ {
864
+ "type": "text",
865
+ "text": "In this work, we present a simple yet effective framework of vision-language pretraining. Unlike prior works using object proposal systems and auxiliary losses, our model processes whole image as patches and is trained end-to-end with a single prefix language modeling objective. Our work suggests a promising alternative to existing VLP paradigm and we hope our work may inspire future research on generative VLP. ",
866
+ "bbox": [
867
+ 174,
868
+ 854,
869
+ 823,
870
+ 922
871
+ ],
872
+ "page_idx": 8
873
+ },
874
+ {
875
+ "type": "text",
876
+ "text": "ACKNOWLEDGMENTS ",
877
+ "text_level": 1,
878
+ "bbox": [
879
+ 176,
880
+ 104,
881
+ 326,
882
+ 117
883
+ ],
884
+ "page_idx": 9
885
+ },
886
+ {
887
+ "type": "text",
888
+ "text": "We would like to thank Hieu Pham, Chao Jia, Andrew Dai, Bowen Zhang, Zhifeng Chen, Ruoming Pang, Douglas Eck, Claire Cui and Yonghui Wu for helpful discussions, Krishna Srinivasan, Samira Daruki, Nan Du and Aashi Jain for help with data preparation, Chao Jia, Zhen Li, Jonathan Shen, Colin Raffel and Sharan Narang for assistance on experimental settings, and others in the Google Brain team for support throughout this project. ",
889
+ "bbox": [
890
+ 174,
891
+ 127,
892
+ 825,
893
+ 198
894
+ ],
895
+ "page_idx": 9
896
+ },
897
+ {
898
+ "type": "text",
899
+ "text": "REFERENCES ",
900
+ "text_level": 1,
901
+ "bbox": [
902
+ 174,
903
+ 218,
904
+ 285,
905
+ 233
906
+ ],
907
+ "page_idx": 9
908
+ },
909
+ {
910
+ "type": "text",
911
+ "text": "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 Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 8948–8957, 2019. ",
912
+ "bbox": [
913
+ 174,
914
+ 241,
915
+ 825,
916
+ 296
917
+ ],
918
+ "page_idx": 9
919
+ },
920
+ {
921
+ "type": "text",
922
+ "text": "Peter Anderson, Xiaodong He, Chris Buehler, Damien Teney, Mark Johnson, Stephen Gould, and Lei Zhang. Bottom-up and top-down attention for image captioning and visual question answering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6077–6086, 2018. ",
923
+ "bbox": [
924
+ 174,
925
+ 306,
926
+ 825,
927
+ 363
928
+ ],
929
+ "page_idx": 9
930
+ },
931
+ {
932
+ "type": "text",
933
+ "text": "Samuel R Bowman, Gabor Angeli, Christopher Potts, and Christopher D Manning. A large annotated corpus for learning natural language inference. arXiv preprint arXiv:1508.05326, 2015. ",
934
+ "bbox": [
935
+ 173,
936
+ 372,
937
+ 818,
938
+ 401
939
+ ],
940
+ "page_idx": 9
941
+ },
942
+ {
943
+ "type": "text",
944
+ "text": "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. ",
945
+ "bbox": [
946
+ 174,
947
+ 409,
948
+ 825,
949
+ 452
950
+ ],
951
+ "page_idx": 9
952
+ },
953
+ {
954
+ "type": "text",
955
+ "text": "Mathilde Caron, Hugo Touvron, Ishan Misra, Herve J ´ egou, Julien Mairal, Piotr Bojanowski, and ´ Armand Joulin. Emerging properties in self-supervised vision transformers. arXiv preprint arXiv:2104.14294, 2021. ",
956
+ "bbox": [
957
+ 174,
958
+ 460,
959
+ 825,
960
+ 503
961
+ ],
962
+ "page_idx": 9
963
+ },
964
+ {
965
+ "type": "text",
966
+ "text": "Ting Chen, Simon Kornblith, Kevin Swersky, Mohammad Norouzi, and Geoffrey E Hinton. Big self-supervised models are strong semi-supervised learners. Advances in Neural Information Processing Systems, 33:22243–22255, 2020a. ",
967
+ "bbox": [
968
+ 173,
969
+ 512,
970
+ 825,
971
+ 554
972
+ ],
973
+ "page_idx": 9
974
+ },
975
+ {
976
+ "type": "text",
977
+ "text": "Xinlei Chen, Hao Fang, Tsung-Yi Lin, Ramakrishna Vedantam, Saurabh Gupta, Piotr Dollar, and ´ C Lawrence Zitnick. Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325, 2015. ",
978
+ "bbox": [
979
+ 174,
980
+ 563,
981
+ 823,
982
+ 606
983
+ ],
984
+ "page_idx": 9
985
+ },
986
+ {
987
+ "type": "text",
988
+ "text": "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 ECCV, 2020b. ",
989
+ "bbox": [
990
+ 171,
991
+ 614,
992
+ 823,
993
+ 643
994
+ ],
995
+ "page_idx": 9
996
+ },
997
+ {
998
+ "type": "text",
999
+ "text": "Jaemin Cho, Jie Lei, Hao Tan, and Mohit Bansal. Unifying vision-and-language tasks via text generation. arXiv preprint arXiv:2102.02779, 2021. ",
1000
+ "bbox": [
1001
+ 171,
1002
+ 652,
1003
+ 823,
1004
+ 681
1005
+ ],
1006
+ "page_idx": 9
1007
+ },
1008
+ {
1009
+ "type": "text",
1010
+ "text": "Marcella Cornia, Matteo Stefanini, Lorenzo Baraldi, and Rita Cucchiara. Meshed-memory transformer for image captioning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10578–10587, 2020. ",
1011
+ "bbox": [
1012
+ 174,
1013
+ 689,
1014
+ 825,
1015
+ 733
1016
+ ],
1017
+ "page_idx": 9
1018
+ },
1019
+ {
1020
+ "type": "text",
1021
+ "text": "Zihang Dai, Hanxiao Liu, Quoc V Le, and Mingxing Tan. Coatnet: Marrying convolution and attention for all data sizes. arXiv preprint arXiv:2106.04803, 2021. ",
1022
+ "bbox": [
1023
+ 171,
1024
+ 741,
1025
+ 823,
1026
+ 770
1027
+ ],
1028
+ "page_idx": 9
1029
+ },
1030
+ {
1031
+ "type": "text",
1032
+ "text": "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. ",
1033
+ "bbox": [
1034
+ 171,
1035
+ 779,
1036
+ 823,
1037
+ 808
1038
+ ],
1039
+ "page_idx": 9
1040
+ },
1041
+ {
1042
+ "type": "text",
1043
+ "text": "Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, Jakob Uszkoreit, and Neil Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In International Conference on Learning Representations, 2021. URL https: //openreview.net/forum?id $=$ YicbFdNTTy. ",
1044
+ "bbox": [
1045
+ 174,
1046
+ 815,
1047
+ 825,
1048
+ 886
1049
+ ],
1050
+ "page_idx": 9
1051
+ },
1052
+ {
1053
+ "type": "text",
1054
+ "text": "Desmond Elliott, Stella Frank, Khalil Sima’an, and Lucia Specia. Multi30k: Multilingual englishgerman image descriptions. arXiv preprint arXiv:1605.00459, 2016. ",
1055
+ "bbox": [
1056
+ 174,
1057
+ 895,
1058
+ 821,
1059
+ 924
1060
+ ],
1061
+ "page_idx": 9
1062
+ },
1063
+ {
1064
+ "type": "text",
1065
+ "text": "Zhe Gan, Yen-Chun Chen, Linjie Li, Chen Zhu, Yu Cheng, and Jingjing Liu. Large-scale adversarial training for vision-and-language representation learning. arXiv preprint arXiv:2006.06195, 2020. ",
1066
+ "bbox": [
1067
+ 171,
1068
+ 103,
1069
+ 823,
1070
+ 132
1071
+ ],
1072
+ "page_idx": 10
1073
+ },
1074
+ {
1075
+ "type": "text",
1076
+ "text": "Yash Goyal, Tejas Khot, Douglas Summers-Stay, Dhruv Batra, and Devi Parikh. Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 6904–6913, 2017. ",
1077
+ "bbox": [
1078
+ 176,
1079
+ 142,
1080
+ 823,
1081
+ 185
1082
+ ],
1083
+ "page_idx": 10
1084
+ },
1085
+ {
1086
+ "type": "text",
1087
+ "text": "Kai Han, Yunhe Wang, Hanting Chen, Xinghao Chen, Jianyuan Guo, Zhenhua Liu, Yehui Tang, An Xiao, Chunjing Xu, Yixing Xu, Zhaohui Yang, Yiman Zhang, and Dacheng Tao. A survey on visual transformer, 2021. ",
1088
+ "bbox": [
1089
+ 174,
1090
+ 194,
1091
+ 826,
1092
+ 237
1093
+ ],
1094
+ "page_idx": 10
1095
+ },
1096
+ {
1097
+ "type": "text",
1098
+ "text": "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. ",
1099
+ "bbox": [
1100
+ 174,
1101
+ 246,
1102
+ 825,
1103
+ 289
1104
+ ],
1105
+ "page_idx": 10
1106
+ },
1107
+ {
1108
+ "type": "text",
1109
+ "text": "Xiaowei Hu, Xi Yin, Kevin Lin, Lijuan Wang, Lei Zhang, Jianfeng Gao, and Zicheng Liu. Vivo: Surpassing human performance in novel object captioning with visual vocabulary pre-training. In AAAI, February 2021. ",
1110
+ "bbox": [
1111
+ 174,
1112
+ 299,
1113
+ 825,
1114
+ 342
1115
+ ],
1116
+ "page_idx": 10
1117
+ },
1118
+ {
1119
+ "type": "text",
1120
+ "text": "Gao Huang, Yu Sun, Zhuang Liu, Daniel Sedra, and Kilian Q Weinberger. Deep networks with stochastic depth. In European conference on computer vision, pp. 646–661. Springer, 2016. ",
1121
+ "bbox": [
1122
+ 171,
1123
+ 351,
1124
+ 823,
1125
+ 381
1126
+ ],
1127
+ "page_idx": 10
1128
+ },
1129
+ {
1130
+ "type": "text",
1131
+ "text": "Lun Huang, Wenmin Wang, Jie Chen, and Xiao-Yong Wei. Attention on attention for image captioning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4634–4643, 2019. ",
1132
+ "bbox": [
1133
+ 174,
1134
+ 390,
1135
+ 823,
1136
+ 433
1137
+ ],
1138
+ "page_idx": 10
1139
+ },
1140
+ {
1141
+ "type": "text",
1142
+ "text": "Zhicheng Huang, Zhaoyang Zeng, Yupan Huang, Bei Liu, Dongmei Fu, and Jianlong Fu. Seeing out of the box: End-to-end pre-training for vision-language representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 12976–12985, 2021. ",
1143
+ "bbox": [
1144
+ 173,
1145
+ 443,
1146
+ 825,
1147
+ 498
1148
+ ],
1149
+ "page_idx": 10
1150
+ },
1151
+ {
1152
+ "type": "text",
1153
+ "text": "Taichi Iki and Akiko Aizawa. Effect of vision-and-language extensions on natural language understanding in vision-and-language models. arXiv preprint arXiv:2104.08066, 2021. ",
1154
+ "bbox": [
1155
+ 174,
1156
+ 508,
1157
+ 820,
1158
+ 537
1159
+ ],
1160
+ "page_idx": 10
1161
+ },
1162
+ {
1163
+ "type": "text",
1164
+ "text": "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. ",
1165
+ "bbox": [
1166
+ 174,
1167
+ 546,
1168
+ 825,
1169
+ 589
1170
+ ],
1171
+ "page_idx": 10
1172
+ },
1173
+ {
1174
+ "type": "text",
1175
+ "text": "Norman P. Jouppi, Cliff Young, Nishant Patil, David Patterson, Gaurav Agrawal, Raminder Bajwa, Sarah Bates, Suresh Bhatia, Nan Boden, Al Borchers, Rick Boyle, Pierre luc Cantin, Clifford Chao, Chris Clark, Jeremy Coriell, Mike Daley, Matt Dau, Jeffrey Dean, Ben Gelb, Tara Vazir Ghaemmaghami, Rajendra Gottipati, William Gulland, Robert Hagmann, C. Richard Ho, Doug Hogberg, John Hu, Robert Hundt, Dan Hurt, Julian Ibarz, Aaron Jaffey, Alek Jaworski, Alexander Kaplan, Harshit Khaitan, Andy Koch, Naveen Kumar, Steve Lacy, James Laudon, James Law, Diemthu Le, Chris Leary, Zhuyuan Liu, Kyle Lucke, Alan Lundin, Gordon MacKean, Adriana Maggiore, Maire Mahony, Kieran Miller, Rahul Nagarajan, Ravi Narayanaswami, Ray Ni, Kathy Nix, Thomas Norrie, Mark Omernick, Narayana Penukonda, Andy Phelps, Jonathan Ross, Matt Ross, Amir Salek, Emad Samadiani, Chris Severn, Gregory Sizikov, Matthew Snelham, Jed Souter, Dan Steinberg, Andy Swing, Mercedes Tan, Gregory Thorson, Bo Tian, Horia Toma, Erick Tuttle, Vijay Vasudevan, Richard Walter, Walter Wang, Eric Wilcox, and Doe Hyun Yoon. In-datacenter performance analysis of a tensor processing unit, 2017. ",
1176
+ "bbox": [
1177
+ 174,
1178
+ 599,
1179
+ 826,
1180
+ 780
1181
+ ],
1182
+ "page_idx": 10
1183
+ },
1184
+ {
1185
+ "type": "text",
1186
+ "text": "Salman Khan, Muzammal Naseer, Munawar Hayat, Syed Waqas Zamir, Fahad Shahbaz Khan, and Mubarak Shah. Transformers in vision: A survey, 2021. ",
1187
+ "bbox": [
1188
+ 173,
1189
+ 790,
1190
+ 823,
1191
+ 819
1192
+ ],
1193
+ "page_idx": 10
1194
+ },
1195
+ {
1196
+ "type": "text",
1197
+ "text": "Wonjae Kim, Bokyung Son, and Ildoo Kim. Vilt: Vision-and-language transformer without convolution or region supervision, 2021. ",
1198
+ "bbox": [
1199
+ 173,
1200
+ 829,
1201
+ 821,
1202
+ 858
1203
+ ],
1204
+ "page_idx": 10
1205
+ },
1206
+ {
1207
+ "type": "text",
1208
+ "text": "Ranjay Krishna, Yuke Zhu, Oliver Groth, Justin Johnson, Kenji Hata, Joshua Kravitz, Stephanie Chen, Yannis Kalantidis, Li-Jia Li, David A Shamma, Michael Bernstein, and Li Fei-Fei. Visual genome: Connecting language and vision using crowdsourced dense image annotations. 2016. URL https://arxiv.org/abs/1602.07332. ",
1209
+ "bbox": [
1210
+ 174,
1211
+ 867,
1212
+ 825,
1213
+ 924
1214
+ ],
1215
+ "page_idx": 10
1216
+ },
1217
+ {
1218
+ "type": "text",
1219
+ "text": "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. ",
1220
+ "bbox": [
1221
+ 171,
1222
+ 103,
1223
+ 825,
1224
+ 132
1225
+ ],
1226
+ "page_idx": 11
1227
+ },
1228
+ {
1229
+ "type": "text",
1230
+ "text": "Guillaume Lample and Alexis Conneau. Cross-lingual language model pretraining. arXiv preprint arXiv:1901.07291, 2019. ",
1231
+ "bbox": [
1232
+ 173,
1233
+ 143,
1234
+ 823,
1235
+ 172
1236
+ ],
1237
+ "page_idx": 11
1238
+ },
1239
+ {
1240
+ "type": "text",
1241
+ "text": "Liunian Harold Li, Mark Yatskar, Da Yin, Cho-Jui Hsieh, and Kai-Wei Chang. Visualbert: A simple and performant baseline for vision and language, 2019. ",
1242
+ "bbox": [
1243
+ 173,
1244
+ 184,
1245
+ 823,
1246
+ 214
1247
+ ],
1248
+ "page_idx": 11
1249
+ },
1250
+ {
1251
+ "type": "text",
1252
+ "text": "Wei Li, Can Gao, Guocheng Niu, Xinyan Xiao, Hao Liu, Jiachen Liu, Hua Wu, and Haifeng Wang. UNIMO: Towards unified-modal understanding and generation via cross-modal contrastive learning. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 2592–2607, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/2021.acl-long.202. URL https://aclanthology.org/2021. acl-long.202. ",
1253
+ "bbox": [
1254
+ 173,
1255
+ 226,
1256
+ 825,
1257
+ 324
1258
+ ],
1259
+ "page_idx": 11
1260
+ },
1261
+ {
1262
+ "type": "text",
1263
+ "text": "Xiujun Li, Xi Yin, Chunyuan Li, Xiaowei Hu, Pengchuan Zhang, Lei Zhang, Lijuan Wang, Houdong Hu, Li Dong, Furu Wei, Yejin Choi, and Jianfeng Gao. Oscar: Object-semantics aligned pretraining for vision-language tasks. ECCV 2020, 2020. ",
1264
+ "bbox": [
1265
+ 174,
1266
+ 335,
1267
+ 825,
1268
+ 378
1269
+ ],
1270
+ "page_idx": 11
1271
+ },
1272
+ {
1273
+ "type": "text",
1274
+ "text": "Pengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pretrain, prompt, and predict: A systematic survey of prompting methods in natural language processing, 2021. ",
1275
+ "bbox": [
1276
+ 173,
1277
+ 390,
1278
+ 823,
1279
+ 433
1280
+ ],
1281
+ "page_idx": 11
1282
+ },
1283
+ {
1284
+ "type": "text",
1285
+ "text": "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. ",
1286
+ "bbox": [
1287
+ 174,
1288
+ 444,
1289
+ 825,
1290
+ 488
1291
+ ],
1292
+ "page_idx": 11
1293
+ },
1294
+ {
1295
+ "type": "text",
1296
+ "text": "Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. arXiv preprint arXiv:1711.05101, 2017. ",
1297
+ "bbox": [
1298
+ 171,
1299
+ 500,
1300
+ 823,
1301
+ 529
1302
+ ],
1303
+ "page_idx": 11
1304
+ },
1305
+ {
1306
+ "type": "text",
1307
+ "text": "Jiasen Lu, Dhruv Batra, Devi Parikh, and Stefan Lee. Vilbert: Pretraining task-agnostic visiolinguistic representations for vision-and-language tasks. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-Buc, E. Fox, and R. Garnett (eds.), ´ Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips. cc/paper/2019/file/c74d97b01eae257e44aa9d5bade97baf-Paper.pdf. ",
1308
+ "bbox": [
1309
+ 173,
1310
+ 540,
1311
+ 825,
1312
+ 611
1313
+ ],
1314
+ "page_idx": 11
1315
+ },
1316
+ {
1317
+ "type": "text",
1318
+ "text": "Ofir Press and Lior Wolf. Using the output embedding to improve language models. arXiv preprint arXiv:1608.05859, 2016. ",
1319
+ "bbox": [
1320
+ 174,
1321
+ 622,
1322
+ 823,
1323
+ 651
1324
+ ],
1325
+ "page_idx": 11
1326
+ },
1327
+ {
1328
+ "type": "text",
1329
+ "text": "Alec Radford, Karthik Narasimhan, Tim Salimans, and Ilya Sutskever. Improving language understanding by generative pre-training. 2018. ",
1330
+ "bbox": [
1331
+ 173,
1332
+ 662,
1333
+ 823,
1334
+ 693
1335
+ ],
1336
+ "page_idx": 11
1337
+ },
1338
+ {
1339
+ "type": "text",
1340
+ "text": "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. ",
1341
+ "bbox": [
1342
+ 171,
1343
+ 704,
1344
+ 823,
1345
+ 733
1346
+ ],
1347
+ "page_idx": 11
1348
+ },
1349
+ {
1350
+ "type": "text",
1351
+ "text": "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. ",
1352
+ "bbox": [
1353
+ 174,
1354
+ 744,
1355
+ 825,
1356
+ 787
1357
+ ],
1358
+ "page_idx": 11
1359
+ },
1360
+ {
1361
+ "type": "text",
1362
+ "text": "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. ",
1363
+ "bbox": [
1364
+ 173,
1365
+ 799,
1366
+ 825,
1367
+ 842
1368
+ ],
1369
+ "page_idx": 11
1370
+ },
1371
+ {
1372
+ "type": "text",
1373
+ "text": "Pranav Rajpurkar, Jian Zhang, Konstantin Lopyrev, and Percy Liang. Squad: $1 0 0 { , } 0 0 0 { + }$ questions for machine comprehension of text. arXiv preprint arXiv:1606.05250, 2016. ",
1374
+ "bbox": [
1375
+ 171,
1376
+ 854,
1377
+ 823,
1378
+ 883
1379
+ ],
1380
+ "page_idx": 11
1381
+ },
1382
+ {
1383
+ "type": "text",
1384
+ "text": "Aditya Ramesh, Mikhail Pavlov, Gabriel Goh, Scott Gray, Chelsea Voss, Alec Radford, Mark Chen, and Ilya Sutskever. Zero-shot text-to-image generation. arXiv preprint arXiv:2102.12092, 2021. ",
1385
+ "bbox": [
1386
+ 173,
1387
+ 895,
1388
+ 821,
1389
+ 924
1390
+ ],
1391
+ "page_idx": 11
1392
+ },
1393
+ {
1394
+ "type": "text",
1395
+ "text": "Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster r-cnn: Towards real-time object detection with region proposal networks. In C. Cortes, N. Lawrence, D. Lee, M. Sugiyama, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 28. Curran Associates, Inc., 2015. URL https://proceedings.neurips.cc/paper/2015/file/ 14bfa6bb14875e45bba028a21ed38046-Paper.pdf. ",
1396
+ "bbox": [
1397
+ 174,
1398
+ 103,
1399
+ 825,
1400
+ 174
1401
+ ],
1402
+ "page_idx": 12
1403
+ },
1404
+ {
1405
+ "type": "text",
1406
+ "text": "Steven J Rennie, Etienne Marcheret, Youssef Mroueh, Jerret Ross, and Vaibhava Goel. Self-critical sequence training for image captioning. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 7008–7024, 2017. ",
1407
+ "bbox": [
1408
+ 174,
1409
+ 184,
1410
+ 825,
1411
+ 227
1412
+ ],
1413
+ "page_idx": 12
1414
+ },
1415
+ {
1416
+ "type": "text",
1417
+ "text": "Paul-Edouard Sarlin, Daniel DeTone, Tomasz Malisiewicz, and Andrew Rabinovich. Superglue: Learning feature matching with graph neural networks. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 4938–4947, 2020. ",
1418
+ "bbox": [
1419
+ 174,
1420
+ 238,
1421
+ 825,
1422
+ 281
1423
+ ],
1424
+ "page_idx": 12
1425
+ },
1426
+ {
1427
+ "type": "text",
1428
+ "text": "Piyush Sharma, Nan Ding, Sebastian Goodman, and Radu Soricut. Conceptual captions: A cleaned, hypernymed, image alt-text dataset for automatic image captioning. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pp. 2556–2565, Melbourne, Australia, July 2018. Association for Computational Linguistics. doi: 10.18653/v1/P18-1238. URL https://aclanthology.org/P18-1238. ",
1429
+ "bbox": [
1430
+ 173,
1431
+ 291,
1432
+ 825,
1433
+ 362
1434
+ ],
1435
+ "page_idx": 12
1436
+ },
1437
+ {
1438
+ "type": "text",
1439
+ "text": "Jonathan Shen, Patrick Nguyen, Yonghui Wu, Zhifeng Chen, et al. Lingvo: a modular and scalable framework for sequence-to-sequence modeling, 2019. ",
1440
+ "bbox": [
1441
+ 171,
1442
+ 372,
1443
+ 823,
1444
+ 401
1445
+ ],
1446
+ "page_idx": 12
1447
+ },
1448
+ {
1449
+ "type": "text",
1450
+ "text": "Sheng Shen, Liunian Harold Li, Hao Tan, Mohit Bansal, Anna Rohrbach, Kai-Wei Chang, Zhewei Yao, and Kurt Keutzer. How much can clip benefit vision-and-language tasks? arXiv preprint arXiv:2107.06383, 2021. ",
1451
+ "bbox": [
1452
+ 173,
1453
+ 411,
1454
+ 825,
1455
+ 454
1456
+ ],
1457
+ "page_idx": 12
1458
+ },
1459
+ {
1460
+ "type": "text",
1461
+ "text": "Lucia Specia, Stella Frank, Khalil Sima’An, and Desmond Elliott. A shared task on multimodal machine translation and crosslingual image description. In Proceedings of the First Conference on Machine Translation: Volume 2, Shared Task Papers, pp. 543–553, 2016. ",
1462
+ "bbox": [
1463
+ 171,
1464
+ 465,
1465
+ 823,
1466
+ 508
1467
+ ],
1468
+ "page_idx": 12
1469
+ },
1470
+ {
1471
+ "type": "text",
1472
+ "text": "Krishna Srinivasan, Karthik Raman, Jiecao Chen, Michael Bendersky, and Marc Najork. Wit: Wikipedia-based image text dataset for multimodal multilingual machine learning. arXiv preprint arXiv:2103.01913, 2021. ",
1473
+ "bbox": [
1474
+ 173,
1475
+ 518,
1476
+ 825,
1477
+ 561
1478
+ ],
1479
+ "page_idx": 12
1480
+ },
1481
+ {
1482
+ "type": "text",
1483
+ "text": "Weijie Su, Xizhou Zhu, Yue Cao, Bin Li, Lewei Lu, Furu Wei, and Jifeng Dai. Vl-bert: Pretraining of generic visual-linguistic representations. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\\underline { { \\underline { { \\mathbf { \\Pi } } } } } =$ SygXPaEYvH. ",
1484
+ "bbox": [
1485
+ 173,
1486
+ 571,
1487
+ 825,
1488
+ 616
1489
+ ],
1490
+ "page_idx": 12
1491
+ },
1492
+ {
1493
+ "type": "text",
1494
+ "text": "Alane Suhr, Stephanie Zhou, Ally Zhang, Iris Zhang, Huajun Bai, and Yoav Artzi. A corpus for reasoning about natural language grounded in photographs. arXiv preprint arXiv:1811.00491, 2018. ",
1495
+ "bbox": [
1496
+ 174,
1497
+ 626,
1498
+ 823,
1499
+ 667
1500
+ ],
1501
+ "page_idx": 12
1502
+ },
1503
+ {
1504
+ "type": "text",
1505
+ "text": "Hao Tan and Mohit Bansal. LXMERT: Learning cross-modality encoder representations from transformers. 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. 5100–5111, Hong Kong, China, November 2019. Association for Computational Linguistics. doi: 10.18653/v1/D19-1514. URL https://aclanthology.org/ D19-1514. ",
1506
+ "bbox": [
1507
+ 173,
1508
+ 679,
1509
+ 825,
1510
+ 763
1511
+ ],
1512
+ "page_idx": 12
1513
+ },
1514
+ {
1515
+ "type": "text",
1516
+ "text": "Maria Tsimpoukelli, Jacob 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, 2021. ",
1517
+ "bbox": [
1518
+ 173,
1519
+ 773,
1520
+ 825,
1521
+ 818
1522
+ ],
1523
+ "page_idx": 12
1524
+ },
1525
+ {
1526
+ "type": "text",
1527
+ "text": "Shagun Uppal, Sarthak Bhagat, Devamanyu Hazarika, Navonil Majumdar, Soujanya Poria, Roger Zimmermann, and Amir Zadeh. Multimodal research in vision and language: A review of current and emerging trends, 2020. ",
1528
+ "bbox": [
1529
+ 171,
1530
+ 828,
1531
+ 823,
1532
+ 871
1533
+ ],
1534
+ "page_idx": 12
1535
+ },
1536
+ {
1537
+ "type": "text",
1538
+ "text": "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. ",
1539
+ "bbox": [
1540
+ 176,
1541
+ 881,
1542
+ 825,
1543
+ 924
1544
+ ],
1545
+ "page_idx": 12
1546
+ },
1547
+ {
1548
+ "type": "text",
1549
+ "text": "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. \nAdina Williams, Nikita Nangia, and Samuel R Bowman. A broad-coverage challenge corpus for sentence understanding through inference. arXiv preprint arXiv:1704.05426, 2017. \nTete Xiao, Mannat Singh, Eric Mintun, Trevor Darrell, Piotr Dollar, and Ross Girshick. Early ´ convolutions help transformers see better, 2021. \nNing Xie, Farley Lai, Derek Doran, and Asim Kadav. Visual entailment: A novel task for finegrained image understanding. arXiv preprint arXiv:1901.06706, 2019. \nHaiyang Xu, Ming Yan, Chenliang Li, Bin Bi, Songfang Huang, Wenming Xiao, and Fei Huang. E2E-VLP: End-to-end vision-language pre-training enhanced by visual learning. In Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers), pp. 503–513, Online, August 2021. Association for Computational Linguistics. doi: 10.18653/v1/ 2021.acl-long.42. URL https://aclanthology.org/2021.acl-long.42. \nZhilin Yang, Zihang Dai, Yiming Yang, Jaime Carbonell, Russ R Salakhutdinov, and Quoc V Le. Xlnet: Generalized autoregressive pretraining for language understanding. In Advances in neural information processing systems, pp. 5754–5764, 2019. \nFei Yu, Jiji Tang, Weichong Yin, Yu Sun, Hao Tian, Hua Wu, and Haifeng Wang. Ernie-vil: Knowledge enhanced vision-language representations through scene graphs. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pp. 3208–3216, 2021. \nPengchuan Zhang, Xiujun Li, Xiaowei Hu, Jianwei Yang, Lei Zhang, Lijuan Wang, Yejin Choi, and Jianfeng Gao. Vinvl: Revisiting visual representations in vision-language models. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 5579– 5588, June 2021. ",
1550
+ "bbox": [
1551
+ 166,
1552
+ 102,
1553
+ 826,
1554
+ 522
1555
+ ],
1556
+ "page_idx": 13
1557
+ },
1558
+ {
1559
+ "type": "image",
1560
+ "img_path": "images/6e00f6fcc1995e6ba3e0bc0f6c6219f6f118bf5a70c76493897cd8e0cf10939a.jpg",
1561
+ "image_caption": [
1562
+ "Figure 2: Generated examples of SimVLM of various applications: (a) zero-shot image captioning (b) zero-shot cross-modality transfer on German image captioning (c) generative VQA (d) zero-shot visual text completion (e) zero-shot open-ended VQA. "
1563
+ ],
1564
+ "image_footnote": [],
1565
+ "bbox": [
1566
+ 169,
1567
+ 90,
1568
+ 826,
1569
+ 741
1570
+ ],
1571
+ "page_idx": 14
1572
+ },
1573
+ {
1574
+ "type": "text",
1575
+ "text": "A GENERATED EXAMPLES ",
1576
+ "text_level": 1,
1577
+ "bbox": [
1578
+ 176,
1579
+ 847,
1580
+ 411,
1581
+ 863
1582
+ ],
1583
+ "page_idx": 14
1584
+ },
1585
+ {
1586
+ "type": "text",
1587
+ "text": "Examples generated by SimVLM of various types are shown in Figure 2. We use either image-only or image-text prefix inputs in the encoder, and use the decoder to generate suffix text. ",
1588
+ "bbox": [
1589
+ 173,
1590
+ 895,
1591
+ 823,
1592
+ 924
1593
+ ],
1594
+ "page_idx": 14
1595
+ },
1596
+ {
1597
+ "type": "table",
1598
+ "img_path": "images/5e99f3cea947c18a5fe1d291c08e042103db747c3d2ff67c94148b0315e0d9da.jpg",
1599
+ "table_caption": [
1600
+ "Table 7: Text-only task performance on the GLUE benchmark (Dev set). Results for BERT and other VLP methods are obtained from Iki & Aizawa (2021). The overall best result is bolded while underline signifies the best VLP model. "
1601
+ ],
1602
+ "table_footnote": [],
1603
+ "table_body": "<table><tr><td></td><td>CoLA</td><td>SST-2</td><td>RTE</td><td>MRPC</td><td>QQP</td><td>MNLI</td><td>QNLI</td><td>WNLI</td></tr><tr><td>BERT</td><td>54.6</td><td>92.5</td><td>62.5</td><td>81.9/87.6</td><td>90.6/87.4</td><td>84.2</td><td>91.0</td><td>48.8</td></tr><tr><td>VisualBERT</td><td>38.6</td><td>89.4</td><td>56.6</td><td>71.9/82.1</td><td>89.4/86.0</td><td>81.6</td><td>87.0</td><td>53.1</td></tr><tr><td>UNITER</td><td>37.4</td><td>89.7</td><td>55.6</td><td>69.3/80.3</td><td>89.2/85.7</td><td>80.9</td><td>86.0</td><td>55.4</td></tr><tr><td>VL-BERT</td><td>38.7</td><td>89.8</td><td>55.7</td><td>70.6/81.8</td><td>89.0/85.4</td><td>81.2</td><td>86.3</td><td>53.1</td></tr><tr><td>VilBERT</td><td>36.1</td><td>90.4</td><td>53.7</td><td>69.0/79.4</td><td>88.6/85.0</td><td>79.9</td><td>83.8</td><td>55.4</td></tr><tr><td>LXMERT</td><td>39.0</td><td>90.2</td><td>57.2</td><td>69.8/80.4</td><td>75.3/75.3</td><td>80.4</td><td>84.2</td><td>46.0</td></tr><tr><td>SimVLMbase</td><td>46.7</td><td>90.9</td><td>63.9</td><td>75.2/84.4</td><td>90.4/87.2</td><td>83.4</td><td>88.6</td><td>58.1</td></tr></table>",
1604
+ "bbox": [
1605
+ 187,
1606
+ 101,
1607
+ 810,
1608
+ 242
1609
+ ],
1610
+ "page_idx": 15
1611
+ },
1612
+ {
1613
+ "type": "text",
1614
+ "text": "B EXPERIMENTAL DETAILS ",
1615
+ "text_level": 1,
1616
+ "bbox": [
1617
+ 176,
1618
+ 325,
1619
+ 419,
1620
+ 342
1621
+ ],
1622
+ "page_idx": 15
1623
+ },
1624
+ {
1625
+ "type": "text",
1626
+ "text": "B.1 PRETRAINING ",
1627
+ "text_level": 1,
1628
+ "bbox": [
1629
+ 176,
1630
+ 358,
1631
+ 315,
1632
+ 372
1633
+ ],
1634
+ "page_idx": 15
1635
+ },
1636
+ {
1637
+ "type": "text",
1638
+ "text": "Our models are pretrained according to the methodology described in Section 3. For the Transformer, each variant follows the same setting as its corresponding ViT variant. For the Conv stage, we use the first three blocks (excluding the Conv stem) of ResNet-101 and ResNet-152 (He et al., 2016) for our Base and Large models respectively, and a larger variant of ResNet-152 with more channels for the Huge model (matching its hidden dimension size). We always use a fixed patch size of $1 6 \\times 1 6$ . During pretraining, we utilize the resolution of $2 2 4 \\times 2 2 4$ , resulting in a patch sequence of length $1 4 \\times 1 4$ as visual tokens. For the textual input, we use a vocabulary size of 32,000 and a max sequence length of 256 in both the encoder and the decoder. We also share parameters between the embedding and the decoder softmax output layer (Press & Wolf, 2016). All parameters are shared across visual and textual inputs except the Conv stage and positional embeddings. ",
1639
+ "bbox": [
1640
+ 174,
1641
+ 383,
1642
+ 825,
1643
+ 523
1644
+ ],
1645
+ "page_idx": 15
1646
+ },
1647
+ {
1648
+ "type": "text",
1649
+ "text": "We pretrain on large-scale web datasets for both image-text and text-only inputs. For joint vision and language data, we exploit the training set of ALIGN (Jia et al., 2021), which contains about 1.8B noisy image-text pairs. Notice that we do not use any extra data preprocessing or filtering, except simple random resized cropping. For the text-only copora, we use the Colossal Clean Crawled Corpus (C4) dataset presented in Raffel et al. (2019) and followed their preprocessing steps. The dataset contains about 800GB of web crawled documents. ",
1650
+ "bbox": [
1651
+ 174,
1652
+ 530,
1653
+ 825,
1654
+ 614
1655
+ ],
1656
+ "page_idx": 15
1657
+ },
1658
+ {
1659
+ "type": "text",
1660
+ "text": "All models are pretrained for about 1M steps from scratch to optimize for the single PrefixLM objective in Eq.3. We use the AdamW optimizer (Loshchilov & Hutter, 2017) with $\\beta _ { 1 } = 0 . 9 , \\beta _ { 2 } =$ 0.999 and weight decay of 0.01. We warm up the learning rate for the first $2 \\%$ of updates to a peak value of $5 \\times 1 0 ^ { - 4 }$ , and then linearly decay it afterwards. Dropout is not used during the pretraining stage. We mix the two pretraining datasets within each batch, which contains 4,096 image-text pairs and 512 text-only documents, sharded across 512 TPU v3 chips (Jouppi et al., 2017). ",
1661
+ "bbox": [
1662
+ 174,
1663
+ 621,
1664
+ 825,
1665
+ 705
1666
+ ],
1667
+ "page_idx": 15
1668
+ },
1669
+ {
1670
+ "type": "text",
1671
+ "text": "B.2 FINETUNING ",
1672
+ "text_level": 1,
1673
+ "bbox": [
1674
+ 174,
1675
+ 723,
1676
+ 307,
1677
+ 737
1678
+ ],
1679
+ "page_idx": 15
1680
+ },
1681
+ {
1682
+ "type": "text",
1683
+ "text": "After pretraining, our model is finetuned on various downstream tasks. Similar to the pretraining stage, we use the AdamW optimizer with the same Beta values, while we tune the learning rate in $\\{ 1 \\times 1 0 ^ { - 5 }$ , $2 \\times 1 0 ^ { - 5 }$ , $5 \\times 1 0 ^ { - 5 } \\}$ . We also enable regularization methods of Dropout (set to 0.1) and stochastic depth (only applied to Conv stage and encoder with a fixed dropout rate of 0.1) (Huang et al., 2016) during the finetuning stage. Following standard practice, we use the corresponding dev split to find the best setting and report the result on the test split. We consider 5 types of downstream tasks listed below: ",
1684
+ "bbox": [
1685
+ 174,
1686
+ 750,
1687
+ 825,
1688
+ 847
1689
+ ],
1690
+ "page_idx": 15
1691
+ },
1692
+ {
1693
+ "type": "text",
1694
+ "text": "Visual question answering: This task requires the model to answer questions about input images, and has been the most widely used VL benchmark. Following prior work, we use the VQA v2 (Goyal et al., 2017) and formulate the task as a classification problem over 3,129 most frequent answers in the training set. The raw image and the corresponding question are used as inputs to the encoder and the decoder respectively, and a task-specific linear classifier is trained to predict answer based on activation corresponding to the last question token from the decoder. We use a resolution of $4 8 0 \\times 4 8 0$ for the image and all positional parameters are adapted using linear interpolation. ",
1695
+ "bbox": [
1696
+ 174,
1697
+ 854,
1698
+ 823,
1699
+ 924
1700
+ ],
1701
+ "page_idx": 15
1702
+ },
1703
+ {
1704
+ "type": "text",
1705
+ "text": "",
1706
+ "bbox": [
1707
+ 171,
1708
+ 103,
1709
+ 823,
1710
+ 132
1711
+ ],
1712
+ "page_idx": 16
1713
+ },
1714
+ {
1715
+ "type": "text",
1716
+ "text": "Visual entailment: The SNLI-VE (Xie et al., 2019) dataset is adapted from SNLI (Bowman et al., 2015), which is originally designed to predict the relation between a premise sentence and a hypothesis sentence as either entailment, neutral or contradiction, a task known as natural language inference (NLI). For the VL variant, the premise is based on the content of an image rather than textual descriptions. We finetune SimVLM similarly to VQA, such that the image and the sentence are fed to encoder and decoder separately, and the classifier is trained to predict the three relations. ",
1717
+ "bbox": [
1718
+ 174,
1719
+ 138,
1720
+ 825,
1721
+ 222
1722
+ ],
1723
+ "page_idx": 16
1724
+ },
1725
+ {
1726
+ "type": "text",
1727
+ "text": "Visual reasoning: The NLVR2 (Suhr et al., 2018) dataset tests the model’s ability of jointly reasoning over the language and multiple images by asking whether a textual description is true based on a pair of two images. Following Zhang et al. (2021), we create two input pairs, each consisting of one image and the textual description, and generate output embeddings for both using the same setup above. The two embeddings are then concatenated for final prediction. ",
1728
+ "bbox": [
1729
+ 174,
1730
+ 229,
1731
+ 825,
1732
+ 299
1733
+ ],
1734
+ "page_idx": 16
1735
+ },
1736
+ {
1737
+ "type": "text",
1738
+ "text": "Image captioning: The captioning task requires a model to generate natural language descriptions of input images. We consider two datasets CoCo (Chen et al., 2015) and NoCaps (Agrawal et al., 2019), both finetuned using the CoCo training data. For SimVLM, it is straightforward to first encode the image in the encoder and then generate captions using the decoder. Note that in contrast to prior work that apply task-specific tricks such as CIDEr optimization (Rennie et al., 2017), our model is trained with naive cross-entropy loss only. ",
1739
+ "bbox": [
1740
+ 174,
1741
+ 306,
1742
+ 825,
1743
+ 390
1744
+ ],
1745
+ "page_idx": 16
1746
+ },
1747
+ {
1748
+ "type": "text",
1749
+ "text": "Multimodal translation: The goal of multimodal translation is to translate image descriptions in source language to target language, for which image inputs can be taken advantage of as grounding signal. We train and evaluate on the Multi30k (Elliott et al., 2016) dataset. We utilize the PrefixLM described in previous sections such that the source sentence, together with the image inputs, are fed to the encoder, which will be translated to the target language by the decoder. ",
1750
+ "bbox": [
1751
+ 174,
1752
+ 397,
1753
+ 825,
1754
+ 467
1755
+ ],
1756
+ "page_idx": 16
1757
+ },
1758
+ {
1759
+ "type": "text",
1760
+ "text": "C MODEL PERFORMANCE ON LANGUAGE-ONLY TASK ",
1761
+ "text_level": 1,
1762
+ "bbox": [
1763
+ 176,
1764
+ 487,
1765
+ 638,
1766
+ 502
1767
+ ],
1768
+ "page_idx": 16
1769
+ },
1770
+ {
1771
+ "type": "text",
1772
+ "text": "We compare our model with prior VLP methods on natural language understanding (NLU) tasks on the GLUE benchmark (Wang et al., 2018) in Table 7. ",
1773
+ "bbox": [
1774
+ 173,
1775
+ 518,
1776
+ 823,
1777
+ 546
1778
+ ],
1779
+ "page_idx": 16
1780
+ },
1781
+ {
1782
+ "type": "text",
1783
+ "text": "D ERRATUM ",
1784
+ "text_level": 1,
1785
+ "bbox": [
1786
+ 174,
1787
+ 568,
1788
+ 294,
1789
+ 583
1790
+ ],
1791
+ "page_idx": 16
1792
+ },
1793
+ {
1794
+ "type": "text",
1795
+ "text": "We found an error in reporting the zero-shot COCO evaluations in the first version of this paper. This mistake does NOT affect all other results and the numbers have been updated. Meanwhile, we also added few-shot results in addition to zero-shot results on both MsCOCO and NoCaps in Table 2, to provide a more comprehensive view of capacities in SimVLM models. Hence, our main claims and conclusions still hold. ",
1796
+ "bbox": [
1797
+ 174,
1798
+ 598,
1799
+ 825,
1800
+ 667
1801
+ ],
1802
+ "page_idx": 16
1803
+ }
1804
+ ]
parse/dev/GUrhfTuf_3/GUrhfTuf_3_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/GUrhfTuf_3/GUrhfTuf_3_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/V88BafmH9Pj/V88BafmH9Pj_content_list.json ADDED
@@ -0,0 +1,1434 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "A Contrastive Framework for Neural Text Generation ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 173,
8
+ 122,
9
+ 821,
10
+ 147
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Yixuan Su♠ Tian Lan♢ Yan Wang♢ Dani Yogatama♣ Lingpeng Kong♡ Nigel Collier♠ ♠Language Technology Lab, University of Cambridge ♢Tencent AI Lab ♣DeepMind ♡Department of Computer Science, The University of Hong Kong {ys484,nhc30}@cam.ac.uk lantiangmftby@gmail.com, yanwang.branden@gmail.com dyogatama@deepmind.com, lpk@cs.hku.hk ",
17
+ "bbox": [
18
+ 251,
19
+ 194,
20
+ 745,
21
+ 313
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Abstract ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 462,
31
+ 347,
32
+ 535,
33
+ 363
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Text generation is of great importance to many natural language processing applications. However, maximization-based decoding methods (e.g., beam search) of neural language models often lead to degenerate solutions—the generated text is unnatural and contains undesirable repetitions. Existing approaches introduce stochasticity via sampling or modify training objectives to decrease the probabilities of certain tokens (e.g., unlikelihood training). However, they often lead to solutions that lack coherence. In this work, we show that an underlying reason for model degeneration is the anisotropic distribution of token representations. We present a contrastive solution: (i) SimCTG, a contrastive training objective to calibrate the model’s representation space, and (ii) a decoding method—contrastive search—to encourage diversity while maintaining coherence in the generated text. Extensive experiments and analyses on three benchmarks from two languages demonstrate that our proposed approach significantly outperforms current state-of-the-art text generation methods as evaluated by both human and automatic metrics.1 ",
40
+ "bbox": [
41
+ 233,
42
+ 380,
43
+ 766,
44
+ 573
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 Introduction ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 174,
54
+ 599,
55
+ 310,
56
+ 617
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Open-ended neural text generation [19, 23] with Transformer [25] is an indispensable component in various natural language applications, such as story generation [7, 20], contextual text completion [18], and dialogue systems [22]. However, the conventional approach of training a language model with maximum likelihood estimation (MLE) and decoding the most likely sequence is often not sufficient [10, 27]. Specifically, this modelling formulation often leads to the problem of degeneration, i.e., the generated texts from the language model tend to be dull and contain undesirable repetitions at different levels (e.g., token-, phrase-, and sentence-level) [4]. To alleviate this problem, previous solutions modify the decoding strategy by sampling from less likely vocabularies [7, 10]. While reducing the generated repetition, these sampling methods introduce another critical problem (semantic inconsistency)—the sampled text tends to diverge from or even contradict to the original semantics defined by the human-written prefix [1]. Another approach addresses the degeneration problem by modifying the model’s output vocabulary distribution with unlikelihood training [27]. ",
63
+ "bbox": [
64
+ 174,
65
+ 632,
66
+ 825,
67
+ 797
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "In this work, we argue that the degeneration of neural language models stems from the anisotropic distribution of token representations, i.e., their representations reside in a narrow subset of the entire space [6, 5, 21]. In Figure 1(a), we showcase a cosine similarity matrix of token representations (taken from the output layer of the Transformer) produced by GPT-2. We see that the cosine similarities between tokens within a sentence are over 0.95, meaning that these representations are close to each other. Such high similarity is undesirable as it can naturally cause the model to generate repetitive tokens at different steps. In an ideal setting, the token representations should follow an isotropic distribution, i.e., the token similarity matrix should be sparse and the representations of distinct tokens should be discriminative as shown in Figure 1(b). Moreover, during the decoding process, the sparseness of the token similarity matrix of the generated text should be preserved to avoid model degeneration. ",
74
+ "bbox": [
75
+ 174,
76
+ 804,
77
+ 823,
78
+ 873
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "image",
84
+ "img_path": "images/f835200a6a4bf1ea7d1293ce5bc4ca125c92bc45b8f6ab9d4b32872cfa724103.jpg",
85
+ "image_caption": [
86
+ "Figure 1: Token cosine similarity matrix of (a) GPT-2 and (b) SimCTG. (best viewed in color) "
87
+ ],
88
+ "image_footnote": [],
89
+ "bbox": [
90
+ 191,
91
+ 85,
92
+ 812,
93
+ 257
94
+ ],
95
+ "page_idx": 1
96
+ },
97
+ {
98
+ "type": "text",
99
+ "text": "",
100
+ "bbox": [
101
+ 173,
102
+ 296,
103
+ 825,
104
+ 381
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "Based on the above motivations, we present SimCTG (a simple contrastive framework for neural text generation) that encourages the model to learn discriminative and isotropic token representations. We also present a novel decoding strategy to complement SimCTG, contrastive search. The key intuitions behind contrastive search are: (i) at each decoding step, the output should be selected from the set of most probable candidates predicted by the model to better maintain the semantic coherence between the generated text and the human-written prefix, and (ii) the sparseness of the token similarity matrix of the generated text should be preserved to avoid degeneration. ",
111
+ "bbox": [
112
+ 174,
113
+ 387,
114
+ 825,
115
+ 484
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "We conduct comprehensive experiments on three widely used benchmarks. We show that our approach is generalizable to different tasks and different languages $\\ S 4$ and $\\ S 5$ ) as well as different model sizes $\\ S 4 . 3$ and Appendix D). Specifically, the experimental results verify that SimCTG improves the intrinsic qualities of the language model, as evaluated by perplexity and token prediction accuracy $\\Re 4 . 2$ and Appendix D). Moreover, we demonstrate that the proposed contrastive search significantly outperforms previous state-of-the-art decoding methods in both human and automatic evaluations $\\{ \\ S 4$ and $\\ S 5$ ). Furthermore, we provide in-depth analyses to get better insights on the inner-workings of our proposed approach (§6). ",
122
+ "bbox": [
123
+ 173,
124
+ 489,
125
+ 825,
126
+ 602
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "2 Background ",
133
+ "text_level": 1,
134
+ "bbox": [
135
+ 174,
136
+ 621,
137
+ 308,
138
+ 637
139
+ ],
140
+ "page_idx": 1
141
+ },
142
+ {
143
+ "type": "text",
144
+ "text": "2.1 Language Modelling ",
145
+ "text_level": 1,
146
+ "bbox": [
147
+ 174,
148
+ 651,
149
+ 356,
150
+ 667
151
+ ],
152
+ "page_idx": 1
153
+ },
154
+ {
155
+ "type": "text",
156
+ "text": "The goal of language modelling is to learn a probability distribution $p _ { \\theta } ( { \\pmb x } )$ over a variable-length text sequence $\\pmb { x } = \\bar { \\{ { x _ { 1 } , . . . , x _ { | x | } } \\} }$ , where $\\theta$ denotes model parameters. Typically, the maximum likelihood estimation (MLE) objective is used to train the language model which is defined as ",
157
+ "bbox": [
158
+ 174,
159
+ 678,
160
+ 825,
161
+ 720
162
+ ],
163
+ "page_idx": 1
164
+ },
165
+ {
166
+ "type": "equation",
167
+ "img_path": "images/8467ee192f6e540f378c2c6811452ef2aa5202ab1b45a5dca873131c0487e08b.jpg",
168
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { M L E } } = - \\frac { 1 } { | \\pmb { x } | } \\sum _ { i = 1 } ^ { | \\pmb { x } | } \\log p _ { \\theta } ( x _ { i } | \\pmb { x } _ { < i } ) .\n$$",
169
+ "text_format": "latex",
170
+ "bbox": [
171
+ 383,
172
+ 727,
173
+ 614,
174
+ 772
175
+ ],
176
+ "page_idx": 1
177
+ },
178
+ {
179
+ "type": "text",
180
+ "text": "However, as observed in many recent studies [6, 5, 21], training with likelihood maximization objective often yields an anisotropic distribution of model representations (especially for Transformerbased models) that undermines the model’s capacity. ",
181
+ "bbox": [
182
+ 174,
183
+ 785,
184
+ 825,
185
+ 828
186
+ ],
187
+ "page_idx": 1
188
+ },
189
+ {
190
+ "type": "text",
191
+ "text": "2.2 Open-ended Text Generation ",
192
+ "text_level": 1,
193
+ "bbox": [
194
+ 174,
195
+ 843,
196
+ 415,
197
+ 859
198
+ ],
199
+ "page_idx": 1
200
+ },
201
+ {
202
+ "type": "text",
203
+ "text": "In this work, we focus on studying the task of open-ended text generation due to its generality in various applications, such as story generation [7, 20], contextual text completion [18], poetry generation [14], and dialogue systems [22]. Formally, conditioned on a human-written prefix (i.e., context) $_ { \\textbf { \\em x } }$ , the task is to decode a continuation $\\hat { \\textbf { \\textit { x } } }$ from the language model and the resulting text is $\\{ x _ { 1 } , . . , x _ { | x | } , \\hat { x } _ { | x | + 1 } , . . . , \\hat { x } _ { | x | + | \\hat { x } | } \\}$ . Typically, there are two classes of methods used for decoding, which are (1) deterministic methods and (2) stochastic methods. ",
204
+ "bbox": [
205
+ 174,
206
+ 869,
207
+ 825,
208
+ 911
209
+ ],
210
+ "page_idx": 1
211
+ },
212
+ {
213
+ "type": "text",
214
+ "text": "",
215
+ "bbox": [
216
+ 173,
217
+ 90,
218
+ 825,
219
+ 133
220
+ ],
221
+ "page_idx": 2
222
+ },
223
+ {
224
+ "type": "text",
225
+ "text": "Deteriminstic Methods. Two widely used deterministic approaches are greedy and beam search which aim to select the text continuation with highest probability based on the model’s probability distribution $p _ { \\theta }$ . However, solely maximizing the output probability often leads to dullness [13] and degeneration [7, 10] in the generated text. ",
226
+ "bbox": [
227
+ 173,
228
+ 138,
229
+ 825,
230
+ 195
231
+ ],
232
+ "page_idx": 2
233
+ },
234
+ {
235
+ "type": "text",
236
+ "text": "Stochastic Methods. To remedy the issues of deterministic decoding, several approaches have been proposed to sample from $p _ { \\theta }$ . To avoid sampling from the unreliable tail of distribution, Fan et al. [7] proposed top- $k$ sampling which draws sample from the vocabulary subset $V ^ { ( k ) }$ that maximizes $\\begin{array} { r } { \\sum _ { v \\in V ^ { ( k ) } } p _ { \\theta } ( v | \\pmb { x } ) } \\end{array}$ . Here, $| V ^ { ( k ) } | = k$ and $_ { \\textbf { \\em x } }$ is the prefix context. Differently, the current state-of-the-art nucleus sampling [10] draws sample from the smallest vocabulary subset $U$ with total probability mass above a threshold $p \\in [ 0 , 1 ]$ ; i.e., $U$ is the smallest vocabulary subset such that $\\begin{array} { r } { \\bar { \\sum _ { v \\in U } } p _ { \\theta } ( \\bar { v } | \\mathbf { x } ) \\ge p } \\end{array}$ . While the sampling approaches help to alleviate model degeneration, the intrinsic stochasticity in these methods could cause the semantic meaning of the sampled text to diverge from or even contradict to the human-written prefix [1]. ",
237
+ "bbox": [
238
+ 173,
239
+ 200,
240
+ 825,
241
+ 329
242
+ ],
243
+ "page_idx": 2
244
+ },
245
+ {
246
+ "type": "text",
247
+ "text": "3 Methodology ",
248
+ "text_level": 1,
249
+ "bbox": [
250
+ 174,
251
+ 347,
252
+ 315,
253
+ 364
254
+ ],
255
+ "page_idx": 2
256
+ },
257
+ {
258
+ "type": "text",
259
+ "text": "In this section, we first present how to apply contrastive learning to calibrate the representation space of the language model. Then, we introduce our proposed contrastive search decoding algorithm. ",
260
+ "bbox": [
261
+ 173,
262
+ 377,
263
+ 823,
264
+ 407
265
+ ],
266
+ "page_idx": 2
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "3.1 Contrastive Training ",
271
+ "text_level": 1,
272
+ "bbox": [
273
+ 174,
274
+ 421,
275
+ 359,
276
+ 438
277
+ ],
278
+ "page_idx": 2
279
+ },
280
+ {
281
+ "type": "text",
282
+ "text": "Our goal is to encourage the language model to learn discriminative and isotropic token representations. To this end, we introduce a contrastive objective ${ \\mathcal { L } } _ { \\mathrm { C L } }$ into the training of the language model. Specifically, given a variable-length sequence $\\pmb { x } = \\{ x _ { 1 } , . . . , x _ { | \\pmb { x } | } \\}$ , the ${ \\mathcal { L } } _ { \\mathrm { C L } }$ is defined as ",
283
+ "bbox": [
284
+ 174,
285
+ 446,
286
+ 826,
287
+ 491
288
+ ],
289
+ "page_idx": 2
290
+ },
291
+ {
292
+ "type": "equation",
293
+ "img_path": "images/34e244536ca1bc2897f7d5509018ed1f35ed393231aca6a374397b469633b59d.jpg",
294
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { C L } } = \\frac { 1 } { | \\boldsymbol { x } | \\times ( | \\boldsymbol { x } | - 1 ) } \\sum _ { i = 1 } ^ { | \\boldsymbol { x } | } \\sum _ { j = 1 , j \\neq i } ^ { | \\boldsymbol { x } | } \\operatorname* { m a x } \\{ 0 , \\rho - s ( h _ { \\boldsymbol { x } _ { i } } , h _ { \\boldsymbol { x } _ { i } } ) + s ( h _ { \\boldsymbol { x } _ { i } } , h _ { \\boldsymbol { x } _ { j } } ) \\} ,\n$$",
295
+ "text_format": "latex",
296
+ "bbox": [
297
+ 256,
298
+ 496,
299
+ 740,
300
+ 541
301
+ ],
302
+ "page_idx": 2
303
+ },
304
+ {
305
+ "type": "text",
306
+ "text": "where $\\rho \\in [ - 1 , 1 ]$ is a pre-defined margin and $h _ { x _ { i } }$ is the representation of token $x _ { i }$ produced by the model. The similarity function $s$ computes the cosine similarity between token representations as ",
307
+ "bbox": [
308
+ 174,
309
+ 545,
310
+ 826,
311
+ 574
312
+ ],
313
+ "page_idx": 2
314
+ },
315
+ {
316
+ "type": "equation",
317
+ "img_path": "images/0068ee059227d426f9b432507e3a8e854f33c1a8fb7ec116b2255809fcdffaa5.jpg",
318
+ "text": "$$\ns ( h _ { x _ { i } } , h _ { x _ { j } } ) = \\frac { h _ { x _ { i } } ^ { \\top } h _ { x _ { j } } } { \\| h _ { x _ { i } } \\| \\cdot \\| h _ { x _ { j } } \\| } .\n$$",
319
+ "text_format": "latex",
320
+ "bbox": [
321
+ 403,
322
+ 577,
323
+ 594,
324
+ 614
325
+ ],
326
+ "page_idx": 2
327
+ },
328
+ {
329
+ "type": "text",
330
+ "text": "Intuitively, by training with ${ \\mathcal { L } } _ { \\mathrm { C L } }$ , the model learns to pull away the distances between representations of distinct tokens.2 Therefore, a discriminative and isotropic model representation space can be obtained. The overall training objective $\\mathcal { L } _ { \\mathrm { S i m C T G } }$ is then defined as ",
331
+ "bbox": [
332
+ 174,
333
+ 617,
334
+ 826,
335
+ 660
336
+ ],
337
+ "page_idx": 2
338
+ },
339
+ {
340
+ "type": "equation",
341
+ "img_path": "images/866b422b4645492266297f2a0227a09f3b3b62cabac890fd5dbfd233793ad09f.jpg",
342
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { { S i m C T G } } } = \\mathcal { L } _ { \\mathrm { { M L E } } } + \\mathcal { L } _ { \\mathrm { { C L } } } ,\n$$",
343
+ "text_format": "latex",
344
+ "bbox": [
345
+ 415,
346
+ 664,
347
+ 581,
348
+ 680
349
+ ],
350
+ "page_idx": 2
351
+ },
352
+ {
353
+ "type": "text",
354
+ "text": "where the maximum likelihood estimation (MLE) objective $\\mathcal { L } _ { \\mathrm { M L E } }$ is described in Eq. (1). Note that, when the margin $\\rho$ in ${ \\mathcal { L } } _ { \\mathrm { C L } }$ equals to $0$ , the $\\mathcal { L } _ { \\mathrm { S i m C T G } }$ degenerates to the vanilla MLE objective $\\mathcal { L } _ { \\mathrm { M L E } }$ . ",
355
+ "bbox": [
356
+ 174,
357
+ 684,
358
+ 826,
359
+ 713
360
+ ],
361
+ "page_idx": 2
362
+ },
363
+ {
364
+ "type": "text",
365
+ "text": "3.2 Contrastive Search ",
366
+ "text_level": 1,
367
+ "bbox": [
368
+ 174,
369
+ 728,
370
+ 346,
371
+ 742
372
+ ],
373
+ "page_idx": 2
374
+ },
375
+ {
376
+ "type": "text",
377
+ "text": "We propose a novel decoding method, contrastive search. At each decoding step, the key ideas of contrastive search are (i) the generated output should be selected from the set of most probable candidates predicted by the model; and (ii) the generated output should be discriminative enough with respect to the previous context. In this way, the generated text can (i) better maintain the semantic coherence with respect to the prefix while (ii) avoiding model degeneration. ",
378
+ "bbox": [
379
+ 173,
380
+ 752,
381
+ 823,
382
+ 824
383
+ ],
384
+ "page_idx": 2
385
+ },
386
+ {
387
+ "type": "text",
388
+ "text": "Formally, given the previous context $\\scriptstyle { \\mathbf { \\mathcal { x } } } _ { < t }$ , at time step $t$ , the selection of the output $x _ { t }$ follows ",
389
+ "bbox": [
390
+ 174,
391
+ 829,
392
+ 787,
393
+ 844
394
+ ],
395
+ "page_idx": 2
396
+ },
397
+ {
398
+ "type": "equation",
399
+ "img_path": "images/8ab3d965ca59d9f3a95ff29d6cca9cc850dda21b0610f84ad61bac5c06b21ccf.jpg",
400
+ "text": "$$\nx _ { t } = \\underset { v \\in V ^ { ( k ) } } { \\arg \\operatorname* { m a x } } \\left\\{ \\left( 1 - \\alpha \\right) \\times \\underset { \\mathrm { m o d e l } \\mathrm { c o n f i d e n c e } } { p \\theta \\left( v | x _ { < t } \\right) } - \\alpha \\times \\underset { \\mathrm { d e g e n e r a t i o n } \\mathrm { p e n a l u } } { \\underbrace { \\left( \\operatorname* { m a x } \\{ s ( h _ { v } , h _ { x _ { j } } ) : 1 \\leq j \\leq t - 1 \\} \\right) } } \\right\\} ,\n$$",
401
+ "text_format": "latex",
402
+ "bbox": [
403
+ 217,
404
+ 847,
405
+ 779,
406
+ 886
407
+ ],
408
+ "page_idx": 2
409
+ },
410
+ {
411
+ "type": "text",
412
+ "text": "where $V ^ { ( k ) }$ is the set of top- $k$ predictions from the model’s probability distribution $p _ { \\theta } ( \\cdot | \\pmb { x } _ { < t } )$ and $k$ is typically set as $3 { \\sim } 1 0$ . In Eq. (5), the first term, model confidence, is the probability of candidate $v$ predicted by the model. The second term, degeneration penalty, measures how discriminative of candidate $v$ with respect to the previous context $\\scriptstyle { \\mathbf { { \\mathcal { x } } } } _ { < t }$ and $s$ is defined in Eq. (3). Specifically, it is defined as the maximum cosine similarity between the representation of $v$ and that of all tokens in $\\scriptstyle { \\mathbf { { \\mathcal { x } } } } _ { < t }$ . Here, the candidate representation $h _ { v }$ is computed by the model given the concatenation of $\\scriptstyle { \\mathbf { \\mathcal { x } } } _ { < t }$ and $v$ . Intuitively, a larger degeneration penalty of $v$ means it is more similar to the context, therefore more likely leading to model degeneration. The hyperparameter $\\alpha \\in [ 0 , 1 ]$ regulates the importance of these two components. When $\\alpha = 0$ , contrastive search degenerates to the greedy search method. ",
413
+ "bbox": [
414
+ 173,
415
+ 90,
416
+ 825,
417
+ 215
418
+ ],
419
+ "page_idx": 3
420
+ },
421
+ {
422
+ "type": "text",
423
+ "text": "4 Document Generation ",
424
+ "text_level": 1,
425
+ "bbox": [
426
+ 174,
427
+ 236,
428
+ 390,
429
+ 253
430
+ ],
431
+ "page_idx": 3
432
+ },
433
+ {
434
+ "type": "text",
435
+ "text": "We first evaluate our approach on the task of open-ended document generation. ",
436
+ "bbox": [
437
+ 174,
438
+ 268,
439
+ 689,
440
+ 284
441
+ ],
442
+ "page_idx": 3
443
+ },
444
+ {
445
+ "type": "text",
446
+ "text": "Model and Baselines. Our proposed approach is architecture-agnostic and can be applied to any generation model. In this work, we evaluate our method on the representative GPT-2 model [18]. Specifically, we fine-tune GPT-2 on the evaluated benchmark (detailed below) with the proposed objective $\\mathcal { L } _ { \\mathrm { { S i m C T G } } }$ (Eq. (4)) and generate the text continuation with different decoding methods. We perform experiments using the base model (117M parameters) which consists of 12 Transformer layers [25] with 12 attention heads.3 We compare our approach with two strong baselines: (1) GPT-2 fine-tuned with the standard MLE objective (Eq. (1)); and (2) GPT-2 fine-tuned with unlikelihood objective [27].4 Our implementation is based on the Huggingface Library [28]. ",
447
+ "bbox": [
448
+ 174,
449
+ 289,
450
+ 825,
451
+ 401
452
+ ],
453
+ "page_idx": 3
454
+ },
455
+ {
456
+ "type": "text",
457
+ "text": "Evaluation Benchmark. We conduct experiments on the Wikitext-103 dataset [16] which contains a large collection of Wikipedia articles with over 100 million words and 260 thousands unique tokens. Wikitext-103 is a document-level dataset and has been widely used for the evaluation of large-scale language modelling [3, 11, 29]. ",
458
+ "bbox": [
459
+ 174,
460
+ 406,
461
+ 825,
462
+ 463
463
+ ],
464
+ "page_idx": 3
465
+ },
466
+ {
467
+ "type": "text",
468
+ "text": "Training. For our SimCTG and the MLE baseline, we fine-tune the models on Wikitext-103 for 40k training steps. For the unlikelihood baseline, following Welleck et al. [27], we first fine-tune the model with the token-level unlikelihood objective for $3 8 . 5 \\mathrm { k }$ steps and then with the sequence-level unlikelihood objective for $1 . 5 \\mathrm { k }$ steps. Therefore, the overall training steps of all compared methods are the same. The batch size is set as 128 and the training samples are truncated to a maximum length of 256. We optimize the model with Adam optimizer [12] and a learning rate of 2e-5. ",
469
+ "bbox": [
470
+ 174,
471
+ 468,
472
+ 825,
473
+ 551
474
+ ],
475
+ "page_idx": 3
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "Decoding. We evaluate the models by producing text continuations given the prefixes from the test set. In the experiments, the lengths of the prefix and the generated continuation are set as 32 and 128, respectively. We test different models with various decoding methods. For deterministic method, we use greedy search and beam search with a beam size of 10. For stochastic method, we use the current state-of-the-art nucleus sampling [10] with $p = 0 . 9 5$ . For the proposed contrastive search, the $k$ and $\\alpha$ in Eq. (5) are set as 8 and 0.6.5 The hyperparameters of different methods are selected based on their optimal MAUVE (detailed in $\\ S 4 . 1 . 2 )$ performance on the validation set. ",
480
+ "bbox": [
481
+ 174,
482
+ 558,
483
+ 825,
484
+ 655
485
+ ],
486
+ "page_idx": 3
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "4.1 Evaluation Metrics ",
491
+ "text_level": 1,
492
+ "bbox": [
493
+ 174,
494
+ 672,
495
+ 346,
496
+ 688
497
+ ],
498
+ "page_idx": 3
499
+ },
500
+ {
501
+ "type": "text",
502
+ "text": "We perform evaluation from two aspects: (1) language modelling quality which measures the intrinsic quality of the model; and (2) generation quality which measures the quality of the generated text. ",
503
+ "bbox": [
504
+ 176,
505
+ 699,
506
+ 825,
507
+ 728
508
+ ],
509
+ "page_idx": 3
510
+ },
511
+ {
512
+ "type": "text",
513
+ "text": "4.1.1 Language Modelling Quality ",
514
+ "text_level": 1,
515
+ "bbox": [
516
+ 174,
517
+ 743,
518
+ 424,
519
+ 758
520
+ ],
521
+ "page_idx": 3
522
+ },
523
+ {
524
+ "type": "text",
525
+ "text": "Following Welleck et al. [27], we report the results of the model on the metrics below. ",
526
+ "bbox": [
527
+ 171,
528
+ 767,
529
+ 736,
530
+ 782
531
+ ],
532
+ "page_idx": 3
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "Perplexity. The model perplexity (ppl) on the test set of Wikitext-103. ",
537
+ "bbox": [
538
+ 173,
539
+ 789,
540
+ 635,
541
+ 804
542
+ ],
543
+ "page_idx": 3
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "Prediction Accuracy. It is defined as: $\\begin{array} { r } { \\mathbf { a c c } = \\frac { 1 } { \\sum _ { \\pmb { x } \\in \\mathcal { D } } | \\pmb { x } | } \\sum _ { \\pmb { x } \\in \\mathcal { D } } \\sum _ { t = 1 } ^ { | \\pmb { x } | } \\mathbb { 1 } [ \\mathrm { a r g } \\operatorname* { m a x } p _ { \\theta } ( x | \\pmb { x } _ { < t } ) = x _ { t } ] , } \\end{array}$ where $\\mathcal { D }$ is the Wikitext-103 test set, $\\scriptstyle { \\mathbf { \\mathcal { x } } } _ { < t }$ is the prefix, and $x _ { t }$ is the reference token at time step $t$ . ",
548
+ "bbox": [
549
+ 174,
550
+ 810,
551
+ 826,
552
+ 844
553
+ ],
554
+ "page_idx": 3
555
+ },
556
+ {
557
+ "type": "table",
558
+ "img_path": "images/0068efbc369fa590e07201bc8c8d53f4f65e0ec2dbb4657984b5887b75162f78.jpg",
559
+ "table_caption": [
560
+ "Table 1: Evaluation results on Wikitext-103 test set. “Unlike.” denotes the model trained with unlikelihood objective. $\\uparrow$ means higher is better and $\\downarrow$ means lower is better. "
561
+ ],
562
+ "table_footnote": [],
563
+ "table_body": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"4\">LanguageModellingQuality</td><td colspan=\"8\">Generation Quality</td></tr><tr><td>ppl</td><td>acc↑</td><td>rep↓</td><td>wrep↓</td><td>Method</td><td>rep-2↓</td><td>rep-3↓</td><td>rep-4↓</td><td>diversity↑</td><td>MAUVE↑</td><td>coherence↑</td><td>gen-ppl</td></tr><tr><td rowspan=\"4\">MLE</td><td rowspan=\"4\">24.32</td><td rowspan=\"4\">39.63</td><td rowspan=\"4\">52.82</td><td rowspan=\"4\">29.97</td><td>greedy</td><td>69.21</td><td>65.18</td><td>62.05</td><td>0.04</td><td>0.03</td><td>0.587</td><td>7.32</td></tr><tr><td>beam</td><td>71.94</td><td>68.97</td><td>66.62</td><td>0.03</td><td>0.03</td><td>0.585</td><td>6.42</td></tr><tr><td>nucleus</td><td>4.45</td><td>0.81</td><td>0.43</td><td>0.94</td><td>0.90</td><td>0.577</td><td>49.71</td></tr><tr><td>contrastive</td><td>44.20</td><td>37.07</td><td>32.44</td><td>0.24</td><td>0.18</td><td>0.599</td><td>9.90</td></tr><tr><td rowspan=\"4\">Unlike.</td><td rowspan=\"4\">28.57</td><td rowspan=\"4\">38.41</td><td rowspan=\"4\">51.23</td><td rowspan=\"4\">28.57</td><td>greedy</td><td>24.12</td><td>13.35</td><td>8.04</td><td>0.61</td><td>0.69</td><td>0.568</td><td>37.82</td></tr><tr><td>beam</td><td>11.83</td><td>5.11</td><td>2.86</td><td>0.81</td><td>0.75</td><td>0.524</td><td>34.73</td></tr><tr><td>nucleus</td><td>4.01</td><td>0.80</td><td>0.42</td><td>0.95</td><td>0.87</td><td>0.563</td><td>72.03</td></tr><tr><td>contrastive</td><td>7.48</td><td>3.23</td><td>1.40</td><td>0.88</td><td>0.83</td><td>0.574</td><td>43.61</td></tr><tr><td rowspan=\"4\">SimCTG</td><td rowspan=\"4\">23.82</td><td rowspan=\"4\">40.91</td><td rowspan=\"4\">51.66</td><td rowspan=\"4\">28.65</td><td>greedy</td><td>67.36</td><td>63.33</td><td>60.17</td><td>0.05</td><td>0.05</td><td>0.596</td><td>7.16</td></tr><tr><td>beam</td><td>70.32</td><td>67.17</td><td>64.64</td><td>0.04</td><td>0.06</td><td>0.591</td><td>6.36</td></tr><tr><td>nucleus</td><td>4.05</td><td>0.79</td><td>0.37</td><td>0.94</td><td>0.92</td><td>0.584</td><td>47.19</td></tr><tr><td>contrastive</td><td>3.93</td><td>0.78</td><td>0.31</td><td>0.95</td><td>0.94</td><td>0.610</td><td>18.26</td></tr><tr><td>Human</td><td>-</td><td>-</td><td>36.19</td><td>-</td><td>-</td><td>3.92</td><td>0.88</td><td>0.28</td><td>0.95</td><td>1.00</td><td>0.644</td><td>24.01</td></tr></table>",
564
+ "bbox": [
565
+ 178,
566
+ 88,
567
+ 821,
568
+ 268
569
+ ],
570
+ "page_idx": 4
571
+ },
572
+ {
573
+ "type": "text",
574
+ "text": "Prediction Repetition. The fraction of next-token (top-1) predictions that occur in the prefix which is defined as: $\\begin{array} { r } { \\mathbf { r e p } = \\frac { 1 } { \\sum _ { \\pmb { x } \\in \\mathcal { D } } | \\pmb { x } | } \\sum _ { \\pmb { x } \\in \\mathcal { D } } \\sum _ { t = 1 } ^ { | \\pmb { x } | } \\mathbb { 1 } \\big [ \\mathrm { a r g } \\operatorname* { m a x } p _ { \\theta } \\big ( \\pmb { x } | \\pmb { x } _ { < t } \\big ) \\in \\pmb { x } _ { < t } \\big ] . } \\end{array}$ ",
575
+ "bbox": [
576
+ 174,
577
+ 325,
578
+ 823,
579
+ 363
580
+ ],
581
+ "page_idx": 4
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "In addition, the next token repetitions that do not equal to the ground truth token: wrep $=$ P 1x |x| Px∈D P|x|t=1 1[arg max pθ(x|x<t) ∈ x<t ∧ ̸= xt] is also reported. ",
586
+ "bbox": [
587
+ 176,
588
+ 367,
589
+ 825,
590
+ 404
591
+ ],
592
+ "page_idx": 4
593
+ },
594
+ {
595
+ "type": "text",
596
+ "text": "4.1.2 Generation Quality ",
597
+ "text_level": 1,
598
+ "bbox": [
599
+ 174,
600
+ 419,
601
+ 361,
602
+ 434
603
+ ],
604
+ "page_idx": 4
605
+ },
606
+ {
607
+ "type": "text",
608
+ "text": "Generation Repetition. This metric measures the sequence-level repetition as the portion of duplicate $n$ -grams in the generated text [27]. For a generated text continuation $\\hat { \\textbf { \\textit { x } } }$ , the repetion at $n$ -gram level is defined as: rep- $\\begin{array} { r } { \\mathbf { \\delta n } = 1 0 0 \\times \\big ( 1 . 0 - \\frac { | \\mathrm { u n i q u e ~ n - g r a m s } ( \\hat { \\pmb x } ) | } { | \\mathrm { t o t a l ~ n - g r a m s } ( \\hat { \\pmb x } ) | } \\big ) } \\end{array}$ ",
609
+ "bbox": [
610
+ 173,
611
+ 444,
612
+ 825,
613
+ 497
614
+ ],
615
+ "page_idx": 4
616
+ },
617
+ {
618
+ "type": "text",
619
+ "text": "Diversity. This metric takes into account the generation repetition at different -gram levels and it is defined as: diversity $\\begin{array} { r } { = \\prod _ { n = 2 } ^ { 4 } ( 1 . 0 - \\frac { \\mathrm { r e p - n } } { 1 0 0 } ) } \\end{array}$ . It can be deemed as an overall assessment of model degeneration. A lower diversity means a more severe degeneration of the model. ",
620
+ "bbox": [
621
+ 174,
622
+ 502,
623
+ 825,
624
+ 546
625
+ ],
626
+ "page_idx": 4
627
+ },
628
+ {
629
+ "type": "text",
630
+ "text": "MAUVE [17] is a metric that measures the token distribution closeness between the generated text and human-written text. A higher MAUVE score means the model generates more human-like texts. ",
631
+ "bbox": [
632
+ 171,
633
+ 553,
634
+ 823,
635
+ 582
636
+ ],
637
+ "page_idx": 4
638
+ },
639
+ {
640
+ "type": "text",
641
+ "text": "Semantic Coherence. To automatically measure the semantic coherence (i.e., consistency) between the prefix and the generated text, we employ the advanced sentence embedding method, SimCSE [9]. Specifically, given the prefix $_ { \\textbf { \\em x } }$ and the generated text $\\hat { \\pmb x }$ , the coherence score is defined as: coherence $= v _ { x } ^ { \\top } v _ { \\hat { x } } / ( \\| v _ { x } \\| { \\cdot } \\| \\hat { v } _ { \\hat { x } } \\| )$ , where $v _ { x } = \\mathrm { S i m C S E } ( x )$ and $v _ { \\hat { \\mathbf { x } } } = \\mathrm { S i m C S E } ( \\hat { \\mathbf { x } } )$ . ",
642
+ "bbox": [
643
+ 174,
644
+ 587,
645
+ 825,
646
+ 643
647
+ ],
648
+ "page_idx": 4
649
+ },
650
+ {
651
+ "type": "text",
652
+ "text": "Perplexity of Generated Text. Lastly, we evaluate the perplexity of the generated text $\\hat { \\pmb x }$ given the prefix $_ { \\textbf { \\em x } }$ , which is defined as: $\\mathbf { g e n - } \\mathbf { \\dot { p } } \\mathbf { p } \\mathbf { l } = 2 ^ { f ( T , \\theta ) }$ and $\\begin{array} { r } { \\bar { f } ( \\bar { D } , \\theta ) = \\frac { 1 } { \\sum _ { \\pmb { x } \\in \\mathcal { D } } | \\hat { \\pmb x } | } \\sum _ { \\pmb { x } \\in \\mathcal { D } } \\log _ { 2 } p _ { \\theta } ( \\bar { \\pmb x } | \\pmb x ) } \\end{array}$ Importantly, the optimal approach should produce text which has a perplexity close to that of the human-written text [10]. A high gen-ppl means the generated text is very unlikely given the prefix, therefore being low quality. In contrastive, a low gen-ppl means the generated text has a low diversity and gets stuck in repetitive loops [10]. We use the model $\\theta$ trained with $\\mathcal { L } _ { \\mathrm { S i m C T G } }$ to measure the gen-ppl of different approaches, therefore making sure the numbers are comparable with each other.6 ",
653
+ "bbox": [
654
+ 173,
655
+ 648,
656
+ 826,
657
+ 753
658
+ ],
659
+ "page_idx": 4
660
+ },
661
+ {
662
+ "type": "text",
663
+ "text": "4.2 Results ",
664
+ "text_level": 1,
665
+ "bbox": [
666
+ 174,
667
+ 770,
668
+ 264,
669
+ 785
670
+ ],
671
+ "page_idx": 4
672
+ },
673
+ {
674
+ "type": "text",
675
+ "text": "The experimental results on Wikitext-103 are shown in Table 1. ",
676
+ "bbox": [
677
+ 174,
678
+ 796,
679
+ 589,
680
+ 811
681
+ ],
682
+ "page_idx": 4
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "Language Modelling Quality. From the results, we observe that SimCTG achieves the best perplexity and next token accuracy. The reason is that, with more discriminative representations, SimCTG is less confusing when making next token predictions, leading to the improved model performance. ",
687
+ "bbox": [
688
+ 176,
689
+ 818,
690
+ 825,
691
+ 859
692
+ ],
693
+ "page_idx": 4
694
+ },
695
+ {
696
+ "type": "text",
697
+ "text": "On the rep and wrep metrics, the unlikelihood model yields the best result but at the expense of unfavorable performance drops in the perplexity and next token accuracy. ",
698
+ "bbox": [
699
+ 173,
700
+ 90,
701
+ 823,
702
+ 119
703
+ ],
704
+ "page_idx": 5
705
+ },
706
+ {
707
+ "type": "text",
708
+ "text": "Generation Quality. Firstly, on the rep-n and diversity metrics, SimCTG $^ +$ contrastive search obtains the best result, suggesting it best addresses the degeneration problem. Secondly, the MAUVE score demonstrates that SimCTG $^ +$ contrastive search generates texts that are closest to human-written texts in terms of token distribution. Thirdly, among all methods, $\\mathrm { S i m C T G } +$ contrastive search is the only approach that achieves over 0.6 coherence score, showing it produces semantically consistent text with respect to the prefix. Lastly, the gen-ppl metric also validates the superiority of $\\mathrm { S i m C T G } +$ contrastive search as it obtains notably better generation perplexity comparing with other approaches. ",
709
+ "bbox": [
710
+ 173,
711
+ 126,
712
+ 825,
713
+ 223
714
+ ],
715
+ "page_idx": 5
716
+ },
717
+ {
718
+ "type": "text",
719
+ "text": "Moreover, from the results of MLE and Unlikelihood baselines, we see that contrastive search still brings performance boost as compared with greedy and beam search. However, the performance gain still lags behind SimCTG, which demonstrates the necessity of contrastive training. The underlying reason is that, without using the contrastive objective ${ \\mathcal { L } } _ { \\mathrm { C L } }$ (Eq. (2)), the token representations obtained by MLE or Unlikelihood are less discriminative (§6.1). Therefore, the degeneration penalty (Eq. (5)) of different candidates are less distinguishable and the selection of output is dominated by the model confidence, making contrastive search less effective. ",
720
+ "bbox": [
721
+ 173,
722
+ 228,
723
+ 825,
724
+ 325
725
+ ],
726
+ "page_idx": 5
727
+ },
728
+ {
729
+ "type": "table",
730
+ "img_path": "images/77980be8052f6149bb30da9d21afca370bcf1b7dc5ad65f9bd729821bc1df8ed.jpg",
731
+ "table_caption": [],
732
+ "table_footnote": [
733
+ "Table 2: Human evaluation results. $\\star$ results significantly outperforms the results of nucleus sampling with different models (Sign Test with p-value $< 0 . 0 5$ ). "
734
+ ],
735
+ "table_body": "<table><tr><td>Model</td><td>DecodingMethod</td><td>Coherence</td><td>Fluency</td><td>Informativeness</td></tr><tr><td>Agreement</td><td>-</td><td>0.51</td><td>0.64</td><td>0.70</td></tr><tr><td rowspan=\"2\">MLE</td><td>nucleus</td><td>2.92</td><td>3.32</td><td>3.91</td></tr><tr><td>contrastive</td><td>2.78</td><td>2.29</td><td>2.56</td></tr><tr><td rowspan=\"2\">Unlikelihood</td><td>nucleus</td><td>2.59</td><td>3.02</td><td>3.58</td></tr><tr><td>contrastive</td><td>2.76</td><td>2.90</td><td>3.35</td></tr><tr><td rowspan=\"2\">SimCTG</td><td>nucleus</td><td>2.96</td><td>3.34</td><td>3.96</td></tr><tr><td>contrastive</td><td>3.25*</td><td>3.57*</td><td>3.96</td></tr><tr><td rowspan=\"2\">SimCTG-large</td><td>nucleus</td><td>3.01</td><td>3.37</td><td>3.98</td></tr><tr><td>contrastive</td><td>3.33*</td><td>3.66*</td><td>3.98</td></tr><tr><td>Human</td><td>-</td><td>3.70</td><td>3.71</td><td>4.21</td></tr></table>",
736
+ "bbox": [
737
+ 250,
738
+ 339,
739
+ 750,
740
+ 513
741
+ ],
742
+ "page_idx": 5
743
+ },
744
+ {
745
+ "type": "text",
746
+ "text": "4.3 Human Evaluation ",
747
+ "text_level": 1,
748
+ "bbox": [
749
+ 174,
750
+ 569,
751
+ 346,
752
+ 583
753
+ ],
754
+ "page_idx": 5
755
+ },
756
+ {
757
+ "type": "text",
758
+ "text": "We also conduct a human evaluation with the help of graders proficient in English from a third-party grading platform. We randomly select 200 prefixes with length of 32 from the test set of Wikitext-103. For each prefix, we use different models (MLE, Unlikelihood, and SimCTG) with two decoding methods (nucleus sampling and contrastive search) to generate text continuations with length of 128. To examine the generality of our approach across different model sizes, we include a large size SimCTG (i.e., SimCTG-large) which is obtained by fine-tuning the GPT-2-large model that consists of 36 Transformer layers with 20 attention heads. All generated results, plus the reference text, are randomly shuffled and evaluated by five graders, which results in 9,000 annotated samples in total. The evaluation follows a 5-point Likert scale (1, 2, 3, 4, or 5) for each of the following features:7 ",
759
+ "bbox": [
760
+ 173,
761
+ 593,
762
+ 826,
763
+ 719
764
+ ],
765
+ "page_idx": 5
766
+ },
767
+ {
768
+ "type": "text",
769
+ "text": "• Coherence: Whether the generated text is semantically consistent with the prefix. \n• Fluency: Whether the generated text is fluent and easy to understand. \n• Informativeness: Whether the generated text is diverse and contains interesting content. ",
770
+ "bbox": [
771
+ 217,
772
+ 727,
773
+ 812,
774
+ 768
775
+ ],
776
+ "page_idx": 5
777
+ },
778
+ {
779
+ "type": "text",
780
+ "text": "Table 2 presents the human evaluation results, with the first row showing strong inter-annotator agreements as measured by Fleiss′ kappa coefficient [8]. Firstly, we see that, directly applying contrastive search with MLE or Unlikelihood model does not yield satisfactory results. This is due to the anisotropic nature of their representation space as discussed in Section $\\ S 4 . 2$ . Secondly, the coherence score of Unlikelihood model is notably lower than MLE and SimCTG, suggesting it generates the most unlikely results which is also shown by its generation perplexity (gen-ppl) in Table 1. Furthermore, the results of SimCTG $^ +$ contrastive search significantly outperforms nucleus sampling with different models in terms of coherence and fluency (Sign Test with $\\boldsymbol { \\mathrm { p } }$ -value $< 0 . 0 5$ ). ",
781
+ "bbox": [
782
+ 173,
783
+ 776,
784
+ 826,
785
+ 887
786
+ ],
787
+ "page_idx": 5
788
+ },
789
+ {
790
+ "type": "text",
791
+ "text": "Lastly, SimCTG-large $^ +$ contrastive search achieves the best performance across the board and even performs comparably with human-written text on the fluency metric (Sign Test with p-value $> 0 . 4$ ). This reveals the clear generalization ability of our approach to large size models and future work could focus on extending it to models that contain over billions of parameters such as GPT-3 [2]. ",
792
+ "bbox": [
793
+ 174,
794
+ 92,
795
+ 826,
796
+ 147
797
+ ],
798
+ "page_idx": 6
799
+ },
800
+ {
801
+ "type": "text",
802
+ "text": "5 Open-domain Dialogue Generation ",
803
+ "text_level": 1,
804
+ "bbox": [
805
+ 173,
806
+ 169,
807
+ 500,
808
+ 186
809
+ ],
810
+ "page_idx": 6
811
+ },
812
+ {
813
+ "type": "text",
814
+ "text": "To test the generality of our approach across different tasks and languages, we then evaluate our method on the task of open-domain dialogue generation. In this task, given a multi-turn dialogue context (where each turn is an user utterance), the model is asked to generate an adequate response that is semantically consistent with the context. Here, the dialogue context is deemed as the prefix. ",
815
+ "bbox": [
816
+ 174,
817
+ 202,
818
+ 825,
819
+ 258
820
+ ],
821
+ "page_idx": 6
822
+ },
823
+ {
824
+ "type": "text",
825
+ "text": "Benchmark and Baselines. We conduct experiments on two benchmark datasets from two languages (i.e., Chinese and English). For the Chinese benchmark, we use the LCCC dataset [26]. For the English Benchmark, we use the DailyDialog dataset [15]. ",
826
+ "bbox": [
827
+ 174,
828
+ 265,
829
+ 821,
830
+ 306
831
+ ],
832
+ "page_idx": 6
833
+ },
834
+ {
835
+ "type": "text",
836
+ "text": "We compare the GPT-2 models fine-tuned with SimCTG and MLE.8 Specifically, for the Chinese benchmark (i.e., LCCC), we use a publicly available Chinese GPT-2 [31].9 Same as in Section $\\ S 4$ , during training, we use a batch size of 128 and truncate the training samples to a maximum length of 256. On the LCCC dataset, we train (i.e., fine-tune) the models for $4 0 \\mathrm { k }$ steps. As for the DailyDialog dataset, due to its smaller dataset size, we train the models for $5 \\mathrm { k }$ steps. For optimization, we use Adam optimizer and a learning rate of 2e-5. ",
837
+ "bbox": [
838
+ 174,
839
+ 313,
840
+ 825,
841
+ 396
842
+ ],
843
+ "page_idx": 6
844
+ },
845
+ {
846
+ "type": "text",
847
+ "text": "For each model, we use four decoding methods, including (1) greedy search; (2) beam search (beam size of 10); (3) nucleus sampling $( p = 0 . 9 5 )$ ; and (4) contrastive search ( $k = 5$ , $\\alpha = 0 . 6$ ). ",
848
+ "bbox": [
849
+ 173,
850
+ 402,
851
+ 823,
852
+ 431
853
+ ],
854
+ "page_idx": 6
855
+ },
856
+ {
857
+ "type": "text",
858
+ "text": "Evaluation. We rely on human evaluation to assess the model performance. Same as in Section $\\ S 4 . 3$ , we randomly select 200 dialogue contexts from the test set and ask five annotators to evaluate the generated responses plus the reference response in three dimensions: (i) coherence, (ii) fluency; and (iii) informativeness. The scores follow a 5-point Likert scale (1, 2, 3, 4, or 5). ",
859
+ "bbox": [
860
+ 174,
861
+ 436,
862
+ 825,
863
+ 492
864
+ ],
865
+ "page_idx": 6
866
+ },
867
+ {
868
+ "type": "table",
869
+ "img_path": "images/60646677eb2475bfa8f2d4d9264d18497f1bd46d7c8642cb82db9c270c78bbb8.jpg",
870
+ "table_caption": [],
871
+ "table_footnote": [],
872
+ "table_body": "<table><tr><td rowspan=\"2\">Model</td><td rowspan=\"2\">Method</td><td colspan=\"3\">LCCC</td><td colspan=\"3\">DailyDialog</td></tr><tr><td>Coherence</td><td>Fluency</td><td>Informativeness</td><td>Coherence</td><td>Fluency</td><td>Informativeness</td></tr><tr><td>Agreement</td><td>-</td><td>0.73</td><td>0.61</td><td>0.57</td><td>0.64</td><td>0.60</td><td>0.55</td></tr><tr><td rowspan=\"4\">MLE</td><td>greedy</td><td>3.01</td><td>3.27</td><td>1.97</td><td>3.28</td><td>3.51</td><td>2.92</td></tr><tr><td>beam</td><td>2.60</td><td>2.90</td><td>1.55</td><td>3.16</td><td>3.43</td><td>2.78</td></tr><tr><td>nucleus</td><td>2.78</td><td>3.55</td><td>2.64</td><td>2.67</td><td>3.58</td><td>3.42</td></tr><tr><td>contrastive</td><td>3.28*</td><td>3.84*</td><td>3.06*</td><td>3.27</td><td>3.41</td><td>2.82</td></tr><tr><td rowspan=\"4\">SimCTG</td><td>greedy</td><td>3.04</td><td>3.32</td><td>2.01</td><td>3.31</td><td>3.50</td><td>2.94</td></tr><tr><td>beam</td><td>2.57</td><td>2.93</td><td>1.59</td><td>3.19</td><td>3.45</td><td>2.79</td></tr><tr><td>nucleus</td><td>2.84</td><td>3.58</td><td>2.72</td><td>2.75</td><td>3.59</td><td>3.39</td></tr><tr><td>contrastive</td><td>3.32*</td><td>3.96*</td><td>3.13*</td><td>3.73*</td><td>3.85*</td><td>3.46</td></tr><tr><td>Human</td><td>■</td><td>3.42</td><td>3.76</td><td>3.20</td><td>4.11</td><td>3.98</td><td>3.74</td></tr></table>",
873
+ "bbox": [
874
+ 186,
875
+ 508,
876
+ 815,
877
+ 683
878
+ ],
879
+ "page_idx": 6
880
+ },
881
+ {
882
+ "type": "text",
883
+ "text": "Table 3: Human evaluation results. $\\star$ results significantly outperforms the results of greedy search, beam search, and nucleus sampling with different models. (Sign Test with p-value $< 0 . 0 5$ ). ",
884
+ "bbox": [
885
+ 173,
886
+ 689,
887
+ 823,
888
+ 718
889
+ ],
890
+ "page_idx": 6
891
+ },
892
+ {
893
+ "type": "text",
894
+ "text": "Table 3 shows the evaluation results where the first row shows strong inter-annotator agreements as measured by Fleiss′ kappa coefficient. On both datasets, we see that $\\mathrm { S i m C T G } +$ contrastive search significantly outperforms other methods on various metrics, suggesting that our approach is generalizable to different languages and tasks. It is worth emphasizing that, on the LCCC benchmark, $\\mathrm { S i m C T G } +$ contrastive search surprisingly outperforms the human performance on the fluency metric, while performing comparably on the coherence and informativeness metrics (Sign Test with p-value $>$ 0.4). Moreover, even without contrastive training, the MLE model performs significantly better when using contrastive search. This is due to the intrinsic property of Chinese language model for which the MLE objective can already yield a representation space that displays a high level of isotropy, making contrastive search directly applicable.10 This finding is particularly attractive as it reveals the potential applicability of contrastive search on off-the-shelf (i.e., without contrastive training) language models for certain languages such as Chinese. ",
895
+ "bbox": [
896
+ 173,
897
+ 731,
898
+ 825,
899
+ 856
900
+ ],
901
+ "page_idx": 6
902
+ },
903
+ {
904
+ "type": "image",
905
+ "img_path": "images/f9767c0d156164c6472258e793f44daf3398abfd0356f83181988553a715bd88.jpg",
906
+ "image_caption": [
907
+ "Figure 2: Layer-wise representation self-similarity. "
908
+ ],
909
+ "image_footnote": [],
910
+ "bbox": [
911
+ 184,
912
+ 88,
913
+ 488,
914
+ 250
915
+ ],
916
+ "page_idx": 7
917
+ },
918
+ {
919
+ "type": "image",
920
+ "img_path": "images/0696f5a70f536adba72883a85153f3e885511b7027c4f8680630c4aa0cc387e2.jpg",
921
+ "image_caption": [
922
+ "Figure 3: The effect of contrastive margin $\\rho$ "
923
+ ],
924
+ "image_footnote": [],
925
+ "bbox": [
926
+ 511,
927
+ 90,
928
+ 812,
929
+ 246
930
+ ],
931
+ "page_idx": 7
932
+ },
933
+ {
934
+ "type": "text",
935
+ "text": "",
936
+ "bbox": [
937
+ 174,
938
+ 297,
939
+ 826,
940
+ 340
941
+ ],
942
+ "page_idx": 7
943
+ },
944
+ {
945
+ "type": "text",
946
+ "text": "6 Further Analysis ",
947
+ "text_level": 1,
948
+ "bbox": [
949
+ 174,
950
+ 359,
951
+ 348,
952
+ 377
953
+ ],
954
+ "page_idx": 7
955
+ },
956
+ {
957
+ "type": "text",
958
+ "text": "6.1 Token Representation Self-similarity ",
959
+ "text_level": 1,
960
+ "bbox": [
961
+ 176,
962
+ 391,
963
+ 467,
964
+ 406
965
+ ],
966
+ "page_idx": 7
967
+ },
968
+ {
969
+ "type": "text",
970
+ "text": "To analyze the token representations learned by SimCTG, we follow Ethayarajh [6] and define the averaged self-similarity of token representations within a text sequence $_ { \\textbf { \\em x } }$ as ",
971
+ "bbox": [
972
+ 173,
973
+ 416,
974
+ 823,
975
+ 445
976
+ ],
977
+ "page_idx": 7
978
+ },
979
+ {
980
+ "type": "equation",
981
+ "img_path": "images/0bc7e215370d1b349953a8b55551a4a3a030ece9060cf36d95dc1bddd98af49e.jpg",
982
+ "text": "$$\n\\mathrm { s e l f - s i m i l a r i t y } ( \\pmb { x } ) = \\frac { 1 } { | \\pmb { x } | \\times ( | \\pmb { x } | - 1 ) } \\sum _ { i = 1 } ^ { | \\pmb { x } | } \\sum _ { j = 1 , j \\neq i } ^ { | \\pmb { x } | } \\frac { h _ { x _ { i } } ^ { \\top } h _ { x _ { j } } } { \\| h _ { x _ { i } } \\| \\cdot \\| h _ { x _ { j } } \\| } ,\n$$",
983
+ "text_format": "latex",
984
+ "bbox": [
985
+ 297,
986
+ 452,
987
+ 697,
988
+ 498
989
+ ],
990
+ "page_idx": 7
991
+ },
992
+ {
993
+ "type": "text",
994
+ "text": "where $h _ { x _ { i } }$ and $h _ { x _ { j } }$ are the token representations of $x _ { i }$ and $x _ { j }$ produced by the model. Intuitively, a lower self-similarity $( { \\pmb x } )$ indicates the representations of distinct tokens within the sequence $_ { \\textbf { \\em x } }$ are less similar to each other, therefore being more discriminative. ",
995
+ "bbox": [
996
+ 174,
997
+ 505,
998
+ 825,
999
+ 547
1000
+ ],
1001
+ "page_idx": 7
1002
+ },
1003
+ {
1004
+ "type": "text",
1005
+ "text": "We use texts from Wikitext-103 test set and compute the self-similarity of token representations over different layers for different models. Figure 2 plots the results averaged over all samples. We see that, in the intermediate layers, the self-similarity of different models are relatively the same. In contrast, at the output layer (layer 12), SimCTG’s self-similarity becomes notably lower than other baselines. We note that the Unlikelihood model also yields more discriminative representations than MLE, but its language model accuracy is lower than MLE and SimCTG as shown in Table 1. On the other hand, SimCTG obtains the most discriminative and isotropic representations while maintaining the best language model accuracy, which further validates the clear advantage of our proposed approach. ",
1006
+ "bbox": [
1007
+ 173,
1008
+ 554,
1009
+ 826,
1010
+ 665
1011
+ ],
1012
+ "page_idx": 7
1013
+ },
1014
+ {
1015
+ "type": "text",
1016
+ "text": "6.2 The Effect of Contrastive Loss Margin ",
1017
+ "text_level": 1,
1018
+ "bbox": [
1019
+ 174,
1020
+ 681,
1021
+ 480,
1022
+ 695
1023
+ ],
1024
+ "page_idx": 7
1025
+ },
1026
+ {
1027
+ "type": "text",
1028
+ "text": "Next, we analyze the effect of contrastive loss margin $\\rho$ (Eq. (2)). To this end, we fine-tune the GPT-2 by varying $\\rho$ from 0.1 to 1.0 and measure the model perplexity on the Wikitext-103 test set. Figure 3 plots the results of different $\\rho$ along with the result of the MLE baseline. Note that, when $\\rho = 0$ , SimCTG is equivalent to MLE (Section $\\ S 3 . 1$ ). From Figure 3, we see that the contrastive training always helps to improve the perplexity as compared with MLE. However, when $\\rho$ is either too small (e.g., 0.1) or large (e.g., 1.0), the learned representation space of the model would be either less or too isotropic, leading to a sub-optimal perplexity. In our experiments, the most suitable margin $\\rho = 0 . 5$ . ",
1029
+ "bbox": [
1030
+ 173,
1031
+ 707,
1032
+ 826,
1033
+ 804
1034
+ ],
1035
+ "page_idx": 7
1036
+ },
1037
+ {
1038
+ "type": "text",
1039
+ "text": "6.3 Contrastive Search versus Nucleus Sampling ",
1040
+ "text_level": 1,
1041
+ "bbox": [
1042
+ 174,
1043
+ 819,
1044
+ 524,
1045
+ 835
1046
+ ],
1047
+ "page_idx": 7
1048
+ },
1049
+ {
1050
+ "type": "text",
1051
+ "text": "Then, we provide an in-depth comparsion between our proposed contrastive search and the current state of the art, nucleus sampling. To this end, we compare the results of SimCTG using these two decoding methods. Specifically, we vary the probability $p$ for nucleus sampling and the $\\alpha$ (Eq. (5)) ",
1052
+ "bbox": [
1053
+ 174,
1054
+ 845,
1055
+ 825,
1056
+ 887
1057
+ ],
1058
+ "page_idx": 7
1059
+ },
1060
+ {
1061
+ "type": "image",
1062
+ "img_path": "images/6905556abe3b339426c77ec29903ed11d0a956f4017d4690b43814ec07ef2962.jpg",
1063
+ "image_caption": [
1064
+ "Figure 4: Contrastive search vs nucleus sampling. "
1065
+ ],
1066
+ "image_footnote": [],
1067
+ "bbox": [
1068
+ 186,
1069
+ 88,
1070
+ 488,
1071
+ 248
1072
+ ],
1073
+ "page_idx": 8
1074
+ },
1075
+ {
1076
+ "type": "image",
1077
+ "img_path": "images/b0acfc3498edd1c88175357fd3f4ee81fc16b9ffaee83af09ceff97622e991aa.jpg",
1078
+ "image_caption": [
1079
+ "Figure 5: Inference latency comparison. "
1080
+ ],
1081
+ "image_footnote": [],
1082
+ "bbox": [
1083
+ 509,
1084
+ 88,
1085
+ 812,
1086
+ 247
1087
+ ],
1088
+ "page_idx": 8
1089
+ },
1090
+ {
1091
+ "type": "text",
1092
+ "text": "for contrastive search to generate results using prefixes from Wikitext-103 test set.11 We evaluate the results from two aspects: (1) generation diversity and (2) perplexity of the generated text (gen-ppl). Both metrics are described in Section $\\ S 4 . 1 . 2$ . Figure 4 plots the results of different methods along with the human performance. For nucleus sampling, when $p$ is small (i.e., $p \\leq 0 . 7 )$ ), its generation perplexity is comparable to that of human. However, the diversity is notably lower than human performance, meaning it stuck in undesirable repetition loops [10]. On the other hand, when $p$ is large (i.e., $p \\geq 0 . 9 5 )$ , the generation diversity is close to that of human but the generation perplexity is significantly higher. Such high perplexity means the generated text is very unlikely, therefore being low quality. As for contrastive search, when $\\alpha \\in [ 0 . 5 , 0 . 8 ]$ , it yields generation diversity and perplexity that are both comparable to human performance. These results demonstrate the superiority of contrastive search as it better balances the trade-off between the generation diversity and perplexity. ",
1093
+ "bbox": [
1094
+ 173,
1095
+ 295,
1096
+ 825,
1097
+ 448
1098
+ ],
1099
+ "page_idx": 8
1100
+ },
1101
+ {
1102
+ "type": "text",
1103
+ "text": "6.4 Decoding Latency Comparison ",
1104
+ "text_level": 1,
1105
+ "bbox": [
1106
+ 176,
1107
+ 463,
1108
+ 428,
1109
+ 479
1110
+ ],
1111
+ "page_idx": 8
1112
+ },
1113
+ {
1114
+ "type": "text",
1115
+ "text": "We compare the decoding latency of different decoding methods using SimCTG. For beam search and contrastive search, we vary the beam width $b$ and the $k$ in Eq. (5). The latency is measured by generating fixed length text continuations on Wikitext-103 test cases with a batch size of 1. In Figure 5, we show the averaged relative decoding latency of different methods. We see that greedy search is the fastest method and the latency of different methods are generally comparable with each other. Comparing contrastive search with beam search, when $b$ and $k$ are small (i.e., $\\leq 6$ ), their latency are nearly identical. When $b$ and $k$ gets larger (i.e., $> 6$ ), contrastive search becomes faster. In summary, these comparison results further verify the practical usage of contrastive search. ",
1116
+ "bbox": [
1117
+ 173,
1118
+ 488,
1119
+ 825,
1120
+ 601
1121
+ ],
1122
+ "page_idx": 8
1123
+ },
1124
+ {
1125
+ "type": "table",
1126
+ "img_path": "images/16d95f640c514d671cb4c54b76a83b3e517f4e6b76622459a449fd3e8f7c0c2a.jpg",
1127
+ "table_caption": [],
1128
+ "table_footnote": [],
1129
+ "table_body": "<table><tr><td>prefix</td><td>Butt criticized Donald&#x27;s controls in certain situations in the game,as well as the difficulty of some levels and puzzles.Buchanan also criticized the controls,calling</td><td>div.</td><td>coh.</td><td>gen-ppl</td></tr><tr><td>beam</td><td>them &quot;too easy &quot;and &quot;too dificult &quot;.He also criticized the game&#x27;s graphics,stating that the game&#x27;s graphics were&quot; too simplistic &quot; and &quot;too simplistic &quot;. He also criticized the game&#x27;s graphics,stating that the game&#x27;s graphics were &quot;too simplistic &quot;and &quot;too simplistic&quot;.He also criticized the graphics, stating that the game&#x27;s graphics were &quot;too simplistic &quot;and &quot;too simplistic &quot;.He also criticized the graphics,stating that the game&#x27;s graphics were&quot;too simplistic &quot;and &quot;too simplistic &quot;.He also criticized the graphics,stating that the game&#x27;s graphics were&quot;...</td><td>0.02</td><td>0.605</td><td>7.91</td></tr><tr><td>nucleus</td><td>them&quot;offensivelyrudimentary &quot;.After the game was released,Buchanan wroteanumberof game reviews about his review of the game,primarily summarizing what he thought the reviewers had enjoyed about it. Buchanan was pleased with how consistently these reviews awarded the game. For one, he praised the puzzles,compared them to Nos.1 and 2 and enjoyed the construction of the artificial intelligence in the game&#x27;s forms.He found no fault with the puzzles,even in those situations where they seemed repetitive.According to an Xbox Magazine review,&quot;every time.</td><td>0.98</td><td>0.597</td><td>37.83</td></tr><tr><td>contrastive</td><td>them&quot;unimpressive &quot;and a &quot;nightmare &quot;of an experience to play with players unfamiliar with Tetris.On the other hand,his opinion was shared by other reviewers,and some were critical of the game&#x27;s technical design for the Wii version of Tetris.In addition,Tintin&#x27;s review included a quote from Roger Ebert,who said that Tetris was better than the original game due to its simplicity and ease of play.Ebert&#x27;s comments were included in the game&#x27;s DVD commentary,released on March 22,201o. It is unclear if any of the video commentary was taken from.</td><td>0.98</td><td>0.626</td><td>19.64</td></tr></table>",
1130
+ "bbox": [
1131
+ 176,
1132
+ 612,
1133
+ 823,
1134
+ 804
1135
+ ],
1136
+ "page_idx": 8
1137
+ },
1138
+ {
1139
+ "type": "text",
1140
+ "text": "Table 4: Case Study: The beam search produces degeneration repetitions (highlighted in red) and the nucleus sampling produces text that has incoherent semantics with respect to the prefix (highlighted in blue). The reasonable repetitions produced by contrastive search are highlighted in green. The “div.” and “coh.” stand for diversity and coherence metrics. (best viewed in color) ",
1141
+ "bbox": [
1142
+ 173,
1143
+ 810,
1144
+ 825,
1145
+ 867
1146
+ ],
1147
+ "page_idx": 8
1148
+ },
1149
+ {
1150
+ "type": "text",
1151
+ "text": "6.5 Case Study ",
1152
+ "text_level": 1,
1153
+ "bbox": [
1154
+ 174,
1155
+ 92,
1156
+ 290,
1157
+ 106
1158
+ ],
1159
+ "page_idx": 9
1160
+ },
1161
+ {
1162
+ "type": "text",
1163
+ "text": "In Table 4, we present generated examples of SimCTG with different decoding methods given a specific prefix.12 From the results, we see that beam search produces undesirable sequence-level repetitions, resulting in low diversity and low generation perplexity. On the other hand, in the prefix, the person “Buchanan” criticizes the game. However, the result from nucleus sampling displays a contradicted semantic, resulting in a low coherence score as well as a high generation perplexity. As for contrastive search, it generates a text that is semantically consistent to the prefix with a proper generation perplexity while obtaining the same diversity as that of the nucleus sampling. Additionally, it is worth emphasizing that, while the degeneration penalty in Eq. (5) encourages the model to generate diverse outputs, contrastive search is still able to generate reasonable repetitions as highlighted in Table 4. This is due to the incorporation of model confidence in Eq. (5) which enables the model to repeat the important content (e.g., person names or entity names) from the previous context like humans do. ",
1164
+ "bbox": [
1165
+ 173,
1166
+ 116,
1167
+ 826,
1168
+ 281
1169
+ ],
1170
+ "page_idx": 9
1171
+ },
1172
+ {
1173
+ "type": "image",
1174
+ "img_path": "images/80f87c23e31acf9e036a95e8f9f429bc53ceb5768ada5621b1b993bcf9697d21.jpg",
1175
+ "image_caption": [
1176
+ "Figure 6: (a) MLE $^ +$ beam search; (b) SimCTG $^ +$ beam search; (c) SimCTG $^ +$ contrastive search. The token similarity matrix of the prefix and the generated text are highlighted in red and yellow. "
1177
+ ],
1178
+ "image_footnote": [],
1179
+ "bbox": [
1180
+ 174,
1181
+ 291,
1182
+ 826,
1183
+ 421
1184
+ ],
1185
+ "page_idx": 9
1186
+ },
1187
+ {
1188
+ "type": "text",
1189
+ "text": "6.6 Comparison of Token Similarity Matrix ",
1190
+ "text_level": 1,
1191
+ "bbox": [
1192
+ 174,
1193
+ 473,
1194
+ 490,
1195
+ 488
1196
+ ],
1197
+ "page_idx": 9
1198
+ },
1199
+ {
1200
+ "type": "text",
1201
+ "text": "To better understand how contrastive search works, in Figure 6, we show the generated token similarity matrix of SimCTG using beam search and contrastive search. For a better comparsion, we also include the result of MLE using beam search. All results are produced with the same prefix as in Table 4. The red and yellow boxes highlight the similarity matrix of the prefix and the generated text. Firstly, we see that, the MLE $^ +$ beam search yields a very dense similarity matrix, meaning that its token representations are indiscriminative. In addition, the high similarity scores in its off-diagonal entries clearly show the degeneration repetitions. Secondly, for $\\mathrm { S i m C T G } +$ beam search, we observe a desirable similarity matrix of the prefix which is sparse and isotropic. However, degeneration repetitions still exist in the generated result as shown in Figure 6(b). Lastly, for $\\mathrm { S i m C T G } +$ contrastive search, the entire similarity matrix is sparse and isotropic, showing that it successfully solves the model degeneration. These observations are in line with our motivations as described in Section $\\ S 1$ . ",
1202
+ "bbox": [
1203
+ 174,
1204
+ 498,
1205
+ 825,
1206
+ 650
1207
+ ],
1208
+ "page_idx": 9
1209
+ },
1210
+ {
1211
+ "type": "text",
1212
+ "text": "7 Conclusion ",
1213
+ "text_level": 1,
1214
+ "bbox": [
1215
+ 174,
1216
+ 670,
1217
+ 299,
1218
+ 686
1219
+ ],
1220
+ "page_idx": 9
1221
+ },
1222
+ {
1223
+ "type": "text",
1224
+ "text": "In this work, we show that the degeneration of neural language models stems from the anisotropic nature of their token representations. We present a new approach, SimCTG, for training the language model such that it obtains an isotropic and discriminative representation space. In addition, we introduce a novel decoding method, contrastive search, which works coherently with the proposed SimCTG. Extensive experiments and analyses are conducted on three benchmarks from two languages. Both automatic and human evaluations demonstrate that our approach substantially reduces model degeneration and significantly outperforms current state-of-the-art text generation approaches. ",
1225
+ "bbox": [
1226
+ 174,
1227
+ 700,
1228
+ 825,
1229
+ 797
1230
+ ],
1231
+ "page_idx": 9
1232
+ },
1233
+ {
1234
+ "type": "text",
1235
+ "text": "Acknowledgments ",
1236
+ "text_level": 1,
1237
+ "bbox": [
1238
+ 176,
1239
+ 816,
1240
+ 328,
1241
+ 833
1242
+ ],
1243
+ "page_idx": 9
1244
+ },
1245
+ {
1246
+ "type": "text",
1247
+ "text": "The first author would like to thank Jialu Xu and Huayang Li for their insightful discussions and supports. Many thanks to our anonymous reviewers, area chairs, and senior area chairs for their suggestions and comments. ",
1248
+ "bbox": [
1249
+ 176,
1250
+ 847,
1251
+ 825,
1252
+ 888
1253
+ ],
1254
+ "page_idx": 9
1255
+ },
1256
+ {
1257
+ "type": "text",
1258
+ "text": "References ",
1259
+ "text_level": 1,
1260
+ "bbox": [
1261
+ 174,
1262
+ 89,
1263
+ 266,
1264
+ 106
1265
+ ],
1266
+ "page_idx": 10
1267
+ },
1268
+ {
1269
+ "type": "text",
1270
+ "text": "[1] Sourya Basu, Govardana Sachitanandam Ramachandran, Nitish Shirish Keskar, and Lav R. Varshney. Mirostat: a neural text decoding algorithm that directly controls perplexity. In 9th International Conference on Learning Representations, ICLR 2021, Virtual Event, Austria, May 3-7, 2021. OpenReview.net, 2021. \n[2] Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. Language models are few-shot learners. In 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. \n[3] Zihang Dai, Zhilin Yang, Yiming Yang, Jaime G. Carbonell, Quoc Viet Le, and Ruslan Salakhutdinov. Transformer-xl: Attentive language models beyond a fixed-length context. In Anna Korhonen, David R. Traum, and Lluís Màrquez, editors, Proceedings of the 57th Conference of the Association for Computational Linguistics, ACL 2019, Florence, Italy, July 28- August 2, 2019, Volume 1: Long Papers, pages 2978–2988. Association for Computational Linguistics, 2019. \n[4] Emily Dinan, Varvara Logacheva, Valentin Malykh, Alexander H. Miller, Kurt Shuster, Jack Urbanek, Douwe Kiela, Arthur Szlam, Iulian Serban, Ryan Lowe, Shrimai Prabhumoye, Alan W. Black, Alexander I. Rudnicky, Jason Williams, Joelle Pineau, Mikhail S. Burtsev, and Jason Weston. The second conversational intelligence challenge (convai2). CoRR, abs/1902.00098, 2019. \n[5] Yihe Dong, Jean-Baptiste Cordonnier, and Andreas Loukas. Attention is not all you need: pure attention loses rank doubly exponentially with depth. 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 2793–2803. PMLR, 2021. \n[6] Kawin Ethayarajh. How contextual are contextualized word representations? comparing the geometry of bert, elmo, and GPT-2 embeddings. In Kentaro Inui, Jing Jiang, Vincent Ng, and Xiaojun Wan, editors, Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019, pages 55–65. Association for Computational Linguistics, 2019. \n[7] Angela Fan, Mike Lewis, and Yann N. Dauphin. Hierarchical neural story generation. In Iryna Gurevych and Yusuke Miyao, editors, Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics, ACL 2018, Melbourne, Australia, July 15-20, 2018, Volume 1: Long Papers, pages 889–898. Association for Computational Linguistics, 2018. \n[8] J.L. Fleiss et al. Measuring nominal scale agreement among many raters. Psychological Bulletin, 76(5):378–382, 1971. \n[9] Tianyu Gao, Xingcheng Yao, and Danqi Chen. Simcse: Simple contrastive learning of sentence embeddings. 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, Virtual Event / Punta Cana, Dominican Republic, 7-11 November, 2021, pages 6894–6910. Association for Computational Linguistics, 2021. \n[10] Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. The curious case of neural text degeneration. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. \n[11] Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. Generalization through memorization: Nearest neighbor language models. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. ",
1271
+ "bbox": [
1272
+ 173,
1273
+ 109,
1274
+ 826,
1275
+ 921
1276
+ ],
1277
+ "page_idx": 10
1278
+ },
1279
+ {
1280
+ "type": "text",
1281
+ "text": "[12] Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Yoshua Bengio and Yann LeCun, editors, 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. ",
1282
+ "bbox": [
1283
+ 173,
1284
+ 90,
1285
+ 823,
1286
+ 133
1287
+ ],
1288
+ "page_idx": 11
1289
+ },
1290
+ {
1291
+ "type": "text",
1292
+ "text": "[13] Jiwei Li, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. A diversity-promoting objective function for neural conversation models. In Kevin Knight, Ani Nenkova, and Owen Rambow, editors, NAACL HLT 2016, The 2016 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, San Diego California, USA, June 12-17, 2016, pages 110–119. The Association for Computational Linguistics, 2016. \n[14] Piji Li, Haisong Zhang, Xiaojiang Liu, and Shuming Shi. Rigid formats controlled text generation. In Dan Jurafsky, Joyce Chai, Natalie Schluter, and Joel R. Tetreault, editors, Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics, ACL 2020, Online, July 5-10, 2020, pages 742–751. Association for Computational Linguistics, 2020. \n[15] Yanran Li, Hui Su, Xiaoyu Shen, Wenjie Li, Ziqiang Cao, and Shuzi Niu. Dailydialog: A manually labelled multi-turn dialogue dataset. In Greg Kondrak and Taro Watanabe, editors, Proceedings of the Eighth International Joint Conference on Natural Language Processing, IJCNLP 2017, Taipei, Taiwan, November 27 - December 1, 2017 - Volume 1: Long Papers, pages 986–995. Asian Federation of Natural Language Processing, 2017. \n[16] Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. Pointer sentinel mixture models. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings. OpenReview.net, 2017. \n[17] Krishna Pillutla, Swabha Swayamdipta, Rowan Zellers, John Thickstun, Sean Welleck, Yejin Choi, and Zaid Harchaoui. MAUVE: Measuring the gap between neural text and human text using divergence frontiers. In A. Beygelzimer, Y. Dauphin, P. Liang, and J. Wortman Vaughan, editors, Advances in Neural Information Processing Systems, 2021. \n[18] Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. Language models are unsupervised multitask learners. 2019. \n[19] Yixuan Su and Nigel Collier. Contrastive search is what you need for neural text generation. arXiv preprint arXiv:2210.14140, 2022. \n[20] Yixuan Su, Tian Lan, Yahui Liu, Fangyu Liu, Dani Yogatama, Yan Wang, Lingpeng Kong, and Nigel Collier. Language models can see: Plugging visual controls in text generation. arXiv preprint arXiv:2205.02655, 2022. \n[21] Yixuan Su, Fangyu Liu, Zaiqiao Meng, Tian Lan, Lei Shu, Ehsan Shareghi, and Nigel Collier. Tacl: Improving BERT pre-training with token-aware contrastive learning. CoRR, abs/2111.04198, 2021. \n[22] Yixuan Su, Yan Wang, Deng Cai, Simon Baker, Anna Korhonen, and Nigel Collier. PROTOTYPE-TO-STYLE: dialogue generation with style-aware editing on retrieval memory. IEEE ACM Trans. Audio Speech Lang. Process., 29:2152–2161, 2021. \n[23] Yixuan Su and Jialu Xu. An empirical study on contrastive search and contrastive decoding for open-ended text generation. arXiv preprint arXiv:2211.10797, 2022. \n[24] 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 Chi, and Quoc Le. Lamda: Language models for dialog applications. CoRR, abs/2201.08239, 2022. \n[25] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N. Gomez, Lukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Isabelle Guyon, Ulrike von Luxburg, Samy Bengio, Hanna M. Wallach, Rob Fergus, S. V. N. Vishwanathan, and Roman Garnett, 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 5998–6008, 2017. \n[26] Yida Wang, Pei Ke, Yinhe Zheng, Kaili Huang, Yong Jiang, Xiaoyan Zhu, and Minlie Huang. A large-scale chinese short-text conversation dataset. In Xiaodan Zhu, Min Zhang, Yu Hong, and Ruifang He, editors, Natural Language Processing and Chinese Computing - 9th CCF International Conference, NLPCC 2020, Zhengzhou, China, October 14-18, 2020, Proceedings, Part I, volume 12430 of Lecture Notes in Computer Science, pages 91–103. Springer, 2020. \n[27] Sean Welleck, Ilia Kulikov, Stephen Roller, Emily Dinan, Kyunghyun Cho, and Jason Weston. Neural text generation with unlikelihood training. In 8th International Conference on Learning Representations, ICLR 2020, Addis Ababa, Ethiopia, April 26-30, 2020. OpenReview.net, 2020. \n[28] Thomas Wolf, Lysandre Debut, Victor Sanh, Julien Chaumond, Clement Delangue, Anthony Moi, Pierric Cistac, Tim Rault, Rémi Louf, Morgan Funtowicz, and Jamie Brew. Huggingface’s transformers: State-of-the-art natural language processing. CoRR, abs/1910.03771, 2019. \n[29] Dani Yogatama, Cyprien de Masson d’Autume, and Lingpeng Kong. Adaptive semiparametric language models. Trans. Assoc. Comput. Linguistics, 9:362–373, 2021. \n[30] Yizhe Zhang, Siqi Sun, Michel Galley, Yen-Chun Chen, Chris Brockett, Xiang Gao, Jianfeng Gao, Jingjing Liu, and Bill Dolan. DIALOGPT : Large-scale generative pre-training for conversational response generation. In Asli Celikyilmaz and Tsung-Hsien Wen, editors, Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics: System Demonstrations, ACL 2020, Online, July 5-10, 2020, pages 270–278. Association for Computational Linguistics, 2020. \n[31] Zhe Zhao, Hui Chen, Jinbin Zhang, Xin Zhao, Tao Liu, Wei Lu, Xi Chen, Haotang Deng, Qi Ju, and Xiaoyong Du. UER: an open-source toolkit for pre-training models. In Sebastian Padó and Ruihong Huang, editors, Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing, EMNLP-IJCNLP 2019, Hong Kong, China, November 3-7, 2019 - System Demonstrations, pages 241–246. Association for Computational Linguistics, 2019. ",
1293
+ "bbox": [
1294
+ 171,
1295
+ 99,
1296
+ 828,
1297
+ 915
1298
+ ],
1299
+ "page_idx": 11
1300
+ },
1301
+ {
1302
+ "type": "text",
1303
+ "text": "",
1304
+ "bbox": [
1305
+ 171,
1306
+ 88,
1307
+ 826,
1308
+ 513
1309
+ ],
1310
+ "page_idx": 12
1311
+ },
1312
+ {
1313
+ "type": "text",
1314
+ "text": "Checklist ",
1315
+ "text_level": 1,
1316
+ "bbox": [
1317
+ 174,
1318
+ 89,
1319
+ 254,
1320
+ 106
1321
+ ],
1322
+ "page_idx": 13
1323
+ },
1324
+ {
1325
+ "type": "text",
1326
+ "text": "1. For all authors... ",
1327
+ "bbox": [
1328
+ 214,
1329
+ 116,
1330
+ 339,
1331
+ 130
1332
+ ],
1333
+ "page_idx": 13
1334
+ },
1335
+ {
1336
+ "type": "text",
1337
+ "text": "(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] \n(b) Did you describe the limitations of your work? [Yes] See Appendix A. \n(c) Did you discuss any potential negative societal impacts of your work? [N/A] \n(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
1338
+ "bbox": [
1339
+ 238,
1340
+ 136,
1341
+ 825,
1342
+ 227
1343
+ ],
1344
+ "page_idx": 13
1345
+ },
1346
+ {
1347
+ "type": "text",
1348
+ "text": "2. If you are including theoretical results... ",
1349
+ "bbox": [
1350
+ 214,
1351
+ 231,
1352
+ 493,
1353
+ 244
1354
+ ],
1355
+ "page_idx": 13
1356
+ },
1357
+ {
1358
+ "type": "text",
1359
+ "text": "(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] ",
1360
+ "bbox": [
1361
+ 238,
1362
+ 248,
1363
+ 738,
1364
+ 280
1365
+ ],
1366
+ "page_idx": 13
1367
+ },
1368
+ {
1369
+ "type": "text",
1370
+ "text": "3. If you ran experiments... ",
1371
+ "bbox": [
1372
+ 212,
1373
+ 285,
1374
+ 393,
1375
+ 299
1376
+ ],
1377
+ "page_idx": 13
1378
+ },
1379
+ {
1380
+ "type": "text",
1381
+ "text": "(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] We provide the code and the instructions to re-implement our results as a supplementary material to this paper. \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] We specify the details in Section $\\ S 4$ and $\\ S 5$ . \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We did not run multiple times for our experiments due to computational constraints. \n(d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] We describe the computational details in Appendix J. ",
1382
+ "bbox": [
1383
+ 238,
1384
+ 304,
1385
+ 825,
1386
+ 476
1387
+ ],
1388
+ "page_idx": 13
1389
+ },
1390
+ {
1391
+ "type": "text",
1392
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1393
+ "bbox": [
1394
+ 212,
1395
+ 481,
1396
+ 823,
1397
+ 496
1398
+ ],
1399
+ "page_idx": 13
1400
+ },
1401
+ {
1402
+ "type": "text",
1403
+ "text": "(a) If your work uses existing assets, did you cite the creators? [Yes] We cite the authors of the datasets and the code of the models in Section $\\ S 4$ and $\\ S 5$ . \n(b) Did you mention the license of the assets? [N/A] The datasets are publicly available. \n(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] We provide the code and the instructions to re-implement our results as a supplementary material to this paper. \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] The datasets are publicly available. \n(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] We use the standard datasets, which are well known in literature, and there are no personally identifiable information or offensive content at the best of the community knowledge. ",
1404
+ "bbox": [
1405
+ 238,
1406
+ 500,
1407
+ 825,
1408
+ 675
1409
+ ],
1410
+ "page_idx": 13
1411
+ },
1412
+ {
1413
+ "type": "text",
1414
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1415
+ "bbox": [
1416
+ 214,
1417
+ 680,
1418
+ 705,
1419
+ 694
1420
+ ],
1421
+ "page_idx": 13
1422
+ },
1423
+ {
1424
+ "type": "text",
1425
+ "text": "(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [Yes] We provide the human evaluation guidelines in Appendix G. \n(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] \n(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [Yes] We provide the details of participant compensation in Appendix G. ",
1426
+ "bbox": [
1427
+ 238,
1428
+ 699,
1429
+ 825,
1430
+ 801
1431
+ ],
1432
+ "page_idx": 13
1433
+ }
1434
+ ]
parse/dev/V88BafmH9Pj/V88BafmH9Pj_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/V88BafmH9Pj/V88BafmH9Pj_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/_CDixzkzeyb/_CDixzkzeyb.md ADDED
@@ -0,0 +1,826 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PROMPT-TO-PROMPT IMAGE EDITINGWITH CROSS-ATTENTION CONTROL
2
+
3
+ Amir Hertz∗1,2, Ron Mokady∗1,2, Jay Tenenbaum 1, Kfir Aberman1, Yael Pritch1, and Daniel Cohen-Or∗1,2
4
+
5
+ 1 Google Research 2The Blavatnik School of Computer Science, Tel Aviv University
6
+
7
+ # ABSTRACT
8
+
9
+ Recent large-scale text-driven synthesis diffusion models have attracted much attention thanks to their remarkable capabilities of generating highly diverse images that follow given text prompts. Therefore, it is only natural to build upon these synthesis models to provide text-driven image editing capabilities. However, Editing is challenging for these generative models, since an innate property of an editing technique is to preserve some content from the original image, while in the text-based models, even a small modification of the text prompt often leads to a completely different outcome. State-of-the-art methods mitigate this by requiring the users to provide a spatial mask to localize the edit, hence, ignoring the original structure and content within the masked region. In this paper, we pursue an intuitive prompt-to-prompt editing framework, where the edits are controlled by text only. We analyze a text-conditioned model in depth and observe that the cross-attention layers are the key to controlling the relation between the spatial layout of the image to each word in the prompt. With this observation, we propose to control the attention maps of the edited image by injecting the attention maps of the original image along the diffusion process. Our approach enables us to monitor the synthesis process by editing the textual prompt only, paving the way to a myriad of caption-based editing applications such as localized editing by replacing a word, global editing by adding a specification, and even controlling the extent to which a word is reflected in the image. We present our results over diverse images and prompts with different text-to-image models, demonstrating high-quality synthesis and fidelity to the edited prompts.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Recently, large-scale language-image (LLI) models, such as Imagen (Saharia et al., 2022b), DALL·E 2 (Ramesh et al., 2022) and Parti (Yu et al., 2022), have shown phenomenal generative semantic and compositional power, and gained unprecedented attention from the research community and the public eye. These LLI models are trained on extremely large language-image datasets and use state-of-the-art image generative models including auto-regressive and diffusion models. However, these models do not provide simple editing means, and generally lack control over specific semantic regions of a given image. In particular, even the slightest change in the textual prompt may lead to a completely different output image. To circumvent this, LLI-based methods (Nichol et al., 2021; Avrahami et al., 2022a; Ramesh et al., 2022) require the user to explicitly mask a part of the image to be inpainted, and drive the edited image to change in the masked area only, while matching the background of the original image. This approach has provided appealing results, however, the masking procedure is cumbersome, hampering quick and intuitive text-driven editing. Moreover, masking the image content removes important structural information, which is completely ignored in the inpainting process. Therefore, some capabilities are out of the inpainting scope, such as modifying the texture of a specific object.
14
+
15
+ In this paper, we introduce an intuitive and powerful textual editing method to semantically edit images in pre-trained text-conditioned diffusion models via Prompt-to-Prompt manipulations. To do so, we dive deep into the cross-attention layers and explore their semantic strength as a handle to control the generated image. Specifically, we consider the internal cross-attention maps, which are high-dimensional tensors that bind pixels and tokens extracted from the prompt text. We find that these maps contain rich semantic relations which critically affect the generated image.
16
+
17
+ ![](images/36663772727eeca2767f67d8990a9655a2fc02b30d4d13358a8585229a5fbb38.jpg)
18
+ Figure 1: Prompt-to-Prompt editing capabilities. Our method paves the way for a myriad of caption-based editing operations: tuning the level of influence of an adjective word (bottom-left), making a local modification in the image by replacing or adding a word (bottom-middle), or specifying a global modification (bottom-right).
19
+
20
+ Our key idea is that we can edit images by injecting the cross-attention maps during the diffusion process, controlling which pixels attend to which tokens of the prompt text during which diffusion steps. To apply our approach to various creative editing applications, we show several methods to control the cross-attention maps through a simple and semantic interface (see fig. 1). The first is to change a single token’s value in the prompt (e.g., “dog” to “cat”), while fixing the cross-attention maps, to preserve the scene composition. The second is adding new words to the prompt and freezing the attention on previous tokens while allowing new attention to flow to the new tokens. This enables us to perform global editing or modify a specific object. The third is to amplify or attenuate the semantic effect of a word in the generated image. Furthermore, we demonstrate how to use these attention maps to obtain a local editing effect that accurately preserves the background.
21
+
22
+ Our approach constitutes an intuitive image editing interface through editing only the textual prompt, therefore called Prompt-to-Prompt. This method enables various editing tasks, which are challenging otherwise, and does not require model training, fine-tuning, extra data, or optimization. Throughout our analysis, we discover even more control over the generation process, recognizing a trade-off between the fidelity to the edited prompt and the source image. We also demonstrate that our method operates with different text-to-image models as a backbone and we will publish our code for the public models upon acceptance. Finally, our method even applies to real images by using an existing inversion technique. Our experiments show that our method enables intuitive text-based editing over diverse images that current methods struggle with.
23
+
24
+ # 2 RELATED WORK
25
+
26
+ Image editing is one of the most fundamental tasks in computer graphics, encompassing the process of modifying an input image through the use of an auxiliary input, such as a label, mask, or reference image. A specifically intuitive way to edit an image is through textual prompts provided by the user. Recently, text-driven image manipulation has achieved significant progress using GANs (Goodfellow et al., 2014; Brock et al., 2018; Karras et al., 2019), which are known for their highquality generation, in tandem with CLIP (Radford et al., 2021), which consists of a semantically rich joint image-text representation, trained over millions of text-image pairs. Seminal works (Patashnik et al., 2021; Gal et al., 2021; Xia et al., 2021a) which combined these components were revolutionary, since they did not require extra manual labor, and produced realistic manipulations using text only. For instance, Bau et al. (2021) further demonstrated how to use masks to restrict the text-based editing to a specific region. However, while GAN-based editing approaches succeed on curated data, e.g., human faces, they struggle over large and diverse datasets (Mokady et al., 2022).
27
+
28
+ To obtain more expressive generation capabilities, Crowson et al. (2022) use VQ-GAN (Esser et al., 2021b), trained over diverse data, as a backbone. Other works (Avrahami et al., 2022b; Kim et al., 2022) exploit the recent Diffusion models (Ho et al., 2020; Song & Ermon, 2019; Ho et al., 2020; Song et al., 2020; Rombach et al., 2021; Ho et al., 2022; Saharia et al., 2021; 2022a), which achieve state-of-the-art generation quality over diverse datasets, often surpassing GANs (Dhariwal & Nichol, 2021). Kim et al. (2022) show how to perform global changes, whereas Avrahami et al. (2022b) successfully perform local manipulations using user-provided masks for guidance. While most works that require only text (i.e., no masks) are limited to global editing (Crowson et al., 2022; Kwon & Ye, 2021), Bar-Tal et al. (2022) proposed a text-based localized editing technique without using any mask, showing impressive results. Yet, their techniques mainly allow changing textures, but not modifying complex structures, such as changing a bicycle to a car. Moreover, unlike our method, their approach requires training a network for each input.
29
+
30
+ ![](images/5c39d917ac357fb8469671390c594fbb67b027412fd380b4da6824d57051b53f.jpg)
31
+ fixed attention maps and random seed
32
+ Figure 2: Content modification through attention injection. We start from an original image generated from the prompt ”lemon cake” (top left), and modify the text prompt to a variety of other cakes. On the top row, we inject the attention weights of the original image during the diffusion process. On the bottom, we only use the same random seeds as the original image, without injecting attention. The latter leads to a completely new structure that is hardly related to the original.
33
+
34
+ Numerous works (Ding et al., 2021; Hinz et al., 2020; Tao et al., 2020; Li et al., 2019; Ramesh et al., 2021; Zhang et al., 2018b; Crowson et al., 2022; Gafni et al., 2022; Rombach et al., 2021) advanced the generation of images conditioned on plain text, known as text-to-image synthesis. But only recently these were followed by several large-scale text-image models, such as Imagen (Saharia et al., 2022b), DALL-E2 (Ramesh et al., 2022), and Parti (Yu et al., 2022), demonstrating unprecedented semantic generation. However, these models do not provide control over a generated image, specifically using text guidance only. Changing a single word in the original prompt associated with the image often leads to a completely different outcome. For instance, adding the adjective “white” to “dog” often changes the dog’s shape. To overcome this, several works (Nichol et al., 2021; Avrahami et al., 2022a) assume that the user provides a mask to restrict the edited region.
35
+
36
+ Unlike previous works, our method requires textual input only, by using the spatial information from the internal layers of the generative model itself. This offers the user a much more intuitive editing experience of modifying local or global details by merely modifying the text prompt.
37
+
38
+ # 3 METHOD
39
+
40
+ Let $\mathcal { T }$ be an image that was generated by a text-guided diffusion model using the text prompt $\mathcal { P }$ and a random seed $s$ . Our goal is to edit $\mathcal { T }$ , using only the guidance of an edited prompt ${ \mathcal { P } } ^ { * }$ , in order to get an edited image $\mathcal { T } ^ { * }$ that maintains the content and structure of the original image but corresponds to the edited prompt. For example, consider an image generated from the prompt “my new bicycle”, and assume that the user wants to edit the color of the bicycle or replace it with a scooter while preserving the appearance and structure of the original image. An intuitive interface for the user is to directly change the text prompt by further describing the appearance of the bike, or replacing it with another word, respectively. As opposed to previous works, we wish to avoid relying on any user-defined mask to assist or signify where the edit should occur. A simple, but unsuccessful attempt is to fix the internal randomness and regenerate using the edited text prompt. Unfortunately, as fig. 2 shows, this results in a completely different structure and composition.
41
+
42
+ Our key observation is that the structure and appearance of the generated image depend not only on the random seed, but also on the interaction between the pixels to the text embedding through the diffusion process. By modifying the pixel-to-text interaction that occurs in cross-attention layers, we provide Prompt-to-Prompt image editing capabilities. More specifically, injecting the crossattention maps of the input image $\mathcal { T }$ enables us to preserve the original composition and structure. In Section 3.1, we review how cross attention is used, and in Section 3.2, we describe how to exploit the cross-attention for editing. Self-attention is discussed in section 3.3. For background on diffusion models, refer to appendix A.
43
+
44
+ ![](images/fd97880c668fb7c758b7964c399b16a9c86cc41b963fd74483d48f2b09770075.jpg)
45
+ Figure 3: Method overview. Top: visual and textual embedding are fused using cross-attention layers that produce attention maps for each textual token. Bottom: we control the spatial layout and geometry of the generated image using the attention maps of a source image. This enables various editing tasks through editing the textual prompt only. When swapping a word in the prompt, we inject the source image maps $M _ { t }$ , overriding the target maps $M _ { t } ^ { * }$ . In the case of adding a refinement phrase, we inject only the maps that correspond to the unchanged part of the prompt. To amplify or attenuate the semantic effect of a word, we re-weight the corresponding attention map.
46
+
47
+ # 3.1 CROSS-ATTENTION IN TEXT-CONDITIONED DIFFUSION MODELS
48
+
49
+ In this section, we refer to the Imagen (Saharia et al., 2022b) text-guided synthesis model as our backbone, although our method is not limited to a specific model, and results with Latent Diffusion and Stable Diffusion (Rombach et al., 2021) are presented in section 4.1 and appendix C. All three models condition on the text prompt in the noise prediction of each diffusion step throughout cross-attention layers. For further details about the attention layers within each model, please see appendix A.2. Since the composition and geometry are mostly determined at the $6 4 \times 6 4$ resolution, we only adapt the text-to-image diffusion model, using the super-resolution process as is. Recall that each diffusion step $t$ consists of predicting the noise $\epsilon$ from a noisy image $z _ { t }$ and text embedding $\psi ( \mathcal P )$ using a U-shaped network (Ronneberger et al., 2015). At the final step, this process yields the generated image $\mathcal { T } = z _ { 0 }$ . Most importantly, the interaction between the two modalities occurs during the noise prediction, where the embeddings of the visual and textual features are fused using cross-attention layers that produce spatial attention maps for each textual token. More formally, as illustrated in fig. 3 (top), the deep spatial features of the noisy image $\phi ( { \boldsymbol { z } } _ { t } )$ are projected to a query matrix $Q = \ell _ { Q } ( \phi ( z _ { t } ) )$ , and the textual embedding is projected to a key matrix $\bar { \boldsymbol { K } } \doteq \ell _ { K } ( \psi ( \mathcal { P } ) \bar { ) }$ and a value matrix $V = \ell _ { V } ( \psi ( \mathcal { P } ) )$ , via learned linear projections $\ell _ { Q } , \ell _ { K } , \ell _ { V }$ . Attention maps are then
50
+
51
+ $$
52
+ M = \mathrm { S o f t m a x } \left( \frac { Q K ^ { T } } { \sqrt { d } } \right) ,
53
+ $$
54
+
55
+ where the cell $M _ { i j }$ defines the weight of the value of the $j$ -th token on the pixel $i$ , and $d$ is the latent projection dimension of the keys and queries. Finally, the cross-attention output is defined to be $\widehat { \phi } \left( \widehat { z } _ { t } \right) = M V$ , which is then used to update the spatial features $\phi \big ( z _ { t } \big )$ .
56
+
57
+ Intuitively, the cross-attention output $M V$ is a weighted average of the values $V$ where the weights are the attention maps $M$ , which are correlated to the similarity between $Q$ and $K$ . In practice, to increase their expressiveness, multi-head attention (Vaswani et al., 2017) is used in parallel, and then the results are concatenated and passed through a learned linear layer to get the final output.
58
+
59
+ # 3.2 CONTROLLING THE CROSS-ATTENTION
60
+
61
+ We return to our key observation — the spatial layout and geometry of the generated image depend on the cross-attention maps. The interaction between pixels and text is illustrated in fig. 4, where the average attention maps are plotted. As can be seen, pixels are more attracted to the words that describe them, e.g., pixels of the bear are correlated with the word “bear”. Note that averaging is done for visualization purposes, and attention maps are kept separate for each head. Interestingly, we can see that the structure is already determined in the early steps of the diffusion process.
62
+
63
+ Since the attention reflects the overall composition, we can inject the attention maps $M$ that were obtained from the generation with the original prompt $\mathcal { P }$ , into a second generation with the modified prompt ${ \mathcal { P } } ^ { * }$ . This allows the synthesis of an edited image $\mathcal { T } ^ { * }$ that is not only manipulated according to the edited prompt, but also preserves the structure of the input image $\mathcal { T }$ . This is a specific instance of a broader set of attention-based manipulations leading to different types of intuitive editing. We, therefore, start by proposing a general framework, followed by the details of the specific operations.
64
+
65
+ ![](images/16fe3c3c57160f199ace7cda7d6c5807449e10c6dc51e859cd9c38e080ecf350.jpg)
66
+ Figure 4: Cross-attention maps of a text-conditioned diffusion image generation. Top: average attention masks for each word in the prompt which was used to synthesize the left image. Bottom: attention maps with respect to the word “bear” from different diffusion steps, ranging from the first step $T = 2 5 6$ to the last step $t = 1$ in equal intervals.
67
+
68
+ Let $D M ( \boldsymbol { z } _ { t } , \mathcal { P } , t , \boldsymbol { s } )$ be the computation of a single step $t$ of the diffusion process, which outputs the noisy image $z _ { t - 1 }$ , and the attention map $M _ { t }$ (omitted if not used). We denote by ${ \cal D } M ( z _ { t } , \mathcal { P } , t , s ) \{ M \widehat { M } \}$ the diffusion step where we override the attention map $M$ with an additional given map $\widehat { M }$ , but keep the values $V$ from the supplied prompt. We also denote by $M _ { t } ^ { * }$ the produced attention map using the edited prompt ${ \mathcal { P } } ^ { * }$ . Lastly, we define $E d i t ( M _ { t } , M _ { t } ^ { * } , t )$ to be a general edit function, receiving as input the $t ^ { \prime }$ ’th attention maps of the original and edited images.
69
+
70
+ Our general algorithm for controlled generation consists of performing the iterative diffusion process for both prompts simultaneously, where an attention-based manipulation is applied in each step according to the desired editing task. We fix the internal randomness since even for the same prompt, two random seeds produce drastically different outputs. We also define a local editing scheme in a subsequent paragraph. Formally, our general algorithm for editing the image $\mathcal { T }$ , which is generated by prompt $\mathcal { P }$ and seed $s$ , is defined:
71
+
72
+ 1 Input: A source prompt $\mathcal { P }$ , a target prompt ${ \mathcal { P } } ^ { * }$ , and a random seed $s$ .
73
+ 2 Optional for local editing: $w$ and $w ^ { * }$ , words in $\mathcal { P }$ and ${ \mathcal { P } } ^ { * }$ , specifying the editing region.
74
+ 3 Output: A source image $x _ { s r c }$ and an edited image $x _ { d s t }$ .
75
+ 4 $z _ { T } \sim N ( 0 , I )$ a unit Gaussian random variable with random seed $s$ ;
76
+ 5 $z _ { T } ^ { * } \gets z _ { T }$ ;
77
+ 6 for $t = T , T - 1 , \dots , 1$ do
78
+ 7 $z _ { t - 1 } , M _ { t } \gets D M ( z _ { t } , \mathcal { P } , t , s ) ;$ ;
79
+ 8 $M _ { t } ^ { * } \gets D M ( z _ { t } ^ { * } , \mathcal { P } ^ { * } , t , s )$ ;
80
+ 9 $\widehat { M _ { t } } \gets E d i t ( M _ { t } , M _ { t } ^ { * } , t ) ;$ ;
81
+ 10 $z _ { t - 1 } ^ { * } D M ( z _ { t } ^ { * } , \mathcal { P } ^ { * } , t , s ) \{ M \widehat { M } _ { t } \} ;$
82
+ 11 if local then
83
+ 12 $\begin{array} { r l } & { \alpha B ( \overline { { M } } _ { t , w } ) \cup B ( \overline { { M } } _ { t , w ^ { * } } ^ { * } ) ; } \\ & { z _ { t - 1 } ^ { * } ( 1 - \alpha ) \odot z _ { t - 1 } + \alpha \odot z _ { t - 1 } ^ { * } } \end{array}$
84
+ 13
85
+ 14 end
86
+ 15 end
87
+ 16 Return $( z _ { 0 } , z _ { 0 } ^ { * } )$
88
+
89
+ For editing real images, see section 4. Also, note that we can skip the forward call in line 8 by applying the edit function inside the diffusion forward function. Moreover, a diffusion step can be applied on both $z _ { t - 1 }$ and $z _ { t } ^ { * }$ in the same batch (i.e., in parallel). We now turn to address local editing followed by specific editing operations, filling the missing definition of the $E d i t ( M _ { t } , M _ { t } ^ { * } , t )$ function. An overview is presented in fig. 3(Bottom).
90
+
91
+ Local Editing. In a common scenario, the user would like to modify a specific object or region, while preserving the rest of the details (i.e., background). For this purpose, we utilize the crossattention map layers corresponding to the edited object. In practice, we approximate a mask of the edited part and constrain the modification to be applied only in this local region (lines 11-14 in Algorithm 1). To calculate the mask at step $t$ , we compute the average attention map $\overline { { M } } _ { t , w }$ (averaged over steps $T , \ldots , t )$ of the original word $w$ and the map $\overline { { M } } _ { t , w ^ { * } } ^ { * }$ of the new word $w *$ . We then apply a threshold to produce binary maps, where $B ( x ) : = x > k$ and $k = 0 . 3$ throughout all our experiments. To support geometry modifications of the object, the edited region should include the silhouettes of both the original and the newly edited object, therefore, our final mask $\alpha$ is a union of the binary maps. Lastly, we use the mask to constrain the editing region (line 13), where $\odot$ denotes an element-wise multiplication.
92
+
93
+ ![](images/690b3ff6124d0d81832c42baf8d5630364893701e00834863624f7787de356cc.jpg)
94
+ Figure 5: Attention injection through a varied number of diffusion steps. We edit the image by replacing a word and injecting the cross-attention maps of the source image ranging from $0 \%$ (left) to $100 \%$ (right) of the steps. Without injection, none of the source content is preserved, while injecting throughout all the steps may over-constrain the geometry. The latter results in low fidelity to the text, e.g., the car becomes a bicycle. The full figure is in the appendix (fig. 11).
95
+
96
+ Word Swap. In this case, the user swaps tokens of the original prompt with others, e.g., $\mathcal { P } = ^ { 6 } \mathrm { { a } }$ big bicycle” to ${ \mathcal { P } } ^ { * } = { } ^ { * } { \bf { a } }$ big car”. The main challenge is to preserve the original composition while also addressing the content of the new prompt. To this end, we inject the attention maps of the source image into the generation with the modified prompt. However, the proposed attention injection may over-constrain the geometry, especially when a large structural modification, such as “car” to “bicycle”, is involved. We address this by suggesting a softer attention constrain:
97
+
98
+ $$
99
+ E d i t ( M _ { t } , M _ { t } ^ { * } , t ) : = { \left\{ \begin{array} { l l } { M _ { t } ^ { * } \quad } & { { \mathrm { i f ~ } } t < \tau } \\ { M _ { t } \quad } & { { \mathrm { o t h e r w i s e , } } } \end{array} \right. }
100
+ $$
101
+
102
+ where $\tau$ is a timestamp parameter that determines until which step the injection is applied. Note that the composition is determined in the early steps. Therefore, by limiting the number of injection steps, we can guide the composition while allowing the necessary geometry freedom for adapting to the new prompt. An illustration is provided in section 4. Another relaxation is to assign a different number of injection steps for the different tokens in the prompt. If the two words are represented using a different number of tokens, we duplicate/average the maps as necessary using an alignment function as described in the next paragraph.
103
+
104
+ Prompt Refinement. In another setting, the user adds new tokens to the prompt, e.g., $\mathcal { P } \mathrm { ~ = ~ } ^ { \ast } \mathrm { a }$ castle” to ${ \mathcal { P } } ^ { * } =$ “children drawing of a castle”. To preserve the common details, we apply the attention injection only over the common tokens from both prompts. Formally, we use an alignment function $A$ that receives a token index from target prompt ${ \mathcal { P } } ^ { * }$ and outputs the corresponding token index in $\mathcal { P }$ or None if there isn’t a match. Then, the editing function is:
105
+
106
+ $$
107
+ \begin{array} { r } { \big ( E d i t \left( M _ { t } , M _ { t } ^ { * } , t \right) \big ) _ { i , j } : = \left\{ \begin{array} { l l } { \big ( M _ { t } ^ { * } \big ) _ { i , j } \quad } & { \mathrm { ~ i f ~ } A ( j ) = N o n e } \\ { \big ( M _ { t } \big ) _ { i , A ( j ) } \quad } & { \mathrm { ~ o t h e r w i s e . } } \end{array} \right. } \end{array}
108
+ $$
109
+
110
+ Recall that the index $i$ corresponds to a pixel value, where $j$ corresponds to a text token. Again, we may control the number of injection steps. This enables diverse capabilities such as stylization, specification of object attributes, or global manipulations as demonstrated in section 4.
111
+
112
+ Attention Re–weighting. Lastly, the user may wish to strengthen or weakens the extent to which each token affects the resulting image. For example, consider the prompt $\mathcal { P } = { ^ { 6 } } \mathrm { a }$ fluffy ball”, and assume we want to make the ball more or less fluffy. To achieve such a manipulation, we scale the attention map of the assigned token $j ^ { * }$ with a parameter $c \in [ - 2 , 2 ]$ , resulting in a stronger/weaker effect. The rest of the attention maps remain unchanged. The editing function is therefore:
113
+
114
+ $$
115
+ \big ( E d i t ( M _ { t } , M _ { t } ^ { * } , t ) \big ) _ { i , j } : = \left\{ \begin{array} { l l } { c \cdot ( M _ { t } ) _ { i , j } \quad } & { \mathrm { i f ~ } j = j ^ { * } } \\ { ( M _ { t } ) _ { i , j } \quad } & { \mathrm { o t h e r w i s e . } } \end{array} \right.
116
+ $$
117
+
118
+ As described in section 4, the parameter $c$ allows fine and intuitive control over the induced effect. In addition, since fine textures are generated during the super-resolution phase, we observe that this application can benefit from applying our method also to the super-resolution diffusion model in the case of amplifying or attenuating such fine textures, such as “fluffiness” as shown in fig. 7.
119
+
120
+ ![](images/df261f19d50229b578ac37cdaea33ad5b8a94eed140f12e83c0b78fafb0ed531.jpg)
121
+ Figure 6: Editing by prompt refinement. By extending the description of the initial prompt, we perform local or global editing. Additional results are in the appendix (fig. 13, 23) .
122
+
123
+ ![](images/03dbb0f64ef9794f91e062c8af2220c86c091e71d2949661d9ae81df5623e490.jpg)
124
+ “The picnic is ready under a blossom( ) tree.”
125
+ Figure 7: Text-based editing with fader control. By reducing or increasing the cross-attention of specific words (marked with an arrow), we control the extent to which it influences the generation. Additional results are in the appendix (fig. 24).
126
+
127
+ # 3.3 SELF-ATTENTION
128
+
129
+ “My fluffy( ) bunny doll.Most models also consist of self-attention layers, which affect the spatial layout and geometry of the generated image as well. However, unlike cross-attention, the interaction that occurs in selfattention layers is only between the pixels to themselves. Therefore, manipulations with respect to specific textual tokens are not feasible. For example, our proposed attention re-weighting and local editing require the matching between the cross-attention maps to the prompt tokens. Another example is presented in the appendix (fig. 16), where we do not inject the attention of the entire prompt but only the attention of a specific word – “butterfly”. This enables the preservation of the original butterfly while changing the rest of the content. Contrarily, we can’t specify which object should be preserved using only self-attention. Moreover, we observe that the self-attention maps provide inferior semantic control compared to the cross-attention. For instance, as demonstrated in the appendix (fig. 17), using cross-attention injection we can swap between apples and oranges by swapping these words in the prompt. The same experiment fails when using self-attention which lacks a strong interaction between textual tokens and pixels.
130
+
131
+ Yet, we find that injecting self-attention through a small portion $( 2 0 \% )$ of the steps in addition to cross-attention injection might further help preserve the source content in some cases. And so, we consider it as an additional tool for Prompt-to-Prompt editing. We provide further analysis in appendix B.
132
+
133
+ # 4 RESULTS
134
+
135
+ In this section, we show several applications of our approach and compare it to other methods.
136
+
137
+ # 4.1 APPLICATIONS
138
+
139
+ Text-Only Localized Editing. We first demonstrate localized editing by modifying the userprovided prompt without requiring any user-provided mask. In fig. 2, we generate an image using the prompt “lemon cake”. Our method allows us to retain the spatial layout, geometry, and semantics when replacing the word “lemon” with “apple” (top row). Observe that the background is well-preserved, including the top-left lemons transforming into apples. On the other hand, naively feeding the model with the prompt “apple cake” results in a completely different geometry (2nd row), even when using the same randomness in a deterministic setting (DDIM). Our method succeeds even for a challenging “pasta cake.” — the generated cake consists of pasta layers with tomato sauce on top. In case the user adds a new specification, we keep the attention maps of the original prompt, while allowing the generator to address the newly added words. For example, see fig. 6, where we add “old” to the “car”, resulting in newly added details over the source car while the background is preserved. Additional results are in the appendix (fig. 16, 22, and 23).
140
+
141
+ As presented in fig. 5, our method is not confined to modifying only textures and can modify the structure as well, e.g., changing a “bicycle” to a “car”. We first show the results without crossattention injection, where changing a word leads to an entirely different outcome. We then show the resulting image by injecting attention to an increasing number of steps. Note that applying the cross-attention injection in a larger number of steps results in greater similarity to the source image. Therefore, the optimal result is not necessarily achieved by applying the injection throughout all steps. This enables us an even better control by changing the number of injection steps.
142
+
143
+ Table 1: User Study results. The participants were asked to rate: (1) background / structure preservation with respect to the source image, (2) alignment to the text, and (3) realism.
144
+
145
+ <table><tr><td></td><td>VQGAN+CLIP</td><td>Text2Live</td><td>baseline</td><td>Ours</td></tr><tr><td>(1) Background / Structure ↑</td><td>1.84 ± 1.11</td><td>4.15 ± 1.09</td><td>3.38 ± 1.12</td><td>4.64 ± 0.64</td></tr><tr><td>(2) Text Alignment ↑</td><td>2.46 ± 1.16</td><td>2.89 ±1.22</td><td>4.26 ± 1.03</td><td>4.55 ± 0.71</td></tr><tr><td>(3) Realism ↑</td><td>1.32 ± 0.70</td><td>2.36 ± 1.12</td><td>4.11 ± 0.93</td><td>4.42 ± 0.82</td></tr></table>
146
+
147
+ Global editing. Preserving the composition is not only valuable for local editing, but also an important aspect of global editing. In this setting, the editing should affect all parts of the image, but still retain the original composition, such as the location and identity of the objects. For example, in fig. 6, we preserve the content while changing the lighting. Additional examples are in the appendix (fig. 18), including translating a sketch into a realistic image and inducing an artistic style.
148
+
149
+ Fader Control using Attention Re-weighting. While controlling the image by editing the prompt is very effective, we find that it still does not allow full control over the generated image. Consider the prompt “snowy mountain”. A user may want to control the amount of snow on the mountain. However, it is quite difficult to describe the desired amount of snow through text. Instead, we suggest a fader control (Lample et al., 2017), where the user controls the magnitude of the effect induced by a specific word, as in fig. 7. As described in section 3.2, we achieve such control by re-scaling the attention of the specified word. Additional results are in the appendix (fig. 24, 27 and 30).
150
+
151
+ Different Backbone We use the Imagen (Saharia et al., 2022b) model as a backbone for most of our experiments and results, exploiting its state-of-the-art synthesis quality. However, our method is not limited to a specific model and can be applied to different models as long as they consist of cross-attention layers which are widely used. To validate this, we present results in the appendix (fig. 25, 26, 27, 28, 29, and 30) using the public and popular Latent Diffusion and Stable Diffusion models (Rombach et al., 2021). As can be seen, our method works well using these models as a backbone, enabling various editing capabilities while preserving the source image content. Further analysis is provided in appendix C.1.
152
+
153
+ Real Image Editing. Editing a real image requires finding an initial noise vector that produces the given input image when fed into the diffusion process. This process, known as inversion, has recently drawn considerable attention for GANs (Xia et al., 2021b; Bermano et al., 2022), but has not yet been fully addressed for text-guided diffusion models. We show preliminary editing results on real images, based on common inversion techniques for diffusion models. First, a rather na¨ıve approach is to add Gaussian noise to the input image, and then perform a predefined number of diffusion steps. Since this results in significant distortions, we adopt an improved inversion approach (Dhariwal & Nichol, 2021; Song et al., 2020), which is based on the deterministic DDIM model rather than the DDPM. We perform the diffusion process in the reverse direction, that is $x _ { 0 } x _ { T }$ instead of $x _ { T } \to x _ { 0 }$ , where $x _ { 0 }$ is set to be the given real image. This process often produces satisfying results, as presented in the appendix (fig. 19). However, the inversion is not sufficiently accurate in other cases, as in fig. 20. This is partially due to a distortion-editability tradeoff, where we recognize that reducing the classifier-free guidance (Ho & Salimans, 2021) parameter (i.e., reducing the prompt influence) improves reconstruction but constrains our ability to perform significant manipulations.
154
+
155
+ To alleviate this limitation, we propose to restore the unedited regions of the original image using a mask, directly extracted from the attention maps. Note that here the mask is generated with no guidance from the user, as described in the local editing paragraph (section 3.2). As presented in fig. 21, this approach works well even using the na¨ıve DDPM inversion scheme (adding noise followed by denoising). Note that the cat’s identity is well-preserved under various editing operations, while the mask is produced only from the prompt itself.
156
+
157
+ # 4.2 COMPARISONS
158
+
159
+ To evaluate our method, we first randomly generate text-based editing examples from predefined text templates, see appendix F for more details. Source text is then fed to the Imagen model to obtain the source image. We compare our results to other text-guided editing methods: (1) $V Q G A N { + } C L I P$ (Crowson, 2021), (2) Text2Live (Bar-Tal et al., 2022), (3) Blended Diffusion Avrahami et al. (2022b) and (4) Glide (Nichol et al., 2021). We also consider (5) a baseline approach where we only replace the source prompt with the target prompt after $2 0 \%$ of diffusion steps using the same random seed.
160
+
161
+ ![](images/3a206c1ec4a07d6268f75c17ef1f6bc2fc97a19ccd91d60d38f9b606b4d68bd1.jpg)
162
+ “Photo of a squirrel bear enjoys at the playground.”
163
+ Figure 8: Visual comparison. Top: text-guided editing methods (same supervision as ours). Bottom: text-guided inpainting methods which rely on an additional input mask (on the left).
164
+
165
+ Qualitative Comparison. As can be seen in fig. 8, both VQGAN $^ +$ CLIP and Text2Live may result in severe artifacts when editing highly structured objects, e.g., a squirrel to a bear. Our method and Text2Live better preserve the background since both methods estimate a mask editing layer. In contrast, the baseline approach produces realistic and meaningful results, but fails to preserve the background. Furthermore, both VQGAN $+ \ell$ CLIP and Text2Live require optimization per example which takes 3 and 9 minutes respectively on a GPU. Our method is applied in a single diffusion pass which takes up to 20 seconds.
166
+
167
+ We also consider text-driven inpainting methods which rely on a given user-defined mask. As can be seen in fig. 8, Glide and Blended Diffusion do produce meaningful edits, but fail to preserve the original structure. Note that these approaches are limited to local changes and cannot handle global edits such as changing the weather in the image. See fig. 14 and 15 in the appendix for more qualitative comparisons.
168
+
169
+ Quantitative Comparison. In the absence of ground truth for text-based editing, quantitative evaluation remains an open challenge. Therefore, similar to (Bar-Tal et al., 2022), we present a user study in table 1. The participants were asked to rate each result in terms of (1) background and structure preservation with respect to the source image, (2) alignment to the text, and (3) realism. Please see appendix E for more details. As shown, the users preferred our method with regard to all three aspects. Glide and Blended Diffusion were not quantitatively evaluated since they require manual labor to produce the input masks.
170
+
171
+ We provide additional measures in the appendix (table 2) to further validate our claims. We evaluate text-image correspondence using their CLIP score, demonstrating competitive results to methods that directly optimize this metric. In addition, we evaluate the perceptual similarity between the original and edited images using LPIPS (Zhang et al., 2018a) and MS-SSIM (Wang et al., 2003). This shows our capability of performing local editing, similar to Text2Live (Bar-Tal et al., 2022). However, CLIP score and perceptual similarity do not reflect our superior quality and realism which are demonstrated in the user study.
172
+
173
+ # 5 CONCLUSIONS
174
+
175
+ In this work, we uncovered the powerful capabilities of the cross-attention layers within text-toimage diffusion models. We showed that these high-dimensional layers have an interpretable representation of spatial maps that play a key role in tying the words in the text prompt to the spatial layout of the synthesized image. With this observation, we showed how various manipulations of the prompt can directly control attributes in the synthesized image, paving the way to various applications including local and global editing. This work is a first step towards providing users with simple and intuitive means to edit images and navigate through a semantic, textual, space, which exhibits incremental changes after each step, rather than producing an image from scratch after each text manipulation.
176
+
177
+ # 6 ETHIC STATEMENT
178
+
179
+ Our work suggests a new editing technique for images that are generated using state-of-the-art textto-image diffusion models. As explained in section 4.1 and appendix D, our approach can edit real images, although this still remains a more challenging setting. Such manipulation of real photos might be exploited by malicious parties to produce fake content in order to spread disinformation. This is a known problem, common to all image editing techniques. However, research in identifying and preventing malicious editing is already making significant progress. We believe our work would contribute to this line of work, since we provide a comprehensive analysis of the editing procedure using text-to-image diffusion models.
180
+
181
+ # ACKNOWLEDGMENTS
182
+
183
+ We thank Noa Glaser, Adi Zicher, Yaron Brodsky, Shlomi Fruchter and David Salesin for their valuable inputs that helped improve this work, and to Mohammad Norouzi, Chitwan Saharia and William Chan for providing us with their support and the pretrained models of Imagen (Saharia et al., 2022b). Special thanks to Yossi Matias for early inspiring discussion on the problem and for motivating and encouraging us to develop technologies along the avenue of intuitive interaction.
184
+
185
+ # REFERENCES
186
+
187
+ Omri Avrahami, Ohad Fried, and Dani Lischinski. Blended latent diffusion. arXiv preprint arXiv:2206.02779, 2022a.
188
+ Omri Avrahami, Dani Lischinski, and Ohad Fried. Blended diffusion for text-driven editing of natural images. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 18208–18218, 2022b.
189
+ Omer Bar-Tal, Dolev Ofri-Amar, Rafail Fridman, Yoni Kasten, and Tali Dekel. Text2live: Textdriven layered image and video editing. arXiv preprint arXiv:2204.02491, 2022.
190
+ David Bau, Alex Andonian, Audrey Cui, YeonHwan Park, Ali Jahanian, Aude Oliva, and Antonio Torralba. Paint by word, 2021.
191
+ Amit H Bermano, Rinon Gal, Yuval Alaluf, Ron Mokady, Yotam Nitzan, Omer Tov, Oren Patashnik, and Daniel Cohen-Or. State-of-the-art in the architecture, methods and applications of stylegan. In Computer Graphics Forum, volume 41, pp. 591–611. Wiley Online Library, 2022.
192
+ Andrew Brock, Jeff Donahue, and Karen Simonyan. Large scale gan training for high fidelity natural image synthesis. arXiv preprint arXiv:1809.11096, 2018.
193
+ Katherine Crowson. Vqgan $^ +$ clip, 2021. https://colab.research.google.com/ drive/1L8oL-vLJXVcRzCFbPwOoMkPKJ8-aYdPN.
194
+ Katherine Crowson, Stella Biderman, Daniel Kornis, Dashiell Stander, Eric Hallahan, Louis Castricato, and Edward Raff. Vqgan-clip: Open domain image generation and editing with natural language guidance. arXiv preprint arXiv:2204.08583, 2022.
195
+ Prafulla Dhariwal and Alexander Nichol. Diffusion models beat gans on image synthesis. Advances in Neural Information Processing Systems, 34:8780–8794, 2021.
196
+ Ming Ding, Zhuoyi Yang, Wenyi Hong, Wendi Zheng, Chang Zhou, Da Yin, Junyang Lin, Xu Zou, Zhou Shao, Hongxia Yang, et al. Cogview: Mastering text-to-image generation via transformers. Advances in Neural Information Processing Systems, 34:19822–19835, 2021.
197
+ Patrick Esser, Robin Rombach, and Bjorn Ommer. Taming transformers for high-resolution image ¨ synthesis. 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 12868–12878, 2021a.
198
+ 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, 2021b.
199
+ Oran Gafni, Adam Polyak, Oron Ashual, Shelly Sheynin, Devi Parikh, and Yaniv Taigman. Make-a-scene: Scene-based text-to-image generation with human priors. arXiv preprint arXiv:2203.13131, 2022.
200
+ 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.
201
+ 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.
202
+ Tobias Hinz, Stefan Heinrich, and Stefan Wermter. Semantic object accuracy for generative text-toimage synthesis. IEEE transactions on pattern analysis and machine intelligence, 2020.
203
+ Jonathan Ho and Tim Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021.
204
+ Jonathan Ho, Ajay Jain, and Pieter Abbeel. Denoising diffusion probabilistic models. Advances in Neural Information Processing Systems, 33:6840–6851, 2020.
205
+ 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.
206
+ Tero Karras, Samuli Laine, and Timo Aila. A style-based generator architecture for generative adversarial networks. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 4401–4410, 2019.
207
+ Gwanghyun Kim, Taesung Kwon, and Jong Chul Ye. Diffusionclip: Text-guided diffusion models for robust image manipulation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 2426–2435, 2022.
208
+ Gihyun Kwon and Jong Chul Ye. Clipstyler: Image style transfer with a single text condition. arXiv preprint arXiv:2112.00374, 2021.
209
+ Guillaume Lample, Neil Zeghidour, Nicolas Usunier, Antoine Bordes, Ludovic Denoyer, and Marc’Aurelio Ranzato. Fader networks: Manipulating images by sliding attributes. Advances in neural information processing systems, 30, 2017.
210
+ Bowen Li, Xiaojuan Qi, Thomas Lukasiewicz, and Philip Torr. Controllable text-to-image generation. Advances in Neural Information Processing Systems, 32, 2019.
211
+ Ron Mokady, Omer Tov, Michal Yarom, Oran Lang, Inbar Mosseri, Tali Dekel, Daniel Cohen-Or, and Michal Irani. Self-distilled stylegan: Towards generation from internet photos. In Special Interest Group on Computer Graphics and Interactive Techniques Conference Proceedings, pp. 1–9, 2022.
212
+ 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.
213
+ Or Patashnik, Zongze Wu, Eli Shechtman, Daniel Cohen-Or, and Dani Lischinski. Styleclip: Textdriven manipulation of stylegan imagery. arXiv preprint arXiv:2103.17249, 2021.
214
+ 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.
215
+ 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.
216
+ 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.
217
+
218
+ Aditya Ramesh, Prafulla Dhariwal, Alex Nichol, Casey Chu, and Mark Chen. Hierarchical textconditional image generation with clip latents. arXiv preprint arXiv:2204.06125, 2022.
219
+
220
+ Robin Rombach, Andreas Blattmann, Dominik Lorenz, Patrick Esser, and Bjorn Ommer. High- ¨ resolution image synthesis with latent diffusion models, 2021.
221
+
222
+ Olaf Ronneberger, Philipp Fischer, and Thomas Brox. U-net: Convolutional networks for biomedical image segmentation. In International Conference on Medical image computing and computerassisted intervention, pp. 234–241. Springer, 2015.
223
+
224
+ 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.
225
+
226
+ Chitwan Saharia, William Chan, Huiwen Chang, Chris Lee, Jonathan Ho, Tim Salimans, David Fleet, and Mohammad Norouzi. Palette: Image-to-image diffusion models. In ACM SIGGRAPH 2022 Conference Proceedings, pp. 1–10, 2022a.
227
+
228
+ Chitwan Saharia, William Chan, Saurabh Saxena, Lala Li, Jay Whang, Emily Denton, Seyed Kamyar Seyed Ghasemipour, Burcu Karagol Ayan, S Sara Mahdavi, Rapha Gontijo Lopes, Tim Salimans, Tim Salimans, Jonathan Ho, David J Fleet, and Mohammad Norouzi. Photorealistic textto-image diffusion models with deep language understanding. arXiv preprint arXiv:2205.11487, 2022b.
229
+
230
+ 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.
231
+
232
+ Jiaming Song, Chenlin Meng, and Stefano Ermon. Denoising diffusion implicit models. In International Conference on Learning Representations, 2020.
233
+
234
+ Yang Song and Stefano Ermon. Generative modeling by estimating gradients of the data distribution. Advances in Neural Information Processing Systems, 32, 2019.
235
+
236
+ Ming Tao, Hao Tang, Songsong Wu, Nicu Sebe, Xiao-Yuan Jing, Fei Wu, and Bingkun Bao. Dfgan: Deep fusion generative adversarial networks for text-to-image synthesis. arXiv preprint arXiv:2008.05865, 2020.
237
+
238
+ Narek Tumanyan, Omer Bar-Tal, Shai Bagon, and Tali Dekel. Splicing vit features for semantic appearance transfer. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 10748–10757, 2022.
239
+
240
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in Neural Information Processing Systems, volume 30, 2017.
241
+
242
+ Zhou Wang, Eero P Simoncelli, and Alan C Bovik. Multiscale structural similarity for image quality assessment. In The Thrity-Seventh Asilomar Conference on Signals, Systems & Computers, 2003, volume 2, pp. 1398–1402. Ieee, 2003.
243
+
244
+ Weihao Xia, Yujiu Yang, Jing-Hao Xue, and Baoyuan Wu. Tedigan: Text-guided diverse face image generation and manipulation. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, pp. 2256–2265, 2021a.
245
+
246
+ Weihao Xia, Yulun Zhang, Yujiu Yang, Jing-Hao Xue, Bolei Zhou, and Ming-Hsuan Yang. Gan inversion: A survey, 2021b.
247
+
248
+ Jiahui Yu, Xin Li, Jing Yu Koh, Han Zhang, Ruoming Pang, James Qin, Alexander Ku, Yuanzhong Xu, Jason Baldridge, and Yonghui Wu. Vector-quantized image modeling with improved vqgan. arXiv preprint arXiv:2110.04627, 2021.
249
+
250
+ Jiahui Yu, Yuanzhong Xu, Jing Yu Koh, Thang Luong, Gunjan Baid, Zirui Wang, Vijay Vasudevan, Alexander Ku, Yinfei Yang, Burcu Karagol Ayan, et al. Scaling autoregressive models for contentrich text-to-image generation. arXiv preprint arXiv:2206.10789, 2022.
251
+
252
+ Richard Zhang, Phillip Isola, Alexei A. Efros, Eli Shechtman, and Oliver Wang. The unreasonable effectiveness of deep features as a perceptual metric. 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 586–595, 2018a.
253
+
254
+ Zizhao Zhang, Yuanpu Xie, and Lin Yang. Photographic text-to-image synthesis with a hierarchically-nested adversarial network. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 6199–6208, 2018b.
255
+
256
+ # A BACKGROUND
257
+
258
+ # A.1 DIFFUSION MODELS
259
+
260
+ Diffusion Denoising Probabilistic Models (DDPM) Sohl-Dickstein et al. (2015); Ho et al. (2020) are generative latent variable models that aim to model a distribution $p _ { \theta } ( x _ { 0 } )$ that approximates the data distribution $q ( x _ { 0 } )$ and easy to sample from. DDPMs model a “forward process” in the space of $x _ { 0 }$ from data to noise.1 This process is a Markov chain starting from $x _ { 0 }$ , where we gradually add noise to the data to generate the latent variables $x _ { 1 } , \dots , x _ { T } \in X$ . The sequence of latent variables therefore follows $\begin{array} { r } { \dot { q ( x _ { 1 } , \dots , x _ { t } \mid x _ { 0 } ) } = \prod _ { i = 1 } ^ { t } q ( x _ { t } \mid x _ { t - 1 } ) } \end{array}$ , where a step in the forward process is defined as a Gaussian transition $q ( x _ { t } \mid x _ { t - 1 } ) : = N ( x _ { t } ; { \sqrt { 1 - \beta _ { t } } } x _ { t - 1 } , \beta _ { t } I )$ parameterized by a schedule $\beta _ { 0 } , \dots , \beta _ { T } \in ( 0 , 1 )$ . When $T$ is large enough, the last noise vector $x _ { T }$ nearly follows an isotropic Gaussian distribution.
261
+
262
+ An interesting property of the forward process is that one can express the latent variable $x _ { t }$ directly as the following linear combination of noise and $x _ { 0 }$ without sampling intermediate latent vectors:
263
+
264
+ $$
265
+ x _ { t } = \sqrt { \alpha _ { t } } x _ { 0 } + \sqrt { 1 - \alpha _ { t } } w , \ w \sim N ( 0 , I ) ,
266
+ $$
267
+
268
+ where $\begin{array} { r } { \alpha _ { t } : = \prod _ { i = 1 } ^ { t } ( 1 - \beta _ { i } ) } \end{array}$ .
269
+
270
+ In order to sample from the distribution $q ( x _ { 0 } )$ , we define the dual “reverse process” $p ( x _ { t - 1 } \mid x _ { t } )$ from isotropic Gaussian noise $x _ { T }$ to data by sampling the posteriors $q ( x _ { t - 1 } \mid x _ { t } )$ . Since the intractable reverse process $q ( x _ { t - 1 } \mid x _ { t } )$ depends on the unknown data distribution $q ( x _ { 0 } )$ , we approximate it with a parameterized Gaussian transition network $p _ { \theta } ( x _ { t - 1 } ~ \vert ~ x _ { t } ) : = N ( x _ { t - 1 } ~ \vert$ $\mu _ { \boldsymbol { \theta } } ( x _ { t } , t ) , \Sigma _ { \boldsymbol { \theta } } ( x _ { t } , t ) )$ . The $\mu _ { \theta } ( x _ { t } , t )$ can be replaced (Ho et al., 2020) by predicting the noise $\epsilon _ { \theta } ( x _ { t } , t )$ added to $x _ { 0 }$ using equation 2.
271
+
272
+ Under this definition, we use Bayes’ theorem to approximate
273
+
274
+ $$
275
+ \mu _ { \theta } ( x _ { t } , t ) = \frac { 1 } { \sqrt { \alpha _ { t } } } \left( x _ { t } - \frac { \beta _ { t } } { \sqrt { 1 - \alpha _ { t } } } \epsilon _ { \theta } ( x _ { t } , t ) \right) .
276
+ $$
277
+
278
+ Once we have a trained $\epsilon _ { \theta } ( x _ { t } , t )$ , we can using the following sample method
279
+
280
+ $$
281
+ x _ { t - 1 } = \mu _ { \theta } ( x _ { t } , t ) + \sigma _ { t } z , \ z \sim N ( 0 , I ) .
282
+ $$
283
+
284
+ We can control $\sigma _ { t }$ of each sample stage, and in DDIMs (Song et al., 2020) the sampling process can be made deterministic using $\sigma _ { t } = 0$ in all the steps. The reverse process can finally be trained by solving the following optimization problem:
285
+
286
+ $$
287
+ \operatorname* { m i n } _ { \theta } L ( \theta ) : = \operatorname* { m i n } _ { \theta } E _ { x _ { 0 } \sim q ( x _ { 0 } ) , w \sim N ( 0 , I ) , t } \left\| w - \epsilon _ { \theta } ( x _ { t } , t ) \right\| _ { 2 } ^ { 2 } ,
288
+ $$
289
+
290
+ teaching the parameters $\theta$ to fit $q ( x _ { 0 } )$ by maximizing a variational lower bound.
291
+
292
+ # A.2 ATTENTION LAYERS IN TEXT TO IMAGE DIFFUSION MODELS
293
+
294
+ We implement our method on three different diffusion models: Imagen, Latent Diffusion, and Stable Diffusion. We describe here only a high-level description of each model and its attention layers that are relevant to our method. Note that these models condition on the text prompt in the noise prediction of each diffusion step through two types of attention layers: i) cross-attention layers. ii)
295
+
296
+ hybrid attention that acts both as self-attention and cross-attention by concatenating the text embedding sequence to the key-value pairs of each self-attention layer. Our method only intervenes in the cross-attention part of the hybrid attention. That is, only the last channels, which refer to text tokens, are modified in the hybrid attention modules.
297
+
298
+ Imagen. (Saharia et al., 2022b) consists of three text-conditioned diffusion models and a language model: A text-to-image $6 4 \times 6 4$ model, two super-resolution models $- 6 4 \times 6 4 \to 2 5 6 \times 2 5 6$ and $2 5 6 \times 2 5 6 \to 1 0 2 4 \times 1 0 2 4$ and a pre-trained $\mathrm { T } 5 \ \mathrm { X L }$ language model Raffel et al. (2020). These predict the noise $\boldsymbol { \epsilon } _ { \theta } ( \boldsymbol { z } _ { t } , \boldsymbol { c } , t )$ via a U-shaped network, for $t$ ranging from $T$ to 1. Where $z _ { t }$ is the latent vector and $c$ is the text embedding of the language model. We highlight the differences between the three diffusion models:
299
+
300
+ ��� $6 4 \times 6 4 -$ starts from a random noise, and uses the U-Net as in (Dhariwal & Nichol, 2021). This model is conditioned on text embeddings via both cross-attention layers at resolutions [16, 8] and hybrid-attention layers at resolutions [32, 16, 8] of the downsampling and upsampling within the U-Net.
301
+ • $6 4 \times 6 4 2 5 6 \times 2 5 6 -$ conditions on a naively upsampled $6 4 \times 6 4$ image. An efficient version of a U-Net is used, which includes Hybrid attention layers in the bottleneck (resolution of 32).
302
+ • $2 5 6 \times 2 5 6 \to 1 0 2 4 \times 1 0 2 4 -$ conditions on a naively upsampled $2 5 6 \times 2 5 6$ image. An efficient version of a U-Net is used, which only includes cross-attention layers in the bottleneck (resolution of 64).
303
+
304
+ Latent Diffusion. Latent Diffusion Model (LDM) (Rombach et al., 2021) is substantially different from Imagen. First, to reduce memory consummation, LDM operates in the latent space of a pretrained VQGAN Yu et al. (2021); Esser et al. (2021a). This reduces the spatial size of an input image from $2 5 6 \times 2 5 6$ to a quantized latent space of size $3 2 \times 3 2$ with 4 channels. Second, the language model is trained from scratch with the main diffusion model and consists of 32 transformer layers. For the diffusion process, a U-Net is used as in (Dhariwal & Nichol, 2021), which consists of selfattention layers followed by text-conditioned cross-attention layers at resolutions 32, 16, 8 and 4.
305
+
306
+ Stable Diffusion. Stable Diffusion (SD) is an improved version of LDM which is trained on higher resolution with more resources and data. The latent space is of size $6 4 \times 6 4$ with 4 channels, which after decoding results in an image of size $5 1 2 \times 5 1 2$ . SD uses pre-trained CLIP model (Radford et al., 2021) for the conditioned text embedding, and consists of self-attention layers followed by text-conditioned cross-attention layers at resolutions 64, 32, 16 and 8.
307
+
308
+ # B SELF-ATTENTION IN TEXT-CONDITIONED DIFFUSION MODELS
309
+
310
+ An interesting question is the role of self-attention maps. In particular, compared to cross-attention, how well it reveals the structure of the generated image, and how its injection affects the image generation under our settings.
311
+
312
+ Similar to the cross-attention maps, we found that self-attention maps are correlated to the structure and different semantic regions in the image. As can be seen in fig. 9, the self-attention maps of different pixels highlight the close region of the pixel in addition to regions in the image that contain the same semantic content. For example, a pixel on the crust of the pizza attends to other pixels on the crust. In addition, if we look at the top principle components of the self-attention maps, we can clearly identify the layout of the generated image, as previously shown in (Tumanyan et al., 2022) for a different model. However, since the self-attention maps are not correlated to specific words, these provide inferior control compared to cross-attention maps. For instance, it is much more challenging to find a map that highlights only the pepperoni using self-attention.
313
+
314
+ Next, we inject the self-attention maps of a source image during the generation of an image conditioned on another target prompt. Notice that the source and target prompts might be unaligned in this scenario. Such examples are shown in fig. 12, where we apply self-attention injection for a gradually increased number of diffusion steps. As we can see, the attention maps drastically affect the resulting images such that injecting the maps for more than $5 0 \%$ steps suppresses almost any connection to the target prompt. Interestingly, the self-attention maps can also determine the color palette in the image. Since the self-attention injection may restrict the editing capability of our method, we use self-attention injection for up to $2 0 \%$ of the diffusion steps. We found that this may improve the source background preservation in some cases.
315
+
316
+ ![](images/b8d2d2f2b9382a6ba39effacff8a47e282baa6e260257776478547ed1783da4e.jpg)
317
+ Figure 9: Visualization of cross and self-attention. The top row for each example illustrates the average cross-attention maps for the given prompt. The second row shows the self-attention maps with respect to different pixels (marked in green). The third row shows the principle components of the self-attention maps. All examples present the attention maps at resolution $1 6 \times 1 6$ after averaging across diffusion steps, different layers, and attention heads.
318
+
319
+ # C ADDITIONAL RESULTS
320
+
321
+ Additional quantitative results are provided in table 2.
322
+
323
+ Full figures for fig. 5 and 6, are in fig. 11 and 13 respectively. Additional qualitative comparisons are provided in fig. 14 and 15.
324
+
325
+ In fig. 16, we do not inject the attention of the entire prompt but only the attention of a specific word – “butterfly”. This enables the preservation of the original butterfly while changing the rest of the content. As demonstrated in fig. 17, using cross-attention injection we can swap between apples and oranges by swapping these words in the prompt. The same experiment fails when using self-attention which lacks a strong interaction between textual tokens and pixels.
326
+
327
+ Additional global editing results are presented in fig. 18, illustrating a translation of a sketch into a photo-realistic image and inducing an artistic style. Examples for editing of real images provided in fig. 19, 20, and 21.
328
+
329
+ We provide additional visual examples for different editing operations using our method: fig. 22 show word swap results, fig. 23 show adding specification to an image, and fig. 24 show attention re-weighting.
330
+
331
+ # C.1 DIFFERENT BACKBONES
332
+
333
+ Results for the Latent Diffusion and Stable Diffusion models are in fig. 25, 26, 27, 28, 29, and 30. We observe that text-based replacement and refinement operations work well for all three models. However, we notice a small difference between the three models in the Fader Control using Attention Re-weighting. Visual examples of this application are presented in fig. 24, 27 and 30 using Imagen, Latent Diffusion and Stabe Diffusion respectively. As can be seen, when using Imagen as the backbone, our method produces high-quality results and can even handle delicate changes such as reducing the “cubic” appearance of sushi. On the other hand, applying our method with Stable Diffusion may result in unexpected artifacts. For example, when reducing the attention to the word “night” (last example in fig. 30), not only the time of the day is changed but also the dark skies turns into trees.
334
+
335
+ We hypothesize that this difference is the result of using different language models for text embedding. Imagen uses a T5 language model that is trained using an unsupervised language objective of span masking. Stable Diffusion uses CLIP which is trained with a multi-modal constructive objective. Lastly, the Latent Diffusion language model is trained with the same reconstitution objective as the diffusion model. Therefore, we suggest that the text embedding of T5 better represents disentangled information and so yields superior results.
336
+
337
+ # D LIMITATIONS
338
+
339
+ While we have demonstrated semantic control by changing only textual prompts, our technique is subject to a few limitations. First, the current inversion process results in a visible distortion over some of the test images, see fig. 20. Moreover, the inversion requires the user to come up with a suitable prompt which could be challenging for complicated compositions. Note that the challenge of inversion for text-guided diffusion models is an orthogonal endeavor to our work, which would be studied in the future. Second, current attention maps are of low resolution, as the cross-attention is placed in the network’s bottleneck. This bounds our ability to perform more precise editing. To alleviate this, we suggest incorporating cross-attention also in higher-resolution layers. We leave this for future work as it requires analyzing the training which is out of our scope. Third, our method requires setting the timestamp parameter for attention injection and the scale parameter for attention re-weighting. Tuning these usually requires roughly a minute for the Imagen model. However, our method is not highly sensitive to these, and using a constant timestamp produces satisfying results in most cases.Furthermore, we believe that future works will reduce the inference time of these models, so tuning the parameter will be quicker and more intuitive. Finally, we recognize that our method cannot be used for large structural changes in the image, like changing the pose of an animal, move objects or changing the number of objects in the image, see examples in fig. 10. We leave this kind of control for future work.
340
+
341
+ # E USER STUDY
342
+
343
+ 32 participants answered our user study. Each was asked to evaluate 18 randomly selected Promptto-Prompt examples for each method. The examples were given in random order and were divided into three parts: (A) consists of 6 replacement examples using templates 1 and 2 (see appendix F). (B) consists of 6 local refinement examples using templates 3 and 4. (C) consist of 6 global refinement examples using templates 5 and 6. For each example the user was asked to rate the image on a $1 - 5$ scale (higher is better) with respect to the following questions:
344
+
345
+ ![](images/d8536c0e62cb50c753c52b2873f9d67ce908040906112f4b04c1e63a93168c06.jpg)
346
+ Figure 10: Editing Failure Cases. Since Prompt-to-Prompt preserves the overall structure of the source image, it fails when large structural modification is required. For example, changing the pose of the dog from “playing” to “sleeping” (on the left) or changing the number of chairs (middle). In addition, our method is limited by the semantic understanding of the diffusion model, for example, on the right, we add the refinement ”smiling bunny doll” that made both the bunny and the child smile.
347
+
348
+ (1) How well does the right image preserve the structure and the background of the left image? Consider the preservation of properties that are not specified by the text above the images.
349
+
350
+ (2) How well does the right image match the text description above it? Specifically, consider the highlighted text.
351
+
352
+ (3) Rate the overall realism and quality of the right image.
353
+
354
+ See fig. 31 for screenshots.
355
+
356
+ # F EVALUATION PROMPTS
357
+
358
+ We use the following prompt templates to generate the evaluation data:
359
+
360
+ T e m p l a t e 1 : ” Image o f <A RPC> i n s i d e a <B CONST $>$ .”
361
+ S e l e c t A $=$ [ ” a p p l e s ” , ” o r a n g e s ” , ” c h o c o l a t e s ” , ” k i t t e n s ” , ” p u p p i e s ” , ” c a n d i e s ” ]
362
+ S e l e c t B $=$ [ ” b o x ” , ” b o w l ” , ” b u c k e t ” , ” n e s t ” , ” p o t ” ]
363
+
364
+ T e m p l a t e 2 : ”A <A RPC> f u l l o f <B CONST> i s l y i n g on t h e t a b l e . ” S e l e c t A $=$ [ ” b o x ” , ” b o w l ” , ” b u c k e t ” , ” n e s t ” , ” p o t ” ] S e l e c t B $=$ [ ” a p p l e s ” , ” o r a n g e s ” , ” c h o c o l a t e s ” , ” k i t t e n s ” , ” p u p p i e s ” , ” c a n d i e s ” ]
365
+
366
+ T e m p l a t e 3 : ” Pho to o f a <A RPC> <CONST>.”
367
+
368
+ s e l e c t f r o m a $=$ [ ” c a t ” , ” d o g ” , ” l i o n ” , ” c a m e l ” , ” h o r s e ” , ” b e a r ” , ” s q u i r r e l ” , ” e l e p h a n t ” , ” z e b r a ” , ” g i r a f f e ” , ” cow ” ]
369
+ s e l e c t f r o m b $=$ [ ” s e a t i n g i n t h e f i e l d ” , ” w a l k i n g i n t h e f i e l d ” , ” w a l k i n g i n t h e c i t y ” , ” w a n d e r i n g a r o u n d t h e c i t y ” , ” w a n d e r i n g i n t h e s t r e e t s ” , ” w a l k i n g i n t h e d e s e r t ” , ” s e a t i n g i n t h e d e s e r t ” , ” w a l k i n g i n t h e f o r e s t ” , ” s e a t i n g i n t h e f o r e s t ” , ” w a l k i n g i n t h e d e s e r t ” , ” s e a t i n g i n t h e d e s e r t ” , ” p l a y s a t t h e p l a y g r o u n d ” , ” e n j o y s a t t h e p l a y g r o u n d ” ]
370
+ Template 3 : ” Photo of a <A CONST> <B ADD> wi th a <C CONST> on i t . ”
371
+ S e l e c t A $=$ [ ” t r e e ” , ” s h r u b ” , ” f l o w e r ” , ” c h a i r ” , ” f r u i t ” ]
372
+ s e l e c t B $=$ [ ” made o f c a n d i e s ” , ” made o f b r i c k s ” , ” made o f p a p e r ” , ” made o f c l a y ” , ” made o f wax ” , ” made o f f e a t h e r s ” ]
373
+ S e l e c t C $=$ [ ” b u g ” , ” b u t t e r f l y ” , ” b e e ” , ” g r a s s h o p p e r ” , ” b i r d ” ]
374
+
375
+ T e m p l a t e 4 : ” Image o f a <A ADD> <B CONST> on t h e s i d e o f t h e r o a d . ” S e l e c t A $=$ [ ” wooden ” , ” o l d ” , ” c r a s h e d ” , ” g o l d e n ” , ” s i l v e r ” , ” s p o r t ” , ” t o y ” ] s e l e c t B $=$ [ ” c a r ” , ” b u s ” , ” b i c y c l e ” , ” m o t o r c y c l e ” , ” s c o o t e r ” , ” v a n ” ]
376
+
377
+ T e m p l a t e 5 : ”A l a n d s c a p e Image o f <A CONST> <B ADD>.”
378
+ S e l e c t A $=$ [ ” a r i v e r ” , ” a l a k e ” , ” a v a l l e y ” , ” m o u n t a i n s ” , ” a f o r e s t ” , ” a r i v e r i n t h e v a l l e y ” , ” a v l i l a g e on a m o u n t a i n ” ,
379
+ s e l e c t B $=$ ” a w a t e r f a l l b e t w e e n t h e m o u n t a i n s ” , ” t h e c l i f f s i n t h e d e s e r t ” ] [ ” i n t h e w i n t e r ” , ” i n t h e a u t u m n ” , ” a t n i g h t ” , ” a t s u n s e t ” , ” a t s u n r i s e ” , ” a t f a l l ” , ” i n r a i n y d a y ” , ” i n a c l o u d y d a y ” , ” a t e v e n i n g ” ]
380
+
381
+ Source image
382
+
383
+ Source Prompt: “Photo of a cat riding on a bicycle.”
384
+
385
+ ![](images/b311c1e201d2f9aa43afcb39502ca0ab0c789158dd9b58a6420e70c17a3396ca.jpg)
386
+
387
+ ![](images/1f7ea96e3b7aded70b43cd99770387c7c5b689205bd8c1bd5d387e95eafe2526.jpg)
388
+ bicycle motorcycle
389
+ Figure 11: Attention injection through a varied number of diffusion steps. Top: source image and prompt. In each row, we modify the content of the image by replacing a single word in the text and injecting the cross-attention maps of the source image ranging from $0 \%$ (left) to $100 \%$ (right) of the steps. Without our method, none of the source image content is guaranteed to be preserved. On the other hand, injecting the cross-attention throughout all the steps may over-constrain the geometry, resulting in low fidelity to the text.
390
+
391
+ W.O.cross-attention injection → Full cross-attention injection
392
+
393
+ T e m p l a t e 6 : ”<A CONST> i n t h e <B ADD> s t r e e t . ”
394
+ S e l e c t A $=$ [ ” H e a v y t r a f f i c ” , ” The h o u s e s ” , ” The b u i l d i n g s ” , ” C y c l i n g ” , ” The t r a m i s p a s s i n g ” , ” The b u s a r r i v e d a t t h e s t a t i o n ” ]
395
+ s e l e c t B $=$ [ ” snowy ” , ” f l o o d e d ” , ” b l o s s o m ” , ” modern ” , ” h i s t o r i c ” , ” c o m m e r c i a l ” , ” c o l o r f u l ” ]
396
+
397
+ We generate 20 random examples using each template where the tokens <CONST>, ${ \mathrm { - R P C } } >$ and ${ \mathrm { < A D D > } }$ where randomly replaced with one item in the corresponding selection list below each template.
398
+
399
+ ${ \mathrm { \ C O N S T { \mathrm { > } } } }$ stands for phrase that is used in both source and target prompt.
400
+
401
+ ${ \mathrm { < R P C > } }$ stands for phrase that is different between the source and target.
402
+
403
+ ${ \mathrm { < A D D > } }$ stands for refinement phrase which is only replaced in the target prompt and omitted in the source prompt.
404
+
405
+ # Source image
406
+
407
+ Source prompt: “A sailing boat near a castle.”
408
+
409
+ ![](images/2b28aca107b155d607471e8ce29a1aca39aca263fb38912aad246d85d402a210.jpg)
410
+
411
+ ![](images/c536b7e9d7582407dfe01a2a88f498b26199092557885d463c78562f6f3a228b.jpg)
412
+ Figure 12: Self-attention injection through a varied number of diffusion steps. In each row, we conditioned the image generation on a new target prompt and inject the self-attention maps of the source image ranging from $0 \%$ (left) to $100 \%$ (right) of the diffusion steps.
413
+
414
+ Target prompt: “An elephant in the field.”
415
+ Table 2: Additional quantitative results. We measure text-image correspondence using CLIP (Radford et al., 2021), demonstrating competitive results to methods that directly optimize the CLIP score. In addition, we evaluate the similarity between the original and the edited images using the LPIPS (Zhang et al., 2018a) perceptual distance and MS-SSIM (Wang et al., 2003). This show our capability of performing local editing, similar to Text2Live (Bar-Tal et al., 2022).
416
+
417
+ <table><tr><td></td><td>CLIP score个</td><td>MS-SSIM↑</td><td>LPIPS↓</td></tr><tr><td>VQGAN+CLIP</td><td>0.282 ±0.04</td><td>0.27 ± 0.046</td><td>0.64± 0.05</td></tr><tr><td>Text2Live</td><td>0.247 ± 0.04</td><td>0.82±0.065</td><td>0.25± 0.05</td></tr><tr><td>baseline</td><td>0.253 ± 0.03</td><td>0.69 ± 0.13</td><td>0.35 ± 0.12</td></tr><tr><td>Ours</td><td>0.253± 0.04</td><td>0.81± 0.11</td><td>0.22 ± 0.1</td></tr></table>
418
+
419
+ “A car on the side of the street.”
420
+
421
+ ![](images/04df67b44a4f163e14f3af863e2c08a26768554be9f0dd5e3aa010534f78cae0.jpg)
422
+ Figure 13: Editing by prompt refinement. By extending the description of the initial prompt, we can make local edits to the car (top rows) or global modifications (bottom rows).
423
+
424
+ “Photo of a cat camel seating in the forest.”
425
+
426
+ ![](images/7654a981632f30da67785934e4e9abfda068e5b96672173b5f3ac3b34f822094.jpg)
427
+
428
+ “Image of a bowl with oranges chocolates.”
429
+
430
+ ![](images/a8e6ff1a6ce1198af712b96544455055bc54237c259b2f008eb7d021a5b0b146.jpg)
431
+
432
+ “Photo of a flower made of candies with a butterfly on it.”
433
+
434
+ ![](images/d4d77c9ee07edf6bcf02f2fd515d581ac5e99b603243cc14cad2fe278288befc.jpg)
435
+
436
+ “Image of a golden scooter on the side of the road.”
437
+
438
+ ![](images/530f6b6a2e668fe70b1e0d9ce1132eb570c02a8d6741dd864ad026f009685363.jpg)
439
+
440
+ “A landscape image of a lake at sunset.”
441
+
442
+ ![](images/d93d4dbe157de84fa7f1ec9771dcd7c2e4fa58413efa8d56f9d152b1bb5b4aca.jpg)
443
+ Figure 14: Additional comparisons to text-guided image editing. Similar to ours, these methods do not require a user-provided mask.
444
+
445
+ “Photo of a lion zebra seating in the forest.”
446
+
447
+ ![](images/91b64ec0e20a42e0e9fb5c3b7727fb3af60b584cf4d4660bd6e2735a84af531a.jpg)
448
+ Figure 15: Additional comparisons to text-guided in-painting methods. Unlike our method, these techniques require an auxiliary segmentation mask which is provided by the user.
449
+
450
+ ![](images/393c330088b967161f7a5914a69ed090e7653553d5f12c8922db87a6826f7b85.jpg)
451
+ Cross–attention injection
452
+ Figure 16: Object preservation and replacement using cross and self attention injection. Top: by injecting only the cross-attention weights of the word “butterfly” taken from the top-left image we can preserve the structure and appearance of a single item while replacing its context (i.e., background). Bottom: using only self-attention injection we can’t specify which object should be preserved, therefore, modifying the background while keeping the butterfly is more challenging.
453
+
454
+ “A photo of a butterfly on...”
455
+
456
+ Cross–attention injection
457
+
458
+ ![](images/cf84f8281b7b824a4e2fbbafc5d6109038cf2cd9e0ff44b6669e7f03346a1610.jpg)
459
+ Figure 17: Object replacement using cross-attention injection and self-attention injection. Cross–attention injection better preserves the semantic relation between the generated image and the text prompt. Top: using cross-attention injection (third row) we can swap between apples and oranges in the source image by swapping these words in the prompt “apples and oranges are on the table.”. The same experiment fails when using self-attention which lacks a strong interaction between textual tokens and pixels. Bottom: cross-attention injection (6th row) better preserves the distinct elements in the image when replacing the word “oranges” with “kittens” in the sentence “a basket with oranges on the counter.”
460
+
461
+ “drawing of...” “photo of...”
462
+
463
+ ![](images/abff34e1b7365e5e51deb7e776dbaa0f40961abaa50e7755378d50589e13d90d.jpg)
464
+ Figure 18: Image stylization. By adding a style description to the prompt while injecting the source attention maps, we can create various images in the new desired styles that preserve the structure of the original image.
465
+
466
+ ![](images/8e93e24bf262b6810b1ae56332d36ba1e0b8213a238897afa557bea75bdfba13.jpg)
467
+ Figure 19: Editing of real images. On the left, inversion results using DDIM Song et al. (2020) sampling. We reverse the diffusion process initialized on a given real image and text prompt. This results in a latent noise that produces an approximation to the input image when fed to the diffusion process. Afterward, on the right, we apply our Prompt-to-Prompt technique to edit the images.
468
+
469
+ ![](images/84091c78f84a55cfae9848ca261ac5c3c7f706c1d9fb1648ed4c83f6d94d9c3e.jpg)
470
+ Figure 20: Inversion Failure Cases. Current DDIM-based inversion of real images might result in unsatisfied reconstructions.
471
+
472
+ ![](images/bf8888ae938ed56ce79fd652f5467f693d275870fd25b0897a20d9cd282a1b13.jpg)
473
+ different noise seeds
474
+ Figure 21: Mask-based editing. Using the attention maps, we preserve the unedited parts of the image when the inversion distortion is significant. This does not require any user-provided masks, as we extract the spatial information from the model using our method. Note how the cat’s identity is retained after the editing process.
475
+
476
+ ![](images/89378203e8d0041750ac9145c1a673ce3a78ef3d990f4dd9310f2c1e00481a01.jpg)
477
+
478
+ “A ball between two chairs on the beach.
479
+
480
+ ![](images/7381076577b65d1d5ab687b4f7f0302730ab35f536cb3efcc5e8897ac81a5dcf.jpg)
481
+ Figure 22: Additional results for Prompt-to-Prompt editing by word swapping using the Imagen model (Saharia et al., 2022b)..
482
+
483
+ ![](images/88286251b3b8e5650f7a0e84e00100f1e1caf6c464d8f1e18e6d79e7cd5ff49e.jpg)
484
+ Figure 23: Additional results for Prompt-to-Prompt editing by adding a specification using the Imagen model (Saharia et al., 2022b)..
485
+
486
+ ![](images/b3d120a0df41e28d1c1a60993ba8885a520d0095bf249613de6b86ddef6a2be7.jpg)
487
+ “A leopard sleeping( ) cake next to an apple.”
488
+
489
+ ![](images/97139ab2ef4572d81a2052b53036ed5cca30fd4724de7f77caf8eb1b1746ab4c.jpg)
490
+ “A smiling( ) teddy bear.”
491
+
492
+ ![](images/c8591a92775ade73b88af9a5edca79890485d172d246d305773a575b96f7983d.jpg)
493
+ “Photo of a cubic( ) sushi.”
494
+
495
+ ![](images/bd646e01f693602867ebd8ba08ed27b5308f07a1f812688f6182f333f34d83a7.jpg)
496
+
497
+ “A photo of a birthday( ) cake next to an apple.”
498
+
499
+ ![](images/4fe2d7f332a1601a8ad5e4953240238b7edd7262120c9b128f9db66011a1bcd9.jpg)
500
+ “My colorful( ) bedroom.”
501
+
502
+ ![](images/e65d1884e620b721a67abd7c48e8ec4263aef3145d7647fce5c13e8e596c2887.jpg)
503
+ Figure 24: Additional results for Prompt-to-Prompt editing by attention re-weighting using the Imagen model (Saharia et al., 2022b).
504
+
505
+ “Photo of a field of poppies at night( ).”
506
+
507
+ ![](images/0173d57ad3035482d0069cf24d53e0878193e5a85006139fd3c8582d29060b8e.jpg)
508
+ “A painting of a squirrel eating a burger pizza.”
509
+
510
+ ![](images/33586fcfc05ad6959c605f3fc615c47de43ba17e2facd6a7b198ba4f8f661292.jpg)
511
+ “A bench with a pile of books magazines on top.”
512
+
513
+ ![](images/6943e732a25acda4ab2ff15d2afb9158177290433c6dee38cddeeb36ad1e41fe.jpg)
514
+ “Banknote portrait of a cow horse.”
515
+
516
+ ![](images/7711404414a610930b20f7a82acc82c1f0926399e390bca8d5a1e95ddac4e7e7.jpg)
517
+
518
+ ![](images/a184576bbaf79ed07b7e40cbca889e54bf779014980b57f57e6ec8481420c3d0.jpg)
519
+
520
+ “Snail Turtle in the middle of the forest. Afternoon light.”
521
+
522
+ ![](images/019a06f2e798428f95586b69d04b17e9fb8d6caed86bab242dd64c9def80b54e.jpg)
523
+
524
+ “A bowl with apples snacks on a table.”
525
+
526
+ “Photo of a butterfly bee on a flower.”
527
+
528
+ ![](images/b4a1c915f50965866d36e0ab1f6a1cdc5849cc791a1e21f3306647b00b7c389f.jpg)
529
+ “A photo of a dog wearing a floral dotted shirt.”
530
+
531
+ ![](images/426a15442cd3e9c026276e9883388d0c93b44ec555685d0d1bb2ef5b94a6ceb1.jpg)
532
+
533
+ ![](images/f4e234875a365303c7c9450d11c549847e391f85cb3ab5cec84bf74a05d08a67.jpg)
534
+ “A photo of a cat dog wearing a blue tie.”
535
+
536
+ “A photo of a cat playing chess domino .”
537
+
538
+ ![](images/704a8b7cbd1fe240be8cf3f9560eb6e7510d92b6cd594e5cc38f9f800a19712c.jpg)
539
+ “A vase filed with cotton tennis balls.”
540
+
541
+ ![](images/b8388857c365e45f1fef72d619a4d8d61e11231943f457bc7344e49e77c8a333.jpg)
542
+ “A beautiful bouquet of tulips daisies on a table.”
543
+
544
+ ![](images/996d6d3ec3b8d0ae63250845e4dc87101be9fa7a37c0e00b9f93e57914b27743.jpg)
545
+ “A deflated inflated tire on the ground.”
546
+
547
+ ![](images/6fe1135eda1e6f684bc29df0d0b86d7cc872d4ed2c068045398bbc05e2128b8b.jpg)
548
+
549
+ “A painting of a lion bear eating an apple.”
550
+
551
+ ![](images/1d7071266a96af7ea98044b54aad85294376949ac527f3b5fd96c37ec5a4319d.jpg)
552
+ “A car is driving on the beach road.”
553
+
554
+ ![](images/bf702a877a63a3118c21707ce90c6c41463b33d2987a0a84ef0f1a0d10f90784.jpg)
555
+ “Soup with rice noodles.”
556
+
557
+ ![](images/c16c2b8fd3d010e5b2da1065215c123075ce32da2fdbfbfe76acc1d67cc2fad8.jpg)
558
+ “Watercolour painting photo of a latent space.”
559
+
560
+ ![](images/908db1a5aded712c56039570b70c595066f212fee06b26c9a969b93f03a082dc.jpg)
561
+ “A photo of an astronaut riding a horse camel.”
562
+
563
+ ![](images/fdb7aa0044115654b4c7ae007c4975788653803ae5e3395fb2e39a4bedde201f.jpg)
564
+ “A castle made out of sand corn.”
565
+
566
+ ![](images/dfcde095a547d23e32e85fc39dc7f890958e8043fb0aa9aa63fce74b8ee7b7d2.jpg)
567
+ “A snowman scarecrow in the garden.”
568
+ Figure 25: Additional results for Prompt-to-Prompt editing by word swap using the Latent Diffusion Model (Rombach et al., 2021).
569
+
570
+ ![](images/b4ec7122bd6f8db2dd014bda90d9ea2ce9d3b0e1098fb88e508d9b10f8a26657.jpg)
571
+ “Lemon Apple cake on the table.”
572
+
573
+ ![](images/20a409519afd83918755291d140cec62d7511d52d13a44341e8b6311f84fd5ac.jpg)
574
+ “Image of candies toys inside a box.”
575
+
576
+ ![](images/029c1832f055f49243414768d74b381363e5a7abb419962a07e8b95410ac3834.jpg)
577
+ “A beautiful bouquet of tulips of the colour red and yellow.”
578
+
579
+ ![](images/087a536b31d1b4ee497a7d99237795aa6b0c66a66b489d166c89ad11c6176424.jpg)
580
+ “A school bus is driving in the street.”
581
+
582
+ ![](images/15fa14d4e70f4699917d971f1a04d16520d2b59804868e903f8ca8e22a17e2a9.jpg)
583
+ “A car is driving in the flooded street.”
584
+
585
+ ![](images/817ba9687efcf22eb6a95220461e46b8495cfb3e399bcbf4c4c6520b19a3a2cf.jpg)
586
+ “A landscape with a lake between mountains at sunset.”
587
+
588
+ ![](images/50e59f9e8e5c36a200142a443d9b19caad5bf6d67ceefff8d0899a495007df05.jpg)
589
+
590
+ ![](images/f17acc516225ced6b648772aa6f0b8832462926fd23b66ed5c42b085bcca7865.jpg)
591
+ “Pizza with mushrooms.”
592
+
593
+ “A wooden bike in the yard.”
594
+
595
+ ![](images/d8e3b2e97ee0b82fcc2c639588070470554a266a980c48859ac1e24310ae2d0f.jpg)
596
+ “A fashion sketch of an evening dress with long sleeves.” ,
597
+
598
+ ![](images/7f6a606c009bb7c6869e3b50f28fe3eb9c56347cdbeccd9f5204b5684f5c33ab.jpg)
599
+ “A speeding race car is driving on the beach.”
600
+
601
+ ![](images/f842cd397cef277e94521e6c3a827cd1c9be082ac7446ca755c4ae183bc8abee.jpg)
602
+ “A big yellow apple on a table”
603
+
604
+ ![](images/a27cb78c7567b55408a920be947faabf4bca71048b7a64219521c9cd9f57118d.jpg)
605
+
606
+ “My bicycle are in the street of Las Vegas.”
607
+
608
+ ![](images/70b0d16f05ca948a29719bf2c8e91cac8f4453a2a3719f230234997a911184db.jpg)
609
+ “A banknote portrait of a cat.”
610
+
611
+ ![](images/800f11cb64def02c1a7a06972f855273ac8f74621a715bb645f72d1c6bc5b1a1.jpg)
612
+
613
+ “A cubist painting of a vase with lilies.”
614
+
615
+ ![](images/86d9e941b1dec22cc451a67977257ba49b41237dde0d8ae63b47bc8adcbecbcf.jpg)
616
+ “A small clay bunny with a big smile.”
617
+
618
+ ![](images/bba3e2dbb585ff155bcda5c5b4711aab6c6e468873fadf36655bb1f5cc97f889.jpg)
619
+ “My bicycle are in the street at blossom.”
620
+
621
+ ![](images/f726cc9c29131f79fcb63722dc2cdfb4d27f78a91495dc0aca099d057a36b8b2.jpg)
622
+ “Photo of a landscape with a river and mountains at sunrise.”
623
+
624
+ ![](images/b564bc7b838196c7bc14b9d298fde77bf67dddc0458180b8643530df76ebcdb0.jpg)
625
+ “A TV screen with many burnt pixels.”
626
+
627
+ ![](images/220da86a7cfbcca2617c2a32e2dad0107e6c68dd6076af61eaf436b180dca0ba.jpg)
628
+ “A stove outside creating a smoke cloud above.”
629
+
630
+ ![](images/029016f182177acf76a987d36a8cdbfe6244f3de6befb696a08d56035e2ec3b9.jpg)
631
+ “A bear with yellow sunglasses and a drink.”
632
+
633
+ ![](images/60f89048121db9f373004e8d50e6a50d33bb6bf22bb1dddcc55dde23e90c46c7.jpg)
634
+
635
+ “A photo of a dog wearing a floral shirt.”
636
+
637
+ ![](images/dded79333cd8b0b9e6d38d325a73988486b2dd4a8c99c65d6a35fc9d2abed8f4.jpg)
638
+ “A landscape photo of a harbor in the storm.”
639
+ Figure 26: Additional results for Prompt-to-Prompt editing by adding a specification using the Latent Diffusion Model (Rombach et al., 2021).
640
+
641
+ ![](images/c54e2101e3cd2ea0a89f8fa13cd91e4dfd03c2c315eafaca75eafeb6ad2dcc12.jpg)
642
+ “The scooter at the city at winter.”
643
+
644
+ ![](images/144c1c40d1b2b55c0c3ec5efae6b97c4baaa5dec703f253b81674d98404a41b5.jpg)
645
+
646
+ "A photo of a blossom ( ) tree."
647
+
648
+ ![](images/01b45cf9c44ebc9713f5e485ebe0b8d244d3fd0ca280e44075c09135a71442ed.jpg)
649
+ “A landscape with a snowy ( ) mountain.”
650
+
651
+ ![](images/35f19b15adce1457e77d0ac6a9efd0d61db7cbe2b45d9eac0e004c40ab4e193e.jpg)
652
+
653
+ “A photo of the ancient ( ) city.”
654
+
655
+ ![](images/75af99811fde35c35302c6ca3afd810cad8e503a72c049c5795ecf7a5ce58bae.jpg)
656
+ “A crahsed ( ) car.”
657
+
658
+ ![](images/4e141fc700d1d58b31182ecbfcfee3f6c5d4ae41b5f25ab4d51ca7ea8cd1ba57.jpg)
659
+ “My puffy ( ) shirt.”
660
+
661
+ ![](images/3a1e9a69e15a155e04730bb77b8c5c7fa10b1adad819a478b3e93e0c56e31e46.jpg)
662
+ “A photo of a poppy field at night ( ).”
663
+ Figure 27: Additional results for Prompt-to-Prompt editing by attention re-weighting using the Latent Diffusion Model (Rombach et al., 2021).
664
+
665
+ ![](images/ccf8abf4c921109d3140438a44ac292933616ec6c3046245c7c53a2a78941c40.jpg)
666
+ “A painting of a squirrel cat eating a burger.”
667
+
668
+ ![](images/b8eb17c875a7cd7a241de1a6952b012b641da4f0054bf14861c91e58323a5b16.jpg)
669
+ “A bench with many books magazines on top.”
670
+
671
+ ![](images/aa18b837f7d29cbe0e08ab938e84b308849dd976f39fd1f15dcf100886276060.jpg)
672
+ “Banknote portrait of a mouse horse.”
673
+
674
+ ![](images/3c1be40db1411e6d7b245afd1fdc58ade53e316f252575cf19e3e2ab6e19b160.jpg)
675
+
676
+ “A car is driving on the beach road.”
677
+
678
+ ![](images/f578011fb88d217d10b573f343d16c1cffcfd73eacf93b46e27ebcc4c8c3fd98.jpg)
679
+ “A chair in the bed living room.”
680
+
681
+ ![](images/0d2f318a6372effbf9709d804a39b970f89b9cd4729117cc1bbe21f4344ae562.jpg)
682
+
683
+ “A deflated inflated tire on the ground.”
684
+
685
+ ![](images/c849c075696e9d6aa677ebfc5cef48b76d2423aedaf0f27ee6ad93cb904cd0b6.jpg)
686
+ “A fashion BW sketch of an evening dress of an evening dress.”
687
+
688
+ ![](images/de6ad14a713a4ce3cc772f5a3496d279590b265f2418baf33a96973b97b8a903.jpg)
689
+
690
+ “A huge translucent mushroom avocado in the middle of the forest. Afternoon light.”
691
+
692
+ ![](images/d9a837231df413d3b820b40aaba3c756cbc26b2a215c4e875837bb4693a04ee1.jpg)
693
+ “A kangaroo deer in a pub eating sushi. DSLR.”
694
+
695
+ ![](images/cd6e77bb5ea3b77d9381ddb46ef88bf6357750d7224bc47cf98d39ed876db719.jpg)
696
+ “A pepperoni mushroom pizza on a table.”
697
+
698
+ ![](images/db61ee1d9fc5b07e9b423cc95eda6f92d05f50ee12c64de80fd71852c5cb3c95.jpg)
699
+
700
+ ![](images/855220727e98240cfa994b71bfcb3295e00044d9009616b8ae093d860c7154ca.jpg)
701
+
702
+ “A stove over a pile of diverse random house sports objects. Low lighting image.”
703
+
704
+ “An evil robot holding a sword broom.”
705
+
706
+ ![](images/26d7e66782faa8adf20eab9f6aa214cb7b53ddf685ebe815a95b965529781a13.jpg)
707
+ “An origami bottle cup.”
708
+
709
+ ![](images/d3e7b977043ecdebb407281ed5925af1c71624d64d001fea90f2a000fa20f2a5.jpg)
710
+ “A vase filed with cotton tennis balls.”
711
+
712
+ ![](images/968b1fc94b926f917b55d2693b6589257ced71844d883e3472b404501cd1d5e0.jpg)
713
+ “A photo of a cat playing chess domino .”
714
+
715
+ ![](images/bb1ccc59692fb1934f6899cf2f4ad2ad37b6d9d4cb98a8493304a3719e0d0c94.jpg)
716
+ “Photo of a dog cat in the street.”
717
+
718
+ ![](images/7ad12530b226c8b914788cb875277e897741a7ad3dc20f9de98a600e9f63c77d.jpg)
719
+ “A piano made out of Lego cubes.”
720
+
721
+ ![](images/cb77b9ee39f9fda22d09dc711771c44eae4cc005710afaa8d24f9f1a5b466743.jpg)
722
+ “A painting of a squirrel eating a burger pizza.” ,
723
+
724
+ ![](images/662d60037e54a64d4cea0d3b87cc03cc408f7dd690063c0701dcc1ee3a420273.jpg)
725
+
726
+ “A beautiful bouquet of tulips daisies.”
727
+
728
+ ![](images/2e4be728f25124060775eb9a1a1e34ce808979733843a50647c49b7a0ac1e03f.jpg)
729
+ “An apple orange on a table.”
730
+
731
+ ![](images/1860a787bc3078038a925a9eafbfc66044f996766230a86ad02334ec7a16b18c.jpg)
732
+ “Image of candies mints inside a box.”
733
+ Figure 28: Additional results for Prompt-to-Prompt editing by word swap using the Stable Diffusion Model .
734
+
735
+ ![](images/0a041bb19649a2e30c9a3933bb530bcf491805cb1d7217ca72b52722367ebd07.jpg)
736
+ “A beautiful bouquet of tulips of the colour red and yellow.”
737
+
738
+ ![](images/64b38c2ab640cbf3336f56d728a9eb902ad0cc97d2b580fb4f719474e3119855.jpg)
739
+ “A big yellow apple on a table”
740
+
741
+ ![](images/a7417ca9978619cbeacf2050df8613ff9fd061b491e2329308d0fd3fe7557ceb.jpg)
742
+ “A wooden bike in the yard.”
743
+
744
+ ![](images/cc23760f853adcdb3ace5dabbc6ec994464f648282be87aba5b9d40a13e200c9.jpg)
745
+ “A bridge made of rope between two cliffs.”
746
+
747
+ ![](images/e29e8286ae201cd77ba838e8b49c74ceb8d55a3fa4a60c196391d6cb893aad6f.jpg)
748
+ “A dangerous bridge missing its steps between two cliffs.”
749
+
750
+ ![](images/8eebaebfab04439b6668f8817c6916b20c41276f433549a852af7287a4058f64.jpg)
751
+ “A speeding race car is driving on the beach.”
752
+
753
+ ![](images/164350de1a09703e2fd940a8a1f6105a717faee9eb42a1b6642733eb7ec5b087.jpg)
754
+ “A fashion sketch of an evening dress with long sleeves.”
755
+
756
+ ![](images/1ff0905d95b388a0f5edad64c548877eb7d9ba70ce4acca7c48bc844cef01828.jpg)
757
+ “A painting of a squirrel jumping over a metal fence with spikes.”
758
+
759
+ ![](images/4453385716b51185a9aa9da3ed8e064f02fa966a522055c7ed497d51bd8c3819.jpg)
760
+
761
+ “A huge translucent mushroom in the middle of the forest. Afternoon light.”
762
+
763
+ ![](images/5c1fdabedb974b32d09e8f67473950a6d241e8e78f48274065c18b164c61ae36.jpg)
764
+ “A painting of lilies in the style of Van Gogh.”
765
+
766
+ ![](images/72098a0028e8ae939a61310ad9f39c3b3841fd3a05561c085d3ccc96ddf07b01.jpg)
767
+ “A pepperoni pizza with mushroom and olive toppings on a table”
768
+
769
+ ![](images/3e4e1ae2f94c978f707c5b59e50cdf8b44f606107a7bad49ea739d46157e352a.jpg)
770
+ “A banknote portrait of a mouse.”
771
+
772
+ ![](images/50a9e25f3be63521c823a624669076fcf4d12538a80867f7d928e31f4829d631.jpg)
773
+ “A small clay bunny with a big smile.”
774
+
775
+ ![](images/15fe8098433f5211675b060372788b2c3b9fec2b604001ac3ca4fa8d0c5b03cc.jpg)
776
+ “A recliner sofa in the living room”
777
+
778
+ ![](images/2e404c084ee7e4a46a0a7238d05f42181e3689f1bcd2e9912d380e115e4ba3b6.jpg)
779
+ “A deflated and ripped up tire on the ground.”
780
+
781
+ ![](images/611123441d9d67efcf806eff9ca5809a0c9e4d47e554a04ef6e8b6fd8ba08c60.jpg)
782
+ “A vase filled with cotton and metal balls.”
783
+
784
+ ![](images/210b6e16cd6ac26016870837e9bf8532c42976f3f6c8c68620fabffc599e4682.jpg)
785
+ “A stove outside creating a smoke cloud above.”
786
+
787
+ ![](images/bb7fba0d80763b6271265801c9d16740ae23ce073f58252039a8e48b7d63d249.jpg)
788
+ “A TV screen with many burnt pixels.”
789
+
790
+ ![](images/6845425ec2f4c276060ad699b7f4014a79124dbf5d1f2044d5679b23ee140ecd.jpg)
791
+
792
+ “An image of soup with alphabet soup crackers in English and Russian.
793
+
794
+ ![](images/83bcaddffed29cabf2be024c0651be7a2ae831bea19cebd3721ac06704091c14.jpg)
795
+ “Eyeglasses on the desk reflecting a strong glare.”
796
+
797
+ ![](images/98e1addd18587efec632c60f243dc52e29d29b5506a4bcd9f290a7d884ff6547.jpg)
798
+ “Image of candies covered with chocolate inside a box.”
799
+
800
+ Figure 29: Additional results for Prompt-to-Prompt editing by adding a specification using the Stable Diffusion Model.
801
+
802
+ ![](images/41b81e16a773060102ec26d0afc647cb63fa4a6809f4c8de2324c7bf5396574d.jpg)
803
+
804
+ "A photo of a blossom ( ) tree."
805
+
806
+ ![](images/7a19e6bbf48b4cbf8413416b1e81b2feec4e43b9c42b73af8eb9c6e0fe7deee8.jpg)
807
+ “A landscape with a snowy ( ) mountain.”
808
+
809
+ ![](images/34ca07bc654a67ce0c3a546b28f2055856a557bcfaec286725c72392d72b49ac.jpg)
810
+
811
+ “A photo of the ancient ( ) city.”
812
+
813
+ ![](images/130cc77105ba97ad15e008a3a716c8c50d5fec58ff5471a2fcebc392fddcf8dc.jpg)
814
+ “A crahsed ( ) car.”
815
+
816
+ ![](images/5ddcea0a932859862d02969e915bdd874a8400b7877f59a19c4ade0258771993.jpg)
817
+
818
+ “A smiling( ) teddy bear.”
819
+
820
+ ![](images/c6fbf7b7c93dc1968ec3d401cd6097a6fe2aa267346ac2799bbc7dbe124c071a.jpg)
821
+ Figure 30: Additional results for Prompt-to-Prompt editing by attention re-weighting using the Stable Diffusion Model.
822
+
823
+ “A photo of a poppy field at night ( ).”
824
+
825
+ ![](images/dd6383bbc42d653fd0626802134a5fbf4a6c2ea328e1a19e87b809f9affaaf5a.jpg)
826
+ Figure 31: Screenshots from our User study. The participants were asked to evaluate: (1) background, structure, and content preservation with respect to the source image, (2) alignment to the text, and (3) realism. The study evaluates both local and global editing.
parse/dev/_CDixzkzeyb/_CDixzkzeyb_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/_CDixzkzeyb/_CDixzkzeyb_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/k7FuTOWMOc7/k7FuTOWMOc7_content_list.json ADDED
@@ -0,0 +1,1166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Elucidating the Design Space of Diffusion-Based Generative Models ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 209,
8
+ 122,
9
+ 790,
10
+ 171
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Tero Karras NVIDIA tkarras@nvidia.com ",
17
+ "bbox": [
18
+ 281,
19
+ 222,
20
+ 437,
21
+ 263
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Miika Aittala NVIDIA maittala@nvidia.com ",
28
+ "bbox": [
29
+ 550,
30
+ 222,
31
+ 717,
32
+ 263
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Timo Aila NVIDIA taila@nvidia.com ",
39
+ "bbox": [
40
+ 294,
41
+ 285,
42
+ 431,
43
+ 325
44
+ ],
45
+ "page_idx": 0
46
+ },
47
+ {
48
+ "type": "text",
49
+ "text": "Samuli Laine NVIDIA slaine@nvidia.com ",
50
+ "bbox": [
51
+ 557,
52
+ 285,
53
+ 705,
54
+ 327
55
+ ],
56
+ "page_idx": 0
57
+ },
58
+ {
59
+ "type": "text",
60
+ "text": "Abstract ",
61
+ "text_level": 1,
62
+ "bbox": [
63
+ 462,
64
+ 363,
65
+ 535,
66
+ 378
67
+ ],
68
+ "page_idx": 0
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "We argue that the theory and practice of diffusion-based generative models are currently unnecessarily convoluted and seek to remedy the situation by presenting a design space that clearly separates the concrete design choices. This lets us identify several changes to both the sampling and training processes, as well as preconditioning of the score networks. Together, our improvements yield new state-of-the-art FID of 1.79 for CIFAR-10 in a class-conditional setting and 1.97 in an unconditional setting, with much faster sampling (35 network evaluations per image) than prior designs. To further demonstrate their modular nature, we show that our design changes dramatically improve both the efficiency and quality obtainable with pre-trained score networks from previous work, including improving the FID of a previously trained ImageNet-64 model from 2.07 to near-SOTA 1.55, and after re-training with our proposed improvements to a new SOTA of 1.36. ",
73
+ "bbox": [
74
+ 233,
75
+ 397,
76
+ 766,
77
+ 564
78
+ ],
79
+ "page_idx": 0
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "1 Introduction ",
84
+ "text_level": 1,
85
+ "bbox": [
86
+ 174,
87
+ 598,
88
+ 310,
89
+ 616
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "Diffusion-based generative models [45] have emerged as a powerful new framework for neural image synthesis, in both unconditional [16, 36, 48] and conditional [17, 35, 36, 38, 39, 41, 42, 48] settings, even surpassing the quality of GANs [13] in certain situations [9]. They are also rapidly finding use in other domains such as audio [27, 37] and video [19] generation, image segmentation [4, 54] and language translation [34]. As such, there is great interest in applying these models and improving them further in terms of image/distribution quality, training cost, and generation speed. ",
96
+ "bbox": [
97
+ 174,
98
+ 633,
99
+ 825,
100
+ 717
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "The literature on these models is dense on theory, and derivations of sampling schedule, training dynamics, noise level parameterization, etc., tend to be based as directly as possible on theoretical frameworks, which ensures that the models are on a solid theoretical footing. However, this approach has a danger of obscuring the available design space — a proposed model may appear as a tightly coupled package where no individual component can be modified without breaking the entire system. ",
107
+ "bbox": [
108
+ 174,
109
+ 723,
110
+ 825,
111
+ 792
112
+ ],
113
+ "page_idx": 0
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "As our first contribution, we take a look at the theory behind these models from a practical standpoint, focusing more on the “tangible” objects and algorithms that appear in the training and sampling phases, and less on the statistical processes from which they might be derived. The goal is to obtain better insights into how these components are linked together and what degrees of freedom are available in the design of the overall system. We focus on the broad class of models where a neural network is used to model the score [22] of a noise level dependent marginal distribution of the training data corrupted by Gaussian noise. Thus, our work is in the context of denoising score matching [51]. ",
118
+ "bbox": [
119
+ 174,
120
+ 797,
121
+ 825,
122
+ 895
123
+ ],
124
+ "page_idx": 0
125
+ },
126
+ {
127
+ "type": "image",
128
+ "img_path": "images/a112149465978ffdcd87523188d94f77b32f0ddb4e19c611ea752326c5d78465.jpg",
129
+ "image_caption": [
130
+ "Figure 1: Denoising score matching on CIFAR-10. (a) Images from the training set corrupted with varying levels of additive Gaussian noise. High levels of noise lead to oversaturated colors; we normalize the images for cleaner visualization. (b) Optimal denoising result from minimizing Eq. 2 analytically (see Appendix B.3). With increasing noise level, the result approaches dataset mean. "
131
+ ],
132
+ "image_footnote": [],
133
+ "bbox": [
134
+ 174,
135
+ 85,
136
+ 823,
137
+ 159
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "Our second set of contributions concerns the sampling processes used to synthesize images using diffusion models. We identify the best-performing time discretization for sampling, apply a higherorder Runge–Kutta method for the sampling process, evaluate different sampler schedules, and analyze the usefulness of stochasticity in the sampling process. The result of these improvements is a significant drop in the number of sampling steps required during synthesis, and the improved sampler can be used as a drop-in replacement with several widely used diffusions models [36, 48]. ",
144
+ "bbox": [
145
+ 173,
146
+ 242,
147
+ 825,
148
+ 325
149
+ ],
150
+ "page_idx": 1
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "The third set of contributions focuses on the training of the score-modeling neural network. While we continue to rely on the commonly used network architectures (DDPM [16], NCSN [47]), we provide the first principled analysis of the preconditioning of the networks’ inputs, outputs, and loss functions in a diffusion model setting and derive best practices for improving the training dynamics. We also suggest an improved distribution of noise levels during training, and note that non-leaking augmentation [25] — typically used with GANs — is beneficial for diffusion models as well. ",
155
+ "bbox": [
156
+ 174,
157
+ 332,
158
+ 825,
159
+ 415
160
+ ],
161
+ "page_idx": 1
162
+ },
163
+ {
164
+ "type": "text",
165
+ "text": "Taken together, our contributions enable significant improvements in result quality, e.g., leading to record FIDs of 1.79 for CIFAR-10 [28] and 1.36 for ImageNet [8] in $6 4 \\times 6 4$ resolution. With all key ingredients of the design space explicitly tabulated, we believe that our approach will allow easier innovation on the individual components, and thus enable more extensive and targeted exploration of the design space of diffusion models. Our implementation and pre-trained models are available at https://github.com/NVlabs/edm ",
166
+ "bbox": [
167
+ 174,
168
+ 421,
169
+ 825,
170
+ 505
171
+ ],
172
+ "page_idx": 1
173
+ },
174
+ {
175
+ "type": "text",
176
+ "text": "2 Expressing diffusion models in a common framework ",
177
+ "text_level": 1,
178
+ "bbox": [
179
+ 174,
180
+ 522,
181
+ 650,
182
+ 540
183
+ ],
184
+ "page_idx": 1
185
+ },
186
+ {
187
+ "type": "text",
188
+ "text": "Let us denote the data distribution by $p _ { \\mathrm { d a t a } } ( \\pmb { x } )$ , with standard deviation $\\sigma _ { \\mathrm { d a t a } }$ , and consider the family of mollified distributions $p ( { \\pmb x } ; { \\boldsymbol \\sigma } )$ obtained by adding i.i.d. Gaussian noise of standard deviation $\\sigma$ to the data. For $\\sigma _ { \\mathrm { m a x } } \\gg \\sigma _ { \\mathrm { d a t a } }$ , $p ( \\pmb { x } ; \\sigma _ { \\mathrm { m a x } } )$ is practically indistinguishable from pure Gaussian noise. The idea of diffusion models is to randomly sample a noise image $\\mathbf { \\boldsymbol { x } } _ { 0 } \\sim \\mathcal { N } ( \\mathbf { \\boldsymbol { 0 } } , \\mathbf { \\dot { \\sigma } } _ { \\operatorname* { m a x } } ^ { 2 } \\mathbf { I } )$ , and sequentially denoise it into images $\\mathbf { \\Delta } _ { \\mathbf { \\mathcal { X } } _ { i } }$ with noise levels $\\sigma _ { 0 } = \\sigma _ { \\mathrm { m a x } } > \\sigma _ { 1 } > \\cdot \\cdot \\cdot > \\sigma _ { N } = 0$ so that at each noise level $\\pmb { x } _ { i } \\sim p ( \\pmb { x } _ { i } ; \\sigma _ { i } )$ . The endpoint $\\scriptstyle { \\mathbf { { \\mathit { x } } } } _ { N }$ of this process is thus distributed according to the data. ",
189
+ "bbox": [
190
+ 174,
191
+ 554,
192
+ 825,
193
+ 638
194
+ ],
195
+ "page_idx": 1
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "Song et al. [48] present a stochastic differential equation (SDE) that maintains the desired distribution $p$ as sample $_ { \\textbf { \\em x } }$ evolves over time. This allows the above process to be implemented using a stochastic solver that both removes and adds noise at each iteration. They also give a corresponding ��probability flow” ordinary differential equation (ODE) where the only source of randomness is the initial noise image $\\scriptstyle { \\mathbf { { \\mathit { x } } } } _ { 0 }$ . Contrary to the usual order of treatment, we begin by examining the ODE, as it offers a fruitful setting for analyzing sampling trajectories and their discretizations. The insights carry over to stochastic sampling, which we reintroduce as a generalization in Section 4. ",
200
+ "bbox": [
201
+ 174,
202
+ 645,
203
+ 825,
204
+ 742
205
+ ],
206
+ "page_idx": 1
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "ODE formulation. A probability flow ODE [48] continuously increases or reduces noise level of the image when moving forward or backward in time, respectively. To specify the ODE, we must first√ choose a schedule $\\sigma ( t )$ that defines the desired noise level at time $t$ . For example, setting $\\sigma ( t ) \\propto \\sqrt { t }$ is mathematically natural, as it corresponds to constant-speed heat diffusion [12]. However, we will show in Section 3 that the choice of schedule has major practical implications and should not be made on the basis of theoretical convenience. ",
211
+ "bbox": [
212
+ 174,
213
+ 755,
214
+ 825,
215
+ 838
216
+ ],
217
+ "page_idx": 1
218
+ },
219
+ {
220
+ "type": "text",
221
+ "text": "The defining characteristic of the probability flow ODE is that evolving a sample $\\pmb { x } _ { a } \\sim p \\big ( \\pmb { x } _ { a } ; \\sigma ( t _ { a } ) \\big )$ from time $t _ { a }$ to $t _ { b }$ (either forward or backward in time) yields a sample $\\mathbf { \\bar { x } } _ { b } \\sim p \\mathbf { \\bar { ( } } \\mathbf { x } _ { b } ; \\sigma ( t _ { b } ) \\mathbf { \\bar { ) } }$ . Following previous work [48], this requirement is satisfied (see Appendix B.1 and B.2) by ",
222
+ "bbox": [
223
+ 174,
224
+ 844,
225
+ 825,
226
+ 887
227
+ ],
228
+ "page_idx": 1
229
+ },
230
+ {
231
+ "type": "equation",
232
+ "img_path": "images/1ca9f8023afd31ee464b48f02c5df2a7fc77a887c5f474ae1885b3c9d6c8547f.jpg",
233
+ "text": "$$\n\\mathrm { d } \\mathbf { { \\boldsymbol { x } } } = - \\dot { \\sigma } ( t ) \\sigma ( t ) \\nabla _ { \\mathbf { { \\boldsymbol { x } } } } \\log p \\big ( \\mathbf { { \\boldsymbol { x } } } ; \\sigma ( t ) \\big ) \\ \\mathrm { d } t ,\n$$",
234
+ "text_format": "latex",
235
+ "bbox": [
236
+ 367,
237
+ 895,
238
+ 630,
239
+ 914
240
+ ],
241
+ "page_idx": 1
242
+ },
243
+ {
244
+ "type": "table",
245
+ "img_path": "images/2c6dc8d1256edaa68b5860619f563fb78a8e6af11027cf0e206ec0f83649441b.jpg",
246
+ "table_caption": [
247
+ "Table 1: Specific design choices employed by different model families. $N$ is the number of ODE solver iterations that we wish to execute during sampling. The corresponding sequence of time steps is $\\{ t _ { 0 } , t _ { 1 } , \\ldots , t _ { N } \\}$ , where $t _ { N } = 0$ . If the model was originally trained for specific choices of $N$ and $\\{ t _ { i } \\}$ , the originals are denoted by $M$ and $\\{ u _ { j } \\}$ , respectively. The denoiser is defined as $D _ { \\theta } ( { \\pmb x } ; \\sigma ) = c _ { \\mathrm { s k i p } } ( \\sigma ) { \\pmb x } + c _ { \\mathrm { o u t } } ( \\sigma ) F _ { \\theta } \\left( c _ { \\mathrm { i n } } ( \\sigma ) { \\pmb x } ; c _ { \\mathrm { n o i s e } } ( \\sigma ) \\right) ;$ ; $F _ { \\theta }$ represents the raw neural network layers. "
248
+ ],
249
+ "table_footnote": [
250
+ "∗ iDDPM also employs a second loss term $L _ { \\mathrm { v l b } }$ † In our tests, $\\overline { { j _ { 0 } = 8 } }$ yielded better FID than $\\overline { { j _ { 0 } = 0 } }$ used by iDDPM "
251
+ ],
252
+ "table_body": "<table><tr><td></td><td></td><td>VP [48]</td><td>VE [48]</td><td>iDDPM[36]+DDIM[46]Ours(&quot;EDM&quot;)</td><td></td></tr><tr><td colspan=\"6\">Sampling (Section 3)</td></tr><tr><td>ODE solver Time steps</td><td></td><td>Euler ti&lt;N 1+ N-1(∈s-1)</td><td>Euler max( </td><td>Euler uLjo+</td><td>2nd order Heun (omax+</td></tr><tr><td></td><td></td><td></td><td></td><td>N-1 uM=0 u+1 uj-1=√</td><td></td></tr><tr><td>Schedule Scaling</td><td></td><td>σ(t)√eβat²+βmint_1 s(t)1/eβdt²+βmint</td><td>Vt 1</td><td>t</td><td>t 1</td></tr><tr><td>Network and preconditioning (Section 5)</td><td></td><td></td><td></td><td>1</td><td></td></tr><tr><td colspan=\"6\">Architecture of Fe</td></tr><tr><td></td><td></td><td>DDPM++</td><td>NCSN++</td><td>DDPM</td><td>(any)</td></tr><tr><td>Skip scaling Cskip(σ)</td><td></td><td>1</td><td>1</td><td>1</td><td>a/(0²+a)</td></tr><tr><td>Output scaling Cout (σ)</td><td></td><td>1σ</td><td>0</td><td>10</td><td> data/a+²</td></tr><tr><td>Input scalingCin(σ)</td><td></td><td>1/²+1</td><td>1</td><td>1/√g²+1</td><td>1/²+0ata</td></tr><tr><td>Noise cond. Cnoise(σ)</td><td></td><td>(M-1) σ-1(σ)</td><td>ln()</td><td>M-1-arg minj luj - σl</td><td>1 n(0)</td></tr><tr><td colspan=\"6\">Training (Section 5)</td></tr><tr><td>Noise distribution</td><td></td><td>σ-1(σ)~U(∈,1)</td><td>ln(σ)~u(ln(σmin), ln(σmax))</td><td>σ=uj,j~U{0,M-1}</td><td>In(σ)~ N(Pmean, P²d)</td></tr><tr><td>Loss weighting λ(σ)</td><td></td><td>1/g2</td><td>1/g2</td><td>1/g²(note: *)</td><td>(σ²+σ²ata)/(σ·Odata)²</td></tr><tr><td>Parameters</td><td></td><td>βd = 19.9,βmin =0.1 ∈s =10-³, = 10-5</td><td>Omin =0.02 Omax =100</td><td>aj = sin²((+) C1=0.001,C=0.008</td><td>Omin = 0.002,gmax =80 Odata=0.5,p=7</td></tr></table>",
253
+ "bbox": [
254
+ 171,
255
+ 170,
256
+ 826,
257
+ 458
258
+ ],
259
+ "page_idx": 2
260
+ },
261
+ {
262
+ "type": "text",
263
+ "text": "where the dot denotes a time derivative. $\\nabla _ { \\pmb { x } } \\log p ( \\pmb { x } ; \\sigma )$ is the score function [22], a vector field that points towards higher density of data at a given noise level. Intuitively, an infinitesimal forward step of this ODE nudges the sample away from the data, at a rate that depends on the change in noise level. Equivalently, a backward step nudges the sample towards the data distribution. ",
264
+ "bbox": [
265
+ 173,
266
+ 496,
267
+ 825,
268
+ 551
269
+ ],
270
+ "page_idx": 2
271
+ },
272
+ {
273
+ "type": "text",
274
+ "text": "Denoising score matching. The score function has the remarkable property that it does not depend on the generally intractable normalization constant of the underlying density function $p ( { \\pmb x } ; { \\boldsymbol \\sigma } )$ [22], and thus can be much easier to evaluate. Specifically, if $D ( \\pmb { x } ; \\sigma )$ is a denoiser function that minimizes the expected $L _ { 2 }$ denoising error for samples drawn from $p _ { \\mathrm { d a t a } }$ separately for every $\\sigma$ , i.e., ",
275
+ "bbox": [
276
+ 174,
277
+ 561,
278
+ 825,
279
+ 618
280
+ ],
281
+ "page_idx": 2
282
+ },
283
+ {
284
+ "type": "equation",
285
+ "img_path": "images/6f0164e152b026907e6a7a1ce628a8f4c1fb8a2e6d7ac9b4ef82a298b38ca98b.jpg",
286
+ "text": "$$\n\\begin{array} { r } { \\mathbb { E } _ { { y } \\sim p _ { \\mathrm { d a l } } } \\mathbb { E } _ { { n } \\sim \\mathcal { N } ( \\mathbf { 0 } , \\sigma ^ { 2 } \\mathbf { I } ) } \\| D ( { y } + { n } ; \\sigma ) - y \\| _ { 2 } ^ { 2 } , \\mathrm { ~ t h e n ~ } \\nabla _ { x } \\log p ( { x } ; \\sigma ) = \\big ( D ( x ; \\sigma ) - x \\big ) / \\sigma ^ { 2 } , } \\end{array}\n$$",
287
+ "text_format": "latex",
288
+ "bbox": [
289
+ 189,
290
+ 623,
291
+ 769,
292
+ 643
293
+ ],
294
+ "page_idx": 2
295
+ },
296
+ {
297
+ "type": "text",
298
+ "text": "where $\\textbf { { y } }$ is a training image and $\\textbf { \\em n }$ is noise. In this light, the score function isolates the noise component from the signal in $_ { \\textbf { \\em x } }$ , and Eq. 1 amplifies (or diminishes) it over time. Figure 1 illustrates the behavior of ideal $D$ in practice. The key observation in diffusion models is that $D ( \\pmb { x } ; \\sigma )$ can be implemented as a neural network $D _ { \\theta } ( \\pmb { x } ; \\sigma )$ trained according to Eq. 2. Note that $D _ { \\theta }$ may include additional pre- and post-processing steps, such as scaling $_ { \\textbf { \\em x } }$ to an appropriate dynamic range; we will return to such preconditioning in Section 5. ",
299
+ "bbox": [
300
+ 173,
301
+ 647,
302
+ 825,
303
+ 731
304
+ ],
305
+ "page_idx": 2
306
+ },
307
+ {
308
+ "type": "text",
309
+ "text": "Time-dependent signal scaling. Some methods (see Appendix C.1) introduce an additional scale schedule $s ( t )$ and consider ${ \\pmb x } = s ( t ) \\hat { \\pmb x }$ to be a scaled version of the original, non-scaled variable $\\hat { \\pmb x }$ . This changes the time-dependent probability density, and consequently also the ODE solution trajectories. The resulting ODE is a generalization of Eq. 1: ",
310
+ "bbox": [
311
+ 173,
312
+ 742,
313
+ 825,
314
+ 799
315
+ ],
316
+ "page_idx": 2
317
+ },
318
+ {
319
+ "type": "equation",
320
+ "img_path": "images/c586523a503b192986780b8163acd43c9215ff9e615d0553797e679dd181a16d.jpg",
321
+ "text": "$$\n\\mathrm { d } \\mathbf { \\boldsymbol { x } } = \\left[ \\frac { \\dot { s } ( t ) } { s ( t ) } \\ \\mathbf { \\boldsymbol { x } } - s ( t ) ^ { 2 } \\ \\dot { \\sigma } ( t ) \\ \\sigma ( t ) \\ \\nabla _ { \\mathbf { \\boldsymbol { x } } } \\log p \\left( \\frac { \\mathbf { \\boldsymbol { x } } } { s ( t ) } ; \\sigma ( t ) \\right) \\right] \\ \\mathrm { d } t .\n$$",
322
+ "text_format": "latex",
323
+ "bbox": [
324
+ 297,
325
+ 803,
326
+ 700,
327
+ 838
328
+ ],
329
+ "page_idx": 2
330
+ },
331
+ {
332
+ "type": "text",
333
+ "text": "Note that we explicitly undo the scaling of $_ { \\textbf { \\em x } }$ when evaluating the score function to keep the definition of $p ( { \\pmb x } ; { \\boldsymbol \\sigma } )$ independent of $s ( t )$ . ",
334
+ "bbox": [
335
+ 173,
336
+ 843,
337
+ 823,
338
+ 873
339
+ ],
340
+ "page_idx": 2
341
+ },
342
+ {
343
+ "type": "text",
344
+ "text": "Solution by discretization. The ODE to be solved is obtained by substituting Eq. 3 into Eq. 4 to define the point-wise gradient, and the solution can be found by numerical integration, i.e., taking finite steps over discrete time intervals. This requires choosing both the integration scheme (e.g., Euler or a variant of Runge–Kutta), as well as the discrete sampling times $\\{ t _ { 0 } , t _ { 1 } , \\ldots , t _ { N } \\}$ . Many prior works rely on Euler’s method, but we show in Section 3 that a $2 ^ { \\mathrm { n d } }$ order solver offers a better computational tradeoff. For brevity, we do not provide a separate pseudocode for Euler’s method applied to our ODE here, but it can be extracted from Algorithm 1 by omitting lines 6–8. ",
345
+ "bbox": [
346
+ 174,
347
+ 882,
348
+ 821,
349
+ 911
350
+ ],
351
+ "page_idx": 2
352
+ },
353
+ {
354
+ "type": "image",
355
+ "img_path": "images/f4d770791a43cc95cc8a7b5b6a3605bfacf51afa1f5eb2e679fe355189eba6bb.jpg",
356
+ "image_caption": [
357
+ "Figure 2: Comparison of deterministic sampling methods using three pre-trained models. For each curve, the dot indicates the lowest NFE whose FID is within $3 \\%$ of the lowest observed FID. "
358
+ ],
359
+ "image_footnote": [],
360
+ "bbox": [
361
+ 174,
362
+ 89,
363
+ 821,
364
+ 200
365
+ ],
366
+ "page_idx": 3
367
+ },
368
+ {
369
+ "type": "text",
370
+ "text": "",
371
+ "bbox": [
372
+ 174,
373
+ 248,
374
+ 825,
375
+ 318
376
+ ],
377
+ "page_idx": 3
378
+ },
379
+ {
380
+ "type": "text",
381
+ "text": "Putting it together. Table 1 presents formulas for reproducing deterministic variants of three earlier methods in our framework. These methods were chosen because they are widely used and achieve state-of-the-art performance, but also because they were derived from different theoretical foundations. Some of our formulas appear quite different from the original papers as indirection and recursion have been removed; see Appendix C for details. The main purpose of this reframing is to bring into light all the independent components that often appear tangled together in previous work. In our framework, there are no implicit dependencies between the components — any choices (within reason) for the individual formulas will, in principle, lead to a functioning model. In other words, changing one component does not necessitate changes elsewhere in order to, e.g., maintain the property that the model converges to the data in the limit. In practice, some choices and combinations will of course work better than others. ",
382
+ "bbox": [
383
+ 173,
384
+ 329,
385
+ 825,
386
+ 481
387
+ ],
388
+ "page_idx": 3
389
+ },
390
+ {
391
+ "type": "text",
392
+ "text": "3 Improvements to deterministic sampling ",
393
+ "text_level": 1,
394
+ "bbox": [
395
+ 174,
396
+ 496,
397
+ 544,
398
+ 513
399
+ ],
400
+ "page_idx": 3
401
+ },
402
+ {
403
+ "type": "text",
404
+ "text": "Improving the output quality and/or decreasing the computational cost of sampling are common topics in diffusion model research (e.g., [10, 24, 30, 31, 32, 36, 43, 50, 52, 53, 56]). Our hypothesis is that the choices related to the sampling process are largely independent of the other components, such as network architecture and training details. In other words, the training procedure of $D _ { \\theta }$ should not dictate $\\sigma ( t ) , s ( t )$ , and $\\{ t _ { i } \\}$ , nor vice versa; from the viewpoint of the sampler, $D _ { \\theta }$ is simply a black box [52, 53]. We test this by evaluating different samplers on three pre-trained models, each representing a different theoretical framework and model family. We first measure baseline results for these models using their original sampler implementations, and then bring these samplers into our unified framework using the formulas in Table 1, followed by our improvements. This allows us to evaluate different practical choices and propose general improvements to the sampling process that are applicable to all models. ",
405
+ "bbox": [
406
+ 174,
407
+ 525,
408
+ 825,
409
+ 678
410
+ ],
411
+ "page_idx": 3
412
+ },
413
+ {
414
+ "type": "text",
415
+ "text": "We evaluate the $\\mathrm { \\cdot D D P M { + } } +$ cont. (VP)” and $\\mathrm { \\Delta ^ { 6 } N C S N { + } }$ cont. (VE)” models by Song et al. [48] trained on unconditional CIFAR-10 [28] at $3 2 \\times 3 2$ , corresponding to the variance preserving (VP) and variance exploding (VE) formulations [48], originally inspired by DDPM [16] and SMLD [47]. We also evaluate the “ADM (dropout)” model by Dhariwal and Nichol [9] trained on class-conditional ImageNet [8] at $6 4 \\times 6 4$ , corresponding to the improved DDPM (iDDPM) formulation [36]. This model was trained using a discrete set of $M = 1 0 0 0$ noise levels. Further details are given in Appendix C. ",
416
+ "bbox": [
417
+ 174,
418
+ 684,
419
+ 825,
420
+ 767
421
+ ],
422
+ "page_idx": 3
423
+ },
424
+ {
425
+ "type": "text",
426
+ "text": "We evaluate the result quality in terms of Fréchet inception distance (FID) [15] computed between 50,000 generated images and all available real images. Figure 2 shows FID as a function of neural function evaluations (NFE), i.e., how many times $D _ { \\theta }$ is evaluated to produce a single image. Given that the sampling process is dominated entirely by the cost of $D _ { \\theta }$ , improvements in NFE translate directly to sampling speed. The original deterministic samplers are shown in blue, and the reimplementations of these methods in our unified framework (orange) yield similar but consistently better results. The differences are explained by certain oversights in the original implementations as well as our more careful treatment of discrete noise levels in the case of DDIM; see Appendix C. Note that our reimplementations are fully specified by Algorithm 1 and Table 1, even though the original codebases are structured very differently from each other. ",
427
+ "bbox": [
428
+ 174,
429
+ 773,
430
+ 825,
431
+ 912
432
+ ],
433
+ "page_idx": 3
434
+ },
435
+ {
436
+ "type": "table",
437
+ "img_path": "images/a0d6f73e8d41aac21b325ff10d482a8f423cb86c2933b2b5032e834e9a9b82b0.jpg",
438
+ "table_caption": [],
439
+ "table_footnote": [],
440
+ "table_body": "<table><tr><td colspan=\"2\">1: procedure HEUNSAMPLER(Dθ(x;σ),σ(t),s(t), ti∈{0.,...N})</td></tr><tr><td>2: sample xo ~ N(0,σ²(to) s²(to) 1) 3:</td><td>Generate initial sample at to</td></tr><tr><td>fori∈{0,...,N-1}do</td><td> Solve Eq.4 over N time steps</td></tr><tr><td>(ti) s(ti) di← xi- (ti)</td><td>Ci ;(ti)) Evaluate dx/dt at ti</td></tr><tr><td>4:</td><td>D0 s(ti) (ti) s(ti)</td></tr><tr><td>5: 6:</td><td>xi+1←xi+(ti+1-ti)di Take Euler step from ti to ti+1 ifσ(ti+1)≠O then Apply 2nd order correction unless goes to zero</td></tr><tr><td>7:</td><td>(ti+1)s((t+1)D d← ((ti+1) s(ti+1) xi+1</td></tr><tr><td>8:</td><td>xi+1 ;(ti+1) ((ti+1) s(ti+1)) g(ti+1) (s(ti+1) xi+1←xi+(ti+1-ti)(di+¹di) Explicit trapezoidal rule at t+1</td></tr></table>",
441
+ "bbox": [
442
+ 176,
443
+ 111,
444
+ 825,
445
+ 277
446
+ ],
447
+ "page_idx": 4
448
+ },
449
+ {
450
+ "type": "text",
451
+ "text": "Discretization and higher-order integrators. Solving an ODE numerically is necessarily an approximation of following the true solution trajectory. At each step, the solver introduces truncation error that accumulates over the course of $N$ steps. The local error generally scales superlinearly with respect to step size, and thus increasing $N$ improves the accuracy of the solution. ",
452
+ "bbox": [
453
+ 173,
454
+ 301,
455
+ 825,
456
+ 358
457
+ ],
458
+ "page_idx": 4
459
+ },
460
+ {
461
+ "type": "text",
462
+ "text": "The commonly used Euler’s method is a first order ODE solver with $\\mathcal { O } ( h ^ { 2 } )$ local error with respect to step size $h$ . Higher-order Runge–Kutta methods [49] scale more favorably but require multiple evaluations of $D _ { \\theta }$ per step. Linear multistep methods have also been recently proposed for sampling diffusion models [30, 56]. Through extensive tests, we have found Heun’s $2 ^ { \\mathrm { n d } }$ order method [2] (a.k.a. improved Euler, trapezoidal rule) — previously explored in the context of diffusion models by Jolicoeur-Martineau et al. [24] — to provide an excellent tradeoff between truncation error and NFE. As illustrated in Algorithm 1, it introduces an additional correction step for $\\boldsymbol { x } _ { i + 1 }$ to account for change in $\\mathrm { d } \\pmb { x } / \\mathrm { d } t$ between $t _ { i }$ and $t _ { i + 1 }$ . This correction leads to $\\mathcal { O } ( h ^ { 3 } )$ local error at the cost of one additional evaluation of $D _ { \\theta }$ per step. Note that stepping to $\\sigma = 0$ would result in a division by zero, so we revert to Euler’s method in this case. We discuss the general family of $2 ^ { \\mathrm { n d } }$ order solvers in Appendix D.2. ",
463
+ "bbox": [
464
+ 173,
465
+ 363,
466
+ 825,
467
+ 502
468
+ ],
469
+ "page_idx": 4
470
+ },
471
+ {
472
+ "type": "text",
473
+ "text": "The time steps $\\{ t _ { i } \\}$ determine how the step sizes and thus truncation errors are distributed between different noise levels. We provide a detailed analysis in Appendix D.1, concluding that the step size should decrease monotonically with decreasing $\\sigma$ and it does not need to vary on a per-sample basis. We adopt a parameterized scheme where the time steps are defined according to a sequence of noise levels $\\{ \\sigma _ { i } \\}$ , i.e., $t _ { i } = \\sigma ^ { - 1 } ( \\sigma _ { i } )$ . We set $\\sigma _ { i < N } = ( A i + B ) ^ { \\rho }$ and select the constants $A$ and $B$ so that $\\sigma _ { 0 } = \\sigma _ { \\operatorname* { m a x } }$ and $\\sigma _ { N - 1 } = \\sigma _ { \\mathrm { m i n } }$ , which gives ",
474
+ "bbox": [
475
+ 174,
476
+ 507,
477
+ 825,
478
+ 592
479
+ ],
480
+ "page_idx": 4
481
+ },
482
+ {
483
+ "type": "equation",
484
+ "img_path": "images/6a9525d6a7353e7e5d10ae21c2cc339258718310ea239fa382c8d326af58410a.jpg",
485
+ "text": "$$\n\\begin{array} { r } { \\sigma _ { i < N } = \\left( \\sigma _ { \\operatorname* { m a x } } { } ^ { \\frac { 1 } { \\rho } } + \\frac { i } { N - 1 } \\big ( \\sigma _ { \\operatorname* { m i n } } { } ^ { \\frac { 1 } { \\rho } } - \\sigma _ { \\operatorname* { m a x } } { } ^ { \\frac { 1 } { \\rho } } \\big ) \\right) ^ { \\rho } \\mathrm { a n d } \\sigma _ { N } = 0 . } \\end{array}\n$$",
486
+ "text_format": "latex",
487
+ "bbox": [
488
+ 300,
489
+ 595,
490
+ 697,
491
+ 618
492
+ ],
493
+ "page_idx": 4
494
+ },
495
+ {
496
+ "type": "text",
497
+ "text": "Here $\\rho$ controls how much the steps near $\\sigma _ { \\mathrm { m i n } }$ are shortened at the expense of longer steps near $\\sigma _ { \\mathrm { m a x } }$ Our analysis in Appendix D.1 shows that setting $\\rho = 3$ nearly equalizes the truncation error at each step, but that $\\rho$ in range of 5 to 10 performs much better for sampling images. This suggests that errors near $\\sigma _ { \\mathrm { m i n } }$ have a large impact. We set $\\rho = 7$ for the remainder of this paper. ",
498
+ "bbox": [
499
+ 174,
500
+ 622,
501
+ 825,
502
+ 679
503
+ ],
504
+ "page_idx": 4
505
+ },
506
+ {
507
+ "type": "text",
508
+ "text": "Results for Heun’s method and Eq. 5 are shown as the green curves in Figure 2. We observe consistent improvement in all cases: Heun’s method reaches the same FID as Euler’s method with considerably lower NFE. ",
509
+ "bbox": [
510
+ 173,
511
+ 684,
512
+ 825,
513
+ 726
514
+ ],
515
+ "page_idx": 4
516
+ },
517
+ {
518
+ "type": "text",
519
+ "text": "Trajectory curvature and noise schedule. The shape of the ODE solution trajectories is defined by functions $\\sigma ( t )$ and $s ( t )$ . The choice of these functions offers a way to reduce the truncation errors discussed above, as their magnitude can be expected to scale proportional to the curvature of $\\mathrm { d } \\pmb { x } / \\mathrm { d } t$ . We argue that the best choice for these functions is $\\sigma ( t ) = t$ and $s ( t ) = 1$ , which is also the choice made in DDIM [46]. With this choice, the ODE of Eq. 4 simplifies to $\\mathrm { d } \\pmb { x } / \\mathrm { d } t = \\big ( \\pmb { x } - D ( \\pmb { x } ; t ) \\big ) / t$ and $\\sigma$ and $t$ become interchangeable. ",
520
+ "bbox": [
521
+ 173,
522
+ 736,
523
+ 825,
524
+ 821
525
+ ],
526
+ "page_idx": 4
527
+ },
528
+ {
529
+ "type": "text",
530
+ "text": "An immediate consequence is that at any $_ { \\textbf { \\em x } }$ and $t$ , a single Euler step to $t = 0$ yields the denoised image $D _ { \\theta } ( \\pmb { x } ; t )$ . The tangent of the solution trajectory therefore always points towards the denoiser output. This can be expected to change only slowly with the noise level, which corresponds to largely linear solution trajectories. The 1D ODE sketch of Figure 3c supports this intuition; the solution trajectories approach linear at both large and small noise levels, and have substantial curvature in only a small region in between. The same effect can be seen with real data in Figure 1b, where the change between different denoiser targets occurs in a relatively narrow $\\sigma$ range. With the advocated schedule, this corresponds to high ODE curvature being limited to this same range. ",
531
+ "bbox": [
532
+ 174,
533
+ 827,
534
+ 825,
535
+ 911
536
+ ],
537
+ "page_idx": 4
538
+ },
539
+ {
540
+ "type": "image",
541
+ "img_path": "images/0627ae2ad62a9c47b9791ffc6b61152f97a61efcc07426c88c28319722a16c98.jpg",
542
+ "image_caption": [
543
+ "Figure 3: A sketch of ODE curvature in 1D where $p _ { \\mathrm { d a t a } }$ is two Dirac peaks at ${ \\pmb x } = \\pm 1$ . Horizontal $t$ axis is chosen to show $\\sigma \\in [ 0 , 2 5 ]$ in each plot, with insets showing $\\sigma \\in [ 0 , 1 ]$ near the data. Example local gradients are shown with black arrows. (a) Variance preserving ODE of Song et al. [48] has solution trajectories that flatten out to horizontal lines at large $\\sigma$ . Local gradients start pointing towards data only at small $\\sigma$ . (b) Variance exploding variant has extreme curvature near data and the solution trajectories are curved everywhere. (c) With the schedule used by DDIM [46] and us, as $\\sigma$ increases the solution trajectories approach straight lines that point towards the mean of data. As $\\sigma \\to 0$ , the trajectories become linear and point towards the data manifold. "
544
+ ],
545
+ "image_footnote": [],
546
+ "bbox": [
547
+ 179,
548
+ 90,
549
+ 820,
550
+ 215
551
+ ],
552
+ "page_idx": 5
553
+ },
554
+ {
555
+ "type": "text",
556
+ "text": "",
557
+ "bbox": [
558
+ 174,
559
+ 361,
560
+ 823,
561
+ 390
562
+ ],
563
+ "page_idx": 5
564
+ },
565
+ {
566
+ "type": "text",
567
+ "text": "The effect of setting $\\sigma ( t ) = t$ and $s ( t ) = 1$ is shown as the red curves in Figure 2. As DDIM already employs these same choices, the red curve is identical to the green one for ImageNet-64. However, VP and VE benefit considerably from switching away from their original schedules. ",
568
+ "bbox": [
569
+ 174,
570
+ 395,
571
+ 826,
572
+ 438
573
+ ],
574
+ "page_idx": 5
575
+ },
576
+ {
577
+ "type": "text",
578
+ "text": "Discussion. The choices that we made in this section to improve deterministic sampling are summarized in the Sampling part of Table 1. Together, they reduce the NFE needed to reach highquality results by a large factor: $7 . 3 \\times$ for VP, $3 0 0 \\times$ for VE, and $3 . 2 \\times$ for DDIM, corresponding to the highlighted NFE values in Figure 2. In practice, we can generate 26.3 high-quality CIFAR-10 images per second on a single NVIDIA V100. The consistency of improvements corroborates our hypothesis that the sampling process is orthogonal to how each model was originally trained. As further validation, we show results for the adaptive RK45 method [11] using our schedule as the dashed black curves in Figure 2; the cost of this sophisticated ODE solver outweighs its benefits. ",
579
+ "bbox": [
580
+ 173,
581
+ 449,
582
+ 826,
583
+ 560
584
+ ],
585
+ "page_idx": 5
586
+ },
587
+ {
588
+ "type": "text",
589
+ "text": "4 Stochastic sampling ",
590
+ "text_level": 1,
591
+ "bbox": [
592
+ 176,
593
+ 580,
594
+ 370,
595
+ 597
596
+ ],
597
+ "page_idx": 5
598
+ },
599
+ {
600
+ "type": "text",
601
+ "text": "Deterministic sampling offers many benefits, e.g., the ability to turn real images into their corresponding latent representations by inverting the ODE. However, it tends to lead to worse output quality [46, 48] than stochastic sampling that injects fresh noise into the image in each step. Given that ODEs and SDEs recover the same distributions in theory, what exactly is the role of stochasticity? ",
602
+ "bbox": [
603
+ 174,
604
+ 611,
605
+ 825,
606
+ 667
607
+ ],
608
+ "page_idx": 5
609
+ },
610
+ {
611
+ "type": "text",
612
+ "text": "Background. The SDEs of Song et al. [48] can be generalized [20, 55] as a sum of the probability flow ODE of Eq. 1 and a time-varying Langevin diffusion SDE [14] (see Appendix B.5): ",
613
+ "bbox": [
614
+ 171,
615
+ 678,
616
+ 823,
617
+ 708
618
+ ],
619
+ "page_idx": 5
620
+ },
621
+ {
622
+ "type": "equation",
623
+ "img_path": "images/31e6ef50d8ab353c9f5adf75783d4036ebf70d28ea919642633a1bc3c8dea539.jpg",
624
+ "text": "$$\n\\begin{array} { r } { \\mathrm { d } \\pmb { x } _ { \\pm } = - \\dot { \\sigma } ( t ) \\sigma ( t ) \\nabla _ { \\pmb { x } } \\log p \\big ( \\pmb { x } ; \\sigma ( t ) \\big ) \\mathrm { d } t \\pm \\beta ( t ) \\sigma ( t ) ^ { 2 } \\nabla _ { \\pmb { x } } \\log p \\big ( \\pmb { x } ; \\sigma ( t ) \\big ) \\mathrm { d } t + \\sqrt { 2 \\beta ( t ) } \\sigma ( t ) \\mathrm { d } \\omega _ { t , 0 } , } \\end{array}\n$$",
625
+ "text_format": "latex",
626
+ "bbox": [
627
+ 183,
628
+ 714,
629
+ 795,
630
+ 734
631
+ ],
632
+ "page_idx": 5
633
+ },
634
+ {
635
+ "type": "text",
636
+ "text": "where $\\omega _ { t }$ is the standard Wiener process. $\\mathrm { d } \\pmb { x } _ { + }$ and $\\mathrm { d } \\mathbf { x _ { - } }$ are now separate SDEs for moving forward and backward in time, related by the time reversal formula of Anderson [1]. The Langevin term can further be seen as a combination of a deterministic score-based denoising term and a stochastic noise injection term, whose net noise level contributions cancel out. As such, $\\beta ( t )$ effectively expresses the relative rate at which existing noise is replaced with new noise. The SDEs of Song et al. [48] are recovered with the choice $\\beta ( \\bar { t } ) = \\dot { \\sigma } ( t ) / \\sigma \\bar { ( } t )$ , whereby the score vanishes from the forward SDE. ",
637
+ "bbox": [
638
+ 174,
639
+ 779,
640
+ 825,
641
+ 864
642
+ ],
643
+ "page_idx": 5
644
+ },
645
+ {
646
+ "type": "text",
647
+ "text": "This perspective reveals why stochasticity is helpful in practice: The implicit Langevin diffusion drives the sample towards the desired marginal distribution at a given time, actively correcting for any errors made in earlier sampling steps. On the other hand, approximating the Langevin term with discrete SDE solver steps introduces error in itself. Previous results [3, 24, 46, 48] suggest that non-zero $\\beta ( t )$ is helpful, but as far as we can tell, the implicit choice for $\\beta ( t )$ in Song et al. [48] enjoys no special properties. Hence, the optimal amount of stochasticity should be determined empirically. ",
648
+ "bbox": [
649
+ 174,
650
+ 869,
651
+ 825,
652
+ 911
653
+ ],
654
+ "page_idx": 5
655
+ },
656
+ {
657
+ "type": "table",
658
+ "img_path": "images/3d9ac99a63b63c1b7d7fafa93865132945283d6db0c81dd7a34862c17cbada38.jpg",
659
+ "table_caption": [
660
+ "Algorithm 2 Our stochastic sampler with $\\sigma ( t ) = t$ and $s ( t ) = 1$ "
661
+ ],
662
+ "table_footnote": [],
663
+ "table_body": "<table><tr><td colspan=\"2\">1: procedure STOCHASTICSAMPLER(Dθ(x;σ), ti∈{0,..,N}, Yiε{0..,N-1}), Snoise)</td></tr><tr><td>2: sample xo ~ N(O, t² I) 3: fori∈{0,...,N-1} d</td><td>{min(Sm,-1)ift∈Sin]</td></tr><tr><td>4:</td><td>Yi = 0 otherwise</td></tr><tr><td>sample ∈i ~ N(O, S²oise I) 5:</td><td>&gt;Select temporarily increased noise level ti</td></tr><tr><td>t←t+Yiti xi←xi+√t-tei</td><td>Add new noise to move from ti to ti</td></tr><tr><td>6:</td><td></td></tr><tr><td>7: di←(xi-Dθ(xi;ti))/ti</td><td>Evaluate dx/dt at ti</td></tr><tr><td>8: xi+1←xi+(ti+1-ti)di</td><td>Take Euler step from ti to ti+1</td></tr><tr><td>9: if ti+1≠Othen 10:</td><td></td></tr><tr><td>d&#x27;←(xi+1-Dθ(xi+1;ti+1))/ti+1 11: xi+1←xi+(ti+1-ti)(di+di)</td><td>&gt; Apply 2nd order correction</td></tr></table>",
664
+ "bbox": [
665
+ 176,
666
+ 107,
667
+ 825,
668
+ 281
669
+ ],
670
+ "page_idx": 6
671
+ },
672
+ {
673
+ "type": "text",
674
+ "text": "",
675
+ "bbox": [
676
+ 174,
677
+ 309,
678
+ 825,
679
+ 351
680
+ ],
681
+ "page_idx": 6
682
+ },
683
+ {
684
+ "type": "text",
685
+ "text": "Our stochastic sampler. We propose a stochastic sampler that combines our $2 ^ { \\mathrm { n d } }$ order deterministic ODE integrator with explicit Langevin-like “churn” of adding and removing noise. A pseudocode is given in Algorithm 2. At each step $i$ , given the sample $\\mathbf { \\Delta } _ { \\mathbf { \\mathcal { X } } _ { i } }$ at noise level $t _ { i }$ $\\mathbf { \\eta } ( = \\sigma ( t _ { i } ) )$ , we perform two sub-steps. First, we add noise to the sample according to a factor $\\gamma _ { i } \\geq 0$ to reach a higher noise level $\\hat { t } _ { i } = t _ { i } \\dot { + } \\gamma _ { i } t _ { i }$ . Second, from the increased-noise sample $\\hat { \\mathbf { x } } _ { i }$ , we solve the ODE backward from $\\hat { t } _ { i }$ to $t _ { i + 1 }$ with a single step. This yields a sample $\\pmb { x } _ { i + 1 }$ with noise level $t _ { i + 1 }$ , and the iteration continues. We stress that this is not a general-purpose SDE solver, but a sampling procedure tailored for the specific problem. Its correctness stems from the alternation of two sub-steps that each maintain the correct distribution (up to truncation error in the ODE step). The predictor-corrector sampler of Song et al. [48] has a conceptually similar structure to ours. ",
686
+ "bbox": [
687
+ 173,
688
+ 362,
689
+ 825,
690
+ 501
691
+ ],
692
+ "page_idx": 6
693
+ },
694
+ {
695
+ "type": "text",
696
+ "text": "To analyze the main difference between our method and Euler–Maruyama, we first note a subtle discrepancy in the latter when discretizing Eq. 6. One can interpret Euler–Maruyama as first adding noise and then performing an ODE step, not from the intermediate state after noise injection, but assuming that $_ { \\textbf { \\em x } }$ and $\\sigma$ remained at the initial state at the beginning of the iteration step. In our method, the parameters used to evaluate $D _ { \\theta }$ on line 7 of Algorithm 2 correspond to the state after noise injection, whereas an Euler–Maruyama -like method would use ${ \\pmb x } _ { i } ; t _ { i }$ instead of $\\hat { \\pmb { x } } _ { i } ; \\hat { t } _ { i }$ . In the limit of $\\Delta _ { t }$ approaching zero there may be no difference between these choices, but the distinction appears to become significant when pursuing low NFE with large steps. ",
697
+ "bbox": [
698
+ 174,
699
+ 507,
700
+ 825,
701
+ 618
702
+ ],
703
+ "page_idx": 6
704
+ },
705
+ {
706
+ "type": "text",
707
+ "text": "Practical considerations. Increasing the amount of stochasticity is effective in correcting errors made by earlier sampling steps, but it has its own drawbacks. We have observed (see Appendix E.1) that excessive Langevin-like addition and removal of noise results in gradual loss of detail in the generated images with all datasets and denoiser networks. There is also a drift toward oversaturated colors at very low and high noise levels. We suspect that practical denoisers induce a slightly nonconservative vector field in Eq. 3, violating the premises of Langevin diffusion and causing these detrimental effects. Notably, our experiments with analytical denoisers (such as the one in Figure 1b) have not shown such degradation. ",
708
+ "bbox": [
709
+ 174,
710
+ 630,
711
+ 825,
712
+ 741
713
+ ],
714
+ "page_idx": 6
715
+ },
716
+ {
717
+ "type": "text",
718
+ "text": "If the degradation is caused by flaws in $D _ { \\theta } ( \\pmb { x } ; \\sigma )$ , they can only be remedied using heuristic means during sampling. We address the drift toward oversaturated colors by only enabling stochasticity within a specific range of noise levels $t _ { i } \\in [ S _ { \\operatorname { t m i n } } , S _ { \\operatorname { t m a x } } ]$ . For these noise levels, we define $\\gamma _ { i } =$ $S _ { \\mathrm { c h u r n } } / N$ , where $S _ { \\mathrm { c h u r n } }$ controls the overall amount of stochasticity. We further clamp $\\gamma _ { i }$ to never introduce more new noise than what is already present in the image. Finally, we have found that the loss of detail can be partially counteracted by setting $S _ { \\mathrm { n o i s e } }$ slightly above 1 to inflate the standard deviation for the newly added noise. This suggests that a major component of the hypothesized non-conservativity of $D _ { \\theta } ( { \\pmb x } ; { \\boldsymbol \\sigma } )$ is a tendency to remove slightly too much noise — most likely due to regression toward the mean that can be expected to happen with any $L _ { 2 }$ -trained denoiser [29]. ",
719
+ "bbox": [
720
+ 174,
721
+ 746,
722
+ 825,
723
+ 872
724
+ ],
725
+ "page_idx": 6
726
+ },
727
+ {
728
+ "type": "text",
729
+ "text": "Evaluation. Figure 4 shows that our stochastic sampler outperforms previous samplers [24, 36, 48] by a significant margin, especially at low step counts. Jolicoeur-Martineau et al. [24] use a standard higher-order adaptive SDE solver [40] and its performance is a good baseline for such solvers in general. Our sampler has been tailored to the use case by, e.g., performing noise injection and ODE step sequentially, and it is not adaptive. It is an open question if adaptive solvers can be a net win over a well-tuned fixed schedule in sampling diffusion models. ",
730
+ "bbox": [
731
+ 174,
732
+ 883,
733
+ 821,
734
+ 911
735
+ ],
736
+ "page_idx": 6
737
+ },
738
+ {
739
+ "type": "image",
740
+ "img_path": "images/1bebb4b1fa86e8d0681976974b16f5801472c9a8620c2dbd93f92f9096112639.jpg",
741
+ "image_caption": [
742
+ "Figure 4: Evaluation of our stochastic sampler (Algorithm 2). The purple curve corresponds to optimal choices for $\\{ S _ { \\mathrm { c h u r n } } , S _ { \\mathrm { t m i n } } , S _ { \\mathrm { t m a x } } , S _ { \\mathrm { n o i s e } } \\}$ ; orange, blue, and green correspond to disabling the effects of $S _ { \\mathrm { t m i n , t m a x } }$ and/or $S _ { \\mathrm { n o i s e } }$ . The red curves show reference results for our deterministic sampler (Algorithm 1), equivalent to setting $S _ { \\mathrm { c h u r n } } = 0$ . The dashed black curves correspond to the original stochastic samplers from previous work: Euler–Maruyama [48] for VP, predictor-corrector [48] for VE, and iDDPM [36] for ImageNet-64. The dots indicate lowest observed FID. "
743
+ ],
744
+ "image_footnote": [],
745
+ "bbox": [
746
+ 174,
747
+ 89,
748
+ 816,
749
+ 233
750
+ ],
751
+ "page_idx": 7
752
+ },
753
+ {
754
+ "type": "text",
755
+ "text": "",
756
+ "bbox": [
757
+ 173,
758
+ 342,
759
+ 825,
760
+ 398
761
+ ],
762
+ "page_idx": 7
763
+ },
764
+ {
765
+ "type": "text",
766
+ "text": "Through sampler improvements alone, we are able to bring the ImageNet-64 model that originally achieved FID 2.07 [9] to 1.55 that is very close to the state-of-the-art; previously, FID 1.48 has been reported for cascaded diffusion [17], 1.55 for classifier-free guidance [18], and 1.52 for StyleGANXL [44]. While our results showcase the potential gains achievable through sampler improvements, they also highlight the main shortcoming of stochasticity: For best results, one must make several heuristic choices — either implicit or explicit — that depend on the specific model. Indeed, we had to find the optimal values of $\\left\\{ S _ { \\mathrm { c h u r n } } , S _ { \\mathrm { t m i n } } , S _ { \\mathrm { t m a x } } , S _ { \\mathrm { n o i s e } } \\right\\}$ on a case-by-case basis using grid search (Appendix E.2). This raises a general concern that using stochastic sampling as the primary means of evaluating model improvements may inadvertently end up influencing the design choices related to model architecture and training. ",
767
+ "bbox": [
768
+ 173,
769
+ 404,
770
+ 826,
771
+ 542
772
+ ],
773
+ "page_idx": 7
774
+ },
775
+ {
776
+ "type": "text",
777
+ "text": "5 Preconditioning and training ",
778
+ "text_level": 1,
779
+ "bbox": [
780
+ 176,
781
+ 556,
782
+ 447,
783
+ 574
784
+ ],
785
+ "page_idx": 7
786
+ },
787
+ {
788
+ "type": "text",
789
+ "text": "There are various known good practices for training neural networks in a supervised fashion. For example, it is advisable to keep input and output signal magnitudes fixed to, e.g., unit variance, and to avoid large variation in gradient magnitudes on a per-sample basis [5, 21]. Training a neural network to model $D$ directly would be far from ideal — for example, as the input ${ \\pmb x } = { \\pmb y } + { \\pmb n }$ is a combination of clean signal $\\textbf { { y } }$ and noise $\\pmb { n } \\sim \\mathcal { N } ( \\mathbf { 0 } , \\sigma ^ { 2 } \\mathbf { I } )$ , its magnitude varies immensely depending on noise level $\\sigma$ . For this reason, the common practice is to not represent $D _ { \\theta }$ as a neural network directly, but instead train a different network $F _ { \\theta }$ from which $D _ { \\theta }$ is derived. ",
790
+ "bbox": [
791
+ 173,
792
+ 585,
793
+ 825,
794
+ 683
795
+ ],
796
+ "page_idx": 7
797
+ },
798
+ {
799
+ "type": "text",
800
+ "text": "Previous methods [36, 46, 48] address the input scaling via a $\\sigma$ -dependent normalization factor and attempt to precondition the output by training $F _ { \\theta }$ to predict $\\mathbf { \\nabla } _ { \\mathbf { \\pmb { n } } }$ scaled to unit variance, from which the signal is then reconstructed via $D _ { \\theta } ( { \\pmb x } ; \\sigma ) = { \\pmb x } - \\sigma F _ { \\theta } ( \\cdot )$ . This has the drawback that at large $\\sigma$ , the network needs to fine-tune its output carefully to cancel out the existing noise $\\textbf { \\em n }$ exactly and give the output at the correct scale; note that any errors made by the network are amplified by a factor of $\\sigma$ . In this situation, it would seem much easier to predict the expected output $D ( \\pmb { x } ; \\sigma )$ directly. In the same spirit as previous parameterizations that adaptively mix signal and noise (e.g., [10, 43, 50]), we propose to precondition the neural network with a $\\sigma$ -dependent skip connection that allows it to estimate either $\\textbf { { y } }$ or $\\textbf { \\em n }$ , or something in between. We thus write $D _ { \\theta }$ in the following form: ",
801
+ "bbox": [
802
+ 173,
803
+ 688,
804
+ 826,
805
+ 814
806
+ ],
807
+ "page_idx": 7
808
+ },
809
+ {
810
+ "type": "equation",
811
+ "img_path": "images/a8620b4b82a4efb523afb01b93d4223ea6c9b16e26520ae763d3f39d924e0f82.jpg",
812
+ "text": "$$\nD _ { \\theta } ( { \\pmb x } ; \\sigma ) = c _ { \\mathrm { s k i p } } ( \\sigma ) { \\pmb x } + c _ { \\mathrm { o u t } } ( \\sigma ) F _ { \\theta } \\left( c _ { \\mathrm { i n } } ( \\sigma ) { \\pmb x } ; c _ { \\mathrm { n o i s e } } ( \\sigma ) \\right) ,\n$$",
813
+ "text_format": "latex",
814
+ "bbox": [
815
+ 310,
816
+ 818,
817
+ 687,
818
+ 837
819
+ ],
820
+ "page_idx": 7
821
+ },
822
+ {
823
+ "type": "text",
824
+ "text": "where $F _ { \\theta }$ is the neural network to be trained, $c _ { \\mathrm { s k i p } } ( \\sigma )$ modulates the skip connection, $c _ { \\mathrm { i n } } ( \\sigma )$ and $ { c _ { \\mathrm { o u t } } } ( \\sigma )$ scale the input and output magnitudes, and $\\dot { c } _ { \\mathrm { n o i s e } } ( \\sigma )$ maps noise level $\\sigma$ into a conditioning input for $F _ { \\theta }$ . Taking a weighted expectation of Eq. 2 over the noise levels gives the overall training loss $\\mathbb { E } _ { \\sigma , \\pmb { y } , \\pmb { n } } [ \\lambda ( \\sigma ) | | D ( \\pmb { y } + \\pmb { n } ; \\sigma ) - \\pmb { y } | | _ { 2 } ^ { 2 } ]$ , where $\\sigma \\sim p _ { \\mathrm { t r a i n } }$ , $y \\sim p _ { \\mathrm { d a t a } }$ , and $\\bar { \\pmb { n } } \\sim \\mathcal { N } ( \\pmb { 0 } , \\sigma ^ { 2 } \\mathbf { I } )$ . The probability of sampling a given noise level $\\sigma$ is given by $p _ { \\mathrm { t r a i n } } ( \\sigma )$ and the corresponding weight is given by $\\lambda ( \\sigma )$ . We can equivalently express this loss with respect to the raw network output $F _ { \\theta }$ in Eq. 7: ",
825
+ "bbox": [
826
+ 174,
827
+ 842,
828
+ 825,
829
+ 912
830
+ ],
831
+ "page_idx": 7
832
+ },
833
+ {
834
+ "type": "table",
835
+ "img_path": "images/4fc7738881e96c37ebcf9aedaf84bd09aa0f3a4d6e5d4cc60be10f8fde2df85f.jpg",
836
+ "table_caption": [
837
+ "Table 2: Evaluation of our training improvements. The starting point (config A) is VP & VE using our deterministic sampler. At the end (configs E,F), VP & VE only differ in the architecture of $F _ { \\theta }$ . "
838
+ ],
839
+ "table_footnote": [],
840
+ "table_body": "<table><tr><td rowspan=\"2\"></td><td colspan=\"4\">CIFAR-10[28] at 32×32</td><td rowspan=\"2\" colspan=\"2\">FFHQ[26]64×64 Unconditional</td><td rowspan=\"2\" colspan=\"2\">AFHQv2[7] 64×64 Unconditional</td></tr><tr><td colspan=\"2\">Conditional</td><td colspan=\"2\">Unconditional</td></tr><tr><td>Training configuration</td><td>VP</td><td>VE</td><td>VP</td><td>VE</td><td>VP</td><td>VE</td><td>VP</td><td>VE</td></tr><tr><td>A Baseline [48](*pre-trained)</td><td>2.48</td><td>3.11</td><td>3.01*</td><td>3.77*</td><td>3.39</td><td>25.95</td><td>2.58</td><td>18.52</td></tr><tr><td>B + Adjust hyperparameters</td><td>2.18</td><td>2.48</td><td>2.51</td><td>2.94</td><td>3.13</td><td>22.53</td><td>2.43</td><td>23.12</td></tr><tr><td>C + Redistribute capacity</td><td>2.08</td><td>2.52</td><td>2.31</td><td>2.83</td><td>2.78</td><td>41.62</td><td>2.54</td><td>15.04</td></tr><tr><td>D + Our preconditioning</td><td>2.09</td><td>2.64</td><td>2.29</td><td>3.10</td><td>2.94</td><td>3.39</td><td>2.79</td><td>3.81</td></tr><tr><td>E + Our loss function</td><td>1.88</td><td>1.86</td><td>2.05</td><td>1.99</td><td>2.60</td><td>2.81</td><td>2.29</td><td>2.28</td></tr><tr><td>F + Non-leaky augmentation</td><td>1.79</td><td>1.79</td><td>1.97</td><td>1.98</td><td>2.39</td><td>2.53</td><td>1.96</td><td>2.16</td></tr><tr><td colspan=\"2\">NFE</td><td>35 35</td><td></td><td>35 35</td><td></td><td>79</td><td>79</td><td>79</td><td>79</td></tr></table>",
841
+ "bbox": [
842
+ 173,
843
+ 131,
844
+ 825,
845
+ 270
846
+ ],
847
+ "page_idx": 8
848
+ },
849
+ {
850
+ "type": "text",
851
+ "text": "",
852
+ "bbox": [
853
+ 173,
854
+ 289,
855
+ 795,
856
+ 304
857
+ ],
858
+ "page_idx": 8
859
+ },
860
+ {
861
+ "type": "equation",
862
+ "img_path": "images/5375b932ac2816e83f4932b56717a7fb8d8a607e52e982de3ea53667ac428955.jpg",
863
+ "text": "$$\n\\begin{array} { r } { \\mathbb { E } _ { \\sigma , y , n } \\Big [ \\underbrace { \\lambda ( \\sigma ) c _ { \\mathrm { o u t } } ( \\sigma ) ^ { 2 } } _ { \\mathrm { e f f e c t i v e ~ w e i g h t } } \\Big \\| \\underbrace { F _ { \\theta } \\big ( c _ { \\mathrm { i n } } ( \\sigma ) \\cdot ( y + n ) ; c _ { \\mathrm { n o i s e } } ( \\sigma ) \\big ) } _ { \\mathrm { n e t w o t k ~ o u t p u t } } - \\underbrace { \\frac { 1 } { c _ { \\mathrm { o u t } } ( \\sigma ) } \\big ( y - c _ { \\mathrm { s k i n } } ( \\sigma ) \\cdot ( y + n ) \\big ) } _ { \\mathrm { e f f e c t i v e ~ t r a i n i n g ~ t a r g e t } } \\Big \\| _ { 2 } ^ { 2 } \\Big ] . } \\end{array}\n$$",
864
+ "text_format": "latex",
865
+ "bbox": [
866
+ 184,
867
+ 310,
868
+ 795,
869
+ 352
870
+ ],
871
+ "page_idx": 8
872
+ },
873
+ {
874
+ "type": "text",
875
+ "text": "This form reveals the effective training target of $F _ { \\theta }$ , allowing us to determine suitable choices for the preconditioning functions from first principles. As detailed in Appendix B.6, we derive our choices shown in Table 1 by requiring network inputs and training targets to have unit variance $( \\boldsymbol { c } _ { \\mathrm { i n } } , \\boldsymbol { c } _ { \\mathrm { o u t } } )$ , and amplifying errors in $F _ { \\theta }$ as little as possible $( c _ { \\mathrm { s k i p } } )$ . The formula for $\\mathrm { \\mathcal { C } _ { n o i s e } }$ is chosen empirically. ",
876
+ "bbox": [
877
+ 176,
878
+ 363,
879
+ 823,
880
+ 419
881
+ ],
882
+ "page_idx": 8
883
+ },
884
+ {
885
+ "type": "text",
886
+ "text": "Table 2 shows FID for a series of training setups, evaluated using our deterministic sampler from Section 3. We start with the baseline training setup of Song et al. [48], which differs considerably between the VP and VE cases; we provide separate results for each (config A). To obtain a more meaningful point of comparison, we re-adjust the basic hyperparameters (config B) and improve the expressive power of the model (config C) by removing the lowest-resolution layers and doubling the capacity of the highest-resolution layers instead; see Appendix F.3 for further details. We then replace the original choices of $\\{ c _ { \\mathrm { i n } } , c _ { \\mathrm { o u t } } , c _ { \\mathrm { n o i s e } } , c _ { \\mathrm { s k i p } } \\}$ with our preconditioning (config D), which keeps the results largely unchanged — except for VE that improves considerably at $6 4 \\times 6 4$ resolution. Instead of improving FID per se, the main benefit of our preconditioning is that it makes the training more robust, enabling us to turn our focus on redesigning the loss function without adverse effects. ",
887
+ "bbox": [
888
+ 174,
889
+ 424,
890
+ 825,
891
+ 563
892
+ ],
893
+ "page_idx": 8
894
+ },
895
+ {
896
+ "type": "text",
897
+ "text": "Loss weighting and sampling. Eq. 8 shows that training $F _ { \\theta }$ as preconditioned in Eq. 7 incurs an effective per-sample loss weight of $\\lambda ( \\sigma ) c _ { \\mathrm { o u t } } ( \\sigma ) ^ { 2 }$ . To balance the effective loss weights, we set $\\lambda ( \\sigma ) = 1 / c _ { \\mathrm { o u t } } ( \\sigma ) ^ { 2 }$ , which also equalizes the initial training loss over the entire $\\sigma$ range as shown in Figure 5a (green curve). Finally, we need to select $p _ { \\mathrm { t r a i n } } ( \\sigma )$ , i.e., how to choose noise levels during training. Inspecting the per- $\\sigma$ loss after training (blue and orange curves) reveals that a significant reduction is possible only at intermediate noise levels; at very low levels, it is both difficult and irrelevant to discern the vanishingly small noise component, whereas at high levels the training targets are always dissimilar from the correct answer that approaches dataset average. Therefore, we target the training efforts to the relevant range using a simple log-normal distribution for $p _ { \\mathrm { t r a i n } } ( \\sigma )$ as detailed in Table 1 and illustrated in Figure 5a (red curve). ",
898
+ "bbox": [
899
+ 174,
900
+ 574,
901
+ 825,
902
+ 713
903
+ ],
904
+ "page_idx": 8
905
+ },
906
+ {
907
+ "type": "text",
908
+ "text": "Table 2 shows that our proposed $p _ { \\mathrm { t r a i n } }$ and $\\lambda$ (config E) lead to a dramatic improvement in FID in all cases when used in conjunction with our preconditioning (config D). In concurrent work, Choi et al. [6] propose a similar scheme to prioritize noise levels that are most relevant w.r.t. forming the perceptually recognizable content of the image. However, they only consider the choice of $\\lambda$ in isolation, which results in a smaller overall improvement. ",
909
+ "bbox": [
910
+ 174,
911
+ 719,
912
+ 825,
913
+ 790
914
+ ],
915
+ "page_idx": 8
916
+ },
917
+ {
918
+ "type": "text",
919
+ "text": "Augmentation regularization. To prevent potential overfitting that often plagues diffusion models with smaller datasets, we borrow an augmentation pipeline from the GAN literature [25]. The pipeline consists of various geometric transformations (see Appendix F.2) that we apply to a training image prior to adding noise. To prevent the augmentations from leaking to the generated images, we provide the augmentation parameters as a conditioning input to $F _ { \\theta }$ ; during inference we set the them to zero to guarantee that only non-augmented images are generated. Table 2 shows that data augmentation provides a consistent improvement (config F) that yields new state-of-the-art FIDs of 1.79 and 1.97 for conditional and unconditional CIFAR-10, beating the previous records of 1.85 [44] and 2.10 [50]. ",
920
+ "bbox": [
921
+ 174,
922
+ 801,
923
+ 825,
924
+ 912
925
+ ],
926
+ "page_idx": 8
927
+ },
928
+ {
929
+ "type": "image",
930
+ "img_path": "images/067281713bc43a0d03df53b1029a4a8d41e0830559276079b392c19962f6402c.jpg",
931
+ "image_caption": [
932
+ "Figure 5: (a) Observed initial (green) and final loss per noise level, representative of the the $3 2 \\times 3 2$ (blue) and $6 4 \\times 6 4$ (orange) models considered in this paper. The shaded regions represent the standard deviation over 10k random samples. Our proposed training sample density is shown by the dashed red curve. (b) Effect of $S _ { \\mathrm { c h u r n } }$ on unconditional CIFAR-10 with 256 steps $( \\mathrm { N F E } = 5 1 1$ ). For the original training setup of Song et al. [48], stochastic sampling is highly beneficial (blue, green), while deterministic sampling $S _ { \\mathrm { c h u r n } } = 0 $ ) leads to relatively poor FID. For our training setup, the situation is reversed (orange, red); stochastic sampling is not only unnecessary but harmful. (c) Effect of $S _ { \\mathrm { c h u r n } }$ on class-conditional ImageNet-64 with 256 steps $( \\mathrm { N F E } = 5 1 1$ ). In this more challenging scenario, stochastic sampling turns out to be useful again. Our training setup improves the results for both deterministic and stochastic sampling. "
933
+ ],
934
+ "image_footnote": [],
935
+ "bbox": [
936
+ 176,
937
+ 89,
938
+ 818,
939
+ 224
940
+ ],
941
+ "page_idx": 9
942
+ },
943
+ {
944
+ "type": "text",
945
+ "text": "Stochastic sampling revisited. Interestingly, the relevance of stochastic sampling appears to diminish as the model itself improves, as shown in Figure 5b,c. When using our training setup in CIFAR-10 (Figure 5b), the best results were obtained with deterministic sampling, and any amount of stochastic sampling was detrimental. ",
946
+ "bbox": [
947
+ 174,
948
+ 391,
949
+ 825,
950
+ 446
951
+ ],
952
+ "page_idx": 9
953
+ },
954
+ {
955
+ "type": "text",
956
+ "text": "ImageNet-64. As a final experiment, we trained a class-conditional ImageNet-64 model from scratch using our proposed training improvements. This model achieved a new state-of-the-art FID of 1.36 compared to the previous record of 1.48 [17]. We used the ADM architecture [9] with no changes, and trained it using our config E with minimal tuning; see Appendix F.3 for details. We did not find overfitting to be a concern, and thus chose to not employ augmentation regularization. As shown in Figure 5c, the optimal amount of stochastic sampling was much lower than with the pre-trained model, but unlike with CIFAR-10, stochastic sampling was clearly better than deterministic sampling. This suggests that more diverse datasets continue to benefit from stochastic sampling. ",
957
+ "bbox": [
958
+ 174,
959
+ 460,
960
+ 825,
961
+ 570
962
+ ],
963
+ "page_idx": 9
964
+ },
965
+ {
966
+ "type": "text",
967
+ "text": "6 Conclusions ",
968
+ "text_level": 1,
969
+ "bbox": [
970
+ 174,
971
+ 588,
972
+ 305,
973
+ 606
974
+ ],
975
+ "page_idx": 9
976
+ },
977
+ {
978
+ "type": "text",
979
+ "text": "Our approach of putting diffusion models to a common framework exposes a modular design. This allows a targeted investigation of individual components, potentially helping to better cover the viable design space. In our tests this let us simply replace the samplers in various earlier models, drastically improving the results. For example, in ImageNet-64 our sampler turned an average model (FID 2.07) to a challenger (1.55) for the previous SOTA model (1.48) [17], and with training improvements achieved SOTA FID of 1.36. We also obtained new state-of-the-art results on CIFAR-10 while using only 35 model evaluations, deterministic sampling, and a small network. The current high-resolution diffusion models rely either on separate super-resolution steps [17, 35, 39], subspace projection [23], very large networks [9, 48], or hybrid approaches [38, 41, 50] — we believe that our contributions are orthogonal to these extensions. That said, many of our parameter values may need to be re-adjusted for higher resolution datasets. Furthermore, we feel that the precise interaction between stochastic sampling and the training objective remains an interesting question for future work. ",
980
+ "bbox": [
981
+ 174,
982
+ 621,
983
+ 825,
984
+ 787
985
+ ],
986
+ "page_idx": 9
987
+ },
988
+ {
989
+ "type": "text",
990
+ "text": "Societal impact. Our advances in sample quality can potentially amplify negative societal effects when used in a large-scale system like DALL·E 2, including types of disinformation or emphasizing sterotypes and harmful biases [33]. The training and sampling of diffusion models needs a lot of electricity; our project consumed ∼250MWh on an in-house cluster of NVIDIA V100s. ",
991
+ "bbox": [
992
+ 174,
993
+ 800,
994
+ 825,
995
+ 856
996
+ ],
997
+ "page_idx": 9
998
+ },
999
+ {
1000
+ "type": "text",
1001
+ "text": "Acknowledgments. We thank Jaakko Lehtinen, Ming-Yu Liu, Tuomas Kynkäänniemi, Axel Sauer, Arash Vahdat, and Janne Hellsten for discussions and comments, and Tero Kuosmanen, Samuel Klenberg, and Janne Hellsten for maintaining our compute infrastructure. ",
1002
+ "bbox": [
1003
+ 176,
1004
+ 869,
1005
+ 825,
1006
+ 911
1007
+ ],
1008
+ "page_idx": 9
1009
+ },
1010
+ {
1011
+ "type": "text",
1012
+ "text": "References ",
1013
+ "text_level": 1,
1014
+ "bbox": [
1015
+ 174,
1016
+ 89,
1017
+ 267,
1018
+ 106
1019
+ ],
1020
+ "page_idx": 10
1021
+ },
1022
+ {
1023
+ "type": "text",
1024
+ "text": "12(3):313–326, 1982. \n[2] U. M. Ascher and L. R. Petzold. Computer Methods for Ordinary Differential Equations and DifferentialAlgebraic Equations. Society for Industrial and Applied Mathematics, 1998. \n[3] F. Bao, C. Li, J. Zhu, and B. Zhang. Analytic-DPM: an analytic estimate of the optimal reverse variance in diffusion probabilistic models. In Proc. ICLR, 2022. \n[4] D. Baranchuk, A. Voynov, I. Rubachev, V. Khrulkov, and A. Babenko. Label-efficient semantic segmentation with diffusion models. In Proc. ICLR, 2022. \n[5] C. M. Bishop. Neural networks for pattern recognition. Oxford University Press, USA, 1995. \n[6] J. Choi, J. Lee, C. Shin, S. Kim, H. Kim, and S. Yoon. Perception prioritized training of diffusion models. In Proc. CVPR, 2022. \n[7] Y. Choi, Y. Uh, J. Yoo, and J.-W. Ha. StarGAN v2: Diverse image synthesis for multiple domains. In Proc. CVPR, 2020. \n[8] J. Deng, W. Dong, R. Socher, L.-J. Li, K. Li, and L. Fei-Fei. ImageNet: A large-scale hierarchical image database. In Proc. CVPR, 2009. \n[9] P. Dhariwal and A. Q. Nichol. Diffusion models beat GANs on image synthesis. In Proc. NeurIPS, 2021. \n[10] T. Dockhorn, A. Vahdat, and K. Kreis. Score-based generative modeling with critically-damped Langevin diffusion. In Proc. ICLR, 2022. \n[11] J. R. Dormand and P. J. Prince. A family of embedded Runge-Kutta formulae. Journal of computational and applied mathematics, 6(1):19–26, 1980. \n[12] J. B. J. Fourier, G. Darboux, et al. Théorie analytique de la chaleur, volume 504. Didot Paris, 1822. \n[13] I. Goodfellow, J. Pouget-Abadie, M. Mirza, B. Xu, D. Warde-Farley, S. Ozair, A. Courville, and Y. Bengio. Generative adversarial networks. In Proc. NIPS, 2014. \n[14] U. Grenander and M. I. Miller. Representations of knowledge in complex systems. Journal of the Royal Statistical Society: Series B (Methodological), 56(4):549–581, 1994. \n[15] M. Heusel, H. Ramsauer, T. Unterthiner, B. Nessler, and S. Hochreiter. GANs trained by a two time-scale update rule converge to a local Nash equilibrium. In Proc. NIPS, 2017. \n[16] J. Ho, A. Jain, and P. Abbeel. Denoising diffusion probabilistic models. In Proc. NeurIPS, 2020. \n[17] J. Ho, C. Saharia, W. Chan, D. J. Fleet, M. Norouzi, and T. Salimans. Cascaded diffusion models for high fidelity image generation. Journal of Machine Learning Research, 23, 2022. \n[18] J. Ho and T. Salimans. Classifier-free diffusion guidance. In NeurIPS 2021 Workshop on Deep Generative Models and Downstream Applications, 2021. \n[19] J. Ho, T. Salimans, A. A. Gritsenko, W. Chan, M. Norouzi, and D. J. Fleet. Video diffusion models. In Proc. ICLR Workshop on Deep Generative Models for Highly Structured Data, 2022. \n[20] C.-W. Huang, J. H. Lim, and A. C. Courville. A variational perspective on diffusion-based generative models and score matching. In Proc. NeurIPS, 2021. \n[21] L. Huang, J. Qin, Y. Zhou, F. Zhu, L. Liu, and L. Shao. Normalization techniques in training DNNs: Methodology, analysis and application. CoRR, abs/2009.12836, 2020. \n[22] A. Hyvärinen. Estimation of non-normalized statistical models by score matching. Journal of Machine Learning Research, 6(24):695–709, 2005. \n[23] B. Jing, G. Corso, R. Berlinghieri, and T. Jaakkola. Subspace diffusion generative models. In Proc. ECCV, 2022. \n[24] A. Jolicoeur-Martineau, K. Li, R. Piché-Taillefer, T. Kachman, and I. Mitliagkas. Gotta go fast when generating data with score-based models. CoRR, abs/2105.14080, 2021. \n[25] T. Karras, M. Aittala, J. Hellsten, S. Laine, J. Lehtinen, and T. Aila. Training generative adversarial networks with limited data. In Proc. NeurIPS, 2020. \n[26] T. Karras, S. Laine, and T. Aila. A style-based generator architecture for generative adversarial networks. In Proc. CVPR, 2018. \n[27] Z. Kong, W. Ping, J. Huang, K. Zhao, and B. Catanzaro. DiffWave: A versatile diffusion model for audio synthesis. In Proc. ICLR, 2021. \n[28] A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009. \n[29] J. Lehtinen, J. Munkberg, J. Hasselgren, S. Laine, T. Karras, M. Aittala, and T. Aila. Noise2Noise: Learning image restoration without clean data. In Proc. ICML, 2018. \n[30] L. Liu, Y. Ren, Z. Lin, and Z. Zhao. Pseudo numerical methods for diffusion models on manifolds. In Proc. ICLR, 2022. \n[31] C. Lu, Y. Zhou, F. Bao, J. Chen, C. Li, and J. Zhu. DPM-Solver: A fast ODE solver for diffusion probabilistic model sampling in around 10 steps. In Proc. NeurIPS, 2022. \n[32] E. Luhman and T. Luhman. Knowledge distillation in iterative generative models for improved sampling speed. CoRR, abs/2101.02388, 2021. \n[33] P. Mishkin, L. Ahmad, M. Brundage, G. Krueger, and G. Sastry. DALL·E 2 preview – risks and limitations. OpenAI, 2022. \n[34] E. Nachmani and S. Dovrat. Zero-shot translation using diffusion models. CoRR, abs/2111.01471, 2021. \n[35] A. Nichol, P. Dhariwal, A. Ramesh, P. Shyam, P. Mishkin, B. McGrew, I. Sutskever, and M. Chen. GLIDE: Towards photorealistic image generation and editing with text-guided diffusion models. In Proc. ICML, 2022. \n[36] A. Q. Nichol and P. Dhariwal. Improved denoising diffusion probabilistic models. In Proc. ICML, volume 139, pages 8162–8171, 2021. \n[37] V. Popov, I. Vovk, V. Gogoryan, T. Sadekova, and M. Kudinov. Grad-TTS: A diffusion probabilistic model for text-to-speech. In Proc. ICML, volume 139, pages 8599–8608, 2021. \n[38] K. Preechakul, N. Chatthee, S. Wizadwongsa, and S. Suwajanakorn. Diffusion autoencoders: Toward a meaningful and decodable representation. In Proc. CVPR, 2022. \n[39] A. Ramesh, P. Dhariwal, A. Nichol, C. Chu, and M. Chen. Hierarchical text-conditional image generation with CLIP latents. Technical report, OpenAI, 2022. \n[40] A. J. Roberts. Modify the improved Euler scheme to integrate stochastic differential equations. CoRR, abs/1210.0933, 2012. \n[41] R. Rombach, A. Blattmann, D. Lorenz, P. Esser, and B. Ommer. High-resolution image synthesis with latent diffusion models. In Proc. CVPR, 2022. \n[42] C. Saharia, W. Chan, H. Chang, C. A. Lee, J. Ho, T. Salimans, D. J. Fleet, and M. Norouzi. Palette: Image-to-image diffusion models. In Proc. SIGGRAPH, 2022. \n[43] T. Salimans and J. Ho. Progressive distillation for fast sampling of diffusion models. In Proc. ICLR, 2022. \n[44] A. Sauer, K. Schwarz, and A. Geiger. StyleGAN-XL: Scaling StyleGAN to large diverse datasets. In Proc. SIGGRAPH, 2022. \n[45] J. Sohl-Dickstein, E. Weiss, N. Maheswaranathan, and S. Ganguli. Deep unsupervised learning using nonequilibrium thermodynamics. In Proc. ICML, pages 2256–2265, 2015. \n[46] J. Song, C. Meng, and S. Ermon. Denoising diffusion implicit models. In Proc. ICLR, 2021. \n[47] Y. Song and S. Ermon. Generative modeling by estimating gradients of the data distribution. In Proc. NeurIPS, 2019. \n[48] Y. Song, J. Sohl-Dickstein, D. P. Kingma, A. Kumar, S. Ermon, and B. Poole. Score-based generative modeling through stochastic differential equations. In Proc. ICLR, 2021. \n[49] E. Süli and D. F. Mayers. An Introduction to Numerical Analysis. Cambridge University Press, 2003. \n[50] A. Vahdat, K. Kreis, and J. Kautz. Score-based generative modeling in latent space. In Proc. NeurIPS, 2021. \n[51] P. Vincent. A connection between score matching and denoising autoencoders. Neural Computation, 23(7):1661–1674, 2011. \n[52] D. Watson, W. Chan, J. Ho, and M. Norouzi. Learning fast samplers for diffusion models by differentiating through sample quality. In Proc. ICLR, 2022. \n[53] D. Watson, J. Ho, M. Norouzi, and W. Chan. Learning to efficiently sample from diffusion probabilistic models. CoRR, abs/2106.03802, 2021. \n[54] J. Wolleb, R. Sandkühler, F. Bieder, P. Valmaggia, and P. C. Cattin. Diffusion models for implicit image segmentation ensembles. In Medical Imaging with Deep Learning, 2022. \n[55] Q. Zhang and Y. Chen. Diffusion normalizing flow. In Proc. NeurIPS, 2021. \n[56] Q. Zhang and Y. Chen. Fast sampling of diffusion models with exponential integrator. CoRR, abs/2204.13902, 2022. ",
1025
+ "bbox": [
1026
+ 171,
1027
+ 127,
1028
+ 828,
1029
+ 912
1030
+ ],
1031
+ "page_idx": 10
1032
+ },
1033
+ {
1034
+ "type": "text",
1035
+ "text": "",
1036
+ "bbox": [
1037
+ 171,
1038
+ 88,
1039
+ 828,
1040
+ 678
1041
+ ],
1042
+ "page_idx": 11
1043
+ },
1044
+ {
1045
+ "type": "text",
1046
+ "text": "Checklist ",
1047
+ "text_level": 1,
1048
+ "bbox": [
1049
+ 174,
1050
+ 89,
1051
+ 254,
1052
+ 106
1053
+ ],
1054
+ "page_idx": 12
1055
+ },
1056
+ {
1057
+ "type": "text",
1058
+ "text": "1. For all authors... ",
1059
+ "bbox": [
1060
+ 214,
1061
+ 116,
1062
+ 339,
1063
+ 130
1064
+ ],
1065
+ "page_idx": 12
1066
+ },
1067
+ {
1068
+ "type": "text",
1069
+ "text": "(a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes] \n(b) Did you describe the limitations of your work? [Yes] Section 6. The main limitations of the analysis relate to the set of tested datasets and their limited resolution. \n(c) Did you discuss any potential negative societal impacts of your work? [Yes] Section 6. \n(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
1070
+ "bbox": [
1071
+ 238,
1072
+ 135,
1073
+ 825,
1074
+ 239
1075
+ ],
1076
+ "page_idx": 12
1077
+ },
1078
+ {
1079
+ "type": "text",
1080
+ "text": "2. If you are including theoretical results... ",
1081
+ "bbox": [
1082
+ 214,
1083
+ 243,
1084
+ 493,
1085
+ 258
1086
+ ],
1087
+ "page_idx": 12
1088
+ },
1089
+ {
1090
+ "type": "text",
1091
+ "text": "(a) Did you state the full set of assumptions of all theoretical results? [No] We follow common application-specific assumptions about the probability distributions, functions and other components, but do not exhaustively specify them, or consider pathological corner cases. \n(b) Did you include complete proofs of all theoretical results? [No] Our equations and algorithms build on previously known results, and highlight their practical aspects through mostly readily verifiable algebraic manipulations (Appendix B). We do not explicitly present all details of the derivations, and assume that the previous results are sufficiently rigorously proven in the respective literature. ",
1092
+ "bbox": [
1093
+ 236,
1094
+ 262,
1095
+ 825,
1096
+ 390
1097
+ ],
1098
+ "page_idx": 12
1099
+ },
1100
+ {
1101
+ "type": "text",
1102
+ "text": "3. If you ran experiments... ",
1103
+ "bbox": [
1104
+ 212,
1105
+ 395,
1106
+ 393,
1107
+ 409
1108
+ ],
1109
+ "page_idx": 12
1110
+ },
1111
+ {
1112
+ "type": "text",
1113
+ "text": "(a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Our implementation and pre-trained models are available at https://github.com/NVlabs/edm \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] Appendix F. \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [Yes] Shaded regions in Figures 4 and 5. \n(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] Section 6. ",
1114
+ "bbox": [
1115
+ 238,
1116
+ 412,
1117
+ 825,
1118
+ 545
1119
+ ],
1120
+ "page_idx": 12
1121
+ },
1122
+ {
1123
+ "type": "text",
1124
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1125
+ "bbox": [
1126
+ 215,
1127
+ 550,
1128
+ 823,
1129
+ 564
1130
+ ],
1131
+ "page_idx": 12
1132
+ },
1133
+ {
1134
+ "type": "text",
1135
+ "text": "(a) If your work uses existing assets, did you cite the creators? [Yes] \n(b) Did you mention the license of the assets? [Yes] Appendix F.5. \n(c) Did you include any new assets either in the supplemental material or as a URL? [No] \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [N/A] \n(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [N/A] ",
1136
+ "bbox": [
1137
+ 238,
1138
+ 569,
1139
+ 823,
1140
+ 676
1141
+ ],
1142
+ "page_idx": 12
1143
+ },
1144
+ {
1145
+ "type": "text",
1146
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1147
+ "bbox": [
1148
+ 214,
1149
+ 680,
1150
+ 705,
1151
+ 695
1152
+ ],
1153
+ "page_idx": 12
1154
+ },
1155
+ {
1156
+ "type": "text",
1157
+ "text": "(a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A] \n(b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A] \n(c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A] ",
1158
+ "bbox": [
1159
+ 238,
1160
+ 699,
1161
+ 825,
1162
+ 787
1163
+ ],
1164
+ "page_idx": 12
1165
+ }
1166
+ ]
parse/dev/oVE1z8NlNe/oVE1z8NlNe.md ADDED
@@ -0,0 +1,382 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DIVERGENCE-AWARE FEDERATED SELF-SUPERVISED LEARNING
2
+
3
+ Weiming Zhuang1,3, Yonggang Wen2, Shuai Zhang3
4
+ $^ 1 S$ -Lab, NTU, Singapore 2NTU, Singapore 3SenseTime Research
5
+ weiming001@e.ntu.edu.sg,ygwen@ntu.edu.sg,zhangshuai@sensetime.com
6
+
7
+ # ABSTRACT
8
+
9
+ Self-supervised learning (SSL) is capable of learning remarkable representations from centrally available data. Recent works further implement federated learning with SSL to learn from rapidly growing decentralized unlabeled images (e.g., from cameras and phones), often resulted from privacy constraints. Extensive attention has been paid to SSL approaches based on Siamese networks. However, such an effort has not yet revealed deep insights into various fundamental building blocks for the federated self-supervised learning (FedSSL) architecture. We aim to fill in this gap via in-depth empirical study and propose a new method to tackle the nonindependently and identically distributed (non-IID) data problem of decentralized data. Firstly, we introduce a generalized FedSSL framework that embraces existing SSL methods based on Siamese networks and presents flexibility catering to future methods. In this framework, a server coordinates multiple clients to conduct SSL training and periodically updates local models of clients with the aggregated global model. Using the framework, our study uncovers unique insights of FedSSL: 1) stop-gradient operation, previously reported to be essential, is not always necessary in FedSSL; 2) retaining local knowledge of clients in FedSSL is particularly beneficial for non-IID data. Inspired by the insights, we then propose a new approach for model update, Federated Divergence-aware Exponential Moving Average update (FedEMA). FedEMA updates local models of clients adaptively using EMA of the global model, where the decay rate is dynamically measured by model divergence. Extensive experiments demonstrate that FedEMA outperforms existing methods by $3 - 4 \%$ on linear evaluation. We hope that this work will provide useful insights for future research.
10
+
11
+ # 1 INTRODUCTION
12
+
13
+ Self-supervised learning (SSL) has attracted extensive research interest for learning representations without relying on expensive data labels. In computer vision, the common practice is to design proxy tasks to facilitate visual representation learning from unlabeled images (Doersch et al., 2015; Noroozi & Favaro, 2016; Zhang et al., 2016; Gidaris et al., 2018). Among them, the state-of-the-art SSL methods employ contrastive learning that uses Siamese networks to minimize the similarity of two augmented views of images (Wu et al., 2018; Chen et al., 2020a; He et al., 2020; Grill et al., 2020; Chen & He, 2021). All these methods heavily rely on the assumption that images are centrally available in cloud servers, such as public data on the Internet.
14
+
15
+ However, the rapidly growing amount of decentralized images may not be centralized due to increasingly stringent privacy protection regulations (Custers et al., 2019). The increasing number of edge devices, such as street cameras and phones, are generating a large number of unlabeled images, but these images may not be centralized as they could contain sensitive personal information like human faces. Besides, learning representations from these images could be more beneficial for downstream tasks deployed in the same scenarios (Yan et al., 2020). A straightforward method is to adopt SSL methods for each edge, but it results in poor performance (Zhuang et al., 2021a) as decentralized data are mostly non-independently and identically distributed (non-IID) (Li et al., 2020a).
16
+
17
+ Federated learning (FL) has emerged as a popular privacy-preserving method to train models from decentralized data (McMahan et al., 2017), where clients send training updates to the server instead of raw data. The majority of FL methods, however, are not applicable for unsupervised representation learning because they require fully labeled data (Caldas et al., 2018), or partially labeled data in either the server or clients (Jin et al., 2020a; Jeong et al., 2021). Recent studies implement FL with SSL methods that are based on Siamese networks, but they only focus on a single SSL method. For example, FedCA (Zhang et al., 2020a) is based on SimCLR (Chen et al., 2020a) and FedU (Zhuang et al., 2021a) is based on BYOL (Grill et al., 2020). These efforts have not yet revealed deep insights into the fundamental building blocks of Siamese networks for federated self-supervised learning.
18
+
19
+ In this paper, we investigate the effects of fundamental components of federated self-supervised learning (FedSSL) via in-depth empirical study. To facilitate fair comparison, we first introduce a generalized FedSSL framework to embrace existing SSL methods that differ in building blocks of Siamese networks. The framework comprises of a server and multiple clients: clients conduct SSL training using Siamese networks — an online network and a target network; the server aggregates the trained online networks to obtain a new global network and uses this global network to update the online networks of clients in the next round of training. FedSSL primarily focuses on the cross-silo FL where clients are stateful with high availability (Kairouz et al., 2019).
20
+
21
+ We conduct empirical studies based on the FedSSL framework and discover important insights of FedSSL. Among four popular SSL methods (SimCLR (Chen et al., 2020a), MoCo (He et al., 2020), BYOL (Grill et al., 2020), and SimSiam (Chen & He, 2021), FedBYOL achieves the best performance, whereas FedSimSiam yields the worst performance. More detailed analysis uncover the following unique insights: 1) Stop-gradient operation, essential for SimSiam and BYOL, is not always essential in FedSSL; 2) Target networks of clients are essential to gain knowledge from online networks; 3) Keeping local knowledge of clients is beneficial for performance on non-IID data.
22
+
23
+ Inspired by the insights, we propose a new approach, Federated Divergence-aware Exponential Moving Average update (FedEMA) 1 , to address the non-IID data problem. Specifically, instead of updating online networks of clients simply by the global network, FedEMA updates them via exponential moving average (EMA) of the global network, where the decay rate of EMA is measured by the divergence of global and online networks dynamically. Extensive experiments demonstrate that FedEMA outperforms existing methods in a wide range of settings. We believe that important insights from this study will shed light on future research. Our main contributions are threefold:
24
+
25
+ • We introduce a new generalized FedSSL framework that embraces existing SSL methods based on Siamese networks and presents flexibility catering to future methods. • We conduct in-depth empirical studies of FedSSL based on the framework and discover deep insights of the fundamental building blocks of Siamese networks for FedSSL. • Inspired by the insights, we further propose a new model update approach, FedEMA, that adaptively updates online networks of clients with EMA of the global network. Extensive experiments show that FedEMA outperforms existing methods in a wide range of settings.
26
+
27
+ # 2 RELATED WORK
28
+
29
+ Self-supervised Learning In computer vision, self-supervised learning (SSL) aims to learn visual representations without any labels. Discriminative SSL methods facilitate learning with proxy tasks (Pathak et al., 2016; Noroozi & Favaro, 2016; Zhang et al., 2016; Gidaris et al., 2018). Among them, contrastive learning (Oord et al., 2018; Bachman et al., 2019) has become a promising principle. It uses Siamese networks to minimize the similarity of two augmented views (positive pairs) and maximize the similarity of two different images (negative pairs). These methods are either contrastive or non-contrastive ones: contrastive SSL methods require negative pairs (Chen et al., 2020a; He et al., 2020) to prevent training collapse; non-contrastive SSL methods (Grill et al., 2020; Chen & He, 2021) are generally more efficient as they maintain remarkable performances using only positive pairs. However, these methods do not perform well on decentralized non-IID data (Zhuang et al., 2021a). We analyze their similarities and variances and propose a generalized FedSSL framework.
30
+
31
+ Federated Learning Federated learning (FL) is a distributed training technique for learning from decentralized parties without transmitting raw data to a central server (McMahan et al., 2017).
32
+
33
+ ![](images/874bfc7e1da77464d2e893530ba49b4554a8d18c90fc251081926b00b0e245de.jpg)
34
+ Figure 1: Overview of federated self-supervised learning (FedSSL) framework. It comprises an endto-end training pipeline with four steps: 1) Each client $k$ conducts local training on unlabeled data $\mathcal { D } _ { k }$ with Siamese networks — an online network $W _ { k } ^ { o }$ and a target network $\it { W _ { k } ^ { t } }$ ; 2) After training, client $k$ uploads $W _ { k } ^ { o }$ to the server; 3) The server aggregates them to obtain a new global network $W _ { g } ^ { o }$ ; 4) The server updates $W _ { k } ^ { o }$ of client $k$ with $W _ { g } ^ { o }$ .
35
+
36
+ Among many studies that address the non-IID data challenge (Zhao et al., 2018; Li et al., 2020b; Wang et al., 2020; Zhuang et al., 2021c), Personalized FL (PFL) aims to learn personalized models for clients (Tan et al., 2021). Although some PFL methods interpolate global and local models (Hanzely et al., 2020; Mansour et al., 2020; yuyang deng et al., 2021), our proposed FedEMA differ in the motivation, application scenario, and measurement of the decay rate. Besides, the majority of existing works only consider supervised learning where clients have fully labeled data. Although recent works propose federated semi-supervised learning (Jin et al., 2020b; Zhang et al., 2020b; Jeong et al., 2021) or federated domain adaptation (Peng et al., 2020; Zhuang et al., 2021b), they still need labels in either the server or clients. This paper focuses on purely unlabeled decentralized data.
37
+
38
+ Federated Unsupervised Learning Learning representations from unlabeled decentralized data while preserving data privacy is still a nascent field. Federated unsupervised representation learning is first proposed by van Berlo et al. (2020) based on autoencoder, but it neglects the non-IID data challenge. Zhang et al. (2020a) address the non-IID issue with potential privacy risk for sharing features. Although Zhuang et al. (2020) address the issue based on BYOL as our FedEMA, they do not shed light on why BYOL works best. Since SSL methods are evolving rapidly and new methods are emerging, we introduce a generalized FedSSL framework and deeply investigate the fundamental components to build up practical guidelines for the generic FedSSL framework.
39
+
40
+ # 3 AN EMPIRICAL STUDY OF FEDERATED SELF-SUPERVISED LEARNING
41
+
42
+ This section first defines the problem and introduces the generalized FedSSL framework. Using the framework, we then conduct empirical studies to reveal deep insights of FedSSL.
43
+
44
+ # 3.1 PROBLEM DEFINITION
45
+
46
+ FedSSL aims to learn a generalized representation $W$ from multiple decentralized parties for downstream tasks in the same scenarios. Each party $k$ contains unlabeled data $\mathcal { D } _ { k } = \{ \mathcal { X } _ { k } \}$ that cannot be transferred to the server or other parties due to privacy constraints. Data is normally non-IID among decentralized parties (Li et al., 2020a); each party could contain only limited data categories (e.g., two out of ten CIFAR-10 classes) (Luo et al., 2019). As a result, each party alone is unable to obtain a good reparties is $\begin{array} { r } { \operatorname* { m i n } _ { w } f ( w ) : = \sum _ { k = 1 } ^ { \bar { K } } \frac { n _ { k } } { n } f _ { k } ( w ) } \end{array}$ 1a). The, where $K$ obal objective function to learis the number of clients, and $\begin{array} { r } { n = \sum _ { k = 1 } ^ { K } { n _ { k } } } \end{array}$ is the total data amount. For client $k$ , $f _ { k } ( w ) : = \mathbb { E } _ { x _ { k } \sim \mathcal { P } _ { k } } [ \tilde { f } _ { k } ( w ; x _ { k } ) ]$ is the expected loss over data distribution $\mathcal { P } _ { k }$ , where $x _ { k }$ is the unlabeled data and $\tilde { f } _ { k } ( w ; x _ { k } )$ is the loss function.
47
+
48
+ # 3.2 GENERALIZED FRAMEWORK
49
+
50
+ We introduce a generalized FedSSL framework that empowers existing SSL methods based on Siamese networks to learn from decentralized data under privacy constraints. Figure 1 depicts the end-to-end training pipeline of the framework. It comprises of three key operations: 1) Local Training in clients; 2) Model Aggregation in the server; 3) Model Communication (upload and update) between the server and clients. We implement and analyze four popular SSL methods — SimCLR (Chen et al., 2020a), MoCo (V1 (He et al., 2020) and V2 (Chen et al., 2020b)), SimSiam (Chen & He, 2021), and BYOL (Grill et al., 2020). Variances in Siamese networks of these methods lead to differences in executions in these three operations 2.
51
+
52
+ Local Training Firstly, each client $k$ conducts self-supervised training on unlabeled data $\mathcal { D } _ { k }$ based on the same global model $W _ { g } ^ { o }$ downloaded from the server. Regardless of SSL methods, clients train with Siamese networks — an online network $W _ { k } ^ { o }$ and a target network $\it { W _ { k } ^ { t } }$ for $E$ local epochs using cooresponding loss functions $\mathcal { L }$ . We classify these SSL methods with two major differences (Figure 8 in Appendix A): 1) Only SimSiam and BYOL contain a predictor in the online network, so we denote their online network $W _ { k } ^ { o } = ( W _ { k } , W _ { k } ^ { p } )$ , where $W _ { k }$ is the online encoder and $\boldsymbol { W } _ { k } ^ { p }$ is the predictor; As for SimCLR and MoCo, $W _ { k } ^ { o } = W _ { k }$ . 2) SimCLR and SimSiam share identical weights between the online encoder and the target encoder, so $W _ { k } ^ { t } \ = \ W _ { k }$ . In contrast, MoCo and BYOL update the target encoder with EMA of the online encoder in every mini-batch: $W _ { k } ^ { t } =$ $m W _ { k } + ( 1 - m ) W _ { k } ^ { t }$ , where $m$ is the momentum value normally set to 0.99.
53
+
54
+ Model Communication After local training, client $k$ uploads the trained online network $W _ { k } ^ { o }$ to the server and updates it with the global model $W _ { g } ^ { o }$ after aggregation. Considering the differences of SSL methods, we upload and update encoders and predictors separately: 1) we upload and update the predictor when it presents in local training; 2) we follow the communication protocol Zhuang et al. (2021a) to upload and update only the online encoder $W _ { k }$ when encoders are different.
55
+
56
+ Model Aggregation When the server receives online networks from clients, it aggregates them to w glob, where odel is th PKk=0 nkn W ok W og = (Wg, W pg ) . n, if predictor presents, otherwiseto clients to update their online $W _ { g } ^ { o } = W _ { g }$ $W _ { g }$ $\tilde { W } _ { g } ^ { o }$ networks. The training iterates these three operations until it meets the stopping conditions. At the end of the training, we use the parameters of $W _ { g } ^ { o }$ as the generic representation $W$ for evaluation.
57
+
58
+ # 3.3 EXPERIMENTAL SETUP
59
+
60
+ We provide basic experimental setups in this section and describe more details in Appendix B.
61
+
62
+ Datasets We conduct experiments using CIFAR-10 and CIFAR-100 datasets (Krizhevsky et al., 2009). To simulate federated settings, we equally split a dataset into $K$ clients. We simulate nonIID data with label heterogeneity, where each client contains limited classes — $l = \{ 2 , 4 , 6 , 8 , 1 0 \}$ number of classes for CIFAR-10 and $l = \{ 2 0 , 4 0 , 6 0 , 8 0 , 1 0 0 \}$ for CIFAR-100. The setting is IID when each client contains 10 (100) classes for CIFAR-10 (CIFAR-100).
63
+
64
+ Implementation Details We implement FedSSL in Python using popular deep learning framework PyTorch (Paszke et al., 2017). To simulate federated learning, we train each client on one NVIDIA V100 GPU. These clients communicate with the server through NCCL backend. We use ResNet-18 (He et al., 2016) as default network for the encoders and present results of ResNet-50 in Appendix C. The predictor is a two-layer multi-layer perceptron (MLP). By default, we train for $R = 1 0 0$ rounds with $K = 5$ clients, $E = 5$ local epoches, batch size $B = 1 2 8$ , learning rate $\eta = 0 . 0 3 2$ with cosine decay, and non-IID data $l = 2$ $\mathit { l } = 2 0$ ) for CIFAR-10 (CIFAR-100).
65
+
66
+ Linear Evaluation We evaluate the quality of representations following linear evaluation (Kolesnikov et al., 2019; Grill et al., 2020) protocol. We first learn representations from the FedSSL framework. Then, we train a new linear classifier on the frozen representations.
67
+
68
+ # 3.4 ALGORITHM COMPARISONS
69
+
70
+ We benchmark and compare the SSL methods using the FedSSL framework. To denote the implementation of an SSL method, We add a prefix Fed to the name of the SSL method. For example, FedBYOL denotes using BYOL in the FedSSL framework.
71
+
72
+ Table 1: Top-1 accuracy comparison of SSL methods using the FedSSL framework on non-IID CIFAR datasets. FedBYOL performs the best, whereas FedSimSiam performs the worst.
73
+
74
+ <table><tr><td>Type</td><td>Method</td><td>CIFAR-10 (%)</td><td>CIFAR-100 (%)</td></tr><tr><td rowspan="3">Contrastive</td><td>FedSimCLR</td><td>78.09± 0.14</td><td>55.58 ± 0.13</td></tr><tr><td>FedMoCoV1</td><td>78.21 ± 0.04</td><td>56.98 ± 0.29</td></tr><tr><td>FedMoCoV2</td><td>79.14 ± 0.13</td><td>57.47 ± 0.65</td></tr><tr><td rowspan="2">Non-contrastive</td><td>FedSimSiam</td><td>76.27 ± 0.18</td><td>48.94 ± 0.22</td></tr><tr><td>FedBYOL</td><td>79.44 ± 0.99</td><td>57.51 ± 0.09</td></tr></table>
75
+
76
+ ![](images/8ebaa67955f5ea651c1ae1d51ec90492eaa17cf5f887f3a4b25620f1c7a2c989.jpg)
77
+ Figure 2: Comparison of non-contrastive FedSSL methods with and without (w/o) predictor (pred) or stop-gradient (stop-grad) on non-IID CIFAR-10 dataset. Without predictor, both FedSimSiam and FedBYOL drops performance on kNN testing accuracy (left plot). Without stop-gradient, FedBYOL retains competitive results on kNN testing accuracy (middle plot) and linear evaluation (right table).
78
+
79
+ Table 1 compares linear evaluation results of these methods under the non-IID setting of CIFAR datasets. On the one hand, contrastive FedSSL methods obtain similar performances. As SimCLR is previously reported to need a large batch size (e.g., $B = 4 0 9 6 ^ { \circ }$ ) (Chen et al., 2020a), it is surprising that FedSimCLR obtains competitive results using the same batch size $B = 1 2 8$ as the others. On the other hand, the results of non-contrastive FedSSL methods have large variances: FedBYOL achieves the best performance, whereas FedSimSiam yields the worst performance. Since SimSiam is capable to learn as powerful representations as BYOL (Chen & He, 2021), as well as considering that noncontrastive methods are conceptually simpler and more efficient (Tian et al., 2021), we focus on non-contrastive methods and further investigate the effects of their fundamental components.
80
+
81
+ # 3.5 IMPACT OF FACTORS OF NON-CONTRASTIVE METHODS
82
+
83
+ This section analyzes the impact of fundamental components of non-contrastive FedSSL methods. From empirical studies, we obtain the following insights: 1) predictor is essential; 2) EMA and stopgradient improves performances; 3) Local encoders should retain local knowledge of the non-IID data; 4) Target encoder should gain knowledge from the online encoder. Details are as followed.
84
+
85
+ Predictor is essential. Figure 2 (left plot) presents the kNN testing accuracy as a monitoring process for FedBYOL and FedSimSiam with and without predictors. Without predictors, both methods can barely learn due to collapse in local training. It affirms the vital role of predictor (Chen & He, 2021; Tian et al., 2021) even when learning from decentralized data.
86
+
87
+ Stop-gradient operation is previously indicated as an essential component for SimSiam and BYOL (Tian et al., 2021), but it is not essential for FedBYOL. Stop-gradient prevents stochastic gradient optimization on the target network. Figure 2 shows that FedSimSiam without stop-gradient collapses, whereas FedBYOL without stop-gradient still achieves competitive performance. It is because online and target encoders are significantly different in FedBYOL as the online encoder is updated by the global encoder every communication round. In contrast, SimSiam or FedSiamSiam share weights between online and target encoders, so removing stop-gradient leads to collapse.
88
+
89
+ Exponential Moving Average (EMA) is not essential, but it helps improve performance. Table 2 (first and second rows) shows that FedBYOL outperforms FedSimSiam at different levels of nonIID data, which is represented by $\{ 2 , 4 , 6 , 8 , 1 0 \}$ classes per client of CIFAR-10. EMA is the main difference between SimSiam and BYOL, indicating that EMA is helpful to improve performance. Based on these results, we further analyze the underlying impact of EMA on the encoders below.
90
+
91
+ Table 2: Top-1 accuracy comparison on various non-IID levels — the number of classes per client on the CIFAR-10 dataset. Update-both means updating both $W _ { k }$ and $\it { W _ { k } ^ { t } }$ with $W _ { g }$ .
92
+
93
+ <table><tr><td rowspan="2">Method</td><td colspan="5"># of classes per client (%)</td></tr><tr><td>2</td><td>4</td><td>6</td><td>8</td><td>10 (iid)</td></tr><tr><td>FedBYOL</td><td>79.44</td><td>82.82</td><td>83.02</td><td>84.57</td><td>84.20</td></tr><tr><td>FedSimSiam</td><td>76.27</td><td>79.34</td><td>80.17</td><td>80.92</td><td>80.50</td></tr><tr><td>FedBYOL,update-both</td><td>74.50</td><td>78.77</td><td>83.02</td><td>84.56</td><td>83.80</td></tr></table>
94
+
95
+ <table><tr><td>FedBYOL</td><td>acc (%)</td></tr><tr><td>w/o EMA</td><td>50.20</td></tr><tr><td>w/o EMA and stop-grad</td><td>11.97</td></tr><tr><td>w/o EMA and stop-grad, update-both</td><td>68.75</td></tr><tr><td>original</td><td>79.44</td></tr></table>
96
+
97
+ ![](images/dd41fed0294801e8527cbe68f366bc34c945f15a2d293b2eed030d8f5ccad7c9.jpg)
98
+ Figure 3: Comparison of FedBYOL without exponential moving average (EMA) and stop-gradient (sg) on the non-IID CIFAR-10 dataset. FedBYOL w/o EMA and sg can hardly learn, but updating both $W _ { k }$ and $\it { W _ { k } ^ { t } }$ with $W _ { g }$ (update-both) enables it to achieve comparable results.
99
+
100
+ Encoders that retain local knowledge of non-IID data helps improve performance. EMA in FedBYOL allows the parameters of the online encoder to be different from the target encoder. As a result, the global encoder only updates the online encoder, not the target encoder. We hypothesize that retaining such local knowledge of data in the target encoder is beneficial especially when the data distribution is highly skewed. For comparison, we remove such local knowledge by updating both online and target encoders with the global model. Table 2 shows that FedBYOL with both encoders updated leads to lower performance than FedBYOL; It achieves results close to FedSimSiam when the data distribution is more skewed (2 or 4 classes per client). These results demonstrate the importance of keeping local knowledge in the encoders. Besides, the results of $\{ 6 , 8 , 1 0 \}$ classes per client also indicate the benefit of EMA.
101
+
102
+ Target encoder is essential to gain knowledge from the online encoder. Figure 3 shows that FedBYOL without EMA can merely learn, and FedBYOL without EMA and stop-gradient (sg) degrades in performance. In both cases, the target encoder is either never updated (w/o EMA) or is updated only through backpropagation (w/o EMA and sg) — not updated by the online encoder. On the other hand, we also identify that FedSSL methods in Table 1, which achieve competitive results, all update target encoders with knowledge of online encoders (the global encoder is the aggregation of the online encoder). We argue that target encoder is crucial to gain knowledge from the online encoder to provide contrastive targets. We further validate it by using the global encoder to update both online and target encoders when removing both EMA and stop-gradient. Figure 3 shows that such method improves performance and achieves comparable results.
103
+
104
+ # 4 DIVERGENCE-AWARE DYNAMIC MOVING AVERAGE UPDATE
105
+
106
+ Built on the FedSSL framework, we propose Federated Divergence-aware EMA update (FedEMA) to further mitigate non-IID data challenges. Since FedBYOL contains all components that help improve performance, we adopt it as the baseline and optimize the model update operation.
107
+
108
+ Non-IID data causes the global model to diverge from centralized training (Zhuang et al., 2021a). Inspired by the insight that retaining local knowledge of non-IID data helps improve performance, we propose to update the online network via EMA of the global network. Compared with FedBYOL that replaces the online network with the global network, FedEMA fuses local and global knowledge effectively through EMA update, where the decay rate of EMA is dynamically measured by model divergences. Figure 4 depicts our proposed FedEMA method. The formulation is as followed:
109
+
110
+ $$
111
+ \begin{array} { r } { W _ { k } ^ { r } = \mu W _ { k } ^ { r - 1 } + ( 1 - \mu ) W _ { g } ^ { r } , } \end{array}
112
+ $$
113
+
114
+ $$
115
+ \begin{array} { r } { W _ { k } ^ { p , r } = \mu W _ { k } ^ { p , r - 1 } + ( 1 - \mu ) W _ { g } ^ { p , r } , } \end{array}
116
+ $$
117
+
118
+ $$
119
+ \mu = \operatorname* { m i n } ( \lambda \left\| W _ { g } ^ { r } - W _ { k } ^ { r - 1 } \right\| , 1 ) ,
120
+ $$
121
+
122
+ where $W _ { k } ^ { r }$ and $W _ { k } ^ { p , r }$ are the online encoder and predictor of client $k$ at training round $r$ ; ${ \boldsymbol { W } _ { g } ^ { r } }$ and $W _ { g _ { . } } ^ { p , r }$ are the global encoder and predictor; $\mu$ is the decay rate, measured by the divergence between global and online encoders; $\lambda$ is a scaler to adjust the level of model divergence, which is measured by calculating the $l _ { 2 }$ -norm of the global and online encoders. We summarize FedEMA in Algorithm 1. FedEMA can be regarded as a generalization of FedBYOL — they are the same when $\lambda = 0$ .
123
+
124
+ Scaler $\lambda$ plays a vital role to adapt FedEMA for different levels of divergence caused by the data. The divergence between global and online encoders varies when the settings of federated learning change. For example, different degrees of non-IID settings would result in different divergences. Since characteristics of data are unknown before training as they are unlabeled, we propose a practical autoscaler to calculate a personalized $\lambda _ { k }$ for each client $k$ automatically. The formula is $\begin{array} { r } { \lambda _ { k } = \frac { \tau } { | | W _ { g } ^ { r + 1 } - W _ { k } ^ { r } | | } } \end{array}$ where $\tau \in [ 0 , \bar { 1 } ]$ is the expected value of $\mu$ at round $r$ . We calculate $\lambda _ { k }$ only once at the earliest round $r$ that client $k$ is sampled for training. When the same set of clients are sampled for training, λk = τ||W 1−W 0|| is calculated at round $r = 1$ .
125
+
126
+ The intuition of FedEMA is to retain more local knowledge when divergence is large and incorporate more global knowledge when divergence is small. When model divergence is large, keeping more local knowledge is more beneficial for the non-IID data. Since the global network is the aggregation of online networks, representing global knowledge from clients. When divergence is small, adapting more global knowledge help improve model generalization. Since model divergence is larger at the start of training (Figure 6), it is practical to choose larger $\tau \in [ 0 . 5 , 1 )$ ; $\tau = 1$ is not considered because only local knowledge is used when $\tau = 1$ . We use $\tau = 0 . 7$ by default in experiments.
127
+
128
+ # Algorithm 1 Our proposed FedEMA
129
+
130
+ 1: ServerExecution: 2: Init $\overline { { W _ { g } ^ { 0 } } }$ and $\overline { { W _ { g } ^ { p , 0 } } }$ , init $\lambda _ { k }$ to be null 3: for each round ${ \bf \bar { \it { r } } } = 0 , 1 , . . . , R$ do 4: $S _ { t } \gets$ (Selection of K clients) 5: for client $k \in S _ { t }$ in parallel do 6: $W _ { k } ^ { r } , W _ { k } ^ { p , r } \gets \mathrm { { C l i e n t } } ( W _ { g } ^ { r } , W _ { g } ^ { p , r } , r , \lambda _ { k } )$ 7: W r+1g ← Pk∈St 8: $\begin{array} { r } { W _ { g } ^ { p , r + 1 } \sum _ { k \in S _ { t } } \frac { n _ { k } } { n } W _ { k } ^ { p , r } } \end{array}$ 9: for client k ∈ St do 10: $\lambda _ { k } \frac { \tau } { | | W _ { g } ^ { r + 1 } - W _ { k } ^ { r } | | }$ if $\lambda _ { k }$ is null 11: Return W R 12: 13: if Client $\lambda _ { k }$ $( W _ { g } ^ { \overline { { { r } } } } , W _ { g } ^ { p , r } , r , \lambda _ { k } ) { : }$ d in $r - 1$ then 14: $W _ { k } , W _ { k } ^ { t } , W _ { k } ^ { p } W _ { g } ^ { r } , W _ { g } ^ { r } , W _ { g } ^ { p , r }$ 15: else 16: $\begin{array} { r l } & { \lceil \mu \operatorname* { m i n } ( \lambda _ { k } W _ { g } ^ { r } - W _ { k } ^ { r - 1 } , 1 ) } \\ & { W _ { k } \mu W _ { k } ^ { r - 1 } + ( 1 - \mu ) W _ { g } ^ { r } } \\ & { W _ { k } ^ { p } \mu W _ { k } ^ { p , r - 1 } + ( 1 - \mu ) W _ { q } ^ { p , r } } \end{array}$ 17: 18: 19: for local epoch $e = 0 , 1 , . . . , E - 1$ do 20: for $b \in B$ data batches with size $B$ do 21: $\begin{array} { r l } & { W _ { k } ^ { o } W _ { k } ^ { o } - \eta \nabla \mathcal { L } _ { W _ { k } ^ { o } , W _ { k } ^ { t } } ( W _ { k } ^ { o } ; b ) } \\ & { W _ { k } ^ { t } m W _ { k } ^ { t } + ( 1 - m ) W _ { k } } \end{array}$ 22: 23: Return $W _ { k } ^ { r }$ , $W _ { k } ^ { p , r }$
131
+
132
+ ![](images/277e2949ea9c2835cd91c7d5575e1baeee23420a28ec2b1bfad5918e9a07ca13.jpg)
133
+ Figure 4: Illustration of our proposed Federated Divergence-aware Exponential Moving Average update (FedEMA). Compared with FedBYOL thof client simply updates the onlinwith the global network work , we $W _ { k } ^ { o }$ $k$ $W _ { g } ^ { o }$ pose to update them via EMA of the global network following Eqn 1 and 2, where the decay rate $\mu$ is dynamically measured the divergences between the online encoder $W _ { k }$ and the global encoder $W _ { g }$ (Eqn 3). The online network, $W _ { k } ^ { o } \ =$ $( W _ { k } , W _ { k } ^ { \tilde { p } } )$ , is the concatenation of the online encoder $W _ { k }$ and the predictor $\boldsymbol { W } _ { k } ^ { p }$ .
134
+
135
+ Table 3: Top-1 accuracy comparison under linear probing on CIFAR datasets. Our proposed FedEMA outperforms all other methods. Full results are in Table 5.
136
+
137
+ <table><tr><td rowspan="2">Method</td><td colspan="2">CIFAR-10 (%)</td><td colspan="2">CIFAR-100 (%)</td></tr><tr><td>IID</td><td>Non-IID</td><td>ID</td><td>Non-IID</td></tr><tr><td>Standalone training</td><td>82.42 ± 0.32</td><td>74.95 ± 0.66</td><td>53.88 ± 2.24</td><td>52.37 ± 0.93</td></tr><tr><td>FedBYOL</td><td>84.29 ± 0.18</td><td>79.44 ± 0.99</td><td>54.24 ± 0.24</td><td>57.51 ± 0.09</td></tr><tr><td>FedU (Zhuang et al., 2021a)</td><td>83.96 ± 0.18</td><td>80.52 ± 0.21</td><td>54.82 ± 0.67</td><td>57.21 ±0.31</td></tr><tr><td>FedEMA (入= 0.8)</td><td>85.59 ±0.25</td><td>82.77 士 0.08</td><td>57.86 ± 0.15</td><td>61.21 ± 0.54</td></tr><tr><td>FedEMA (autoscaler, T = 0.7)</td><td>86.26 ± 0.26</td><td>83.34 士 0.39</td><td>58.55 ±0.34</td><td>61.78 ± 0.14</td></tr><tr><td>BYOL (Centralized)</td><td>90.46 ± 0.34</td><td>-</td><td>65.54 ± 0.47</td><td>1</td></tr></table>
138
+
139
+ Table 4: Top-1 accuracy comparison on $1 \%$ and $10 \%$ of labeled data for semi-supervised learning on non-IID CIFAR datasets. FedEMA outperforms other methods. Full results are in Table 7.
140
+
141
+ <table><tr><td rowspan="2">Method</td><td colspan="2">CIFAR-10 (%)</td><td colspan="2">CIFAR-100 (%)</td></tr><tr><td>1%</td><td>10%</td><td>1%</td><td>10%</td></tr><tr><td>Standalone training</td><td>61.37 ± 0.13</td><td>69.06± 0.24</td><td>21.37± 0.73</td><td>39.99 ± 0.87</td></tr><tr><td>FedBYOL</td><td>70.48 ± 0.30</td><td>76.95 ± 0.46</td><td>30.21 ± 0.40</td><td>47.07 ± 0.14</td></tr><tr><td>FedU (Zhuang et al., 2021a)</td><td>69.52 ± 0.73</td><td>77.06 ± 0.55</td><td>29.00 ± 0.27</td><td>46.67 ± 0.06</td></tr><tr><td>FedEMA (λ= 1)</td><td>72.78 ± 0.66</td><td>79.01 士 0.30</td><td>32.49 士 0.22</td><td>49.82 士 0.36</td></tr><tr><td>FedEMA (autoscaler, T = 0.7)</td><td>73.44 ± 0.22</td><td>79.49 士 0.34</td><td>33.04 士 0.23</td><td>50.48 ± 0.11</td></tr><tr><td>BYOL (Centralized)</td><td>87.67 ± 0.15</td><td>87.89 ±0.05</td><td>40.96 ± 0.58</td><td>56.60 ± 0.33</td></tr></table>
142
+
143
+ # 5 EVALUATION
144
+
145
+ This section follows the experimental setup in Section 3.3 to evaluate FedEMA in the linear evaluation and semi-supervised learning. We also provide ablation studies of important hyperparameters.
146
+
147
+ # 5.1 ALGORITHM COMPARISONS
148
+
149
+ To demonstrate the effectiveness of FedEMA, we compare it with the following methods: 1) standalone training, where a client learns independently using BYOL; 2) FedCA, which is proposed in Zhang et al. (2020a); 3) FedBYOL as the baseline; 4) FedU, which is proposed in (Zhuang et al., 2021a). Besides, we also present results of possible upper bounds that learn representations with centralized data using BYOL.
150
+
151
+ Linear Evaluation Table 3 shows that FedEMA outperforms other methods on different settings of CIFAR datasets. Specifically, the performance is more $3 \%$ higher than existing methods in most settings. Besides, our proposed autoscaler achieves similar results as $\lambda = 0 . 8$ . More experiments on larger number of clients $K$ and random selection of clients are provided in Table 6 in Appendix C.
152
+
153
+ Semi-supervised Learning We also assess the quality of representations following the semisupervised learning protocol (Zhai et al., 2019; Chen et al., 2020a) — we add a new two-layer MLP on top of the encoder and fine-tune the whole model with limited ( $1 \%$ and $10 \%$ ) labeled data for 100 epochs. Table 4 indicates that FedEMA consistently outperforms other methods on non-IID settings of CIFAR datasets and our autoscaler outperforms manual-selected $\lambda = 1$ .
154
+
155
+ # 5.2 ABLATION STUDIES
156
+
157
+ Ablation on FedEMA We analyze whether we need to update both online encoder (Eqn 1) and predictor (Eqn 2) in FedEMA. Figure 5 shows that updating only the encoder or predictor leads to better performance; only updating predictor also leads to faster convergence. Their combination results in the best performance. These results demonstrate the effectiveness of updating both predictor and encoder in FedEMA. More results on other settings are provided in Table 5 in Appendix C.
158
+
159
+ ![](images/e637cc2e85c15a7c7254ccc285e226d19b355c00bb0aa1bfd7f0b93c9bd6d5b4.jpg)
160
+ Figure 5: Ablation studies of FedEMA: applying EMA on either predictor or encoder leads to better performance on CIFAR-10.
161
+ Figure 6: Changes of divergence throughout training.
162
+
163
+ ![](images/986eceee3580d893bd5a06f30d41656d4d300d99cf988aa8fca770295b2bcd17.jpg)
164
+ Figure 7: Ablation study on scaler $\lambda$ , decay rate $\mu$ , and non-IID levels of the CIFAR-10 dataset: (a) analyzes the impact of scaler $\lambda$ on performance; (b) compares using constant $\mu$ on encoder, predictor, or both; (c) studies the impact of different non-IID levels.
165
+
166
+ Changes of Divergence Figure 6 illustrates that the divergence between global encoder and online encoder (Eqn 3) decreases gradually as training proceeds. It validates our intuition that more local knowledge is used at the start of training when divergence is larger. Besides, clients can update at their own pace depending on the divergence caused by their local dataset.
167
+
168
+ Scaler $\lambda$ We study the impact of $\lambda$ with values in [0, 2] with interval of 0.2 in Figure 7a. $\lambda > 1$ leads to a significant performance drop because it results in $\mu = 1$ at the start of training on CIFAR datasets, implying that no aggregated global network is used. When $\lambda \in ( 0 , 1 )$ , the performances are consistently better than FedBYOL $\lambda = 0$ ) as both local and global knowledge are effectively aggregated. These analyses are mainly suitable for our experiment setting. The range values of $\lambda$ depend on the characteristics of data and the hyper-parameters (e.g., local epoch) of FL settings. A practical way to tune $\lambda$ manually is to understand the divergence by running the algorithm for several rounds and choose the $\lambda$ that scales $\mu$ to (0.5, 1). Nevertheless, we recommend using autoscaler and provide ablation study of $\tau$ of autoscaler in Figure 10a in Appendix C.
169
+
170
+ Constant Values of $\mu$ We further demonstrate the necessity of dynamic EMA by comparing with using constant values of $\mu$ in Eqn 1 and 2. Figure 7b shows that a good choice of constant $\mu$ can outperform FedBYOL, but FedEMA outperforms using constant $\mu$ for the online encoder, predictor, or applying both. We also provide results that encoder and predictor use different $\mu$ in Appendix C.
171
+
172
+ Non-IID Level Figure $\mathrm { 7 c }$ compares the performance of different non-IID levels, ranging from 2 to 10 classes per client on the CIFAR-10 dataset. We use autoscaler for these experiments. FedEMA consistently outperforms FedBYOL in these settings.
173
+
174
+ # 6 CONCLUSION
175
+
176
+ We uncover important insights of federated self-supervised learning (FedSSL) from in-depth empirical studies, using a newly introduced generalized FedSSL framework. Inspired by the insights, we propose a new method, Federated Divergence-aware Exponential Moving Average update (FedEMA), to further address the non-IID data challenge. Our experiments and ablations demonstrate that FedEMA outperforms existing methods in a wide range of settings. In the future, we plan to implement FedSSL and FedEMA on larger-scale datasets. We hope that this study will provide useful insights for future research.
177
+
178
+ # 7 REPRODUCIBILITY STATEMENT
179
+
180
+ To facilitate reproducibility of experiment results, we first provide basic experimental setups in Section 3.3, including datasets, implementation details, and evaluation protocols. Then, we describe more experimental details in Appendix B, including datasets, data transformation, network architecture, training details, and default settings. Also, we indicate the settings and hyper-parameters of experiments when their settings are different from the default. Moreover, we plan to open-source the codes in the future.
181
+
182
+ # ACKNOWLEDGMENTS
183
+
184
+ We would like to thank reviewers of ICLR 2022 for their constructive and helpful feedback. This study is in part supported by the RIE2020 Industry Alignment Fund – Industry Collaboration Projects (IAF-ICP) Funding Initiative, as well as cash and in-kind contribution from the industry partner(s); the National Research Foundation, Singapore under its Energy Programme (EP Award NRF2017EWT-EP003-023) administrated by the Energy Market Authority of Singapore, and its Energy Research Test-Bed and Industry Partnership Funding Initiative, part of the Energy Grid (EG) 2.0 programme, and its Central Gap Fund (“Central Gap” Award No. NRF2020NRF-CG001-027); Singapore MOE under its Tier 1 grant call, Reference number RG96/20.
185
+
186
+ # REFERENCES
187
+
188
+ Philip Bachman, R Devon Hjelm, and William Buchwalter. Learning representations by maximizing mutual information across views. In H. Wallach, H. Larochelle, A. Beygelzimer, F. d'Alche-´ Buc, E. Fox, and R. Garnett (eds.), Advances in Neural Information Processing Systems, volume 32. Curran Associates, Inc., 2019. URL https://proceedings.neurips.cc/ paper/2019/file/ddf354219aac374f1d40b7e760ee5bb7-Paper.pdf.
189
+
190
+ Sebastian Caldas, Sai Meher Karthik Duddu, Peter Wu, Tian Li, Jakub Konecnˇ y, H Brendan McMa- \` han, Virginia Smith, and Ameet Talwalkar. Leaf: A benchmark for federated settings. arXiv preprint arXiv:1812.01097, 2018.
191
+
192
+ Ting Chen, Simon Kornblith, Mohammad Norouzi, and Geoffrey Hinton. A simple framework for contrastive learning of visual representations. In International conference on machine learning, pp. 1597–1607. PMLR, 2020a.
193
+
194
+ Xinlei Chen and Kaiming He. Exploring simple siamese representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), pp. 15750– 15758, June 2021.
195
+
196
+ Xinlei Chen, Haoqi Fan, Ross Girshick, and Kaiming He. Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297, 2020b.
197
+
198
+ Bart Custers, Alan M. Sears, Francien Dechesne, Ilina Georgieva, Tommaso Tani, and Simone van der Hof. EU Personal Data Protection in Policy and Practice. Springer, 2019.
199
+
200
+ Carl Doersch, Abhinav Gupta, and Alexei A Efros. Unsupervised visual representation learning by context prediction. In Proceedings of the IEEE international conference on computer vision, pp. 1422–1430, 2015.
201
+
202
+ Spyros Gidaris, Praveer Singh, and Nikos Komodakis. Unsupervised representation learning by predicting image rotations. arXiv preprint arXiv:1803.07728, 2018.
203
+
204
+ Jean-Bastien Grill, Florian Strub, Florent Altche, Corentin Tallec, Pierre Richemond, Elena ´ Buchatskaya, Carl Doersch, Bernardo Avila Pires, Zhaohan Guo, Mohammad Gheshlaghi Azar, Bilal Piot, koray kavukcuoglu, Remi Munos, and Michal Valko. Bootstrap your own latent - a new approach to self-supervised learning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 21271–21284. Curran Associates, Inc., 2020. URL https://proceedings.neurips. cc/paper/2020/file/f3ada80d5c4ee70142b17b8192b2958e-Paper.pdf.
205
+
206
+ Filip Hanzely, Slavom´ır Hanzely, Samuel Horvath, and Peter Richt ´ arik. Lower bounds and optimal ´ algorithms for personalized federated learning. In Advances in Neural Information Processing Systems. Curran Associates, Inc., 2020.
207
+
208
+ 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.
209
+
210
+ 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.
211
+
212
+ Wonyong Jeong, Jaehong Yoon, Eunho Yang, and Sung Ju Hwang. Federated semi-supervised learning with inter-client consistency & disjoint learning. In International Conference on Learning Representations, 2021. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ ce6CFXBh30h.
213
+
214
+ Yilun Jin, Xiguang Wei, Yang Liu, and Qiang Yang. Towards utilizing unlabeled data in federated learning: A survey and prospective. arXiv e-prints, pp. arXiv–2002, 2020a.
215
+
216
+ Yilun Jin, Xiguang Wei, Yang Liu, and Qiang Yang. A survey towards federated semi-supervised learning. arXiv preprint arXiv:2002.11545, 2020b.
217
+
218
+ Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurelien Bellet, Mehdi Bennis, Arjun Nitin ´ Bhagoji, Kallista Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977, 2019.
219
+
220
+ Alexander Kolesnikov, Xiaohua Zhai, and Lucas Beyer. Revisiting self-supervised visual representation learning. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 1920–1929, 2019.
221
+
222
+ Alex Krizhevsky, Geoffrey Hinton, et al. Learning multiple layers of features from tiny images. 2009.
223
+
224
+ Tian Li, Anit Kumar Sahu, Ameet Talwalkar, and Virginia Smith. Federated learning: Challenges, methods, and future directions. IEEE Signal Processing Magazine, 37:50–60, 2020a.
225
+
226
+ Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. Proceedings of Machine Learning and Systems, 2:429–450, 2020b.
227
+
228
+ Ilya Loshchilov and Frank Hutter. SGDR: stochastic gradient descent with warm restarts. In 5th International Conference on Learning Representations, ICLR 2017, Toulon, France, April 24-26, 2017, Conference Track Proceedings, 2017. URL https://openreview.net/forum? id $=$ Skq89Scxx.
229
+
230
+ Jiahuan Luo, Xueyang Wu, Yun Luo, Anbu Huang, Yunfeng Huang, Yang Liu, and Qiang Yang. Real-world image datasets for federated learning. arXiv preprint arXiv:1910.11089, 2019.
231
+
232
+ Yishay Mansour, Mehryar Mohri, Jae Ro, and Ananda Theertha Suresh. Three approaches for personalization with applications to federated learning. arXiv preprint arXiv:2002.10619, 2020.
233
+
234
+ Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. ¨ Communication-efficient learning of deep networks from decentralized data. In Aarti Singh and Xiaojin (Jerry) Zhu (eds.), Proceedings of the 20th International Conference on Artificial Intelligence and Statistics, AISTATS 2017, 20-22 April 2017, Fort Lauderdale, FL, USA, volume 54 of Proceedings of Machine Learning Research, pp. 1273–1282. PMLR, 2017. URL http://proceedings.mlr.press/v54/mcmahan17a.html.
235
+
236
+ Mehdi Noroozi and Paolo Favaro. Unsupervised learning of visual representations by solving jigsaw puzzles. In European conference on computer vision, pp. 69–84. Springer, 2016.
237
+
238
+ Aaron van den Oord, Yazhe Li, and Oriol Vinyals. Representation learning with contrastive predictive coding. arXiv preprint arXiv:1807.03748, 2018.
239
+
240
+ 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. 2017.
241
+
242
+ Deepak Pathak, Philipp Krahenbuhl, Jeff Donahue, Trevor Darrell, and Alexei A Efros. Context encoders: Feature learning by inpainting. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 2536–2544, 2016.
243
+
244
+ Xingchao Peng, Zijun Huang, Yizhe Zhu, and Kate Saenko. Federated adversarial domain adaptation. In International Conference on Learning Representations, 2020. URL https:// openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ HJezF3VYPB.
245
+
246
+ Alysa Ziying Tan, Han Yu, Lizhen Cui, and Qiang Yang. Towards personalized federated learning. arXiv preprint arXiv:2103.00710, 2021.
247
+
248
+ Yuandong Tian, Xinlei Chen, and Surya Ganguli. Understanding self-supervised learning dynamics without contrastive pairs. In Marina Meila and Tong Zhang (eds.), Proceedings of the 38th International Conference on Machine Learning, volume 139 of Proceedings of Machine Learning Research, pp. 10268–10278. PMLR, 18–24 Jul 2021. URL https://proceedings.mlr. press/v139/tian21a.html.
249
+
250
+ Bram van Berlo, Aaqib Saeed, and Tanir Ozcelebi. Towards federated unsupervised representation learning. In Proceedings of the Third ACM International Workshop on Edge Systems, Analytics and Networking, pp. 31–36, 2020.
251
+
252
+ Hongyi Wang, Mikhail Yurochkin, Yuekai Sun, Dimitris Papailiopoulos, and Yasaman Khazaeni. Federated learning with matched averaging. In International Conference on Learning Representations, 2020. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ BkluqlSFDS.
253
+
254
+ Zhirong Wu, Yuanjun Xiong, Stella X Yu, and Dahua Lin. Unsupervised feature learning via nonparametric instance discrimination. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 3733–3742, 2018.
255
+
256
+ Xi Yan, David Acuna, and Sanja Fidler. Neural data server: A large-scale search engine for transfer learning data. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 3893–3902, 2020.
257
+
258
+ yuyang deng, Mohammad Mahdi Kamani, and Mehrdad Mahdavi. Adaptive personalized federated learning, 2021. URL https://openreview.net/forum?id $=$ g0a-XYjpQ7r.
259
+
260
+ Xiaohua Zhai, Avital Oliver, Alexander Kolesnikov, and Lucas Beyer. S4l: Self-supervised semisupervised learning. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 1476–1485, 2019.
261
+
262
+ Fengda Zhang, Kun Kuang, Zhaoyang You, Tao Shen, Jun Xiao, Yin Zhang, Chao Wu, Yueting Zhuang, and Xiaolin Li. Federated unsupervised representation learning. arXiv preprint arXiv:2010.08982, 2020a.
263
+
264
+ Richard Zhang, Phillip Isola, and Alexei A Efros. Colorful image colorization. In European conference on computer vision, pp. 649–666. Springer, 2016.
265
+
266
+ Zhengming Zhang, Zhewei Yao, Yaoqing Yang, Yujun Yan, Joseph E Gonzalez, and Michael W Mahoney. Benchmarking semi-supervised federated learning. arXiv preprint arXiv:2008.11364, 17, 2020b.
267
+
268
+ Yue Zhao, Meng Li, Liangzhen Lai, Naveen Suda, Damon Civin, and Vikas Chandra. Federated learning with non-iid data. CoRR, abs/1806.00582, 2018. URL http://arxiv.org/abs/ 1806.00582.
269
+
270
+ Weiming Zhuang, Yonggang Wen, Xuesen Zhang, Xin Gan, Daiying Yin, Dongzhan Zhou, Shuai Zhang, and Shuai Yi. Performance optimization of federated person re-identification via benchmark analysis. In Proceedings of the 28th ACM International Conference on Multimedia, pp. 955–963, 2020.
271
+
272
+ Weiming Zhuang, Xin Gan, Yonggang Wen, Shuai Zhang, and Shuai Yi. Collaborative unsupervised visual representation learning from decentralized data. In Proceedings of the IEEE/CVF International Conference on Computer Vision, pp. 4912–4921, 2021a.
273
+
274
+ Weiming Zhuang, Xin Gan, Yonggang Wen, Xuesen Zhang, Shuai Zhang, and Shuai Yi. Towards unsupervised domain adaptation for deep face recognition under privacy constraints via federated learning. arXiv preprint arXiv:2105.07606, 2021b.
275
+
276
+ Weiming Zhuang, Yonggang Wen, and Shuai Zhang. Joint optimization in edge-cloud continuum for federated unsupervised person re-identification. In Proceedings of the 29th ACM International Conference on Multimedia, pp. 433–441, 2021c.
277
+
278
+ Weiming Zhuang, Xin Gan, Yonggang Wen, and Shuai Zhang. Easyfl: A low-code federated learning platform for dummies. IEEE Internet of Things Journal, 2022.
279
+
280
+ # A DIFFERENCES OF SELF-SUPERVISED LEARNING METHODS
281
+
282
+ We study four SSL methods using the FedSSL framework in Section 3. These four SSL methods have two major differences that impact the executions of local training, model communication, and model aggregation. Figure 8 depicts these differences: 1) BYOL and SimSiam have predictors, whereas MoCo and SimCLR do not have them; 2) SimSiam and SimCLR share weights between two encoders, whereas BYOL and MoCo have different parameters for the online and target encoders.
283
+
284
+ ![](images/3ba946997c7b80318927296d0f860084b7591d1d2472857ef99c7bc51adef84f.jpg)
285
+ Figure 8: Illustration of differences among four Self-supervised Learning (SSL) methods.
286
+
287
+ # B EXPERIMENTAL DETAILS
288
+
289
+ In this section, we provide more details about the dataset, network architecture, and training and evaluation setups.
290
+
291
+ # B.1 DATA
292
+
293
+ Datasets CIFAR-10 and CIFAR-100 are two popular image datasets (Krizhevsky et al., 2009). Both datasets consist of 50,000 training images and 10,000 testing images. CIFAR-10 contains 10 classes, where each class has 5,000 training images and 1,000 testing images. While CIFAR-100 contains 100 classes, where each class has 500 training images and 100 testing images. To simulate federated learning, we equally split the training set into $K$ clients. We simulate non-IID data using label heterogeneity — data among clients is more skewed when each client contains less number of classes. Hence, we simulate different levels of non-IID data with $l$ number of classes per client, where $l = \{ 2 , 4 , 6 , 8 , 1 0 \}$ for CIFAR-10 and $l = \{ 2 0 , 4 0 , 6 0 , 8 0 , 1 0 0 \}$ for CIFAR-100. For example, when simulating 5 clients with $l = 4$ classes per client in CIFAR-10, we need $5 \times 4 = 2 0$ total sets of data over 10 classes. Thus, we split the training images of each class equally into two sets (2,500 images in each set) and assign random four sets without overlapping classes to a client. The setting is IID when each client contains all classes of a dataset. By default, we run experiments with $K = 5$ clients with non-IID setting $l = 2$ classes per client for CIFAR-10 dataset and $l = 2 0$ classes per client for CIFAR-100 dataset.
294
+
295
+ Transformation In local training of the FedSSL framework, we take two augmentations of each image as the inputs for online and target networks, respectively. We obtain the augmentations by transforming the images with a set of transformations: For SimCLR, BYOL, SimSiam, and MoCoV2, we adopt the transformations from Chen et al. (2020a); For MoCoV1, we use the transformation described in its paper (He et al., 2020).
296
+
297
+ Table 5: Top-1 accuracy comparison under linear evaluation protocol on CIFAR datasets. Our proposed FedEMA outperforms all other methods on non-IID settings.
298
+
299
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">Architecture</td><td rowspan="2">Param.</td><td colspan="2">CIFAR-10 (%)</td><td colspan="2">CIFAR-100 (%)</td></tr><tr><td>ID</td><td>Non-IID</td><td>IID</td><td>Non-IID</td></tr><tr><td>Standalone training</td><td>ResNet-18</td><td>11M</td><td>82.42</td><td>74.95</td><td>53.88</td><td>52.37</td></tr><tr><td>FedSimCLR</td><td>ResNet-18</td><td>11M</td><td>82.15</td><td>78.09</td><td>56.39</td><td>55.58</td></tr><tr><td>FedMoCoV1</td><td>ResNet-18</td><td>11M</td><td>83.63</td><td>78.21</td><td>59.58</td><td>56.98</td></tr><tr><td>FedMoCoV2</td><td>ResNet-18</td><td>11M</td><td>84.25</td><td>79.14</td><td>58.71</td><td>57.47</td></tr><tr><td>FedSimSiam</td><td>ResNet-18</td><td>11M</td><td>81.46</td><td>76.27</td><td>49.92</td><td>48.94</td></tr><tr><td>FedBYOL</td><td>ResNet-18</td><td>11M</td><td>84.29</td><td>79.44</td><td>54.24</td><td>57.51</td></tr><tr><td>FedU (Zhuang et al., 2021a)</td><td>ResNet-18</td><td>11M</td><td>83.96</td><td>80.52</td><td>54.82</td><td>57.21</td></tr><tr><td>FedEMA predictor only (ours)</td><td>ResNet-18</td><td>11M</td><td>84.97</td><td>81.13</td><td>55.52</td><td>57.53</td></tr><tr><td>FedEMA encoder only (ours)</td><td>ResNet-18</td><td>11M</td><td>82.88</td><td>82.39</td><td>56.06</td><td>59.74</td></tr><tr><td>FedEMA (λ= 0.8)</td><td>ResNet-18</td><td>11M</td><td>85.59</td><td>82.77</td><td>57.86</td><td>61.21</td></tr><tr><td>FedEMA (autoscaler,T = 0.7)</td><td>ResNet-18</td><td>11M</td><td>86.26</td><td>83.34</td><td>58.55</td><td>61.78</td></tr><tr><td>Standalone training</td><td>ResNet-50</td><td>23M</td><td>83.16</td><td>77.84</td><td>57.21</td><td>55.16</td></tr><tr><td>FedSimCLR</td><td>ResNet-50</td><td>23M</td><td>82.24</td><td>80.37</td><td>57.46</td><td>56.88</td></tr><tr><td>FedMoCoV1</td><td>ResNet-50</td><td>23M</td><td>87.19</td><td>82.18</td><td>64.74</td><td>59.73</td></tr><tr><td>FedMoCoV2</td><td>ResNet-50</td><td>23M</td><td>87.19</td><td>79.62</td><td>63.75</td><td>59.52</td></tr><tr><td>FedSimSiam</td><td>ResNet-50</td><td>23M</td><td>79.64</td><td>76.7</td><td>46.28</td><td>48.8</td></tr><tr><td>FedBYOL</td><td>ResNet-50</td><td>23M</td><td>83.90</td><td>81.33</td><td>57.75</td><td> 59.53</td></tr><tr><td>FedCA (Zhang et al., 2020a)</td><td>ResNet-50</td><td>23M</td><td>71.25</td><td>68.01</td><td>43.30</td><td>42.34</td></tr><tr><td>FedU (Zhuang et al., 2021a)</td><td>ResNet-50</td><td>23M</td><td>86.48</td><td>83.25</td><td>59.51</td><td>61.94</td></tr><tr><td>FedEMA predictor only (ours)</td><td>ResNet-50</td><td>23M</td><td>83.66</td><td>81.78</td><td>57.79</td><td>60.11</td></tr><tr><td>FedEMA encoder only (ours)</td><td>ResNet-50</td><td>23M</td><td>84.66</td><td>84.91</td><td>58.52</td><td>62.51</td></tr><tr><td>FedEMA (入= 0.8)</td><td>ResNet-50</td><td>23M</td><td>86.12</td><td>85.29</td><td>60.96</td><td> 62.53</td></tr><tr><td>FedEMA (autoscaler, T = 0.7)</td><td>ResNet-50</td><td>23M</td><td>85.08</td><td>84.31</td><td>59.48</td><td>62.77</td></tr><tr><td>BYOL (Centralized)</td><td>ResNet-18</td><td>11M</td><td>90.46</td><td>-</td><td>65.54</td><td>-</td></tr><tr><td>BYOL (Centralized)</td><td>ResNet-50</td><td>23M</td><td>91.85</td><td>1</td><td>66.51</td><td>=</td></tr></table>
300
+
301
+ Table 6: Top-1 accuracy comparison on larger numbers of clients with client subsampling: 1) randomly selecting 5 out of 20 clients per round (5/20); 2) randomly selecting 8 out of 80 clients per round (8/80). FedEMA, trained with autoscaler, consistently outperforms FedBYOL in both settings.
302
+
303
+ <table><tr><td rowspan="3">Method</td><td colspan="4">5/20 clients (%)</td><td colspan="4">8/80 clients (%)</td></tr><tr><td colspan="2">CIFAR-10</td><td colspan="2">CIFAR-100</td><td colspan="2">CIFAR-10</td><td colspan="2">CIFAR-100</td></tr><tr><td>IID</td><td>Non-IID</td><td>IID</td><td>Non-IID</td><td>ID</td><td>Non-IID</td><td>IID</td><td>Non-IID</td></tr><tr><td>FedBYOL</td><td>83.25</td><td>74.92</td><td>49.49</td><td>47.09</td><td>73.58</td><td>63.28</td><td>41.19</td><td>41.58</td></tr><tr><td>FedEMA (ours)</td><td>84.98</td><td>75.77</td><td>55.41</td><td>52.78</td><td>73.96</td><td>64.19</td><td>41.97</td><td>43.05</td></tr></table>
304
+
305
+ # B.2 NETWORK ARCHITECTURE
306
+
307
+ Predictor The network architecture of the predictor is a two-layer multilayer perceptron (MLP). The two-layer MLP starts from a fully connected layer with 4096 neurons. Followed by onedimension batch normalization and a ReLU activation function, it ends with another fully connected layer with 2048 neurons.
308
+
309
+ Encoder We use ResNet-18 He et al. (2016) as the default network architecture of the encoder in the majority of experiments. Besides, we also provide results of ResNet-50 in Table 5 and 7.
310
+
311
+ Table 7: Top-1 accuracy comparison on using $1 \%$ and $10 \%$ of labeled data for semi-supervised learning on the non-IID settings of CIFAR datasets. FedEMA outperforms all other methods.
312
+
313
+ <table><tr><td rowspan="2">Method</td><td rowspan="2">Architecture</td><td rowspan="2">Param.</td><td colspan="2">CIFAR-10 (%)</td><td colspan="2">CIFAR-100 (%)</td></tr><tr><td>1%</td><td>10%</td><td>1%</td><td>10%</td></tr><tr><td>Standalone training</td><td>ResNet-18</td><td>11M</td><td>61.37</td><td>69.06</td><td>21.37</td><td>39.99</td></tr><tr><td>FedSimCLR</td><td>ResNet-18</td><td>11M</td><td>63.79</td><td>73.49</td><td>21.55</td><td>41.90</td></tr><tr><td>FedMoCoV1</td><td>ResNet-18</td><td>11M</td><td>60.57</td><td>73.95</td><td>21.83</td><td>43.49</td></tr><tr><td>FedMoCoV2</td><td>ResNet-18</td><td>11M</td><td>62.89</td><td>73.65</td><td>26.93</td><td>45.27</td></tr><tr><td>FedSimSiam</td><td>ResNet-18</td><td>11M</td><td>67.57</td><td>74.96</td><td>25.13</td><td>41.96</td></tr><tr><td>FedBYOL</td><td>ResNet-18</td><td>11M</td><td>70.48</td><td>76.95</td><td>30.21</td><td>47.07</td></tr><tr><td>FedU (Zhuang et al., 2021a)</td><td>ResNet-18</td><td>11M</td><td>69.52</td><td>77.06</td><td>29.00</td><td>46.67</td></tr><tr><td>FedEMA (λ= 1)</td><td>ResNet-18</td><td>11M</td><td>72.78</td><td>79.01</td><td>32.49</td><td>49.82</td></tr><tr><td>FedEMA (autoscaler, T = 0.7)</td><td>ResNet-18</td><td>11M</td><td>73.44</td><td>79.49</td><td>33.04</td><td>50.48</td></tr><tr><td>Standalone training</td><td>ResNet-50</td><td>23M</td><td>63.65</td><td>74.30</td><td>23.18</td><td>41.43</td></tr><tr><td>FedSimCLR</td><td>ResNet-50</td><td>23M</td><td>63.00</td><td>73.56</td><td>19.30</td><td>41.13</td></tr><tr><td>FedMoCoV1</td><td>ResNet-50</td><td>23M</td><td>61.85</td><td>75.53</td><td>22.12</td><td>46.43</td></tr><tr><td>FedMoCoV2</td><td>ResNet-50</td><td>23M</td><td>64.25</td><td>73.96</td><td>25.79</td><td>42.52</td></tr><tr><td>FedSimSiam</td><td>ResNet-50</td><td>23M</td><td>61.46</td><td>15.25</td><td>16.03</td><td>29.76</td></tr><tr><td>FedBYOL</td><td>ResNet-50</td><td>23M</td><td>69.99</td><td>76.69</td><td>26.57</td><td>45.46</td></tr><tr><td>FedCA (Zhang et al., 2020a)</td><td>ResNet-50</td><td>23M</td><td>28.50</td><td>36.28</td><td>16.48</td><td>22.46</td></tr><tr><td>FedU (Zhuang et al., 2021a)</td><td>ResNet-50</td><td>23M</td><td>69.76</td><td>80.25</td><td>28.42</td><td>48.42</td></tr><tr><td>FedEMA(λ=1)</td><td>ResNet-50</td><td>23M</td><td>74.64</td><td>81.48</td><td>31.42</td><td>49.92</td></tr><tr><td>FedEMA (autoscaler,T = 0.7)</td><td>ResNet-50</td><td>23M</td><td>72.52</td><td>80.68</td><td>29.68</td><td>50.75</td></tr><tr><td>BYOL (Centralized)</td><td>ResNet-18</td><td>11M</td><td>87.67</td><td>87.89</td><td>40.96</td><td>56.60</td></tr><tr><td>BYOL (Centralized)</td><td>ResNet-50</td><td>23M</td><td>89.07</td><td>89.66</td><td>41.49</td><td>60.23</td></tr></table>
314
+
315
+ Table 8: Top-1 accuracy comparison on various non-IID levels — the number of classes per client on the CIFAR-100 dataset. Update-both means updating both $W _ { k }$ and $\it { W _ { k } ^ { t } }$ with $W _ { g }$ .
316
+
317
+ <table><tr><td rowspan="2">Method</td><td colspan="5"># of classes per client (%)</td></tr><tr><td>2</td><td>4</td><td>6</td><td>8</td><td>10 (iid)</td></tr><tr><td>FedBYOL</td><td>57.51</td><td>56.96</td><td>55.14</td><td>54.96</td><td>54.24</td></tr><tr><td>FedSimSiam</td><td>48.94</td><td>51.08</td><td>49.05</td><td>48.09</td><td>49.92</td></tr><tr><td>FedBYOL,update-both</td><td>49.53</td><td>54.17</td><td>51.50</td><td>52.70</td><td>53.41</td></tr></table>
318
+
319
+ Our ResNet architecture differs from the implementation in PyTorch (Paszke et al., 2017) in three aspects: 1) We use kernel size $3 \times 3$ for the first convolution layer instead of $7 \times 7$ ; 2) We use an average pooling layer with kernel size $4 \times 4$ before the last linear layer instead of adaptive average pooling layer; 3) We replace the last linear layer with a two-layer MLP. The network architecture of the MLP is the same as the predictor.
320
+
321
+ # B.3 TRAINING AND EVALUATION DETAILS
322
+
323
+ We implement FedSSL in Python using EasyFL (Zhuang et al., 2022), an easy-to-use federated learning platform based on PyTorch (Paszke et al., 2017). The following are the details of training and evaluation.
324
+
325
+ Training We use Stochastic Gradient Descent (SGD) as the optimizer in training. We use $\eta =$ 0.032 as the initial learning rate and decay the learning with a cosine annealing (Loshchilov & Hutter, 2017), which is also used in SimSiam. By default, we train $R = 1 0 0$ rounds with local epochs $E = 5$ and batch size $B = 1 2 8$ using $K = 5$ clients. We simulate training of $K$ clients on $K$ NVIDIA V100 GPUs and employ the PyTorch Paszke et al. (2017) communication backend (NCCL) for communications between clients and the server. If not specified, we use $\lambda = 1$ by default or autoscaler with $\tau = 0 . 7$ for FedEMA. As for experiments of FedU, we follow the hyperparameters described in paper (Zhuang et al., 2021a).
326
+
327
+ Table 9: Comparison of FedBYOL without exponential moving average (EMA) and stop-gradient (sg) on the CIFAR datasets. FedBYOL w/o EMA and sg can hardly learn, but updating both $W _ { k }$ and $\it { W } _ { k } ^ { t }$ with $W _ { g }$ (update-both) enables it to achieve comparable results.
328
+
329
+ <table><tr><td rowspan="2">Method</td><td colspan="2">CIFAR-10 (%)</td><td colspan="2">CIFAR-100 (%)</td></tr><tr><td>IID</td><td>Non-IID</td><td>ID</td><td>Non-IID</td></tr><tr><td>FedBYOL w/o EMA</td><td>54.11</td><td>50.20</td><td>23.82</td><td>25.83</td></tr><tr><td>FedBYOL w/o EMA and stop-grad</td><td>21.21</td><td>11.97</td><td>3.74</td><td>2.79</td></tr><tr><td>FedBYOL w/o EMA and stop-grad, update-both</td><td>82.29</td><td>68.75</td><td>48.74</td><td>41.91</td></tr><tr><td>FedBYOL</td><td>84.29</td><td>79.44</td><td>54.24</td><td>57.51</td></tr></table>
330
+
331
+ ![](images/b13ea0defe96a9bb69e14ba92eee55471f6b9bb7c8b312ee491d045c98aa1cfe.jpg)
332
+
333
+ Figure 9: Comparison of FedBYOL and FedEMA on various total training rounds $R$ on the non-IID setting of the CIFAR-10 dataset. FedEMA consistently outperforms FedBYOL.
334
+
335
+ <table><tr><td rowspan="2">Method</td><td colspan="4">Rounds R(%)</td></tr><tr><td>100</td><td>200</td><td>300</td><td>400</td></tr><tr><td>FedBYOL</td><td>79.08</td><td>82.23</td><td>83.77</td><td>86.09</td></tr><tr><td>FedEMA (ours)</td><td>80.78</td><td>82.41</td><td>84.08</td><td>86.51</td></tr></table>
336
+
337
+ Cross-silo FL vs Cross-device FL This paper primarily focuses on cross-silo FL where clients are stateful with high availability. Clients can cache local models and carry these local states from round to round. Extensive experiments demonstrate that FedEMA achieves the best performance under this setting. On the other hand, cross-device FL assumes there are millions of stateless clients that might participate in training just once. Due to the constraints of experimental settings, the majority of studies conduct experiments with at most hundreds of clients (Wang et al., 2020; Jeong et al., 2021). FedEMA can work under such experimental settings by caching the states of clients in the server. When the number of clients scales to millions, FedEMA degrades to FedBYOL that updates both encoders — without keeping any local states.
338
+
339
+ Evalaution We assess the quality of learned representations using linear evaluation (Kolesnikov et al., 2019; Grill et al., 2020) and semi-supervised learning (Zhai et al., 2019; Chen et al., 2020a) protocols. We first obtain a trained encoder (or learned representations) using full training set for linear evaluation and $9 9 \%$ or $90 \%$ of the training set for semi-supervised learning (excluding the $1 \%$ or $10 \%$ for fine-tuning). Then, we conduct evaluations based on the trained encoder. For linear evaluation, we train a new fully connected layer on top of the frozen trained encoder (fixed parameters) for 200 epochs, using batch size 512 and Adam optimizer with learning rate 3e-3. For semi-supervised learning, we add a new two-layer MLP on top of the trained encoder and fine-tune the whole model using $1 \%$ or $10 \%$ of data for 100 epochs, using batch size 128 and Adam optimizer with learning rate 1e-3. In both evaluation protocols, we remove the two-layer MLP of the encoder by replacing it with an identity function.
340
+
341
+ # C ADDITIONAL EXPERIMENTAL RESULTS AND ANALYSIS
342
+
343
+ In this section, we provide more experimental results of algorithm comparisons and further analyze FedEMA in different data amounts, training rounds $R$ , and batch sizes $B$ .
344
+
345
+ ![](images/ec3b12032d19f8d255a149edbe78cc9e08ec8b88d341a75b7343d16b5f24e206.jpg)
346
+ Figure 10: Ablation study on $\tau$ for autoscaler and combinations of constant $\mu$ : (a) analyzes the impact of $\tau$ on performances; 2) presents top-1 accuracy of using different combinations of constant $\mu _ { o }$ on the online encoder and constant $\mu _ { p }$ on the predictor.
347
+
348
+ Table 10: Top-1 accuracy comparison on various batch sizes $B$ on the non-IID setting of CIFAR-10 dataset. The batch size should not be either too small or too large. Besides, FedEMA outperforms FedBYOL.
349
+
350
+ <table><tr><td rowspan="2">Method</td><td colspan="6">Batch Sizes B (%)</td></tr><tr><td>16</td><td>32</td><td>64</td><td>128</td><td>256</td><td>512</td></tr><tr><td>FedBYOL</td><td>68.74</td><td>72.90</td><td>78.58</td><td>79.44</td><td>79.80</td><td>77.74</td></tr><tr><td>FedEMA (ours)</td><td>74.03</td><td>79.06</td><td>82.18</td><td>83.34</td><td>82.19</td><td>80.51</td></tr></table>
351
+
352
+ # C.1 MORE EXPERIMENTAL RESULTS
353
+
354
+ Table 5 presents top-1 accuracy comparison under linear evaluation of a wide range of methods on CIFAR datasets using both ResNet-18 and ResNet-50. It supplements the algorithm comparisons in Section 3.4 and 5.1. Interestingly, FedMoCoV1 achieves good performances on IID settings of CIFAR-100 dataset. Since decentralized data are mostly non-IID, we focus more on the non-IID setting. FedEMA outperforms all the other methods in non-IID settings of CIFAR datasets. We use $\lambda = 0 . 8$ when using ResNet-18 and $\lambda = 1$ when using ResNet-50.
355
+
356
+ Table 6 shows results of scaling to larger numbers of clients $K$ with subsampling clients in each training round. We run two sets of experiments: 1) randomly selecting 5 out of 20 clients in each round with local epoch $E = 5$ and total rounds $R = 4 0 0 ; 2 \AA$ ) randomly selecting 8 out of 80 clients in each round with local epoch $E = 2$ and total rounds $R = 8 0 0$ . We run FedEMA with autoscaler. FedEMA consistently outperforms FedBYOL with both encoders updated. We conduct these experiments using ResNet-18.
357
+
358
+ Table 7 supplements the semi-supervised learning results on Table 4, providing additional results using ResNet-50 as the network architecture for the encoder. FedEMA consistently outperforms all the other methods.
359
+
360
+ Besides, Table 8 and 9 compare FedSimSiam, FedBYOL, and variances of FedBYOL to further demonstrate the insights from empirical studies. They supplement results in Table 2 and Figure 3.
361
+
362
+ # C.2 FURTHER ANALYSIS
363
+
364
+ $\tau$ for Autoscaler We analyze the impact of $\tau$ on performances in Figure 10a. Generally, using autoscaler with $\tau \in ( 0 , 1 )$ is better than FedBYOL $\mathit { \Omega } ^ { ' } \tau = 0$ ). The performance of $\tau = 1$ yields worse results because only local knowledge are used in model update (the global knowledge is neglected) as discussed in Section 4. Besides, performances of $\tau \in [ 0 . 5 , 1 )$ are generally better other values, which verifies our intuition discussed in Section 4. These results also show that we can achieve even higher performance on the CIFAR-100 dataset on Table 3 by tunning $\tau$ . We run experiments on non-IID settings using ResNet-18.
365
+
366
+ Table 11: Comparison of needed communication rounds to reach target accuracy using different local epochs $E$ on the non-IID setting of the CIFAR-10 dataset. $E = 1$ is unable to reach $80 \%$ in 100 rounds. A larger $E$ can reduce communication costs by increasing the computation cost.
367
+
368
+ <table><tr><td rowspan="2">Target accuracy</td><td colspan="4">Communiation (rounds)</td><td colspan="4">Computation (epochs)</td></tr><tr><td>E=1</td><td>E=5</td><td>E=10</td><td>E=20</td><td>E=1</td><td>E=5</td><td>E=10</td><td>E=20</td></tr><tr><td>70%</td><td>90</td><td>40</td><td>10</td><td>8</td><td>90</td><td>200</td><td>100</td><td>160</td></tr><tr><td>80%</td><td>1</td><td>80</td><td>50</td><td>40</td><td>1</td><td>400</td><td>500</td><td>800</td></tr></table>
369
+
370
+ Table 12: Top-1 accuracy comparison of various data amounts in clients and different numbers of clients. Increasing the number of clients does not improve performance, whereas increasing the data amount of clients results in better performance.
371
+
372
+ <table><tr><td># of clients</td><td colspan="4">K=5</td><td>K= 10</td><td>K= 20</td></tr><tr><td>Data amount</td><td>10%</td><td>25%</td><td>50%</td><td>100%</td><td>50%</td><td>25%</td></tr><tr><td>FedBYOL</td><td>43.27</td><td>65.14</td><td>76.11</td><td>78.25</td><td>75.10</td><td>63.95</td></tr><tr><td>FedEMA (ours)</td><td>44.33</td><td>67.46</td><td>79.49</td><td>82.54</td><td>79.20</td><td>66.61</td></tr></table>
373
+
374
+ Constant $\mu$ To further illustrate the effectiveness of our dynamic EMA, we provide results of using different combinations of constant $\mu _ { o }$ on the online encoder and constant $\mu _ { p }$ on the predictor in Figure 10b. The results of $\mu _ { o } = 0 . 9$ and $\mu _ { p } = 0 . 9$ is only $5 4 . 5 2 \%$ , which is far lower than the others. Among these combinations, $\mu _ { o } = 0 . 5$ and $\mu _ { p } = 0 . 3$ achieve the best performance. It suggests that better performances may be achieved if we can construct different dynamic $\mu$ for the encoder and the predictor, while we leave this interesting insight for future exploration. Although good choices of constant $\mu _ { o }$ and $\mu _ { p }$ achieve better performance than FedBYOL, FedEMA consistently outperforms all these methods. These results complement Figure 7b in the main manuscript.
375
+
376
+ Impact of Training Rounds $R$ Figure 9 compares FedBYOL and FedEMA with increasing number of training (communication) rounds $R$ . Performances of both FedBYOL and FedEMA increases as training proceeds and FedEMA consistently outperforms FedBYOL. We run these experiments with $\lambda = 0 . 5$ for FedEMA on the non-IID setting of CIFAR-10 dataset.
377
+
378
+ Impact of Batch Size $B$ We investigate the impact of batch size in Table 10. The performances of batch size $B = 1 2 8$ and $B = 2 5 6$ are similar, outperforming the other batch sizes. It indicates that the batch size should not be either too small or too large. Besides, FedEMA outperforms FedBYOL in all batch sizes. We run the experiments with autoscaler $\tau = 0 . 7$ ) on the non-IID setting of the CIFAR-10 dataset.
379
+
380
+ Communication vs Computation Cost Table 11 shows the needed communication rounds and computation epochs to reach a target accuracy using different local epochs $E$ with FedEMA. Increasing $E$ reduces communication cost as the needed rounds decrease, but it generally requires a higher computation cost. For example, compared with $E = 5$ that needs 80 rounds to reach $80 \%$ with 400 epochs of computation, $E = 2 0$ only uses 40 rounds but needs 800 epochs computation cost. These results indicate the trade-off between communication cost and computation cost.
381
+
382
+ Data Amount Table 12 shows that increasing the data amount improves the performance significantly. By default, we split the CIFAR-10 dataset into 5 clients, each client contains 10,000 training images, denoting as $100 \%$ data amount. As a result, $p \%$ data amount means that each client contains $1 0 , 0 0 0 * p \%$ images. For example, $2 5 \%$ data amount means that each client contains 2,500 images. With lesser data points in each client, we can construct more clients to conduct training as the total data amount is fixed. Table 12 shows that when the data amount is same in clients, increasing the number of clients in each training round do not improve performance. However, increasing the data amount in each client increases the performance significantly. These results indicate that it is important for clients to have sufficient data to participate in training in FedSSL.
parse/dev/oVE1z8NlNe/oVE1z8NlNe_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/oVE1z8NlNe/oVE1z8NlNe_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/oVE1z8NlNe/oVE1z8NlNe_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/r-6Z1SJbCpv/r-6Z1SJbCpv_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/w4cXZDDib1H/w4cXZDDib1H.md ADDED
@@ -0,0 +1,419 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # VIDT: AN EFFICIENT AND EFFECTIVEFULLY TRANSFORMER-BASED OBJECT DETECTOR
2
+
3
+ Hwanjun $\mathbf { S o n g ^ { 1 } }$ , Deqing $\mathbf { S u n ^ { 2 } }$ , Sanghyuk $\mathbf { C h u n ^ { 1 } }$ , Varun Jampani2, Dongyoon $\mathbf { H a n } ^ { 1 }$ , Byeongho $\mathbf { H e o ^ { 1 } }$ , Wonjae $\mathbf { K i m ^ { 1 } }$ , Ming-Hsuan Yang2,3,4 1NAVER AI Lab 2Google Research 3University of California at Merced 4Yonsei University {hwanjun.song, sanghyuk.c, dongyoon.han, bh.heo, wonjae.kim}@navercorp.com {deqingsun, varunjampani}@google.com, mhyang@ucmerced.edu
4
+
5
+ # ABSTRACT
6
+
7
+ Transformers are transforming the landscape of computer vision, especially for recognition tasks. Detection transformers are the first fully end-to-end learning systems for object detection, while vision transformers are the first fully transformer-based architecture for image classification. In this paper, we integrate Vision and Detection Transformers (ViDT) to build an effective and efficient object detector. ViDT introduces a reconfigured attention module to extend the recent Swin Transformer to be a standalone object detector, followed by a computationally efficient transformer decoder that exploits multi-scale features and auxiliary techniques essential to boost the detection performance without much increase in computational load. Extensive evaluation results on the Microsoft COCO benchmark dataset demonstrate that ViDT obtains the best AP and latency trade-off among existing fully transformer-based object detectors, and achieves 49.2AP owing to its high scalability for large models. We release the code and trained models at https://github.com/naver-ai/vidt.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Object detection is the task of predicting both bounding boxes and object classes for each object of interest in an image. Modern deep object detectors heavily rely on meticulously designed components, such as anchor generation and non-maximum suppression (Papageorgiou & Poggio, 2000; Liu et al., 2020). As a result, the performance of these object detectors depend on specific postprocessing steps, which involve complex pipelines and make fully end-to-end training difficult.
12
+
13
+ Motivated by the recent success of Transformers (Vaswani et al., 2017) in NLP, numerous studies introduce Transformers into computer vision tasks. Carion et al. (2020) proposed Detection Transformers (DETR) to eliminate the meticulously designed components by employing a simple transformer encoder and decoder architecture, which serves as a neck component to bridge a CNN body for feature extraction and a detector head for prediction. Thus, DETR enables end-to-end training of deep object detectors. By contrast, Dosovitskiy et al. (2021) showed that a fully-transformer backbone without any convolutional layers, Vision Transformer (ViT), achieves the state-of-theart results in image classification benchmarks. Approaches like ViT have been shown to learn effective representation models without strong human inductive biases, e.g., meticulously designed components in object detection (DETR), locality-aware designs such as convolutional layers and pooling mechanisms. However, there is a lack of effort to synergize DETR and ViT for a better object detection architecture. In this paper, we integrate both approaches to build a fully transformer-based, end-to-end object detector that achieves state-of-the-art performance without increasing computational load.
14
+
15
+ A straightforward integration of DETR and ViT can be achieved by replacing the ResNet backbone (body) of DETR with ViT – Figure 2(a). This naive integration, DETR $( \mathbf { V i T } ) ^ { 1 }$ , has two limitations. First, the canonical ViT suffers from the quadratic increase in complexity w.r.t. image size, resulting in the lack of scalability. Furthermore, the attention operation at the transformer encoder and decoder (i.e., the “neck” component) adds significant computational overhead to the detector. Therefore, the naive integration of DETR and ViT show very high latency – the blue lines of Figure 1.
16
+
17
+ ![](images/059d1196dc7dfcb83c9a1b75faca6fd415d53377ba29adcb296e066152a41ac6.jpg)
18
+ Figure 1. AP and latency (milliseconds) summarized in Table 2. The text in the plot indicates the backbone model size.
19
+
20
+ ![](images/375d191b536070f8a3a8178cba0c583e66368c02cc34cf98f0f2561dca4d763f.jpg)
21
+ Figure 2. Pipelines of fully transformer-based object detectors. DETR (ViT) means Detection Transformer that uses ViT as its body. The proposed ViDT synergizes DETR (ViT) and YOLOS and achieves best AP and latency trade-off among fully transformer-based object detectors.
22
+
23
+ Recently, Fang et al. (2021) propose an extension of ViT to object detection, named YOLOS, by appending the detection tokens [DET] to the patch tokens [PATCH] (Figure 2(b)), where [DET] tokens are learnable embeddings to specify different objects to detect. YOLOS is a neck-free architecture and removes the additional computational costs from the neck encoder. However, YOLOS shows limited performance because it cannot use additional optimization techniques on the neck architecture, e.g., multi-scale features and auxiliary loss. In addition, YOLOS can only accommodate the canonical transformer due to its architectural limitation, resulting in a quadratic complexity w.r.t. the input size.
24
+
25
+ In this paper, we propose a novel integration of Vision and Detection Transformers (ViDT) (Figure 2(c)). Our contributions are three-folds. First, ViDT introduces a modified attention mechanism, named Reconfigured Attention Module (RAM), that facilitates any ViT variant to handle the appended [DET] and [PATCH] tokens for object detection. Thus, we can modify the latest Swin Transformer (Liu et al., 2021) backbone with RAM to be an object detector and obtain high scalability using its local attention mechanism with linear complexity. Second, ViDT adopts a lightweight encoder-free neck architecture to reduce the computational overhead while still enabling the additional optimization techniques on the neck module. Note that the neck encoder is unnecessary because RAM directly extracts fine-grained representation for object detection, i.e., [DET] tokens. As a result, ViDT obtains better performance than neck-free counterparts. Finally, we introduce a new concept of token matching for knowledge distillation, which brings additional performance gains from a large model to a small model without compromising detection efficiency.
26
+
27
+ ViDT has two architectural advantages over existing approaches. First, similar to YOLOS, ViDT takes [DET] tokens as the additional input, maintaining a fixed scale for object detection, but constructs hierarchical representations starting with small-sized image patches for [PATCH] tokens. Second, ViDT can use the hierarchical (multi-scale) features and additional techniques without a significant computation overhead. Therefore, as a fully transformer-based object detector, ViDT facilitates better integration of vision and detection transformers. Extensive experiments on Microsoft COCO benchmark (Lin et al., 2014) show that ViDT is highly scalable even for large ViT models, such as Swin-base with 0.1 billion parameters, and achieves the best AP and latency trade-off.
28
+
29
+ # 2 PRELIMINARIES
30
+
31
+ Vision transformers process an image as a sequence of small-sized image patches, thereby allowing all the positions in the image to interact in attention operations (i.e., global attention). However, the canonical ViT (Dosovitskiy et al., 2021) is not compatible with a broad range of vision tasks due to its high computational complexity, which increases quadratically with respect to image size. The Swin Transformer (Liu et al., 2021) resolves the complexity issue by introducing the notion of shifted windows that support local attention and patch reduction operations, thereby improving compatibility for dense prediction task such as object detection. A few approaches use vision transformers as detector backbones but achieve limited success (Heo et al., 2021; Fang et al., 2021).
32
+
33
+ Detection transformers eliminate the meticulously designed components (e.g., anchor generation and non-maximum suppression) by combining convolutional network backbones and Transformer encoder-decoders. While the canonical DETR (Carion et al., 2020) achieves high detection performance, it suffers from very slow convergence compared to previous detectors. For example, DETR requires 500 epochs while the conventional Faster R-CNN (Ren et al., 2015) training needs only 37 epochs (Wu et al., 2019). To mitigate the issue, Zhu et al. (2021) propose Deformable DETR which introduces deformable attention for utilizing multi-scale features as well as expediting the slow training convergence of DETR. In this paper, we use the Deformable DETR as our base detection transformer framework and integrate it with the recent vision transformers.
34
+
35
+ DETR (ViT) is a straightforward integration of DETR and ViT, which uses ViT as a feature extractor, followed by the transformer encoder-decoder in DETR. As illustrated in Figure 2(a), it is a body–neck–head structure; the representation of input [PATCH] tokens are extracted by the ViT backbone and then directly fed to the transformer-based encoding and decoding pipeline. To predict multiple objects, a fixed number of learnable [DET] tokens are provided as additional input to the decoder. Subsequently, output embeddings by the decoder produce final predictions through the detection heads for classification and box regression. Since DETR (ViT) does not modify the backbone at all, it can be flexibly changed to any latest ViT model, e.g., Swin Transformer. Additionally, its neck decoder facilitates the aggregation of multi-scale features and the use of additional techniques, which help detect objects of different sizes and speed up training (Zhu et al., 2021). However, the attention operation at the neck encoder adds significant computational overhead to the detector. In contrast, ViDT resolves this issue by directly extracting fine-grained [DET] features from Swin Transformer with RAM without maintaining the transformer encoder in the neck architecture.
36
+
37
+ YOLOS (Fang et al., 2021) is a canonical ViT architecture for object detection with minimal modifications. As illustrated in Figure 2(b), YOLOS achieves a neck-free structure by appending randomly initialized learnable [DET] tokens to the sequence of input [PATCH] tokens. Since all the embeddings for [PATCH] and [DET] tokens interact via global attention, the final [DET] tokens are generated by the fine-tuned ViT backbone and then directly generate predictions through the detection heads without requiring any neck layer. While the naive DETR (ViT) suffers from the computational overhead from the neck layer, YOLOS enjoys efficient computations by treating the [DET] tokens as additional input for ViT. YOLOS shows that 2D object detection can be accomplished in a pure sequence-to-sequence manner, but this solution entails two inherent limitations:
38
+
39
+ 1) YOLOS inherits the drawback of the canonical ViT; the high computational complexity attributed to the global attention operation. As illustrated in Figure 1, YOLOS shows very poor latency compared with other fully transformer-based detectors, especially when its model size becomes larger, i.e., small base. Thus, YOLOS is not scalable for the large model. 2) YOLOS cannot benefit from using additional techniques essential for better performance, e.g., multi-scale features, due to the absence of the neck layer. Although YOLOS used the same DeiT backbone with Deformable DETR (DeiT), its AP was lower than the straightforward integration.
40
+
41
+ In contrast, the encoder-free neck architecture of ViDT enjoys the additional optimization techniques from Zhu et al. (2021), resulting in the faster convergence and the better performance. Further, our RAM enables to combine Swin Transformer and the sequence-to-sequence paradigm for detection.
42
+
43
+ # 3 VIDT: VISION AND DETECTION TRANSFORMERS
44
+
45
+ ViDT first reconfigures the attention model of Swin Transformer to support standalone object detection while fully reusing the parameters of Swin Transformer. Next, it incorporates an encoder-free neck layer to exploit multi-scale features and two essential techniques: auxiliary decoding loss and iterative box refinement. We further introduce knowledge distillation with token matching to benefit from large ViDT models.
46
+
47
+ # 3.1 RECONFIGURED ATTENTION MODULE
48
+
49
+ Applying patch reduction and local attention scheme of Swin Transformer to the sequence-tosequence paradigm is challenging because (1) the number of [DET] tokens must be maintained at a fixed-scale and (2) the lack of locality between [DET] tokens. To address this challenge, we introduce a reconfigured attention module (RAM)2 that decomposes a single global attention associated with [PATCH] and [DET] tokens into the three different attention, namely $\mathrm { \Delta \left[ P A T C H \right] \times \left[ P A T C H \right] }$ , [DET] × [DET], and $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ attention. Based on the decomposition, the efficient schemes of Swin Transformer are applied only to $\mathrm { \Delta \left[ P A T C H \right] \times \Delta \left[ P A T C H \right] }$ attention, which is the heaviest part in computational complexity, without breaking the two constraints on [DET] tokens. As illustrated in Figure 3, these modifications fully reuse all the parameters of Swin Transformer by sharing projection layers for [DET] and [PATCH] tokens, and perform the three different attention operations:
50
+
51
+ ![](images/bd29e6d21a76e855027a6673eeaa73de483b453e50afbe9f85867120dc343a1e.jpg)
52
+ Figure 3. Reconfigured Attention Module (Q: query, K: key, V: value). The skip connection and feedforward networks following the attention operation is omitted just for ease of exposition.
53
+
54
+ $\mathrm { \Delta \left[ P A T C H \right] \times \left[ P A T C H \right] }$ Attention: The initial [PATCH] tokens are progressively calibrated across the attention layers such that they aggregate the key contents in the global feature map (i.e., spatial form of [PATCH] tokens) according to the attention weights, which are computed by hquery, keyi pairs. For $[ \mathrm { P A T C H } ] \times [ \mathrm { P A T C H } ]$ attention, Swin Transformer performs local attention on each window partition, but its shifted window partitioning in successive blocks bridges the windows of the preceding layer, providing connections among partitions to capture global information. Without modifying this concept, we use the same policy to generate hierarchical [PATCH] tokens. Thus, the number of [PATCH] tokens is reduced by a factor of 4 at each stage; the resolution of feature maps decreases from $H / 4 \times W / 4$ to $H / 3 2 \times W / 3 2$ over a total of four stages, where $H$ and $W$ denote the width and height of the input image, respectively.
55
+
56
+ • $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ Attention: Like YOLOS, we append one hundred learnable [DET] tokens as the additional input to the [PATCH] tokens. As the number of [DET] tokens specifies the number of objects to detect, their number must be maintained with a fixed-scale over the transformer layers. In addition, [DET] tokens do not have any locality unlike the [PATCH] tokens. Hence, for $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention, we perform global self-attention while maintaining the number of them; this attention helps each [DET] token to localize a different object by capturing the relationship between them.
57
+
58
+ • $[ \mathrm { D E T } ] \times \left[ \mathrm { P A T C H } \right]$ Attention: This is cross-attention between [DET] and [PATCH] tokens, which produces an object embedding per [DET] token. For each [DET] token, the key contents in [PATCH] tokens are aggregated to represent the target object. Since the [DET] tokens specify different objects, it produces different object embeddings for diverse objects in the image. Without the crossattention, it is infeasible to realize the standalone object detector. As shown in Figure 3, ViDT binds $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ and $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ attention to process them at once to increase efficiency.
59
+
60
+ We replace all the attention modules in Swin Transformer with the proposed RAM, which receives [PATCH] and [DET] tokens (as shown in “Body” of Figure 2(c)) and then outputs their calibrated new tokens by performing the three different attention operations in parallel.
61
+
62
+ Positional Encoding. ViDT adopts different positional encodings for different types of attention. For $\mathrm { [ P A T C H ] } \times \mathrm { [ P A T C H ] }$ attention, we use the relative position bias (Hu et al., 2019) originally used in Swin Transformer. In contrast, the learnable positional encoding is added for [DET] tokens for $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention because there is no particular order between [DET] tokens. However, for $[ \mathrm { D E T } ] \times \left[ \mathrm { P A T C H } \right]$ attention, it is crucial to inject spatial bias to the [PATCH] tokens due to the permutation-equivariant in transformers, ignoring spatial information of the feature map. Thus, ViDT adds the sinusoidalbased spatial positional encoding to the feature map, which is reconstructed from the [PATCH] tokens for $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ attention, as can be seen from the left side of Figure 3. We present a thorough analysis of various spatial positional encodings in Section 4.2.1.
63
+
64
+ Use of $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ Attention. Applying cross-attention between [DET] and [PATCH] tokens adds additional computational overhead to Swin Transformer, especially when it is activated at the bottom layer due to the large number of [PATCH] tokens. To minimize such computational overhead, ViDT only activates the cross-attention at the last stage (the top level of the pyramid) of Swin Transformer, which consists of two transformer layers that receives [PATCH] tokens of size $H / 3 2 \times W / 3 2$ .
65
+
66
+ Thus, only self-attention for [DET] and [PATCH] tokens are performed for the remaining stages except the last one. In Section 4.2.2 we show that this design choice helps achieve the highest FPS, while achieving similar detection performance as when cross-attention is enabled at every stage. We provide more details on RAM including its complexity analysis and algorithmic design in Appendix A.
67
+
68
+ # 3.2 ENCODER-FREE NECK STRUCTURE
69
+
70
+ To exploit multi-scale feature maps, ViDT incorporates a decoder of multi-layer deformable transformers (Zhu et al., 2021). In the DETR family (Figure 2(a)), a transformer encoder is required at the neck to transform features extracted from the backbone for image classification into the ones suitable for object detection; the encoder is generally computationally expensive since it involves $\mathrm { \Delta \left[ P A T C H \right] \times \Delta \left[ P A T C H \right] }$ attention. However, ViDT maintains only a transformer decoder as its neck, in that Swin Transformer with RAM directly extracts fine-grained features suitable for object detection as a standalone object detector. Thus, the neck structure of ViDT is computationally efficient.
71
+
72
+ The decoder receives two inputs from Swin Transformer with RAM: (1) [PATCH] tokens generated from each stage (i.e., four multi-scale feature maps, $\{ { \pmb x } ^ { l } \} _ { l = 1 } ^ { L }$ where $L = 4$ ) and (2) [DET] tokens generated from the last stage. The overview is illustrated in “Neck” of Figure 2(c). In each deformable transformer layer, $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention is performed first. For each [DET] token, multi-scale deformable attention is applied to produce a new [DET] token, aggregating a small set of key contents sampled from the multi-scale feature maps $\{ \mathbf { } x ^ { l } \} _ { l = 1 } ^ { L }$ ,
73
+
74
+ $$
75
+ \mathrm { M S D e f o r m A t t n } ( [ \mathbb { D } \mathbb { E } \mathbb { T } ] , \{ \pmb { x } ^ { l } \} _ { l = 1 } ^ { L } ) = \sum _ { m = 1 } ^ { M } { W _ { m } } \bigg [ \sum _ { l = 1 } ^ { L } \sum _ { k = 1 } ^ { K } A _ { m l k } \cdot { W _ { m } ^ { \prime } } { x } ^ { l } \big ( \phi _ { l } ( p ) + \Delta p _ { m l k } \big ) \bigg ] ,
76
+ $$
77
+
78
+ where $m$ indices the attention head and $K$ is the total number of sampled keys for content aggregation. In addition, $\phi _ { l } ( \pmb { p } )$ is the reference point of the [DET] token re-scaled for the $l$ -th level feature map, while $\Delta p _ { m l k }$ is the sampling offset for deformable attention; and $A _ { m l k }$ is the attention weights of the $K$ sampled contents. $W _ { m }$ and $W _ { m } ^ { \prime }$ are the projection matrices for multi-head attention.
79
+
80
+ Auxiliary Techniques for Additional Improvements. The decoder of ViDT follows the standard structure of multi-layer transformers, generating refined [DET] tokens at each layer. Hence, ViDT leverages the two auxiliary techniques used in (Deformable) DETR for additional improvements:
81
+
82
+ • Auxiliary Decoding Loss: Detection heads consisting of two feedforward networks (FNNs) for box regression and classification are attached to every decoding layer. All the training losses from detection heads at different scales are added to train the model. This helps the model output the correct number of objects without non-maximum suppression (Carion et al., 2020). Iterative Box Refinement: Each decoding layer refines the bounding boxes based on predictions from the detection head in the previous layer. Therefore, the box regression process progressively improves through the decoding layers (Zhu et al., 2021).
83
+
84
+ These two techniques are essential for transformer-based object detectors because they significantly enhance detection performance without compromising detection efficiency. We provide an ablation study of their effectiveness for object detection in Section 4.3.1.
85
+
86
+ # 3.3 KNOWLEDGE DISTILLATION WITH TOKEN MATCHING FOR OBJECT DETECTION
87
+
88
+ While a large model has a high capacity to achieve high performance, it can be computationally expensive for practical use. As such, we additionally present a simple knowledge distillation approach that can transfer knowledge from the large ViDT model by token matching. Based on the fact that all ViDT models has exactly the same number of [PATCH] and [DET] tokens regardless of their scale, a small ViDT model (a student model) can easily benefit from a pre-trained large ViDT (a teacher model) by matching its tokens with those of the large one, thereby bringing out higher detection performance at a lower computational cost.
89
+
90
+ Matching all the tokens at every layer is very inefficient in training. Thus, we only match the tokens contributing the most to prediction. The two sets of tokens are directly related: $( 1 ) \mathcal { P }$ : the set of [PATCH] tokens used as multi-scale feature maps, which are generated from each stage in the body, and $( 2 ) D$ : the set of [DET] tokens, which are generated from each decoding layer in the neck. Accordingly, the distillation loss based on token matching is formulated by
91
+
92
+ $$
93
+ \ell _ { d i s } ( \mathcal { P } _ { s } , \mathcal { D } _ { s } , \mathcal { P } _ { t } , \mathcal { D } _ { t } ) = \lambda _ { d i s } \Big ( \frac { 1 } { | \mathcal { P } _ { s } | } \sum _ { i = 1 } ^ { | \mathcal { P } _ { s } | } \Big \| \mathcal { P } _ { s } [ i ] - \mathcal { P } _ { t } [ i ] \Big \| _ { 2 } + \frac { 1 } { | \mathcal { D } _ { s } | } \sum _ { i = 1 } ^ { | \mathcal { D } _ { s } | } \Big \| \mathcal { D } _ { s } [ i ] - \mathcal { D } _ { t } [ i ] \Big \| _ { 2 } \Big ) ,
94
+ $$
95
+
96
+ <table><tr><td rowspan=1 colspan=1>Backbone</td><td rowspan=1 colspan=1>Type (Size)</td><td rowspan=1 colspan=1>Train Data</td><td rowspan=1 colspan=1>Epochs</td><td rowspan=1 colspan=1>Resolution</td><td rowspan=1 colspan=1>Params</td><td rowspan=1 colspan=1>ImageNet Acc.</td></tr><tr><td rowspan=1 colspan=1>DeiT</td><td rowspan=1 colspan=1>DeiT-tiny ()DeiT-small()DeiT-base()</td><td rowspan=1 colspan=1>ImageNet-1KImageNet-1KImageNet-1K</td><td rowspan=1 colspan=1>300300300</td><td rowspan=1 colspan=1>224224384</td><td rowspan=1 colspan=1>6M22M87M</td><td rowspan=1 colspan=1>74.581.285.2</td></tr><tr><td rowspan=1 colspan=1>SwinTransformer</td><td rowspan=1 colspan=1>Swin-nanoSwin-tinySwin-smallSwin-base</td><td rowspan=1 colspan=1>ImageNet-1KImageNet-1KImageNet-1KImageNet-22K</td><td rowspan=1 colspan=1>30030030090</td><td rowspan=1 colspan=1>224224224224</td><td rowspan=1 colspan=1>6M28M50M88M</td><td rowspan=1 colspan=1>74.981.283.286.3</td></tr></table>
97
+
98
+ Table 1. Summary on the ViT backbone. $\because \frac { \partial } { \partial x } ^ { , }$ is the distillation strategy for classification (Touvron et al., 2021).
99
+
100
+ where the subscripts $s$ and $t$ refer to the student and teacher model. $\mathcal { P } [ i ]$ and $\mathcal { D } [ i ]$ return the $i$ -th [PATCH] and [DET] tokens, $n$ -dimensional vectors, belonging to $\mathcal { P }$ and $\mathcal { D }$ , respectively. $\lambda _ { d i s }$ is the coefficient to determine the strength of $\ell _ { d i s }$ , which is added to the detection loss if activated.
101
+
102
+ # 4 EVALUATION
103
+
104
+ In this section, we show that ViDT achieves the best trade-off between accuracy and speed (Section 4.1). Then, we conduct detailed ablation study of the reconfigured attention module (Section 4.2) and additional techniques to boost detection performance (Section 4.3). Finally, we provide a complete analysis of all components available for ViDT (Section 4.4).
105
+
106
+ Dataset. We carry out object detection experiments on the Microsoft COCO 2017 benchmark dataset (Lin et al., 2014). All the fully transformer-based object detectors are trained on 118K training images and tested on 5K validation images following the literature (Carion et al., 2020).
107
+
108
+ Algorithms. We compare ViDT with two existing fully transformer-based object detection pipelines, namely DETR (ViT) and YOLOS. Since DETR (ViT) follows the general pipeline of (Deformable) DETR by replacing its ResNet backbone with other ViT variants; hence, we use one canonical ViT and one latest ViT variant, DeiT and Swin Transformer, as its backbone without any modification. In contrast, YOLOS is the canonical ViT architecture, thus only DeiT is available. Table 1 summarizes all the ViT models pre-trained on ImageNet used for evaluation. Note that publicly available pretrained models are used except for Swin-nano. We newly configure Swin-nano3 comparable to DeiTtiny, which is trained on ImageNet with the identical setting. Overall, with respect to the number of parameters, Deit-tiny, -small, and -base are comparable to Swin-nano, -tiny, and -base, respectively. Please see Appendix B.2 for the detailed pipeline of compared detectors.
109
+
110
+ Implementation Details. All the algorithms are implemented using PyTorch and executed using eight NVIDIA Tesla V100 GPUs. We train ViDT using AdamW (Loshchilov & Hutter, 2019) with the same initial learning rate of $1 0 ^ { - 4 }$ for its body, neck and head. In contrast, following the (Deformable) DETR setting, DETR (ViT) is trained with the initial learning rate of $1 0 ^ { - 5 }$ for its pretrained body (ViT backbone) and $1 0 ^ { - 4 }$ for its neck and head. YOLOS and ViDT (w.o. Neck) are trained with the same initial learning rate of $5 \times 1 0 ^ { - 5 }$ , which is the original setting of YOLOS for the neck-free detector. We do not change any hyperparameters used in transformer encoder and decoder for (Deformable) DETR; thus, the neck decoder of ViDT also consists of six deformable transformer layers using exactly the same hyperparameters. The only new hyperparameter introduced, the distillation coefficient $\lambda _ { d i s }$ in Eq. (2), is set to be 4. For fair comparison, knowledge distillation is not applied for ViDT in the main experiment in Section 4.1. The efficacy of knowledge distillation with token matching is verified independently in Section 4.3.2. Auxiliary decoding loss and iterative box refinement are applied to the compared methods if applicable.
111
+
112
+ Regarding the resolution of input images, we use scale augmentation that resizes them such that the shortest side is at least 480 and at most 800 pixels while the longest at most 1333 (Wu et al., 2019). More details of the experiment configuration can be found in Appendix B.3–B.5. All the source code and trained models will be made available to the public at https://github.com/naver-ai/vidt.
113
+
114
+ # 4.1 MAIN EXPERIMENTS WITH MICROSOFT COCO BENCHMARK
115
+
116
+ Table 2 compares ViDT with DETR (ViT) and YOLOS w.r.t their AP, FPS, # parameters, where the two variants of DETR (ViT) are simply named DETR and Deformable DETR. We report the result of ViDT without using knowledge distillation for fair comparison. A summary plot is provided in Figure 1. The experimental comparisons with CNN backbones are provided in Appendix C.1.
117
+
118
+ <table><tr><td>Method</td><td>Backbone</td><td>Epochs</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td><td>Param.</td><td>FPS</td></tr><tr><td rowspan="6">DETR</td><td rowspan="6">DeiT-tiny DeiT-small DeiT-base</td><td>50 50</td><td>30.0 32.4</td><td>49.2 52.5</td><td>30.5 33.2</td><td>9.9</td><td>30.8</td><td>50.6</td><td>24M</td><td>10.9 (13.1)</td></tr><tr><td></td><td></td><td></td><td></td><td>11.3</td><td>33.5</td><td>53.7</td><td>39M</td><td>7.8 (8.8)</td></tr><tr><td>50</td><td>37.1</td><td>59.2</td><td>38.4</td><td>14.7</td><td>39.4</td><td>52.9</td><td>0.1B</td><td>4.3(4.9)</td></tr><tr><td>Swin-nano 50</td><td>27.8</td><td>47.5</td><td>27.4</td><td>9.0</td><td>29.2</td><td>44.9</td><td>24M</td><td>24.7 (46.1)</td></tr><tr><td>Swin-tiny 50</td><td>34.1</td><td>55.1</td><td>35.3</td><td>12.7</td><td>35.9</td><td>54.2</td><td>45M</td><td>19.3 (28.1)</td></tr><tr><td>Swin-small 50 Swin-base</td><td>37.6</td><td>59.0</td><td>39.0</td><td>15.9</td><td>40.1</td><td>58.9</td><td>66M</td><td>13.5 (17.7)</td></tr><tr><td rowspan="6">Deformable DETR</td><td></td><td>50</td><td>40.7</td><td>62.9</td><td>42.7</td><td>18.3</td><td>44.1</td><td>62.4</td><td>0.1B</td><td>9.7 (12.6)</td></tr><tr><td>DeiT-tiny DeiT-small</td><td>50 50</td><td>40.8 43.6</td><td>60.1 63.7</td><td>43.6</td><td>21.4</td><td>43.4</td><td>58.2</td><td>18M 35M</td><td>12.4 (16.3)</td></tr><tr><td>DeiT-base</td><td>50</td><td>46.4</td><td></td><td>46.5</td><td>23.3</td><td>47.1</td><td>62.1</td><td></td><td>8.5 (10.2)</td></tr><tr><td>Swin-nano</td><td>50</td><td>43.1</td><td>67.3 61.4</td><td>49.4 46.3</td><td>26.7</td><td>50.1</td><td>65.4</td><td>0.1B</td><td>4.4(5.3)</td></tr><tr><td>Swin-tiny</td><td>50</td><td>47.0</td><td>66.8</td><td>50.8</td><td>25.9 28.1</td><td>45.2 49.8</td><td>59.4 63.9</td><td>18M 39M</td><td>7.0 (7.8)</td></tr><tr><td>Swin-small</td><td>50</td><td>49.0</td><td>68.9</td><td>52.9</td><td>30.3</td><td>52.8</td><td>66.6</td><td>60M</td><td>6.3 (7.0) 5.5 (6.1)</td></tr><tr><td rowspan="4">YOLOS</td><td>Swin-base</td><td>50</td><td>51.4</td><td>71.7</td><td>56.2</td><td>34.5</td><td>55.1</td><td>67.5</td><td>0.1B</td><td>4.8 (5.4)</td></tr><tr><td>DeiT-tiny</td><td>150</td><td>30.4</td><td>48.6</td><td>31.1</td><td>12.4</td><td>31.8</td><td>48.2</td><td>6M</td><td>28.1 (31.3)</td></tr><tr><td>DeiT-small</td><td>150</td><td>36.1</td><td>55.7</td><td>37.6</td><td>15.6</td><td>38.4</td><td>55.3</td><td>30M</td><td>9.3 (11.8)</td></tr><tr><td>DeiT-base</td><td>150</td><td>42.0</td><td>62.2</td><td>44.5</td><td>19.5</td><td>45.3</td><td>62.1</td><td>0.1B</td><td>3.9 (5.4)</td></tr><tr><td rowspan="4">ViDT (w.0. Neck)</td><td>Swin-nano</td><td>150</td><td>28.7</td><td>48.6</td><td>28.5</td><td>12.3</td><td>30.7</td><td>44.1</td><td>7M</td><td>36.5 (64.4)</td></tr><tr><td>Swin-tiny</td><td>150</td><td>36.3</td><td>56.3</td><td>37.8</td><td>16.4</td><td>39.0</td><td>54.3</td><td>29M</td><td>28.6 (32.1)</td></tr><tr><td>Swin-small</td><td>150</td><td>41.6</td><td>62.7</td><td>43.9</td><td>20.1</td><td>45.4</td><td>59.8</td><td>52M</td><td>16.8 (18.8)</td></tr><tr><td>Swin-base</td><td>150</td><td>43.2</td><td>64.2</td><td>45.9</td><td>21.9</td><td>46.9</td><td>63.2</td><td>91M</td><td>11.5 (12.5)</td></tr><tr><td rowspan="4">ViDT</td><td>Swin-nano</td><td>50</td><td>40.4</td><td>59.6</td><td></td><td></td><td>42.5</td><td>55.8</td><td>16M</td><td>20.0 (45.8)</td></tr><tr><td>Swin-tiny</td><td>50</td><td>44.8</td><td>64.5</td><td>43.3 48.7</td><td>23.2 25.9</td><td>47.6</td><td>62.1</td><td>38M</td><td>17.2 (26.5)</td></tr><tr><td>Swin-small</td><td>50</td><td>47.5</td><td>67.7</td><td>51.4</td><td>29.2</td><td>50.7</td><td>64.8</td><td>61M</td><td>12.1 (16.5)</td></tr><tr><td>Swin-base</td><td>50</td><td>49.2</td><td>69.4</td><td>53.1</td><td>30.6</td><td>52.6</td><td>66.9</td><td>0.1B</td><td>9.0 (11.6)</td></tr></table>
119
+
120
+ Table 2. Comparison of ViDT with other compared detectors on COCO2017 val set. Two neck-free detectors, YOLOS and ViDT (w.o. Neck) are trained for 150 epochs due to the slow convergence. FPS is measured with batch size 1 of $8 0 0 \times 1 3 3 3$ resolution on a single Tesla V100 GPU, where the value inside the parentheses is measured with batch size 4 of the same resolution to maximize GPU utilization.
121
+
122
+ Highlights. ViDT achieves the best trade-off between AP and FPS. With its high scalability, it performs well even for Swin-base of 0.1 billion parameters, which is $2 \mathbf { x }$ faster than Deformable DETR with similar AP. Besides, ViDT shows 40.4AP only with 16M parameters; it is 6.3–12.6AP higher than those of DETR (swin-nano) and DETR (swin-tiny), which exhibit similar FPS of 19.3–24.7.
123
+
124
+ ViDT vs. Deformable DETR. Thanks to the use of multi-scale features, Deformable DETR exhibits high detection performance in general. Nevertheless, its encoder and decoder structure in the neck becomes a critical bottleneck in computation. In particular, the encoder with multi-layer deformable transformers adds considerable overhead to transform multi-scale features by attention. Thus, it shows very low FPS although it achieves higher AP with a relatively small number of parameters. In contrast, ViDT removes the need for a transformer encoder in the neck by using Swin Transformer with RAM as its body, directly extracting multi-scale features suitable for object detection.
125
+
126
+ ViDT (w.o. Neck) vs. YOLOS. For the comparison with YOLOS, we train ViDT without using its neck component. These two neck-free detectors show relatively low AP compared with other detectors in general. In terms of speed, YOLOS exhibits much lower FPS than ViDT (w.o. Neck) because of its quadratic computational complexity for attention. However, ViDT (w.o. Neck) extends Swin Transformers with RAM, thus requiring linear complexity for attention. Hence, it shows AP comparable to YOLOS for various backbone size, but its FPS is much higher.
127
+
128
+ One might argue that better integration could be also achieved by (1) Deformable DETR without its neck encoder because its neck decoder also has $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ cross-attention, or (2) YOLOS with VIDT’s neck decoder because of the use of multiple auxiliary techniques. Such integration is actually not effective; the former significantly drops AP, while the latter has a much greater drop in FPS than an increase in AP. The detailed analysis can be found in Appendix C.2.
129
+
130
+ # 4.2 ABLATION STUDY ON RECONFIGURED ATTENTION MODULE (RAM)
131
+
132
+ We extend Swin Transformer with RAM to extract fine-grained features for object detection without maintaining an additional transformer encoder in the neck. We provide an ablation study on the two main considerations for RAM, which leads to high accuracy and speed. To reduce the influence of secondary factors, we mainly use our neck-free version, ViDT (w.o. Neck), for the ablation study.
133
+
134
+ # 4.2.1 SPATIAL POSITIONAL ENCODING
135
+
136
+ Spatial positional encoding is essential for [DET] $\times$ [PATCH] attention in RAM. Typically, the spatial encoding can be added to the [PATCH] tokens before or after the projection layer in Figure 3. We call the former “pre-addition” and the latter “postaddition”. For each one, we can design the encoding in a sinusoidal or learnable manner (Carion et al.,
137
+
138
+ <table><tr><td rowspan=1 colspan=1>Method</td><td rowspan=1 colspan=1>None</td><td rowspan=1 colspan=2>Pre-addition</td><td rowspan=1 colspan=2>Post-addition</td></tr><tr><td rowspan=1 colspan=1>Type</td><td rowspan=1 colspan=1>None</td><td rowspan=1 colspan=1>Sin.</td><td rowspan=1 colspan=1>Learn.</td><td rowspan=1 colspan=1>Sin.</td><td rowspan=1 colspan=1>Learn.</td></tr><tr><td rowspan=1 colspan=1>AP</td><td rowspan=1 colspan=1>23.7</td><td rowspan=1 colspan=1>28.7</td><td rowspan=1 colspan=1>27.4</td><td rowspan=1 colspan=1>28.0</td><td rowspan=1 colspan=1>24.1</td></tr></table>
139
+
140
+ Table 3. Results for different spatial encodings for $[ \mathsf { D E T } ] \times [ \mathsf { P A T C H } ]$ cross-attention.
141
+
142
+ 2020). Table 3 contrasts the results with different spatial positional encodings with ViDT (w.o. Neck). Overall, pre-addition results in performance improvement higher than post-addition, and specifically, the sinusoidal encoding is better than the learnable one; thus, the 2D inductive bias of the sinusoidal spatial encoding is more helpful in object detection. In particular, pre-addition with the sinusoidal encoding increases AP by 5.0 compared to not using any encoding.
143
+
144
+ # 4.2.2 SELECTIVE $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ CROSS-ATTENTION
145
+
146
+ The addition of cross-attention to Swin Transformer inevitably entails computational overhead, particularly when the number of [PATCH] is large. To alleviate such overhead, we selectively enable cross-attention in RAM at the last stage of Swin Transformer; this is shown to greatly improve FPS, but barely drop AP. Table 4 summarizes AP and FPS when used different selective strategies for the cross-attention, where Swin Transformer consists of four stages in total. It is interesting that all the strategies exhibit similar AP as long as cross-attention is activated at the last stage. Since features are extracted in a bottom-up manner as they go through the stages, it seems difficult to directly obtain useful information about the target object at the low level of stages. Thus, only using the last stage is the best design choice in terms of high AP and FPS due to the smallest number of [PATCH] tokens.
147
+
148
+ Meanwhile, the detection fails completely or the performance significantly drops if all the stages are not involved due to the lack of interaction between [DET] and [PATCH] tokens that spatial positional encoding is associated with. A more detailed analysis of the $[ \mathrm { D E T } ] \stackrel { \cdot } { \times } [ \mathrm { P A T C H } ]$ cross-attention and $[ \mathrm { D E T } ] \times [ \mathrm { D E T } ]$ self-attention is provided in appendices C.3 and C.4.
149
+
150
+ <table><tr><td>Stage Ids</td><td colspan="2">{1,2,3,4}</td><td colspan="2">{2,3,4}</td><td colspan="2">{3,4}</td><td colspan="2">{4}</td><td colspan="2">0</td></tr><tr><td>Metric</td><td>AP</td><td>FPS</td><td>AP</td><td>FPS</td><td>AP</td><td>FPS</td><td>AP</td><td>FPS</td><td>AP</td><td>FPS</td></tr><tr><td>w.o. Neck</td><td>29.0</td><td>21.8</td><td>28.8</td><td>29.1</td><td>28.5</td><td>34.3</td><td>28.7</td><td>36.5</td><td>FAIL</td><td>37.7</td></tr><tr><td>w. Neck</td><td>40.3</td><td>14.6</td><td>40.1</td><td>18.0</td><td>40.3</td><td>19.5</td><td>40.4</td><td>20.0</td><td>37.1</td><td>20.5</td></tr></table>
151
+
152
+ Table 4. AP and FPS comparison with different selective cross-attention strategies.
153
+
154
+ # 4.3 ABLATION STUDY ON ADDITIONAL TECHNIQUES
155
+
156
+ We analyze the performance improvement of two additional techniques, namely auxiliary decoding loss and iterative box refinement, and the proposed distillation approach in Section 3.3. Furthermore, we introduce a simple technique that can expedite the inference speed of ViDT by dropping unnecessary decoding layers at inference time.
157
+
158
+ # 4.3.1 AUXILIARY DECODING LOSS AND ITERATIVE BOX REFINEMENT
159
+
160
+ To thoroughly verify the efficacy of auxiliary decoding loss and iterative box refinement, we extend them even for the neck-free detector like YOLOS; the principle of them is applied to the encoding layers in the body, as opposed to the conventional way of using the decoding layers in the neck. Table 5 shows the performance of the two neck-free detectors, YOLOS and ViDT (w.o. Neck), decreases considerably with the two techniques. The use of them in the encoding layers is likely to negatively affect feature extraction of the transformer encoder. In contrast, an opposite trend is observed with the neck component. Since the neck decoder is decoupled with the feature extraction in the body, the two techniques make a synergistic effect and thus show significant improvement in AP. These results justify the use of the neck decoder in ViDT to boost object detection performance.
161
+
162
+ <table><tr><td></td><td>Aux. l Box Ref.</td><td>Neck</td><td>AP</td><td>△</td></tr><tr><td>SOTOX</td><td>&lt;</td><td>√</td><td>30.4 29.2 20.1</td><td>-1.2 -10.3</td></tr><tr><td></td><td>广 √</td><td>一 一</td><td>28.7 27.2 22.9 36.2</td><td>-1.6 -5.9 +7.4</td></tr><tr><td></td><td>√ 1</td><td>1</td><td>40.4</td><td>+11.6</td></tr></table>
163
+
164
+ # 4.3.2 KNOWLEDGE DISTILLATION WITH TOKEN MATCHING
165
+
166
+ We show that a small ViDT model can benefit from a large ViDT model via knowledge distillation. The proposed token matching is a new concept of knowledge distillation for object detection, especially for a fully transformer-based object detector. Compared to very complex distillation methods that rely on heuristic rules with multiple hyperparameters (Chen et al., 2017; Dai et al., 2021), it simply matches some tokens with
167
+
168
+ <table><tr><td>Student</td><td>ViDT(Swin-nano)</td><td>ViDT (Swin-tiny)</td></tr><tr><td>Teacher</td><td>ViDT ViDT (small) (base)</td><td>ViDT ViDT (small) (base)</td></tr><tr><td>入dis=0</td><td>40.4</td><td>44.8</td></tr><tr><td>Xdis=2</td><td>41.4 41.4</td><td>45.6 46.1</td></tr><tr><td>Xdis=4</td><td>41.5 41.9</td><td>45.8 46.5</td></tr></table>
169
+
170
+ Table 6. AP comparison of student models associated with different teacher models.
171
+
172
+ a single hyperparameter, the distillation coefficient $\lambda _ { d i s }$ . Table 6 summarizes the AP improvement via knowledge distillation with token matching with varying distillation coefficients. Overall, the larger the size of the teacher model, the greater gain to the student model. Regarding coefficients, in general, larger values achieve better performance. Distillation increases AP by 1.0–1.7 without affecting the inference speed of the student model.
173
+
174
+ # 4.3.3 DECODING LAYER DROP
175
+
176
+ ViDT has six layers of transformers as its neck decoder. We emphasize that not all layers of the decoder are required at inference time for high performance. Table 7 show the performance of ViDT when dropping its decoding layer one by one from the top in the inference step. Although there is a trade-off relationship between accuracy and speed as the layers are detached from the model, there is no significant AP drop even when the two layers are removed. This technique is not designed for performance evaluation in Table 2
177
+
178
+ <table><tr><td>Model Metric</td><td>ViDT(Swin-nano) AP Param.</td><td>FPS</td><td>AP Param.</td><td>ViDT(Swin-tiny) FPS</td></tr><tr><td>0 Drop</td><td>40.4 16M</td><td>20.0</td><td>44.8</td><td>38M 17.2</td></tr><tr><td>1 Drop</td><td>40.2 14M</td><td>20.9</td><td>44.8</td><td>37M 18.5</td></tr><tr><td> 2 Drop</td><td>40.0 13M</td><td>22.3</td><td> 44.5</td><td>35M 19.6</td></tr><tr><td> 3 Drop</td><td>38.6 12M</td><td>24.7</td><td>43.6</td><td>34M 21.0</td></tr><tr><td>4 Drop 5 Drop</td><td>36.8 11M 32.5</td><td>26.0 10M 28.7</td><td>41.9 38.0</td><td>33M 22.4 32M 24.4</td></tr></table>
179
+
180
+ Table 7. Performance trade-off by decoding layer drop regarding AP, Param, and FPS.
181
+
182
+ with other methods, but we can accelerate the inference speed of a trained ViDT model to over $1 0 \%$ by dropping its two decoding layers without a much decrease in AP.
183
+
184
+ # 4.4 COMPLETE COMPONENT ANALYSIS
185
+
186
+ In this section, we combine all the proposed components (even with distillation and decoding layer drop) to achieve high accuracy and speed for object detection. As summarized in Table 8, there are four components: (1) RAM to extend Swin Transformer as a standalone object detector, (2) the neck decoder to exploit multi-scale features with two auxiliary techniques, (3) knowledge distillation to benefit from a large model, and (4) decoding layer drop to further accelerate inference speed. The performance of the final version is very outstanding; it achieves 41.7AP with reasonable FPS by only using 13M parameters when used Swin-nano as its backbone. Further, it only loses 2.7 FPS while exhibiting 46.4AP when used Swin-tiny. This indicates that a fully transformer-based object detector has the potential to be used as a generic object detector when further developed in the future.
187
+
188
+ Table 8. Detailed component analysis with Swin-nano and Swin-tiny.
189
+
190
+ <table><tr><td></td><td colspan="4">Component</td><td colspan="4">Swin-nano</td><td colspan="5"></td></tr><tr><td>#</td><td></td><td>RAM Neck Distil</td><td></td><td>Drop</td><td>AP</td><td>AP50AP75</td><td></td><td>Param.</td><td>FPS</td><td>AP</td><td>AP50</td><td>Swin-tiny AP75</td><td>Param.</td><td>FPS</td></tr><tr><td>(1)</td><td>√</td><td></td><td></td><td></td><td>28.7</td><td>48.6</td><td>28.5</td><td>7M</td><td>36.5</td><td>36.3</td><td>56.3</td><td>37.8</td><td>29M</td><td>28.6</td></tr><tr><td>(2</td><td>√</td><td>√</td><td></td><td></td><td>40.4</td><td>59.6</td><td>43.3</td><td>16M</td><td>20.0</td><td>44.8</td><td>64.5</td><td>48.7</td><td>38M</td><td>17.2</td></tr><tr><td>3</td><td>√</td><td>√</td><td>√</td><td></td><td>41.9</td><td>61.1</td><td>45.0</td><td>16M</td><td>20.0</td><td>46.5</td><td>66.3</td><td>50.2</td><td>38M</td><td>17.2</td></tr><tr><td>(4)</td><td>√</td><td>√</td><td>√</td><td>√</td><td>41.7</td><td>61.0</td><td>44.8</td><td>13M</td><td>22.3</td><td>46.4</td><td>66.3</td><td>50.2</td><td>35M</td><td>19.6</td></tr></table>
191
+
192
+ # 5 CONCLUSION
193
+
194
+ We have explored the integration of vision and detection transformers to build an effective and efficient object detector. The proposed ViDT significantly improves the scalability and flexibility of transformer models to achieve high accuracy and inference speed. The computational complexity of its attention modules is linear w.r.t. image size, and ViDT synergizes several essential techniques to boost the detection performance. On the Microsoft COCO benchmark, ViDT achieves 49.2AP with a large Swin-base backbone, and 41.7AP with the smallest Swin-nano backbone and only 13M parameters, suggesting the benefits of using transformers for complex computer vision tasks.
195
+
196
+ # ETHICS STATEMENT
197
+
198
+ This paper deals with the topic of general object detection in computer vision. We propose a novel integration of vision and detection transformers for a fully transformer-based object detector. Therefore, we do not expect any potential negative social impact of our work.
199
+
200
+ # REPRODUCIBILITY STATEMENT
201
+
202
+ For reproducibility, we provide a detailed description of our experiment and hyperparameter settings in Appendix B. It includes the Swin-nano architecture (Appendix B.1), the pipelines of all compared object detectors (Appendix B.2), hyperparameters of neck transformers (Appendix B.3), detailed implementation (Appendix B.4), and training configuration (Appendix B.5). We will release the code and trained models upon acceptance.
203
+
204
+ # ACKNOWLEDGMENTS
205
+
206
+ We thank NAVER AI Lab members for valuable discussion and advice. NAVER Smart Machine Learning (NSML) (Kim et al., 2018) has been used for experiment. M.-H. Yang is supported in part by the NSF CAREER grant 1149783.
207
+
208
+ # REFERENCES
209
+
210
+ Nicolas Carion, Francisco Massa, Gabriel Synnaeve, Nicolas Usunier, Alexander Kirillov, and Sergey Zagoruyko. End-to-end object detection with transformers. In ECCV, pp. 213–229, 2020. 1, 3, 5, 6, 8, 14, 15
211
+
212
+ Chun-Fu Chen, Quanfu Fan, and Rameswar Panda. CrossViT: Cross-attention multi-scale vision transformer for image classification. In ICCV, 2021. 13
213
+
214
+ Guobin Chen, Wongun Choi, Xiang Yu, Tony Han, and Manmohan Chandraker. Learning efficient object detection models with knowledge distillation. In NeurIPS, 2017. 9
215
+
216
+ Xing Dai, Zeren Jiang, Zhao Wu, Yiping Bao, Zhicheng Wang, Si Liu, and Erjin Zhou. General instance distillation for object detection. In CVPR, pp. 7842–7851, 2021. 9
217
+
218
+ Alexey Dosovitskiy, Lucas Beyer, Alexander Kolesnikov, Dirk Weissenborn, Xiaohua Zhai, Thomas Unterthiner, Mostafa Dehghani, Matthias Minderer, Georg Heigold, Sylvain Gelly, et al. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. 1, 2
219
+
220
+ Yuxin Fang, Bencheng Liao, Xinggang Wang, Jiemin Fang, Jiyang Qi, Rui Wu, Jianwei Niu, and Wenyu Liu. You only look at one sequence: Rethinking transformer in vision through object detection. arXiv preprint arXiv:2106.00666, 2021. 2, 3, 14, 15
221
+
222
+ Byeongho Heo, Sangdoo Yun, Dongyoon Han, Sanghyuk Chun, Junsuk Choe, and Seong Joon Oh. Rethinking spatial dimensions of vision transformers. In ICCV, 2021. 2, 13
223
+
224
+ Han Hu, Zheng Zhang, Zhenda Xie, and Stephen Lin. Local relation networks for image recognition. In CVPR, pp. 3464–3473, 2019. 4
225
+
226
+ Hanjoo Kim, Minkyu Kim, Dongjoo Seo, Jinwoong Kim, Heungseok Park, Soeun Park, Hyunwoo Jo, KyungHyun Kim, Youngil Yang, Youngkwan Kim, et al. NSML: Meet the mlaas platform with a real-world case study. arXiv preprint arXiv:1810.09957, 2018. 10
227
+
228
+ Tsung-Yi Lin, Michael Maire, Serge Belongie, James Hays, Pietro Perona, Deva Ramanan, Piotr Dollar, and C Lawrence Zitnick. Microsoft COCO: Common objects in context. In ´ ECCV, pp. 740–755, 2014. 2, 6
229
+
230
+ Tsung-Yi Lin, Priya Goyal, Ross Girshick, Kaiming He, and Piotr Dollar. Focal loss for dense object ´ detection. In CVPR, pp. 2980–2988, 2017. 14
231
+
232
+ Li Liu, Wanli Ouyang, Xiaogang Wang, Paul Fieguth, Jie Chen, Xinwang Liu, and Matti Pietikainen. ¨ Deep learning for generic object detection: A survey. International Journal of Computer Vision, 128(2):261–318, 2020. 1
233
+
234
+ Ze Liu, Yutong Lin, Yue Cao, Han Hu, Yixuan Wei, Zheng Zhang, Stephen Lin, and Baining Guo. Swin Transformer: Hierarchical vision transformer using shifted windows. In ICCV, 2021. 2, 12
235
+
236
+ Ilya Loshchilov and Frank Hutter. Decoupled weight decay regularization. In ICLR, 2019. 6, 15
237
+
238
+ Constantine Papageorgiou and Tomaso Poggio. A trainable system for object detection. International Journal of Computer Vision, 38(1):15–33, 2000. 1
239
+
240
+ Shaoqing Ren, Kaiming He, Ross Girshick, and Jian Sun. Faster R-CNN: Towards real-time object detection with region proposal networks. NeurIPS, 28:91–99, 2015. 3
241
+
242
+ Hamid Rezatofighi, Nathan Tsoi, JunYoung Gwak, Amir Sadeghian, Ian Reid, and Silvio Savarese. Generalized intersection over union: A metric and a loss for bounding box regression. In CVPR, pp. 658–666, 2019. 14
243
+
244
+ Hugo Touvron, Matthieu Cord, Matthijs Douze, Francisco Massa, Alexandre Sablayrolles, and Herve J ´ egou. Training data-efficient image transformers & distillation through attention. In ´ ICML, pp. 10347–10357, 2021. 6
245
+
246
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In NeurIPS, pp. 5998–6008, 2017. 1, 12, 17
247
+
248
+ Wenhai Wang, Enze Xie, Xiang Li, Deng-Ping Fan, Kaitao Song, Ding Liang, Tong Lu, Ping Luo, and Ling Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In ICCV, 2021. 13
249
+
250
+ Yuxin Wu, Alexander Kirillov, Francisco Massa, Wan-Yen Lo, and Ross Girshick. Detectron2. https://github.com/facebookresearch/detectron2, 2019. 3, 6
251
+
252
+ Xizhou Zhu, Weijie Su, Lewei Lu, Bin Li, Xiaogang Wang, and Jifeng Dai. Deformable DETR: Deformable transformers for end-to-end object detection. In ICLR, 2021. 3, 5, 14, 15
253
+
254
+ # An Efficient and Effective Fully Transformer-based Object Detector (Supplementary Material)
255
+
256
+ A RECONFIGURED ATTENTION MODULE
257
+
258
+ The proposed RAM in Figure 3 performs three attention operations, namely $\mathrm { \Delta [ P A T C H ] \ \times \ [ P A T C H ] } .$ , $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ , and $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention. This section provides (1) computational complexity analysis and (2) further algorithmic design for [DET] tokens.
259
+
260
+ # A.1 COMPUTATIONAL COMPLEXITY ANALYSIS
261
+
262
+ We analyze the computational complexity of the proposed RAM compared with the attention used in YOLOS. The analysis is based on the computational complexity of basic building blocks for Canonical and Swin Transformer, which is summarized in Table $9 ^ { 4 }$ , where ${ \sf T } _ { 1 }$ and ${ \sf T } _ { 2 }$ is the number of tokens for self- and cross-attention, and $d$ is the embedding dimension.
263
+
264
+ <table><tr><td rowspan=1 colspan=1>Transformer</td><td rowspan=1 colspan=1>Canonical Transformer</td><td rowspan=1 colspan=1>Swin Transformer</td></tr><tr><td rowspan=1 colspan=1>Attention</td><td rowspan=1 colspan=1>Global Self-attention Global Cross-attention</td><td rowspan=1 colspan=1>Local Self-attention</td></tr><tr><td rowspan=1 colspan=1>Complexity</td><td rowspan=1 colspan=1>O(d²T1 + dT²) O(d²(T1 +T2)+dT1T2)</td><td rowspan=1 colspan=1>O(d²T1 + dk²T1)</td></tr></table>
265
+
266
+ Table 9. Computational complexity of attention modules: In the canonical transformer, the complexity of global self-attention is $\mathcal { O } ( d ^ { 2 } \mathsf { T } _ { 1 } + \mathsf { \dot { d } } \mathsf { T } _ { 1 } ^ { 2 } )$ , where $\mathcal { O } ( d ^ { 2 } \mathsf { T } _ { 1 } )$ is the cost of computing the query, key, and value embeddings and $\mathcal { O } ( d \mathsf { T } _ { 1 } ^ { 2 } )$ is the cost of computing the attention weights. The complexity of global cross-attention is $\mathcal { O } ( \bar { d } ^ { 2 } ( \mathsf { T } _ { 1 } + \mathsf { T } _ { 2 } ) + d \mathsf { T } _ { 1 } \mathsf { T } _ { 2 } )$ , which is the interaction between the two different tokens ${ \sf T } _ { 1 }$ and ${ \mathsf { T } } _ { 2 }$ . In contrast, Swin Transformer achieves much lower attention complexity of $\mathcal { O } ( d ^ { 2 } \mathsf { T } _ { 1 } + d k ^ { 2 } \mathsf { T } _ { 1 } )$ with window partitioning, where $k$ is the width and height of the window $( k < < \mathsf { T } _ { 1 } , \mathsf { T } _ { 2 } )$ .
267
+
268
+ Let $\mathsf { P }$ and $\mathsf { D }$ be the number of [PATCH] and [DET] tokens ( $\mathsf { D } < < \mathsf { P }$ in practice, e.g., $\mathsf { P } = 6 6 , 6 5 0$ and $\mathsf { D } = 1 0 0$ at the first stage of ViDT). Then, the computational complexity of the attention module for YOLOS and ViDT (RAM) is derived as below, also summarized in Table 10:
269
+
270
+ • YOLOS Attention: [DET] tokens are simply appended to [PATCH] tokens to perform global selfattention on [PATCH, DET] tokens (i.e., ${ \sf T } _ { 1 } = { \sf P } + { \sf D } )$ . Thus, the computational complexity is $\mathcal { O } ( d ^ { 2 } ( \mathsf { P } + \mathsf { D } ) ^ { } + d ( \mathsf { P } + \bar { \mathsf { D } } ) ^ { 2 } )$ , which is quadratic to the number of [PATCH] tokens. If breaking down the total complexity, we obtain $\mathcal { O } \big ( ( d ^ { 2 } \mathsf { P } + d \mathsf { P } ^ { 2 } ) + ( d ^ { 2 } \mathsf { D } + d \mathsf { D } ^ { 2 } ) + d \mathsf { P } \mathsf { D } \big )$ , where the first and second terms are for the global self-attention for [PATCH] and [DET] tokens, respectively, and the last term is for the global cross-attention between them.
271
+
272
+ • ViDT (RAM) Attention: RAM performs the three different attention operations: (1) $\left[ \mathrm { P A T C H } \right] \times$ [PATCH] local self-attention with window partition, $\mathcal { O } ( d ^ { 2 } \mathsf { P } + d k ^ { 2 } \mathsf { P } )$ ; (2) $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ global selfattention, $\mathcal { O } ( d ^ { 2 } \mathsf { D } + d \mathsf { D } ^ { 2 } )$ ; (3) $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ global cross-attention, $\bar { \mathcal { O } } ( d ^ { 2 } \bar { ( } \mathsf { D } \doteq \mathsf { P } ) \bar { + } d \mathsf { D } \mathsf { P } )$ . In total, the computational complexity of RAM is $\mathsf { \bar { O } } ( d ^ { 2 } ( \mathsf { D } + \mathsf { P } ) + d k ^ { 2 } \mathsf { P } + d \mathsf { D } ^ { 2 } + d \mathsf { D } \mathsf { P } )$ , which is linear to the number of [PATCH] tokens.
273
+
274
+ Consequently, the complexity of RAM is much lower than the attention module used in YOLOS since $\mathsf { D } < < \mathsf { P }$ . Note that only RAM achieves the linear complexity to the patch tokens. In addition, one might argue that YOLOS can be efficient if the cross-attention is selectively removed similar to RAM. Even if we remove the complexity $\mathcal { O } ( d \mathsf { P } \mathsf { D } )$ for the global cross-attention, the computational complexity is $\mathcal { O } ( d ^ { 2 } ( \mathsf { P } + \mathsf { D } ) + d \mathsf { P } ^ { 2 } + d \mathsf { D } ^ { \bar { 2 } } )$ , which is still quadratic to the number of [PATCH] tokens.
275
+
276
+ <table><tr><td>Attention Type</td><td>YOLOS</td><td>ViDT</td></tr><tr><td>[PATCH] × [PATCH]</td><td>O(d²P +dP²)</td><td>O(d²P + dk²P)</td></tr><tr><td>[DET] × [DET]</td><td>O(d²D +dD²)</td><td>O(d²D + dD²)</td></tr><tr><td>[DET] × [PATCH]</td><td>O(dPD)</td><td>O(d²(D +P) + dDP)</td></tr><tr><td>Total Complexity</td><td>O(d²(P + D)+ d(P + D)²)</td><td>O(d²(D+P)+dk²P+dD²+dDP)</td></tr></table>
277
+
278
+ Table 10. Summary of computational complexity for different attention operations used in YOLOS and ViDT (RAM), where $\mathsf { P }$ and D are the number of [PATCH] and [DET] tokens, respectively $( \mathsf { D } < < \mathsf { P }$ ).
279
+
280
+ # A.2 ALGORITHMIC DESIGN FOR [DET] TOKENS
281
+
282
+ # A.2.1 BINDING $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ AND [DET] $\times$ [PATCH] ATTENTION
283
+
284
+ Binding the two attention modules is very simple in implementation. $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ and $\left[ \tt D E T \right] \times$ [PATCH] attention is generating a new [DET] token, which aggregates relevant contents in [DET] and [PATCH] tokens, respectively. Since the two attention share exactly the same [DET] query embedding obtained after the projection as shown in Figure 3, they can be processed at once by performing the scaled-dot product between $[ \tt D E T ] _ { Q }$ and $\left[ ^ { - } [ \mathsf { D E T } ] _ { K } , [ \mathsf { P A T C H } ] _ { K } \right]$ embeddings, where $Q , K$ are the key and query, and $[ \cdot ]$ is the concatenation. Then, the obtained attention map is applied to the ${ \left[ \ [ \mathsf { D E T } ] _ { V } , \mathsf { [ P A T C H ] } _ { V } \right] }$ embeddings, where $V$ is the value and $d$ is the embedding dimension,
285
+
286
+ $$
287
+ \mathsf { \Gamma } [ \mathsf { D E T } ] _ { n e w } = \mathsf { S o f t m a x } \Big ( \frac { \bigl [ \mathsf { D E T } \bigr ] _ { Q } \left[ \bigl [ \mathsf { D E T } \bigr ] _ { K } , \bigl [ \mathsf { P A T C H } \bigr ] _ { K } \right] ^ { \top } } { \sqrt { d } } \big ) \left[ \bigl [ \mathsf { D E T } \bigr ] _ { V } , \bigl [ \mathsf { P A T C H } \bigr ] _ { V } \right] .
288
+ $$
289
+
290
+ This approach is commonly used in the recent Transformer-based architectures, such as YOLOS.
291
+
292
+ # A.2.2 EMBEDDING DIMENSION OF [DET] TOKENS
293
+
294
+ $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention is performed across all the stages, and the embedding dimension of [DET] tokens increases gradually like [PATCH] tokens. For the [PATCH] token, its embedding dimension is increased by concatenating nearby [PATCH] tokens in a grid. However, this mechanism is not applicable for [DET] tokens since we maintain the same number of [DET] tokens for detecting a fixed number of objects in a scene. Hence, we simply repeat a [DET] token multiple times along the embedding dimension to increase its size. This allows [DET] tokens to reuse all the projection and normalization layers in Swin Transformer without any modification.
295
+
296
+ # B EXPERIMENTAL DETAILS
297
+
298
+ # B.1 SWIN-NANO ARCHITECTURE
299
+
300
+ Due to the absence of Swin models comparable to Deit-tiny, we configure Swin-nano, which is a $0 . 2 5 \times$ model of Swin-tiny such that it has 6M training parameters comparable to Deit-tiny. Table 11 summarizes the configuration of Swin Transformer models available, including the newly introduced Swinnano; S1–S4 indicates the four stages in Swin Transformer. The performance of all the pre-trained Swin
301
+
302
+ <table><tr><td>Model Name</td><td>Channel Dim.</td><td colspan="3">Layer Numbers S2</td></tr><tr><td>Swin-nano</td><td>48</td><td>S1</td><td>S3 6</td><td>S4 2</td></tr><tr><td>Swin-tiny</td><td>96</td><td></td><td>6</td><td></td></tr><tr><td>Swin-small</td><td>128</td><td></td><td>18</td><td></td></tr><tr><td>Swin-base</td><td>192</td><td>2222</td><td>18</td><td>222</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></table>
303
+
304
+ Table 11. Swin Transformer Architecture.
305
+
306
+ Transformer models are summarized in Table 1 in the manuscript.
307
+
308
+ # B.2 DETECTION PIPELINES OF ALL COMPARED DETECTORS
309
+
310
+ All the compared fully transformer-based detectors are composed of either (1) body–neck–head or (2) body–head structure, as summarized in Table 12. The main difference of ViDT is the use of reconfigured attention modules (RAM) for Swin Transformer, allowing the extraction of fine-grained detection features directly from the input image. Thus, Swin Transformer is extended to a standalone object detector called ViDT (w.o. Neck). Further, its extension to ViDT allows to use multi-scale features and multiple essential techniques for better detection, such as auxiliary decoding loss and iterative box refinement, by only maintaining a transformer decoder at the neck. Except for the two neck-free detector, YOLOS and ViDT (w.o. Neck), all the pipelines maintain multiple FFNs; that is, a single FFNs for each decoding layer at the neck for box regression and classification.
311
+
312
+ We believe that our proposed RAM can be combined with even other latest efficient vision transformer architectures, such as PiT (Heo et al., 2021), PVT (Wang et al., 2021) and Cross-ViT (Chen et al., 2021). We leave this as future work.
313
+
314
+ # B.3 HYPERPARAMETERS OF NECK TRANSFORMERS
315
+
316
+ The transformer decoder at the neck in ViDT introduces multiple hyperparameters. We follow exactly the same setting used in Deformable DETR. Specifically, we use six layers of deformable transformers with width 256; thus, the channel dimension of the [PATCH] and [DET] tokens extracted from Swin Transformer are reduced to 256 to be utilized as compact inputs to the decoder transformer. For each transformer layer, multi-head attention with eight heads is applied, followed by the point-wise FFNs of 1024 hidden units. Furthermore, an additive dropout of 0.1 is applied before the layer normalization. All the weights in the decoder are initialized with Xavier initialization. For (Deformable) DETR, the tranformer decoder receives a fixed number of learnable detection tokens. We set the number of detection tokens to 100, which is the same number used for YOLOS and ViDT.
317
+
318
+ <table><tr><td>Pipeline Method Name</td><td>Body Feature Extractor</td><td>Neck Tran. Encoder Tran. Decoder</td><td>Head Prediction</td></tr><tr><td>DETR (DeiT) DETR (Swin)</td><td>DeiT Transformer Swin Transformer</td><td>8 8</td><td>Multiple FFNs</td></tr><tr><td>Deformable DETR (DeiT)</td><td></td><td>O+</td><td>Multiple FFNs</td></tr><tr><td></td><td>DeiT Transformer</td><td>O+</td><td>Multiple FFNs</td></tr><tr><td>Deformable DETR (Swin)</td><td>Swin Transformer</td><td>0+ 0</td><td>Multiple FFNs</td></tr><tr><td>YOLOS</td><td>DeiT Transformer</td><td>× ×</td><td>Single FFNs</td></tr><tr><td>ViDT(w.o. Neck)</td><td>Swin Transformer+RAM</td><td>× ×</td><td>Single FFNs</td></tr><tr><td>ViDT</td><td>Swin Transformer+RAM</td><td>× O+</td><td>Multiple FFNs</td></tr></table>
319
+
320
+ Table 12. Comparison of detection pipelines for all available fully transformer-based object detectors, where $\dagger$ indicates that multi-scale deformable attention is used for neck transformers.
321
+
322
+ # B.4 IMPLEMENTATION
323
+
324
+ # B.4.1 DETECTION HEAD FOR PREDICTION
325
+
326
+ The last [DET] tokens produced by the body or neck are fed to a 3-layer FFNs for bounding box regression and linear projection for classification,
327
+
328
+ $$
329
+ \hat { B } = \mathrm { F F N } _ { \mathrm { 3 - l a y e r } } \left( \mathrm { [ D E T ] } \right) \ \mathrm { a n d } \ \hat { P } = \mathrm { L i n e a r } \big ( \mathrm { [ D E T ] } \big ) .
330
+ $$
331
+
332
+ For box regression, the FFNs produce the bounding box coordinates for $d$ objects, $\hat { B } \in [ 0 , 1 ] ^ { d \times 4 }$ , that encodes the normalized box center coordinates along with its width and height. For classification, the linear projection uses a softmax function to produce the classification probabilities for all possible classes including the background class, $\hat { P } \in \mathsf { \bar { [ 0 , 1 ] } } ^ { d \times ( c + 1 ) }$ , where $c$ is the number of object classes. When deformable attention is used on the neck in Table 12, only $c$ classes are considered without the background class for classification. This is the original setting used in DETR, YOLOS (Carion et al., 2020; Fang et al., 2021) and Deformable DETR (Zhu et al., 2021).
333
+
334
+ # B.4.2 LOSS FUNCTION FOR TRAINING
335
+
336
+ All the methods adopts the loss function of (Deformable) DETR. Since the detection head return a fixed-size set of $d$ bounding boxes, where $d$ is usually larger than the number of actual objects in an image, Hungarian matching is used to find a bipartite matching between the predicted box $\hat { B }$ and the ground-truth box $B$ . In total, there are three types of training loss: a classification loss $\ell _ { c l } { } ^ { 5 }$ , a box distance $\ell _ { l _ { 1 } }$ , and a GIoU loss $\ell _ { i o u }$ (Rezatofighi et al., 2019),
337
+
338
+ $$
339
+ \begin{array} { r l } & { \ell _ { c l } ( i ) = - \log \hat { P } _ { \sigma ( i ) , c _ { i } } , \ell _ { \ell _ { 1 } } ( i ) = | | B _ { i } - \hat { B } _ { \sigma ( i ) } | | _ { 1 } , \mathrm { ~ a n d ~ } } \\ & { \ell _ { i o u } ( i ) = 1 - \big ( \frac { | B _ { i } \cap \hat { B } _ { \sigma ( i ) } | } { | B _ { i } \cup \hat { B } _ { \sigma ( i ) } | } - \frac { | \mathsf { B } ( B _ { i } , \hat { B } _ { \sigma ( i ) } ) \backslash B _ { i } \cup \hat { B } _ { \sigma ( i ) } | } { | \mathsf { B } ( B _ { i } , \hat { B } _ { \sigma ( i ) } ) | } \big ) , } \end{array}
340
+ $$
341
+
342
+ where $c _ { i }$ and $\sigma ( i )$ are the target class label and bipartite assignment of the $i$ -th ground-truth box, and $\textsf { B }$ returns the largest box containing two given boxes. Thus, the final loss of object detection is a linear combination of the three types of training loss,
343
+
344
+ $$
345
+ \ell = \lambda _ { c l } \ell _ { c l } + \lambda _ { \ell _ { 1 } } \ell _ { l _ { 1 } } + \lambda _ { i o u } \ell _ { i o u } .
346
+ $$
347
+
348
+ Table 13. Evaluations of ViDT with other detectors using CNN backbones on COCO2017 val set. FPS is measured with batch size 1 of $8 0 0 \times 1 3 3 3$ resolution on a single Tesla V100 GPU, where the value inside the parentheses is measured with batch size 4 of the same resolution to maximize GPU utilization.
349
+
350
+ <table><tr><td>Method</td><td>Backbone</td><td>Epochs</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td><td>Param.</td><td>FPS</td></tr><tr><td>DETR</td><td>ResNet-50</td><td>500</td><td>42.0</td><td>62.4</td><td>44.2</td><td>20.5</td><td>45.8</td><td>61.1</td><td>41M</td><td>22.8 (38.6)</td></tr><tr><td>DETR-DC5</td><td>ResNet-50</td><td>500</td><td>43.3</td><td>63.1</td><td>45.9</td><td>22.5</td><td>47.3</td><td>61.1</td><td>41M</td><td>12.8 (14.2)</td></tr><tr><td>DETR-DC5</td><td>ResNet-50</td><td>50</td><td>35.3</td><td>55.7</td><td>36.8</td><td>15.2</td><td>37.5</td><td>53.6</td><td>41M</td><td>12.8 (14.2)</td></tr><tr><td>Deform.DETR</td><td>ResNet-50</td><td>50</td><td>45.4</td><td>64.7</td><td>49.0</td><td>26.8</td><td>48.3</td><td>61.7</td><td>40M</td><td>13.7 (19.4)</td></tr><tr><td>ViDT</td><td>Swin-tiny</td><td>50</td><td>44.8</td><td>64.5</td><td>48.7</td><td>25.9</td><td>47.6</td><td>62.1</td><td>38M</td><td>17.2 (26.5)</td></tr><tr><td>ViDT</td><td>Swin-tiny</td><td>150</td><td>47.2</td><td>66.7</td><td>51.4</td><td>28.4</td><td>50.2</td><td>64.7</td><td>38M</td><td>17.2 (26.5)</td></tr></table>
351
+
352
+ <table><tr><td>Method</td><td>Backbone</td><td>AP</td><td>AP50</td><td>AP75</td><td>APs</td><td>APM</td><td>APL</td><td>Param.</td><td>FPS</td></tr><tr><td>Deformable DETR - neck encoder</td><td>Swin-nano</td><td>43.1 34.0</td><td>61.4 52.8</td><td>46.3 35.6</td><td>25.9 18.0</td><td>45.2 36.3</td><td>59.4 48.4</td><td>17M 14M</td><td>7.0 22.4</td></tr><tr><td>YOLOS + neck decoder</td><td>DeiT-tiny</td><td>30.4 38.1</td><td>48.6 57.1</td><td>31.1 40.2</td><td>12.4 20.1</td><td>31.8 40.2</td><td>48.2 56.0</td><td>6M 14M</td><td>28.1 17.1</td></tr><tr><td>ViDT + neck encoder</td><td>Swin-nano</td><td>40.4 46.1</td><td>59.6 64.1</td><td>43.3 49.7</td><td>23.2 28.5</td><td>42.5 48.7</td><td>55.8 61.7</td><td>16M 19M</td><td>20.0 6.3</td></tr></table>
353
+
354
+ Table 14. Variations of Deformable DETR, YOLOS, and ViDT with respect to their neck structure. They are trained for 50 epochs with the same configuration used in our main experimental results.
355
+
356
+ The coefficient for each training loss is set to be $\lambda _ { c l } = 1$ , $\lambda _ { \ell _ { 1 } } = 5$ , and $\lambda _ { i o u } = 2$ . If we leverage auxiliary decoding loss, the final loss is computed for every detection head separately and merged with equal importance. Additionally, ViDT adds the distillation loss in Eq. (2) to the final loss if the distillation approach in Section 3.3 is enabled for training.
357
+
358
+ # B.5 TRAINING CONFIGURATION
359
+
360
+ We train ViDT for 50 epochs using AdamW (Loshchilov & Hutter, 2019) with the same initial learning rate of $1 0 ^ { - 4 }$ for its body, neck and head. The learning rate is decayed by cosine annealing with batch size of 16, weight decay of $1 \times 1 0 ^ { - 4 }$ , and gradient clipping of 0.1. In contrast, ViDT (w.o. Neck) is trained for 150 epochs using AdamW with the initial learning rate of $5 \times 1 0 ^ { - 5 }$ by cosine annealing. The remaining configuration is the same as for ViDT.
361
+
362
+ Regarding DETR (ViT), we follow the setting of Deformable DETR. Thus, all the variants of this pipeline are trained for 50 epochs with the initial learning rate of $1 0 ^ { - 5 }$ for its pre-trained body (ViT backbone) and $1 0 ^ { - 4 }$ for its neck and head. Their learning rates are decayed at the 40-th epoch by a factor of 0.1. Meanwhile, the results of YOLOS are borrowed from the original paper (Fang et al., 2021) except YOLOS (DeiT-tiny); since the result of YOLOS (DeiT-tiny) for $8 0 0 \times 1 3 3 3$ is not reported in the paper, we train it by following the training configuration suggested by authors.
363
+
364
+ # C SUPPLEMENTARY EVALUATION
365
+
366
+ # C.1 COMPARISON WITH OBJECT DETECTOR USING CNN BACKBONE
367
+
368
+ We compare ViDT with (Deformable) DETR using the ResNet-50 backbone, as summarized in Table 13, where all the results except ViDT are borrowed from (Carion et al., 2020; Zhu et al., 2021), and DETR-DC5 is a modification of DETR to use a dilated convolution at the last stage in ResNet. For a fair comparison, we compare ViDT (Swin-tiny) with similar parameter numbers. In general, ViDT shows a better trade-off between AP and FPS even compared with (Deformable) DETR with the ResNet-50. Specifically, ViDT achieves FPS much higher than DETR-DC5 and Deformable DETR with competitive AP. Particularly when training ViDT for 150 epochs, ViDT outperforms other compared methods using the ResNet-50 backbone in terms of both AP and FPS.
369
+
370
+ # C.2 VARIATIONS OF EXISTING PIPELINES
371
+
372
+ We study more variations of existing detection methods by modifying their original pipelines in Table 12. Thus, we remove the neck encoder of Deformable DETR to increase its efficiency, while adding a neck decoder to YOLOS to leverage multi-scale features along with auxiliary decoding loss and iterative box refinement. Note that these modified versions follow exactly the same detection pipeline with ViDT, maintaining a encoder-free neck between their body and head. Table 14 summarizes the performance of all the variations in terms of AP, FPS, and the number of parameters.
373
+
374
+ ![](images/f8cb1404df19856bf94ecdc38a33397b3a30a2bdda796f329f109caaf7d52d9e.jpg)
375
+ Figure 4. Visualization of the attention map for cross-attention with ViDT (Swin-nano).
376
+
377
+ Deformable DETR shows significant improvement in FPS $( + 1 4 . 4 )$ but its AP drops sharply $( - 9 . 1 )$ when its neck encoder is removed. Thus, it is difficult to obtain fine-grained object detection representation directly from the raw ViT backbone without using an additional neck encoder. However, ViDT compensates for the effect of the neck encoder by adding [DET] tokens into the body (backbone), thus successfully removing the computational bottleneck without compromising AP; it maintains 6.4 higher AP compared with the neck encoder-free Deformable DETR (the second row) while achieving similar FPS. This can be attributed to that RAM has a great contribution to the performance w.r.t AP and FPS, especially for the trade-off between them.
378
+
379
+ YOLOS shows a significant gain in $\mathrm { A P } ( + 7 . 7 ) $ while losing FPS (−11.0) when the neck decoder is added. Unlike Deformable DETR, its AP significantly increases even without the neck encoder due to the use of a standalone object detector as its backbone (i.e., the modified DeiT in Figure 2(b)). However, its AP is lower than ViDT by 2.3AP. Even worse, it is not scalable for large models because of its quadratic computational cost for attention. Therefore, in the aspects of accuracy and speed, ViDT maintains its dominance compared with the two carefully tuned baselines.
380
+
381
+ For a complete analysis, we additionally add a neck encoder to ViDT. The inference speed of ViDT degrades drastically by 13.7 because of the self-attention for multi-scale features at the neck encoder. However, it is interesting to see the improvement of AP by 5.7 while adding only 3M parameters; it is 3.0 higher even than Deformable DETR. This indicates that lowering the computational complexity of the encoder and thus increasing its utilization could be another possible direction for a fully transformer-based object detector.
382
+
383
+ # C.3 $[ \mathrm { D E T } ] \times [ \mathrm { P A T C H } ]$ ATTENTION IN RAM
384
+
385
+ In Section 4.2.2, it turns out that the cross-attention in RAM is only necessary at the last stage of Swin Transformer; all the different selective strategies show similar AP as long as cross-attention is activated at the last stage. Hence, we analyze the attention map obtained by the cross-attention in RAM. Figure 4 shows attention maps for the stages of Swin Transformer where cross-attention is utilized; it contrasts (a) ViDT with cross-attention at all stages and (b) ViDT with cross-attention at the last stage. Regardless of the use of cross-attention at the lower stage, it is noteworthy that the finally obtained attention map at the last stage is almost the same. In particular, the attention map at Stage 1–3 does not properly focus the features on the target object, which is framed by the bounding box. In addition, the attention weights (color intensity) at Stage 1–3 are much lower than those at Stage 4. Since features are extracted from a low level to a high level in a bottom-up manner as they go through the stages, it seems difficult to directly get information about the target object with such low-level features at the lower level of stages. Therefore, this analysis provides strong empirical evidence for the use of selective $\mathrm { [ D E T ] } \times \mathrm { [ P A T H ] }$ cross-attention.
386
+
387
+ # C.4 $[ \mathrm { D E T } ] \times [ \mathrm { D E T } ]$ ATTENTION IN RAM
388
+
389
+ Another possible consideration for ViDT is the use of $\left[ { \tt D E T } \right] ^ { - } \times \ \left[ { \tt D E T } \right]$ self-attention in RAM. We conduct an ablation study by removing the $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ attention one by one from the bottom stage, and summarize the results in Table 15. When all the $[ \mathrm { D E T } ] \times [ \mathrm { D E T } ]$ self-attention are removed, (5) the AP drops by 0.7, which is a meaningful performance degradation. On the other hand, as long as the selfattention is activated at the last two stages, (1) – (3) all the strategies exhibit similar AP. Therefore, only keeping $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ self-attention at the last two stages can further increase FPS $\left( + 0 . 2 \right)$ without degradation in AP. This observation could be used as another design choice for the AP and FPS trade-off. Therefore, we believe that $[ \mathsf { D E T } ] \times [ \mathsf { D E T } ]$ self-attention is meaningful to use in RAM.
390
+
391
+ Table 15. AP and FPS comparison with different $[ \tt D E T ] \times [ \tt D E T ]$ self-attention strategies with ViDT.
392
+
393
+ <table><tr><td rowspan="2">#</td><td colspan="3">Stage Id</td><td colspan="2">Swin-nano</td></tr><tr><td>1</td><td>2</td><td>3 4</td><td>AP</td><td>FPS</td></tr><tr><td>(1)</td><td>√</td><td>√</td><td>√ √</td><td>40.4</td><td>20.0</td></tr><tr><td>(2)</td><td></td><td>√ √</td><td>?</td><td>40.3</td><td>20.1</td></tr><tr><td>(3)</td><td></td><td>1</td><td></td><td>40.4</td><td>20.2</td></tr><tr><td>(4)</td><td></td><td></td><td>厂</td><td>40.1</td><td>20.3</td></tr><tr><td>(5)</td><td></td><td></td><td></td><td>39.7</td><td>20.4</td></tr></table>
394
+
395
+ # D PRELIMINARIES: TRANSFORMERS
396
+
397
+ A transformer is a deep model that entirely relies on the self-attention mechanism for machine translation (Vaswani et al., 2017). In this section, we briefly revisit the standard form of the transformer.
398
+
399
+ Single-head Attention. The basic building block of the transformer is a self-attention module, which generates a weighted sum of the values (contents), where the weight assigned to each value is the attention score computed by the scaled dot-product between its query and key. Let $W _ { Q }$ , $W _ { K }$ , and $W _ { V }$ be the learned projection matrices of the attention module, and then the output is generated by
400
+
401
+ $$
402
+ \operatorname { A t t e n t i o n } ( Z ) = \operatorname { s o f t m a x } \Bigl ( \frac { ( Z W _ { Q } ) ( Z W _ { K } ) ^ { \top } } { \sqrt { d } } \Bigr ) ( Z W _ { V } ) \in \mathbb { R } ^ { h w \times d } ,
403
+ $$
404
+
405
+ Multi-head Attention. It is beneficial to maintain multiple heads such that they repeat the linear projection process $k$ times with different learned projection matrices. Let $W _ { Q _ { i } }$ , $W _ { K _ { i } }$ , and $W _ { V _ { i } }$ be the learned projection matrices of the $i$ -th attention head. Then, the output is generated by the concatenation of the results from all heads,
406
+
407
+ $$
408
+ \begin{array} { r l } & { \mathbf { M u l t i - H e a d } ( Z ) = [ \mathbf { A t t e n t i o n } _ { 1 } ( Z ) , \mathbf { A t t e n t i o n } _ { 2 } ( Z ) , \dots , \mathbf { A t t e n t i o n } _ { k } ( Z ) ] \in \mathbb { R } ^ { h w \times d } , } \\ & { \qquad \mathrm { w h e r e } ~ \forall _ { i } W _ { Q _ { i } } , W _ { K _ { i } } , W _ { V _ { i } } \in \mathbb { R } ^ { d \times ( d / k ) } . } \end{array}
409
+ $$
410
+
411
+ Typically, the dimension of each head is divided by the total number of heads.
412
+
413
+ Feed-Forward Networks (FFNs). The output of the multi-head attention is fed to the point-wise FFNs, which performs the linear transformation for each position separately and identically to allow the model focusing on the contents of different representation subspaces. Here, the residual connec
414
+
415
+ tion and layer normalization are applied before and after the FFNs. The final output is generated by
416
+
417
+ where $H ^ { \prime } = \mathrm { F F N } ( H ^ { \prime \prime } )$ $\begin{array} { r } { \begin{array} { r l } & { H = \mathrm { L a y e r N o r m } ( \mathrm { D r o p o u t } ( H ^ { \prime } ) + H ^ { \prime \prime } ) , } \\ & { H ^ { \prime \prime } ) \mathrm { a n d } H ^ { \prime \prime } = \mathrm { L a y e r N o r m } ( \mathrm { D r o p o u t } ( \mathrm { M u l t i \mathrm { - } H e a d } ( Z ) ) + Z ) . } \end{array} } \end{array}$
418
+
419
+ Multi-Layer Transformers. The output of a previous layer is fed directly to the input of the next layer. Regarding the positional encoding, the same value is added to the input of each attention module for all layers.