ZHANGYUXUAN-zR commited on
Commit
9506a0d
·
verified ·
1 Parent(s): 2686837

Add files using upload-large-folder tool

Browse files
parse/dev/EbMuimAbPbs/EbMuimAbPbs_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/EbMuimAbPbs/EbMuimAbPbs_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/EbMuimAbPbs/EbMuimAbPbs_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/Pyd6Rh9r1OT/Pyd6Rh9r1OT.md ADDED
@@ -0,0 +1,285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Fast Vision Transformers with HiLo Attention
2
+
3
+ Zizheng Pan Jianfei Cai Bohan Zhuang†
4
+
5
+ Department of Data Science & AI, Monash University, Australia
6
+
7
+ # Abstract
8
+
9
+ Vision Transformers (ViTs) have triggered the most recent and significant breakthroughs in computer vision. Their efficient designs are mostly guided by the indirect metric of computational complexity, i.e., FLOPs, which however has a clear gap with the direct metric such as throughput. Thus, we propose to use the direct speed evaluation on the target platform as the design principle for efficient ViTs. Particularly, we introduce LITv2, a simple and effective ViT which performs favourably against the existing state-of-the-art methods across a spectrum of different model sizes with faster speed. At the core of LITv2 is a novel self-attention mechanism, which we dub HiLo. HiLo is inspired by the insight that high frequencies in an image capture local fine details and low frequencies focus on global structures, whereas a multi-head self-attention layer neglects the characteristic of different frequencies. Therefore, we propose to disentangle the high/low frequency patterns in an attention layer by separating the heads into two groups, where one group encodes high frequencies via self-attention within each local window, and another group encodes low frequencies by performing global attention between the average-pooled low-frequency keys and values from each window and each query position in the input feature map. Benefiting from the efficient design for both groups, we show that HiLo is superior to the existing attention mechanisms by comprehensively benchmarking FLOPs, speed and memory consumption on GPUs and CPUs. For example, HiLo is $1 . 4 \times$ faster than spatial reduction attention and $1 . 6 \times$ faster than local window attention on CPUs. Powered by HiLo, LITv2 serves as a strong backbone for mainstream vision tasks including image classification, dense detection and segmentation. Code is available at https://github.com/ziplab/LITv2.
10
+
11
+ # 1 Introduction
12
+
13
+ Real-world applications usually require a model to have an optimal speed and accuracy trade-off under limited computational budget, such as UAV and autonomous driving. This motivates substantial works toward efficient vision Transformer (ViT) design, such as PVT [51], Swin [32] and Focal Transformer [60], among others. To measure the computational complexity, a widely adopted metric in recent ViT design is the number of float-point operations, i.e., FLOPs. However, FLOPs is an indirect metric, which can not directly reflect the real speed on the target platform. For example, Focal-Tiny is much slower than Swin-Ti on GPUs although their FLOPs are comparable.
14
+
15
+ In general, the discrepancy between the indirect metric (FLOPs) and the direct metric (speed) in recent ViTs can be attributed to two main reasons. First, although self-attention is efficient on low-resolution feature maps, the quadratic complexity in both memory and time makes it much slower on high-resolution images due to intensive memory access cost [34], where fetching data from off-chip DRAM can be speed-consuming. Second, some efficient attention mechanisms in ViTs have low theoretical complexity guarantee but are actually slow on GPUs due to particular operations that are not hardware-friendly or cannot be parallelized, such as the multi-scale window partition [60], recursion [44] and dilated window [20].
16
+
17
+ ![](images/3863cf3f80ae0c2671284d8f8aac929d15e60c053d4009d3925cdf0e063955e0.jpg)
18
+ Figure 1: Framework of HiLo attention. $N _ { h }$ refers to the total number of self-attention heads at this layer. $\alpha$ denotes the split ratio for high/low frequency heads. Best viewed in color.
19
+
20
+ With these observations, in this paper we propose to evaluate ViT by the direct metric, i.e., throughput, not only FLOPs. Based on this principle, we introduce LITv2, a novel efficient and accurate vision Transformer that outperforms most state-of-the-art (SoTA) ViTs on standard benchmarks while being practically faster on GPUs. LITv2 is bulit upon LITv1 [36], a simple ViT baseline which removes all multi-head self-attention layers (MSAs) in the early stages while applying standard MSAs in the later stages. Benefit from this design, LITv1 is faster than many existing works on ImageNet classification due to no computational cost from the early MSAs while the later MSAs only need to process downsampled low-resolution feature maps. However, the standard MSA still suffers from huge computational cost on high-resolution images, especially for dense prediction tasks.
21
+
22
+ To address this problem, we propose a novel efficient attention mechanism, termed HiLo. HiLo is motivated by the fact that natural images contain rich frequencies where high/low frequencies play different roles in encoding image patterns, i.e., local fine details and global structures, respectively. A typical MSA layer enforces the same global attention across all image patches without considering the characteristics of different underlying frequencies. This motivates us to propose to separate an MSA layer into two paths where one path encodes high-frequency interactions via local self-attention with relatively high-resolution feature maps while the other path encodes low-frequency interactions via global attention with down-sampled feature maps, which leads to a great efficiency improvement.
23
+
24
+ Specifically, HiLo employs two efficient attentions to disentangle High/Low frequencies in feature maps. As shown in Figure 1, in the upper path, we allocate a few heads to the high frequency attention (Hi-Fi) to capture fine-grained high frequencies by local window self-attention (e.g., $2 \times 2$ windows), which is much more efficient than standard MSAs. The lower path, implementing the low-frequency attention (Lo-Fi), first applies average pooling to each window to obtain low-frequency signals. Then, we allocate the remaining heads for Lo-Fi to model the relationship between each query position in the input feature map and the average-pooled low-frequency keys and values from each window. Benefit from the reduced length of keys and values, Lo-Fi also achieves significant complexity reduction. Finally, we concatenate the refined high/low-frequency features and forward the resulting output into subsequent layers. Since both Hi-Fi and Lo-Fi are not equipped with time-consuming operations such as dilated windows and recursion, the overall framework of HiLo is fast on both CPUs and GPUs. We show by comprehensive benchmarks that HiLo achieves advantage over the existing attention mechanisms in terms of performance, FLOPs, throughput and memory consumption.
25
+
26
+ Besides, we find the fixed relative positional encoding in LITv1 dramatically slows down its speed on dense prediction tasks due to the interpolation for different image resolutions. For better efficiency, we propose to adopt one $3 \times 3$ depthwise convolutional layer with zero-padding in each FFN to incorporate the implicitly learned position information from zero-padding [27]. Moreover, the $3 \times 3$ convolutional filters simultaneously help to enlarge the receptive field of the early multi-layer perceptron (MLP) blocks in LITv1. Finally, we conduct extensive experiments on ImageNet, COCO and ADE20K to evaluate the performance of LITv2. Comprehensive comparisons with SoTA models show that our architecture achieves competitive performance with faster throughput, making ViTs more feasible to run low-latency applications for real-world scenarios.
27
+
28
+ # 2 Related Work
29
+
30
+ Vision Transformers. Vision Transformers are neural networks that adopt self-attention mechanisms into computer vision tasks. In [18], Dosovitskiy et al. propose a ViT for image classification, which inherits the similar architecture from a standard Transformer [48] in natural language processing (NLP) tasks. Since then, subsequent works have been proposed to improve ViT by incorporating more convolutional layers [54, 61], introducing pyramid feature maps [51, 32], enhancing the locality [62], as well as automatically searching a well-performed architecture [5, 3] with neural architecture search (NAS). Some others also seek for token pruning to accelerate the inference speed of ViTs [37] or applying ViT into low-level vision tasks [47]. Compared to existing works, this paper focuses on a general ViT-based backbone for computer vision (CV) tasks and aims to achieve better efficiency on GPUs while maintaining competitive performance.
31
+
32
+ Efficient attention mechanisms. Efficient attention mechanisms aim to reduce the quadratic complexity of standard MSAs. Existing efforts in NLP can be roughly categories into low-rank decomposition [50], kernelization [28, 39], memory [40] and sparsity mechanism [10]. However, simply adopting these method usually performs suboptimally in CV tasks [32, 63]. In CV, representative efficient self-attention mechanisms includes spatial reduction attention (SRA) [51], local window attention [32, 26] and Twins attention [12]. However, they only focus on either local or global attention at the same layer. To address this problem, TNT [21] introduced additional global tokens and MixFormer [6] mixed local window attention with depthwise convolutional layers. Some other attention mechanisms consider both simultaneously, such as Focal [60] and QuadTree [44]. However, due to the inefficient operations which are not hardware-friendly and cannot be reflected in FLOPs (e.g., multi-scale window partition, recursion), they are slow on GPUs even compared to standard MSA. To this end, the proposed HiLo attention simultaneously captures rich local-global information at the same MSA layer and is faster and more memory-efficient compared to the existing works.
33
+
34
+ Frequency domain analysis in vision. The frequency domain analysis in CV has been well studied in the literature. According to [13, 16], the low frequencies in an image usually capture global structures and color information while the high frequencies contain fine details of objects (e.g., sharp edges). Based on this insight, a plethora of solutions have been proposed for image super-resolution [66, 19], generalization [25], image re-scaling [56] and neural network compression [59, 7]. Furthermore, Octave convolution [9] targeted convolutional layers and proposed to locally applies convolution on high/low-resolution feature maps, separately. Different from it, the proposed HiLo is a novel attention mechanism that captures both local and global relationships with self-attention.
35
+
36
+ # 3 Background
37
+
38
+ Multi-head self-attention. Transformers are built upon multi-head self-attention, which enables to capture long-range relationships for tokens at different positions. Specifically, let $\mathbf { X } \in \mathbb { R } ^ { N \times D }$ be the input sequence into a standard MSA layer, where $N$ is the length of the input sequence and $D$ refers to the number of hidden dimensions. Each self-attention head calculates the query $\mathbf { Q }$ , key $\mathbf { K }$ and value $\mathbf { V }$ matrices with a linear transformation from $\mathbf { X }$ ,
39
+
40
+ $$
41
+ \mathbf { Q } = \mathbf { X } \mathbf { W } _ { q } , \mathbf { K } = \mathbf { X } \mathbf { W } _ { k } , \mathbf { V } = \mathbf { X } \mathbf { W } _ { v } ,
42
+ $$
43
+
44
+ where $\mathbf { W } _ { q }$ , $\mathbf { W } _ { k }$ , $\mathbf { W } _ { v } \in \mathbb { R } ^ { D \times D _ { h } }$ are learnable parameters and $D _ { h }$ is the number of hidden dimensions for a head. Next, the output of a self-attention head is a weighted sum over $N$ value vectors,
45
+
46
+ $$
47
+ \mathrm { S A } _ { h } ( \mathbf { X } ) = \mathrm { S o f t m a x } ( \frac { \mathbf { Q } \mathbf { K } ^ { \top } } { \sqrt { D _ { h } } } ) \mathbf { V } .
48
+ $$
49
+
50
+ For an MSA layer with $N _ { h }$ heads, the final output is computed by a linear projection of the concatenated outputs from each self-attention head, which can be formulated by
51
+
52
+ $$
53
+ \mathrm { M S A } ( \mathbf { X } ) = \operatorname * { c o n c a t } _ { h \in [ N _ { h } ] } [ \mathrm { S A } _ { h } ( \mathbf { X } ) ] \mathbf { W } _ { o } ,
54
+ $$
55
+
56
+ where $\mathbf { W } _ { o } \in \mathbb { R } ^ { ( N _ { h } \times D _ { h } ) \times D }$ is a learnable parameter. In practice, $D$ is usually equal to $N _ { h } \times D _ { h }$ . Overall, a standard MSA layer have the computational cost of $4 N D ^ { 2 } + 2 N ^ { 2 } D$ , where $2 N ^ { 2 } D$ comes from Eq. (2), $3 N D ^ { 2 }$ and $\dot { N } D ^ { 2 }$ comes from Eq. (1) and Eq. (3), respectively.
57
+
58
+ Transformer blocks. A standard vision Transformer as described in [18] consists of a patch embedding layer, several blocks and a prediction head. Let $l$ be the index of a block. Then each block contains an MSA layer and a position-wise feed-forward network (FFN), which can expressed as
59
+
60
+ $$
61
+ \begin{array} { r } { \mathbf { X } _ { l - 1 } ^ { ' } = \mathbf { X } _ { l - 1 } + \mathrm { M S A } ( \mathrm { L N } ( \mathbf { X } _ { l - 1 } ) ) , } \\ { \mathbf { X } _ { l } = \mathbf { X } _ { l - 1 } ^ { ' } + \mathrm { F F N } ( \mathrm { L N } ( \mathbf { X } _ { l - 1 } ^ { ' } ) ) , } \end{array}
62
+ $$
63
+
64
+ where LN denotes the LayerNorm [2] and an FFN consists of two FC layers with GELU [24] nonlinearity in between. Recent works on ViT have proposed to divide the blocks into several stages (typically 4 stages) to generate pyramid feature maps for dense prediction tasks. Furthermore, to reduce the computational cost on high-resolution feature maps in the early stages, the MSA in Eq. (4) has been replaced with efficient alternatives, such as SRA [51] and W-MSA [32].
65
+
66
+ Bottlenecks of LITv1. Recent studies have shown that the MSA layers in the early stages in a model still focus on local patterns [14]. With the same observation, LITv1 [36] removes all early MSAs (i.e., exclude Eq. (4) in each block) while applying standard MSAs at the later stages. This design principle has achieved better efficiency with competitive performance on ImageNet compared to PVT [51] and Swin [32]. However, LITv1 still has two main bottlenecks in speed: 1) Given a high-resolution image, the standard MSAs in the later stages still result in huge computational cost. 2) The fixed relative positional encoding [32] dramatically slows down the speed when dealing with different image resolutions. This is due to interpolating the fixed-size positional encoding for each different image resolution. In the next section, we describe a novel attention mechanism with zero padding positional encoding to comprehensively accelerate LITv1.
67
+
68
+ # 4 Method
69
+
70
+ # 4.1 HiLo Attention
71
+
72
+ We propose to separately process high/low frequencies in a feature map at an attention layer. We name the new attention mechanism as HiLo, which is depicted in Figure 1. Essentially, the low-frequency attention branch (Lo-Fi) is to capture the global dependencies of the input (image/features), which does not need a high-resolution feature map but requires global attention. On the other hand, the high-frequency attention branch (Hi-Fi) is to capture the fine detailed local dependency, which requires a high-resolution feature map but can be done via local attention. In the next, we describe the two attentions in detail.
73
+
74
+ High-frequency attention. Intuitively, as high frequencies encode local details of objects, it can be redundant and computationally expensive to apply global attention on a feature map. Therefore, we propose to design Hi-Fi to capture fine-grained high frequencies with local window self-attention (e.g., $2 \times 2$ windows), which saves significant computational complexity. Furthermore, we employ the simple non-overlapping window partition in Hi-Fi, which is more hardware-friendly compared to the time-consuming operations such as window shifting [32] or multi-scale window partition [60].
75
+
76
+ Low-frequency attention. Recent studies have shown that the global attention in MSA helps to capture low frequencies [38]. However, directly applying MSA to high-resolution feature maps requires huge computational cost. As averaging is a low-pass filter [49], Lo-Fi firstly applies average pooling to each window to get low-frequency signals in the input $\mathbf { X }$ . Next, the average-pooled feature maps are projected into keys $\mathbf { K } \in \mathbb { R } ^ { \bar { N } / s ^ { 2 } \times \bar { D } _ { h } }$ and values $\bar { \mathbf { V } } \in \mathbb { R } ^ { N / s ^ { 2 } \times D _ { h } }$ , where $s$ is the window size. The queries $\mathbf { Q }$ in Lo-Fi still comes from the original feature map X. We then apply the standard attention to capture the rich low-frequency information in feature maps. Note that due to the spatial reduction of $\mathbf { K }$ and $\mathbf { V }$ , Lo-Fi simultaneously reduces the complexity for both Eq. (1) and Eq. (2).
77
+
78
+ Head splitting. A naive solution for head assignment is to allocate both Hi-Fi and Lo-Fi the same number of heads as the standard MSA layer. However, doubling heads results in more computational cost. In order to achieve better efficiency, HiLo separates the same number of heads in an MSA into two groups with a split ratio $\alpha$ , where $( 1 - \alpha ) N _ { h }$ heads will be employed for Hi-Fi and the other $\alpha N _ { h }$ heads are used for Lo-Fi. By doing so, as each attention has a lower complexity than a standard MSA, the entire framework of HiLo guarantees a low complexity and ensures high throughput on GPUs. Moreover, another benefit of head splitting is that the learnable parameter $\mathbf { W } _ { o }$ can be decomposed into two smaller matrices, which helps to reduce model parameters. Finally, the output of HiLo is a
79
+
80
+ ![](images/c3dd3c5a05b524fb30cb83fbc377172c98779c266436e3c6dd34b30951bf6bec.jpg)
81
+ Figure 2: FLOPs comparison for Hi-Fi and Lo-Fi under different image resolutions and equal number of heads (Figures a and b). A larger window size helps HiLo achieve better efficiency on highresolution images (Figure c).
82
+
83
+ 81.8 3.90 concatenation of the outputs from each attention
84
+
85
+ $$
86
+ \mathrm { H i L o ( X ) } = \mathrm { [ H i \mathrm { - } F i ( X ) ; L o \mathrm { - } F i ( X ) ] , }
87
+ $$
88
+
89
+ 81.2where $[ \cdot ]$ denotes the concatenation operation.
90
+
91
+ Complexity Analysis. Without loss of generality, we assume Hi-Fi and Lo-Fi have an equal number of heads (i.e., $\alpha = 0 . 5$ ) and the feature map has equal width and height. Then, Hi-Fi and Lo-Fi have a computational cost of this result can be found $\scriptstyle { \frac { 7 } { 4 } } N D ^ { 2 } + s ^ { 2 } N D$ and ntar $( \textstyle { \frac { 3 } { 4 } } + \textstyle { \frac { 1 } { s ^ { 2 } } } ) N D ^ { 2 } + \textstyle { \frac { 1 } { s ^ { 2 } } } \bar { N ^ { 2 } D }$ , respectively. Derivation forigure 2-(a) and (b), under a small input image resolution and a small value of $s$ (e.g., $s = 2$ ), both Hi-Fi and Lo-Fi are comparably efficient. However, with a much higher resolution, Lo-Fi will result in a huge computational cost as it still has a quadratic complexity in terms of $N$ in Eq. (2), i.e., $\scriptstyle { \frac { 1 } { s ^ { 2 } } } N ^ { 2 } D$ . In this case, slightly increasing $s$ (e.g., $s = 4$ ) helps Lo-Fi achieve better efficiency while preserving the accuracy. Combining the two attentions together, a larger window size also helps the overall framework of HiLo to reduce more FLOPs on high-resolution images, as shown in Figure 2-(c). Thus, we suggest a practical guideline for adopting HiLo into existing frameworks: increasing the window size in order to get better efficiency on high-resolution images. We further show in Section 5.2 that this principle helps LITv2 achieve a better speed and accuracy trade-off on downstream tasks, e.g., dense object detection.
92
+
93
+ # 4.2 Positional Encoding
94
+
95
+ Positional encoding is essential to self-attention due to its permutation-invariant property. In LITv1, the later MSAs adopt the same relative positional encoding (RPE) scheme as Swin [32]. This approach has significantly improves Swin by $0 . 7 \%$ in Top-1 accuracy on ImageNet compared to using absolute positional encoding [32]. However, on dense prediction tasks, the fixed RPE has to be interpolated for different image resolutions, which dramatically slows down the training/inference speed of LITv1. As a recent study [27] has shown that position information can be implicitly learned from zero-padding in CNNs, we propose to adopt one layer of $3 \times 3$ depthwise convolutional layer with zero-padding in each FFN to replace the time-consuming RPE. Notably, due to the elimination of early MSAs, the early blocks in LITv1 only have FFNs left, which results in a tiny receptive field of $1 \times 1$ . To this end, we show in Section 5.4 that the $3 \times 3$ convolutional filters adopted in each FFN also improve LITv2 by simultaneously enlarging the receptive field in the early stages.
96
+
97
+ # 4.3 Model Architecture
98
+
99
+ LITv2 has three variants: LITv2-S, LITv2-M and LITv2-B, corresponding to the small, medium and base settings in LITv1, respectively. For a fair comparison, we keep the network width and depth as the same as LITv1. The overall modifications are simply in two steps: 1) Adding one layer of depthwise convolution with zero-padding in each FFN and removing all relative positional encodings in all MSAs. 2) Replacing all attention layers with the proposed HiLo attention. Detailed architecture configurations can be found in the supplementary material.
100
+
101
+ # 5 Experiment
102
+
103
+ In this section we conduct experiments to validate the effectiveness of the proposed LITv2. Following common practice [51, 32, 12, 60], we experiment LITv2 on three tasks, including image classification on ImageNet-1K [43], object detection and instance segmentation on COCO [31] and semantic segmentation on ADE20K [65].
104
+
105
+ Table 1: Image classification results on ImageNet-1K. By default, the FLOPs, throughput and memory consumption are measured based on the resolution $2 2 4 \times 2 2 4$ . We report the throughput and training/test time memory consumption with a batch size of 64. Throughput is tested on one NVIDIA RTX 3090 GPU and averaged over 30 runs. ResNet results are from "ResNet Stikes Back" [53]. “↑ 384” means a model is finetuned at the resolution $3 8 4 \times 3 8 4$ . “OOM” means “out-of-memory”.
106
+
107
+ <table><tr><td>Model</td><td>Param (M)</td><td>FLOPs (G)</td><td>Throughput (imgs/s)</td><td>Train Mem (GB)</td><td>Test Mem (GB)</td><td>Top-1 (%)</td></tr><tr><td>ResNet-50 [53]</td><td>26</td><td>4.1</td><td>1,279</td><td>7.9</td><td>2.8</td><td>80.4</td></tr><tr><td>ConvNext-Ti [33]</td><td>28</td><td>4.5</td><td>1,079</td><td>8.3</td><td>1.7</td><td>82.1</td></tr><tr><td>PVT-S [51]</td><td>25</td><td>3.8</td><td>1,007</td><td>6.8</td><td>1.3</td><td>79.8</td></tr><tr><td>Swin-Ti [32]</td><td>28</td><td>4.5</td><td>961</td><td>6.1</td><td>1.5</td><td>81.3</td></tr><tr><td>CvT-13 [54]</td><td>20</td><td>4.5</td><td>947</td><td>6.1</td><td>1.5</td><td>81.6</td></tr><tr><td>Focal-Tiny [60]</td><td>29</td><td>4.9</td><td>384</td><td>12.2</td><td>3.3</td><td>82.2</td></tr><tr><td>Twins-PCPVT-S [12]</td><td>24</td><td>3.8</td><td>998</td><td>6.8</td><td>1.2</td><td>81.2</td></tr><tr><td>LITv1-S [36]</td><td>27</td><td>4.1</td><td>1,298</td><td>5.8</td><td>1.2</td><td>81.5</td></tr><tr><td>LITv2-S</td><td>28</td><td>3.7</td><td>1,471</td><td>5.1</td><td>1.2</td><td>82.0</td></tr><tr><td>ResNet-101[53]</td><td>45</td><td>7.9</td><td>722</td><td>10.5</td><td>3.0</td><td>81.5</td></tr><tr><td>ConvNext-S [33]</td><td>50</td><td>8.7</td><td>639</td><td>12.3</td><td>1.8</td><td>83.1</td></tr><tr><td>PVT-M [51]</td><td>44</td><td>6.7</td><td>680</td><td>9.3</td><td>1.5</td><td>81.2</td></tr><tr><td>Twins-SVT-B[12]</td><td>56</td><td>8.3</td><td>621</td><td>9.8</td><td>1.9</td><td>83.2</td></tr><tr><td>Swin-S [32]</td><td>50</td><td>8.7</td><td>582</td><td>9.7</td><td>1.7</td><td>83.0</td></tr><tr><td>LITv1-M [36]</td><td>48</td><td>8.6</td><td>638</td><td>12.0</td><td>1.4</td><td>83.0</td></tr><tr><td>LITv2-M</td><td>49</td><td>7.5</td><td>812</td><td>8.8</td><td>1.4</td><td>83.3</td></tr><tr><td>ResNet-152 [53]</td><td>60</td><td>11.6</td><td>512</td><td>13.4</td><td>2.9</td><td>82.0</td></tr><tr><td>ConvNext-B [33]</td><td>89</td><td>15.4</td><td>469</td><td>16.9</td><td>2.9</td><td>83.8</td></tr><tr><td>Twins-SVT-L [12]</td><td>99</td><td>14.8</td><td>440</td><td>13.7</td><td>3.1</td><td>83.7</td></tr><tr><td>Swin-B [32]</td><td>88</td><td>15.4</td><td>386</td><td>13.4</td><td>2.4</td><td>83.3</td></tr><tr><td>LITv1-B [36]</td><td>86</td><td>15.0</td><td>444</td><td>16.4</td><td>2.1</td><td>83.4</td></tr><tr><td>LITv2-B</td><td>87</td><td>13.2</td><td>602</td><td>12.2</td><td>2.1</td><td>83.6</td></tr><tr><td>DeiT-B↑ 384 [45]</td><td>86</td><td>55.4</td><td>159</td><td>39.9</td><td>2.5</td><td>83.1</td></tr><tr><td>Swin-B↑ 384 [32]</td><td>88</td><td>47.1</td><td>142</td><td>OOM</td><td>6.1</td><td>84.5</td></tr><tr><td>LITv2-B↑ 384</td><td>87</td><td>39.7</td><td>198</td><td>35.8</td><td>4.6</td><td>84.7</td></tr></table>
108
+
109
+ # 5.1 Image Classification on ImageNet-1K
110
+
111
+ We conduct image classification experiments on ImageNet-1K [43], a large-scale image dataset which contains ${ \sim } 1 . 2 \mathbf { M }$ training images and 50K validation images from 1K categories. We measure the model performance by Top-1 accuracy. Furthermore, we report the FLOPs, throughput, as well as training/test memory consumption on GPUs. We compare with two CNN-based models [53, 33] and several representative SoTA ViTs [51, 32, 54, 60, 12]. Note that this paper does not consider mobile-level architectures [8, 35]. Instead, we focus on models with the similar model size. Besides, we are also not directly comparable with NAS-based methods [3, 5] as LITv2 is manually designed.
112
+
113
+ Implementation details. All models are trained for 300 epochs from scratch on 8 V100 GPUs. At training time, we set the total batch size as 1,024. The input images are resized and randomly cropped into $2 2 4 \times 2 2 4$ . The initial learning rate is set to $1 \times 1 0 ^ { - 5 }$ and the weight decay is set to $5 \times \mathrm { { 1 0 ^ { - 2 } } }$ . We use AdamW optimizer with a cosine decay learning rate scheduler. All training strategies including the data augmentation are same as in LITv1. For HiLo, the window size $s$ is set to 2. The split ratio $\alpha$ is set to 0.9, which is chosen from a simple grid search on ImageNet-1K. The depthwise convolutional layers in FFNs are set with a kernel size of $3 \times 3$ , stride of 1 and zero padding size of 1.
114
+
115
+ Table 2: Object detection and instance segmentation performance on the COCO val2017 split using the RetinaNet [30] and Mask R-CNN [22] framework. $\mathrm { A P } ^ { b }$ and $\mathrm { A P } ^ { m }$ denote the bounding box AP and mask AP, respectively. “\*” indicates the model adopts a local window size of 4 in HiLo.
116
+
117
+ <table><tr><td rowspan="2">Backbone</td><td colspan="4">RetinaNet</td><td colspan="5">MaskR-CNN</td></tr><tr><td>Params</td><td>FLOPs (G)</td><td>FPS</td><td>AP6</td><td>Params</td><td>FLOPs (G)</td><td>FPS</td><td>AP6</td><td>APm</td></tr><tr><td>ResNet-50 [23]</td><td>38M</td><td>239</td><td>18.5</td><td>36.3</td><td>44M</td><td>260</td><td>27.1</td><td>38.0</td><td>34.4</td></tr><tr><td>PVT-S [51]</td><td>34M</td><td>273</td><td>13.0</td><td>40.4</td><td>44M</td><td>292</td><td>16.2</td><td>40.4</td><td>37.8</td></tr><tr><td>Swin-T [32]</td><td>38M</td><td>251</td><td>17.0</td><td>41.5</td><td>48M</td><td>270</td><td>21.1</td><td>42.2</td><td>39.1</td></tr><tr><td>Twins-SVT-S[12]</td><td>34M</td><td>225</td><td>15.5</td><td>43.0</td><td>44M</td><td>244</td><td>20.4</td><td>43.4</td><td>40.3</td></tr><tr><td>LITv1-S [36]</td><td>39M</td><td>305</td><td>3.3</td><td>41.6</td><td>48M</td><td>324</td><td>3.2</td><td>42.9</td><td>39.6</td></tr><tr><td>LITv2-S</td><td>38M</td><td>242</td><td>18.7</td><td>44.0</td><td>47M</td><td>261</td><td>18.7</td><td>44.9</td><td>40.8</td></tr><tr><td>LITv2-S*</td><td>38M</td><td>230</td><td>20.4</td><td>43.7</td><td>47M</td><td>249</td><td>21.9</td><td>44.7</td><td>40.7</td></tr><tr><td>ResNet-101[23]</td><td>57M</td><td>315</td><td>15.2</td><td>38.5</td><td>63M</td><td>336</td><td>20.9</td><td>40.4</td><td>36.4</td></tr><tr><td>PVT-M[51]</td><td>54M</td><td>348</td><td>10.5</td><td>41.9</td><td>64M</td><td>367</td><td>10.8</td><td>42.0</td><td>39.0</td></tr><tr><td>Swin-S [32]</td><td>60M</td><td>343</td><td>13.3</td><td>44.5</td><td>69M</td><td>362</td><td>15.8</td><td>44.8</td><td>40.9</td></tr><tr><td>Twins-SVT-B[12]</td><td>67M</td><td>358</td><td>10.8</td><td>45.3</td><td>76M</td><td>377</td><td>12.7</td><td>45.2</td><td>41.5</td></tr><tr><td>LITv2-M</td><td>59M</td><td>348</td><td>12.2</td><td>46.0</td><td>68M</td><td>367</td><td>12.6</td><td>46.8</td><td>42.3</td></tr><tr><td>LITv2-M*</td><td>59M</td><td>312</td><td>14.8</td><td>45.8</td><td>68M</td><td>315</td><td>16.0</td><td>46.5</td><td>42.0</td></tr><tr><td>ResNeXt101-64x4d [58]</td><td>96M</td><td>473</td><td>10.3</td><td>41.0</td><td>102M</td><td>493</td><td>12.4</td><td>42.8</td><td>38.4</td></tr><tr><td>PVT-L [51]</td><td>71M</td><td>439</td><td>9.5</td><td>42.6</td><td>81M</td><td>457</td><td>8.3</td><td>42.9</td><td>39.5</td></tr><tr><td>Swin-B [32]</td><td>98M</td><td>488</td><td>11.0</td><td>44.7</td><td>107M</td><td>507</td><td>11.3</td><td>45.5</td><td>41.3</td></tr><tr><td>Twins-SVT-L [12]</td><td>111M</td><td>504</td><td>9.9</td><td>45.7</td><td>120M</td><td>524</td><td>10.1</td><td>45.9</td><td>41.6</td></tr><tr><td>LITv2-B</td><td>97M</td><td>481</td><td>9.5</td><td>46.7</td><td>106M</td><td>500</td><td>9.3</td><td>47.3</td><td>42.6</td></tr><tr><td>LITv2-B*</td><td>97M</td><td>430</td><td>11.8</td><td>46.3</td><td>106M</td><td>449</td><td>11.5</td><td>46.8</td><td>42.3</td></tr></table>
118
+
119
+ Results. In Table 1, we report the experiment results on ImageNet-1K. First, compared to LITv1 baselines, LITv2 achieves consistent improvement on Top-1 accuracy while using less FLOPs. Moreover, benefit from HiLo, LITv2 achieves faster throughput and significant training time memory reduction (e.g., $1 3 \%$ , $2 7 \%$ , $3 6 \%$ inference speedup for the small, medium and base settings, respectively) compared to LITv1. Second, compared to CNNs, LITv2 models outperform all counterparts of ResNet and ConvNext in terms of FLOPs, throughput and memory consumption while achieving comparable performance. Last, compared to SoTA ViTs, LITv2 surpasses many models in terms of throughput and memory consumption with competitive performance. For example, under the similar amount of FLOPs, LITv2-S achieves faster inference speed than PVT-S and Twins-PCPVT-S with better performance. Although Focal-Tiny achieves better Top-1 accuracy than LITv2-S, it runs much slower (i.e., 384 vs. 1,471 images/s) and requires a large amount of memory to train. Besides, when finetuning on a higher resolution, LITv2-B outperforms both DeiT-B and Swin-B with a faster throughput and lower complexity.
120
+
121
+ # 5.2 Object Detection and Instance Segmentation on COCO
122
+
123
+ In this section, we conduct experiments on COCO 2017, a common benchmark for object detection and instance segmentation which contains ${ \sim } 1 1 8 \mathrm { K }$ images for the training set and ${ \sim } 5 \mathrm { K }$ images for the validation set. Following common practice [12, 51], we experiment with two detection frameworks: RetinaNet [30] and Mask R-CNN [22]. We measure model performance by Average Precision (AP).
124
+
125
+ Implementation details. All backbones are initialized with pretrained weights on ImageNet-1K. We train each model on 8 GPUs with $1 \times$ schedule (12 epochs) and a total batch size of 16. For a fair comparison, we adopt the same training strategy and hyperparameter settings as in LITv1 [36]. Note that we pretrain LITv2 with a local window size of 2 and $\alpha = 0 . 9$ on ImageNet-1K. Under the same $\alpha$ , a larger window size helps to achieve lower complexity and thus improves the speed at high resolution, as explained in Section 4.1. In this case, we also train models with a slightly larger window size of $s = 4$ for better efficiency, which we denote with “\*”. By default, FLOPs is evaluated based on the input resolution of $1 2 8 0 \times 8 0 0$ . FPS is measured on one RTX 3090 GPU based on the mmdetection [4] framework.
126
+
127
+ Results. In Table 2, we report the experimental results on COCO. In general, LITv2 outperforms LITv1 by a large margin in almost all metrics. Besides, our LITv2 significantly surpasses ResNet in terms of AP, though it runs slightly slower in some cases. More importantly, our LITv2 beats all the compared SoTA ViTs, achieving the best AP with compelling fast inference speed. Furthermore, by adopting a larger window size (i.e., $s = 4$ ), LITv2 achieves better efficiency with a slightly performance drop.
128
+
129
+ ![](images/e1c23fc80b9d93d228356c59d71a9cb8f9c3744fe4adfed45474b49f5b975b11.jpg)
130
+ Figure 3: Comparison with other attention mechanisms based on LITv2-S. We report the FLOPs, throughput, and training/test time memory consumption. Evaluations are based on a batch size of 64 on one RTX 3090 GPU. The black cross symbol means “out-of-memory”.
131
+
132
+ # 5.3 Semantic Segmentation on ADE20K
133
+
134
+ In this section, we evaluate LITv2 on the semantic segmentation task. We conduct experiments on ADE20K [65], a widely adopted dataset for semantic segmentation which has $\sim 2 0 \mathrm { K }$ training images, ${ \sim } 2 \mathbf { K }$ validation images and ${ \sim } 3 \mathrm { K }$ test images. Following prior works, we adopt the framework of Semantic FPN [29] and measure the model performance by mIoU. We train each model on 8 GPUs with a total batch size of 16 with 80K iterations. All backbones are initialized with pretrained weights on ImageNet1K. The stochastic depth for the small, medium and base models of LITv2 are 0.2, 0.2 and 0.3, respectively. All other training strategies are the same as in LITv1 [36].
135
+
136
+ Results. In Table 3, we compare LITv2 with ResNet and representative ViTs on ADE20K. In general, LITv2 achieves fast speed while outperforming many SoTA models. For example, our LITv2-S, LITv2-M and LITv2-B surpass SwinTi, Swin-S and Swin-B by $2 . 8 \%$ , $0 . 5 \%$ and $1 . 2 \%$ in mIoU with higher FPS, respectively.
137
+
138
+ Table 4: Performance comparisons with other efficient attention mechanisms in ViTs based on LITv2-S. We report the Top-1 accuracy on ImageNet-1K and mIoU on ADE20K.
139
+ Table 3: Semantic segmentation performance of different backbones on the ADE20K validation set. FLOPs is evaluated based on the image resolution of $5 1 2 \times 5 1 2$ .
140
+
141
+ <table><tr><td>Backbone</td><td>Params (M)</td><td>FLOPs (G)</td><td>FPS</td><td>mIoU (%)</td></tr><tr><td rowspan="3">ResNet-50[23] PVT-S [51] Swin-Ti[32] Twins-SVT-S [12] LITv1-S [36]</td><td>29</td><td>45</td><td>45.4 38.7</td><td>36.7 39.8</td></tr><tr><td>28 32</td><td>40 46</td><td>39.6</td><td>41.5</td></tr><tr><td>28 32</td><td>37 46</td><td>34.5</td><td>43.2</td></tr><tr><td rowspan="3">LITv2-S ResNet-101[23] PVT-M [51] Swin-S [32]</td><td>31</td><td>41</td><td>18.1 42.6</td><td>41.7 44.3</td></tr><tr><td>48 48</td><td>66 55</td><td>36.7 29.7</td><td>38.8 41.6</td></tr><tr><td>53</td><td>70</td><td></td><td></td></tr><tr><td rowspan="3">Twins-SVT-B[12] LITv2-M</td><td></td><td></td><td>24.4</td><td>45.2</td></tr><tr><td>60</td><td>67</td><td>28.0</td><td>45.3</td></tr><tr><td>52</td><td>63</td><td>28.5</td><td>45.7</td></tr><tr><td rowspan="3">PVT-L [51] Swin-B[32] Twins-SVT-L [12]</td><td>65</td><td>71</td><td>20.5</td><td>42.1</td></tr><tr><td>107</td><td>107</td><td>25.5</td><td>46.0</td></tr><tr><td>104</td><td>102</td><td>25.9</td><td>46.7</td></tr><tr><td>LITv2-B</td><td>90</td><td>93</td><td>27.5</td><td>47.2</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></table>
142
+
143
+ # 5.4 Ablation Study
144
+
145
+ In this section, we provide ablation studies for LITv2, including the comparison with other efficient attention variants, the effect of $\alpha$ in HiLo, as well as the effect of architecture modifications. By default, the throughput and memory consumption are measured on one RTX 3090 GPU with a batch size of 64 under the resolution of $2 2 4 \times 2 2 4$ .
146
+
147
+ Comparing HiLo with other attention mechanisms. Based on LITv2-S, we compare the performance of HiLo with other efficient attention mechanisms on ImageNet-1K, including spatial reduction attention (SRA) in PVT [51], shifted-window based attention (W-MSA) in Swin [32] and alternated local and global attention (T-MSA) in Twins [12]. In our implementation, we directly replace HiLo with each compared method. The results are reported in Table 4. In general, HiLo reduces more FLOPs while achieving better performance and faster speed than the compared methods. Furthermore, in Figure 3, we provide comprehensive benchmarks for more attention mechanisms based on different image resolutions, including Focal [60], QuadTree [44] and Performer [11]. Suffering from weak parallelizability, they are even slower than that of using standard MSAs on GPUs. Compared to them, HiLo achieves competitive results in terms of the FLOPs, throughput and memory consumption. Moreover, we conduct experiments based on ADE20K and Semantic FPN and show that HiLo achieves more performance gain than other attention mechanisms on the downstream dense prediction task.
148
+
149
+ ![](images/cbb1d473d79c8154b87f092117e77eb635c96c219d6956f092558d34b04d2fe6.jpg)
150
+ Figure 4: Effect of $\alpha$ based on LITv2-S.
151
+
152
+ Table 5: Effect of architecture modifications based on LITv1-S. “ConvFNN” means we add one layer of $3 \times 3$ depthwise convolutional layer into each FFN. “RPE” refers to relative positional encoding [32].
153
+
154
+ <table><tr><td rowspan="2">Name</td><td colspan="2">ImageNet-1K</td><td colspan="2">COCO (RetinaNet)</td></tr><tr><td>FLOPs Mem (G) (GB)</td><td>Top-1 (%)</td><td>FLOPs FPS (G)</td><td>AP</td></tr><tr><td>LITv1-S [36]</td><td>4.1 5.8</td><td>81.5</td><td>305 3.3</td><td>41.6</td></tr><tr><td>+ ConvFFN</td><td>4.1 6.5</td><td>82.5</td><td>306 3.1</td><td>45.1</td></tr><tr><td>+ Remove RPE</td><td>4.1 6.5</td><td>82.3</td><td>306 13.3</td><td>44.7</td></tr><tr><td>+ HiLo</td><td>3.7 5.1</td><td>82.0</td><td>224 18.7</td><td>44.0</td></tr></table>
155
+
156
+ ![](images/5daaae6e60488795ecfa600882462a6338d3c311c84c74c105beee391c097eea.jpg)
157
+ Figure 5: Frequency magnitude $( 1 4 \times 1 4 )$ from 8 output channels of Hi-Fi and Lo-Fi in LITv2-B. The magnitude is averaged over 100 samples. The lighter the color, the larger the magnitude. A pixel that is closer to the centre means a lower frequency. Visualization code can be found in the supplementary material.
158
+
159
+ Effect of $\alpha$ . As shown in Figure 4, since the complexity of Lo-Fi is lower than Hi-Fi under the resolution of $2 2 4 \times 2 2 4$ and the window size of 2, a larger $\alpha$ helps to reduce more FLOPs as we allocate more heads to Lo-Fi. Moreover, we found HiLo performs badly with $\alpha = 0$ , in which case only the Hi-Fi is left and HiLo only focuses on high frequencies. We speculate that low frequencies play an important role in self-attention. For other values of $\alpha$ , we find the performance difference is around $0 . 2 \%$ , where $\alpha = 0 . 9$ achieves the best performance. However, it is worth noting that although the pure Lo-Fi branch $( \alpha = 1 . 0$ ) can achieve competitive results on ImageNet-1K, high-frequency signals play an important role in capturing fine object details, which is particularly important for dense prediction tasks such as semantic segmentation. For example, with $\alpha = 0 . 9$ , LITv2-S based Semantic FPN achieves more performance gain $( + 0 . 6 \% )$ than that of using $\alpha = 1 . 0 \ : ( 4 3 . 7 \% )$ .
160
+
161
+ Effect of architecture modifications. Based on LITv2-S, we explore the effect of architecture modifications. As shown in Table 5, benefit from the enlarged receptive field in the early stages, the adoption of depthwise convolutions improves the performance on both ImageNet and COCO. Next, by removing the relative positional encoding, we significantly improve FPS on dense prediction tasks with a slightly performance drop on both datasets. Also note that since depthwise convolutions have encoded positional information by zero paddings [27], the elimination of RPE does not result in a significant performance drop compared to prior works [32]. Finally, benefit from HiLo, we achieve more gains in model efficiency on both ImageNet and COCO.
162
+
163
+ Spectrum analysis of HiLo. In Figure 5, we visualize the magnitude of frequency component [42] by applying Fast Fourier Transform (FFT) to the output feature maps from Hi-Fi and Lo-Fi attentions, respectively. The visualisation indicates that Hi-Fi captures more high frequencies and Lo-Fi mainly focuses on low frequencies. This strongly aligns with our aim of disentangling high and low frequencies in feature maps at a single attention layer.
164
+
165
+ Table 6: Speed and performance comparisons between LITv2-S and other recent ViTs on different GPUs. All throughput results are averaged over 30 runs with a total batch size of 64 and image resolution of $2 2 4 \times 2 2 4$ on one GPU card. We also report the Top-1 accuracy on ImageNet-1K.
166
+
167
+ <table><tr><td>Model</td><td>Params (M)</td><td>FLOPs (G)</td><td>A100</td><td>V100</td><td>RTX 6000</td><td>RTX 3090</td><td>Top-1 (%)</td></tr><tr><td>ResNet-50 [53]</td><td>26</td><td>4.1</td><td>1,424</td><td>1,123</td><td>877</td><td>1,279</td><td>80.4</td></tr><tr><td>PVT-S [51]</td><td>25</td><td>3.8</td><td>1,460</td><td>798</td><td>548</td><td>1,007</td><td>79.8</td></tr><tr><td>Twins-PCPVT-S[12]</td><td>24</td><td>3.8</td><td>1,455</td><td>792</td><td>529</td><td>998</td><td>81.2</td></tr><tr><td>Swin-Ti [32]</td><td>28</td><td>4.5</td><td>1,564</td><td>1,039</td><td>710</td><td>961</td><td>81.3</td></tr><tr><td>TNT-S [21]</td><td>24</td><td>5.2</td><td>802</td><td>431</td><td>298</td><td>534</td><td>81.3</td></tr><tr><td>CvT-13 [54]</td><td>20</td><td>4.5</td><td>1,595</td><td>716</td><td>379</td><td>947</td><td>81.6</td></tr><tr><td>CoAtNet-0 [15]</td><td>25</td><td>4.2</td><td>1,538</td><td>962</td><td>643</td><td>1,151</td><td>81.6</td></tr><tr><td>CaiT-XS24 [46]</td><td>27</td><td>5.4</td><td>991</td><td>484</td><td>299</td><td>623</td><td>81.8</td></tr><tr><td>PVTv2-B2 [52]</td><td>25</td><td>4.0</td><td>1,175</td><td>670</td><td>451</td><td>854</td><td>82.0</td></tr><tr><td>XCiT-S12[1]</td><td>26</td><td>4.8</td><td>1,727</td><td>761</td><td>504</td><td>1,068</td><td>82.0</td></tr><tr><td>ConvNext-Ti [33]</td><td>28</td><td>4.5</td><td>1,654</td><td>762</td><td>571</td><td>1,079</td><td>82.1</td></tr><tr><td>Focal-Tiny [60]</td><td>29</td><td>4.9</td><td>471</td><td>372</td><td>261</td><td>384</td><td>82.2</td></tr><tr><td>LITv2-S</td><td>28</td><td>3.7</td><td>1,874</td><td>1,304</td><td>928</td><td>1,471</td><td>82.0</td></tr></table>
168
+
169
+ ![](images/c167131df68793aafbb163d5e125013626b52aa2596fd33f47cb38482ef2660f.jpg)
170
+ Intel® Core i9-10900X CPU @ 3.70GHz
171
+ NVIDIA GeForce RTX 3090
172
+ Figure 6: Throughput comparisons with more attention mechanisms on CPUs and GPUs based on a single attention layer and $1 4 \times 1 4$ feature maps.
173
+
174
+ Speed and performance comparisons with more ViTs on different GPUs. We compare the inference speed with more models and on more types of GPUs. Table 6 reports the results. It shows that LITv2-S still achieves consistent faster throughput (images/s) than many ViTs on NVIDIA A100, Tesla V100, RTX 6000, and RTX 3090. It is also worth noting that under similar performance $( 8 2 . 0 \% )$ , LITv2-S is $2 . 1 \times$ faster than PVTv2-B2 [52], $1 . 7 \times$ faster than XCiT-S12 [1] and ConvNext-Ti [33], and $3 . 5 \times$ faster than Focal-Tiny [60] on V100, which is another common GPU version for speed test in previous works [32, 45, 33, 64].
175
+
176
+ Throughput comparisons with more attention mechanisms on CPUs and GPUs. In Figure 6, we show that HiLo is consistently faster than many attention mechanisms [51, 32, 1, 50, 11, 17, 55, 60, 41, 44, 20, 18] on both CPUs and GPUs. In particular, under CPU testing, HiLo is $1 . 4 \times$ faster than SRA [51], $1 . 6 \times$ faster than local window attention [32] and $1 7 . 4 \times$ faster than VAN [20]. Detailed benchmark configurations can be found in the supplementary material.
177
+
178
+ # 6 Conclusion and Future Work
179
+
180
+ In this paper, we have introduced LITv2, a novel efficient vision Transformer backbone with fast speed on GPUs and outperforms most SoTA models on ImageNet and downstream tasks. We have also presented HiLo attention, the core of LITv2 which helps to achieve better efficiency especially on high-resolution images. With competitive performance, HiLo achieves great advantage over the existing attention mechanisms across FLOPs, throughput and memory consumption. Future work may include incorporating convolutional stem [57] and overlapping patch embedding [52] for better performance, or extending HiLo on more tasks such as speech recognition and video processing.
181
+
182
+ Limitations and societal impact. HiLo adopts a head splitting ratio to assign different numbers of heads into Hi-Fi and Lo-Fi. In our experiments, this ratio is determined by a grid search on ImageNet (i.e., $\alpha = 0 . 9$ ). However, different tasks may have different importance on high and low frequencies. Thus, the optimal value of $\alpha$ is task-specific and needs to be set manually. Besides, our work potentially brings some negative societal impacts, such as the huge energy consumption and carbon emissions from large-scale training on GPU clusters.
183
+
184
+ # References
185
+
186
+ [1] A. Ali, H. Touvron, M. Caron, P. Bojanowski, M. Douze, A. Joulin, I. Laptev, N. Neverova, G. Synnaeve, J. Verbeek, and H. Jégou. Xcit: Cross-covariance image transformers. In NIPS, pages 20014–20027, 2021.
187
+ [2] J. Ba, J. Kiros, and G. E. Hinton. Layer normalization. ArXiv, abs/1607.06450, 2016.
188
+ [3] B. Chen, P. Li, C. Li, B. Li, L. Bai, C. Lin, M. Sun, J. Yan, and W. Ouyang. Glit: Neural architecture search for global and local image transformer. In ICCV, 2021.
189
+ [4] K. Chen, J. Wang, J. Pang, Y. Cao, Y. Xiong, X. Li, S. Sun, W. Feng, Z. Liu, J. Xu, Z. Zhang, D. Cheng, C. Zhu, T. Cheng, Q. Zhao, B. Li, X. Lu, R. Zhu, Y. Wu, J. Dai, J. Wang, J. Shi, W. Ouyang, C. C. Loy, and D. Lin. MMDetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019.
190
+ [5] M. Chen, H. Peng, J. Fu, and H. Ling. Autoformer: Searching transformers for visual recognition. In ICCV, pages 12250–12260, 2021.
191
+ [6] Q. Chen, Q. Wu, J. Wang, Q. Hu, T. Hu, E. Ding, J. Cheng, and J. Wang. Mixformer: Mixing features across windows and dimensions. In CVPR, pages 5239–5249, 2022.
192
+ [7] W. Chen, J. T. Wilson, S. Tyree, K. Q. Weinberger, and Y. Chen. Compressing convolutional neural networks in the frequency domain. In KDD, pages 1475–1484. ACM, 2016.
193
+ [8] Y. Chen, X. Dai, D. Chen, M. Liu, X. Dong, L. Yuan, and Z. Liu. Mobile-former: Bridging mobilenet and transformer. In CVPR, pages 5260–5269, 2022.
194
+ [9] Y. Chen, H. Fan, B. Xu, Z. Yan, Y. Kalantidis, M. Rohrbach, S. Yan, and J. Feng. Drop an octave: Reducing spatial redundancy in convolutional neural networks with octave convolution. In ICCV, pages 3434–3443. IEEE, 2019.
195
+ [10] R. Child, S. Gray, A. Radford, and I. Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
196
+ [11] K. M. Choromanski, V. Likhosherstov, D. Dohan, X. Song, A. Gane, T. Sarlós, P. Hawkins, J. Q. Davis, A. Mohiuddin, L. Kaiser, D. B. Belanger, L. J. Colwell, and A. Weller. Rethinking attention with performers. In ICLR, 2021.
197
+ [12] X. Chu, Z. Tian, Y. Wang, B. Zhang, H. Ren, X. Wei, H. Xia, and C. Shen. Twins: Revisiting the design of spatial attention in vision transformers. In NeurIPS, pages 9355–9366, 2021.
198
+ [13] J. W. Cooley, P. A. W. Lewis, and P. D. Welch. The fast fourier transform and its applications. IEEE Transactions on Education, 12(1):27–34, 1969.
199
+ [14] J. Cordonnier, A. Loukas, and M. Jaggi. On the relationship between self-attention and convolutional layers. In ICLR, 2020.
200
+ [15] Z. Dai, H. Liu, Q. V. Le, and M. Tan. Coatnet: Marrying convolution and attention for all data sizes. In NeurIPS, pages 3965–3977, 2021.
201
+ [16] G. Deng and L. Cahill. An adaptive gaussian filter for noise reduction and edge detection. In 1993 IEEE Conference Record Nuclear Science Symposium and Medical Imaging Conference, pages 1615–1619 vol.3, 1993.
202
+ [17] X. Dong, J. Bao, D. Chen, W. Zhang, N. Yu, L. Yuan, D. Chen, and B. Guo. Cswin transformer: A general vision transformer backbone with cross-shaped windows. In CVPR, pages 12114–12124, 2022.
203
+ [18] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. ICLR, 2021.
204
+ [19] M. Fritsche, S. Gu, and R. Timofte. Frequency separation for real-world super-resolution. ICCVW, Oct 2019.
205
+ [20] M.-H. Guo, C.-Z. Lu, Z.-N. Liu, M.-M. Cheng, and S.-M. Hu. Visual attention network. arXiv preprint arXiv:2202.09741, 2022.
206
+ [21] K. Han, A. Xiao, E. Wu, J. Guo, C. Xu, and Y. Wang. Transformer in transformer. In NeurIPS, pages 15908–15919, 2021.
207
+ [22] K. He, G. Gkioxari, P. Dollár, and R. B. Girshick. Mask R-CNN. In ICCV, pages 2980–2988, 2017.
208
+ [23] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016.
209
+ [24] D. Hendrycks and K. Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016.
210
+ [25] J. Huang, D. Guan, A. Xiao, and S. Lu. Rda: Robust domain adaptation via fourier adversarial attacking. In ICCV, pages 8988–8999, 2021.
211
+ [26] Z. Huang, Y. Ben, G. Luo, P. Cheng, G. Yu, and B. Fu. Shuffle transformer: Rethinking spatial shuffle for vision transformer. arXiv preprint arXiv:2106.03650, 2021.
212
+ [27] M. A. Islam, S. Jia, and N. D. B. Bruce. How much position information do convolutional neural networks encode? In ICLR, 2020.
213
+ [28] A. Katharopoulos, A. Vyas, N. Pappas, and F. Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML, pages 5156–5165. PMLR, 2020.
214
+ [29] A. Kirillov, R. B. Girshick, K. He, and P. Dollár. Panoptic feature pyramid networks. In CVPR, pages 6399–6408, 2019.
215
+ [30] T. Lin, P. Goyal, R. B. Girshick, K. He, and P. Dollár. Focal loss for dense object detection. In ICCV, pages 2999–3007, 2017.
216
+ [31] T. Lin, M. Maire, S. J. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick. Microsoft COCO: common objects in context. In D. J. Fleet, T. Pajdla, B. Schiele, and T. Tuytelaars, editors, ECCV, pages 740–755, 2014.
217
+ [32] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In ICCV, pages 9992–10002, 2021.
218
+ [33] Z. Liu, H. Mao, C.-Y. Wu, C. Feichtenhofer, T. Darrell, and S. Xie. A convnet for the 2020s. In CVPR, pages 11966–11976, 2022.
219
+ [34] N. Ma, X. Zhang, H.-T. Zheng, and J. Sun. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In ECCV, pages 116–131, 2018.
220
+ [35] S. Mehta and M. Rastegari. Mobilevit: Light-weight, general-purpose, and mobile-friendly vision transformer. In ICLR, 2022.
221
+ [36] Z. Pan, B. Zhuang, H. He, J. Liu, and J. Cai. Less is more: Pay less attention in vision transformers. In AAAI, pages 2035–2043, 2022.
222
+ [37] Z. Pan, B. Zhuang, J. Liu, H. He, and J. Cai. Scalable visual transformers with hierarchical pooling. In ICCV, pages 377–386, 2021.
223
+ [38] N. Park and S. Kim. How do vision transformers work? In ICLR, 2022.
224
+ [39] H. Peng, N. Pappas, D. Yogatama, R. Schwartz, N. A. Smith, and L. Kong. Random feature attention. In ICLR, 2021.
225
+ [40] J. W. Rae, A. Potapenko, S. M. Jayakumar, and T. P. Lillicrap. Compressive transformers for long-range sequence modelling. In ICLR, 2020.
226
+ [41] Y. Rao, W. Zhao, Y. Tang, J. Zhou, S.-L. Lim, and J. Lu. Hornet: Efficient high-order spatial interactions with recursive gated convolutions. In NeurIPS, 2022.
227
+ [42] Y. Rao, W. Zhao, Z. Zhu, J. Lu, and J. Zhou. Global filter networks for image classification. In NeurIPS, pages 980–993, 2021.
228
+ [43] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, et al. Imagenet large scale visual recognition challenge. IJCV, pages 211–252, 2015.
229
+ [44] S. Tang, J. Zhang, S. Zhu, and P. Tan. Quadtree attention for vision transformers. ICLR, 2022.
230
+ [45] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou. Training data-efficient image transformers & distillation through attention. In ICML, pages 10347–10357, 2021.
231
+ [46] H. Touvron, M. Cord, A. Sablayrolles, G. Synnaeve, and H. Jégou. Going deeper with image transformers. In ICCV, pages 32–42. IEEE, 2021.
232
+ [47] Z. Tu, H. Talebi, H. Zhang, F. Yang, P. Milanfar, A. Bovik, and Y. Li. Maxim: Multi-axis mlp for image processing. CVPR, pages 5759–5770, 2022.
233
+ [48] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, pages 5998–6008, 2017.
234
+ [49] E. Voigtman and J. D. Winefordner. Low-pass filters for signal averaging. Review of Scientific Instruments, 57(5):957–966, 1986.
235
+ [50] S. Wang, B. Li, M. Khabsa, H. Fang, and H. Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020.
236
+ [51] W. Wang, E. Xie, X. Li, D.-P. Fan, K. Song, D. Liang, T. Lu, P. Luo, and L. Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In ICCV, pages 548–558, 2021.
237
+ [52] W. Wang, E. Xie, X. Li, D.-P. Fan, K. Song, D. Liang, T. Lu, P. Luo, and L. Shao. Pvtv2: Improved baselines with pyramid vision transformer. Computational Visual Media, 8(3):1–10, 2022.
238
+ [53] R. Wightman, H. Touvron, and H. Jégou. Resnet strikes back: An improved training procedure in timm. CoRR, abs/2110.00476, 2021.
239
+ [54] H. Wu, B. Xiao, N. Codella, M. Liu, X. Dai, L. Yuan, and L. Zhang. Cvt: Introducing convolutions to vision transformers. In ICCV, pages 22–31, 2021.
240
+ [55] Z. Xia, X. Pan, S. Song, L. E. Li, and G. Huang. Vision transformer with deformable attention. In CVPR, pages 4794–4803, 2022.
241
+ [56] M. Xiao, S. Zheng, C. Liu, Y. Wang, D. He, G. Ke, J. Bian, Z. Lin, and T. Liu. Invertible image rescaling. In ECCV, pages 126–144, 2020.
242
+ [57] T. Xiao, M. Singh, E. Mintun, T. Darrell, P. Dollár, and R. B. Girshick. Early convolutions help transformers see better. In NeurIPS, pages 30392–30400, 2021.
243
+ [58] S. Xie, R. B. Girshick, P. Dollár, Z. Tu, and K. He. Aggregated residual transformations for deep neural networks. In CVPR, pages 5987–5995, 2017.
244
+ [59] K. Xu, M. Qin, F. Sun, Y. Wang, Y. Chen, and F. Ren. Learning in the frequency domain. In CVPR, pages 1737–1746. Computer Vision Foundation / IEEE, 2020.
245
+ [60] J. Yang, C. Li, P. Zhang, X. Dai, B. Xiao, L. Yuan, and J. Gao. Focal self-attention for local-global interactions in vision transformers. In NeurIPS, pages 30008–30022, 2021.
246
+ [61] K. Yuan, S. Guo, Z. Liu, A. Zhou, F. Yu, and W. Wu. Incorporating convolution designs into visual transformers. In ICCV, pages 559–568, 2021.
247
+ [62] L. Yuan, Y. Chen, T. Wang, W. Yu, Y. Shi, F. E. Tay, J. Feng, and S. Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. In ICCV, pages 538–547, 2021.
248
+ [63] P. Zhang, X. Dai, J. Yang, B. Xiao, L. Yuan, L. Zhang, and J. Gao. Multi-scale vision longformer: A new vision transformer for high-resolution image encoding. In ICCV, pages 2978–2988, 2021.
249
+ [64] Q. Zhang, Y. Xu, J. Zhang, and D. Tao. Vsa: Learning varied-size window attention in vision transformers. ECCV, 2022.
250
+ [65] B. Zhou, H. Zhao, X. Puig, T. Xiao, S. Fidler, A. Barriuso, and A. Torralba. Semantic understanding of scenes through the ADE20K dataset. IJCV, pages 302–321, 2019.
251
+ [66] Y. Zhou, W. Deng, T. Tong, and Q. Gao. Guided frequency separation network for real-world superresolution. In CVPRW, pages 1722–1731, 2020.
252
+
253
+ # Checklist
254
+
255
+ 1. For all authors...
256
+
257
+ (a) Do the main claims made in the abstract and introduction accurately reflect the paper’s contributions and scope? [Yes]
258
+ (b) Did you describe the limitations of your work? [Yes] See Section 6.
259
+ (c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 6.
260
+ (d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes]
261
+
262
+ 2. If you are including theoretical results...
263
+
264
+ (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]
265
+
266
+ 3. If you ran experiments...
267
+
268
+ (a) Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? [Yes] Code and pretrained models are included as a URL in the abstract.
269
+ (b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 5.
270
+ (c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We use the same random seed as in recent works for fair comparison.
271
+ (d) Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? [Yes] See Section 5.
272
+
273
+ 4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets...
274
+
275
+ (a) If your work uses existing assets, did you cite the creators? [Yes] See Section 5.
276
+ (b) Did you mention the license of the assets? [No] The license of the public datasets can be found in their websites.
277
+ (c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Code and pretrained models are included as a URL in the abstract.
278
+ (d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] We use public datasets (e.g., ImageNet [43] and ADE20K [65]).
279
+ (e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] No such concerns as we are using widely adopted public datasets.
280
+
281
+ 5. If you used crowdsourcing or conducted research with human subjects...
282
+
283
+ (a) Did you include the full text of instructions given to participants and screenshots, if applicable? [N/A]
284
+ (b) Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? [N/A]
285
+ (c) Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? [N/A]
parse/dev/Pyd6Rh9r1OT/Pyd6Rh9r1OT_content_list.json ADDED
@@ -0,0 +1,1115 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Fast Vision Transformers with HiLo Attention ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 217,
8
+ 122,
9
+ 779,
10
+ 147
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Zizheng Pan Jianfei Cai Bohan Zhuang† ",
17
+ "bbox": [
18
+ 344,
19
+ 195,
20
+ 658,
21
+ 212
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Department of Data Science & AI, Monash University, Australia ",
28
+ "bbox": [
29
+ 287,
30
+ 218,
31
+ 710,
32
+ 232
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Abstract ",
39
+ "text_level": 1,
40
+ "bbox": [
41
+ 462,
42
+ 267,
43
+ 535,
44
+ 284
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "Vision Transformers (ViTs) have triggered the most recent and significant breakthroughs in computer vision. Their efficient designs are mostly guided by the indirect metric of computational complexity, i.e., FLOPs, which however has a clear gap with the direct metric such as throughput. Thus, we propose to use the direct speed evaluation on the target platform as the design principle for efficient ViTs. Particularly, we introduce LITv2, a simple and effective ViT which performs favourably against the existing state-of-the-art methods across a spectrum of different model sizes with faster speed. At the core of LITv2 is a novel self-attention mechanism, which we dub HiLo. HiLo is inspired by the insight that high frequencies in an image capture local fine details and low frequencies focus on global structures, whereas a multi-head self-attention layer neglects the characteristic of different frequencies. Therefore, we propose to disentangle the high/low frequency patterns in an attention layer by separating the heads into two groups, where one group encodes high frequencies via self-attention within each local window, and another group encodes low frequencies by performing global attention between the average-pooled low-frequency keys and values from each window and each query position in the input feature map. Benefiting from the efficient design for both groups, we show that HiLo is superior to the existing attention mechanisms by comprehensively benchmarking FLOPs, speed and memory consumption on GPUs and CPUs. For example, HiLo is $1 . 4 \\times$ faster than spatial reduction attention and $1 . 6 \\times$ faster than local window attention on CPUs. Powered by HiLo, LITv2 serves as a strong backbone for mainstream vision tasks including image classification, dense detection and segmentation. Code is available at https://github.com/ziplab/LITv2. ",
51
+ "bbox": [
52
+ 233,
53
+ 300,
54
+ 764,
55
+ 630
56
+ ],
57
+ "page_idx": 0
58
+ },
59
+ {
60
+ "type": "text",
61
+ "text": "1 Introduction ",
62
+ "text_level": 1,
63
+ "bbox": [
64
+ 174,
65
+ 656,
66
+ 310,
67
+ 674
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Real-world applications usually require a model to have an optimal speed and accuracy trade-off under limited computational budget, such as UAV and autonomous driving. This motivates substantial works toward efficient vision Transformer (ViT) design, such as PVT [51], Swin [32] and Focal Transformer [60], among others. To measure the computational complexity, a widely adopted metric in recent ViT design is the number of float-point operations, i.e., FLOPs. However, FLOPs is an indirect metric, which can not directly reflect the real speed on the target platform. For example, Focal-Tiny is much slower than Swin-Ti on GPUs although their FLOPs are comparable. ",
74
+ "bbox": [
75
+ 174,
76
+ 688,
77
+ 825,
78
+ 785
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "In general, the discrepancy between the indirect metric (FLOPs) and the direct metric (speed) in recent ViTs can be attributed to two main reasons. First, although self-attention is efficient on low-resolution feature maps, the quadratic complexity in both memory and time makes it much slower on high-resolution images due to intensive memory access cost [34], where fetching data from off-chip DRAM can be speed-consuming. Second, some efficient attention mechanisms in ViTs have low theoretical complexity guarantee but are actually slow on GPUs due to particular operations that are not hardware-friendly or cannot be parallelized, such as the multi-scale window partition [60], recursion [44] and dilated window [20]. ",
85
+ "bbox": [
86
+ 174,
87
+ 791,
88
+ 825,
89
+ 875
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "image",
95
+ "img_path": "images/3863cf3f80ae0c2671284d8f8aac929d15e60c053d4009d3925cdf0e063955e0.jpg",
96
+ "image_caption": [
97
+ "Figure 1: Framework of HiLo attention. $N _ { h }$ refers to the total number of self-attention heads at this layer. $\\alpha$ denotes the split ratio for high/low frequency heads. Best viewed in color. "
98
+ ],
99
+ "image_footnote": [],
100
+ "bbox": [
101
+ 204,
102
+ 87,
103
+ 790,
104
+ 267
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "",
111
+ "bbox": [
112
+ 174,
113
+ 318,
114
+ 825,
115
+ 347
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "With these observations, in this paper we propose to evaluate ViT by the direct metric, i.e., throughput, not only FLOPs. Based on this principle, we introduce LITv2, a novel efficient and accurate vision Transformer that outperforms most state-of-the-art (SoTA) ViTs on standard benchmarks while being practically faster on GPUs. LITv2 is bulit upon LITv1 [36], a simple ViT baseline which removes all multi-head self-attention layers (MSAs) in the early stages while applying standard MSAs in the later stages. Benefit from this design, LITv1 is faster than many existing works on ImageNet classification due to no computational cost from the early MSAs while the later MSAs only need to process downsampled low-resolution feature maps. However, the standard MSA still suffers from huge computational cost on high-resolution images, especially for dense prediction tasks. ",
122
+ "bbox": [
123
+ 174,
124
+ 352,
125
+ 825,
126
+ 477
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "To address this problem, we propose a novel efficient attention mechanism, termed HiLo. HiLo is motivated by the fact that natural images contain rich frequencies where high/low frequencies play different roles in encoding image patterns, i.e., local fine details and global structures, respectively. A typical MSA layer enforces the same global attention across all image patches without considering the characteristics of different underlying frequencies. This motivates us to propose to separate an MSA layer into two paths where one path encodes high-frequency interactions via local self-attention with relatively high-resolution feature maps while the other path encodes low-frequency interactions via global attention with down-sampled feature maps, which leads to a great efficiency improvement. ",
133
+ "bbox": [
134
+ 174,
135
+ 483,
136
+ 825,
137
+ 594
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "Specifically, HiLo employs two efficient attentions to disentangle High/Low frequencies in feature maps. As shown in Figure 1, in the upper path, we allocate a few heads to the high frequency attention (Hi-Fi) to capture fine-grained high frequencies by local window self-attention (e.g., $2 \\times 2$ windows), which is much more efficient than standard MSAs. The lower path, implementing the low-frequency attention (Lo-Fi), first applies average pooling to each window to obtain low-frequency signals. Then, we allocate the remaining heads for Lo-Fi to model the relationship between each query position in the input feature map and the average-pooled low-frequency keys and values from each window. Benefit from the reduced length of keys and values, Lo-Fi also achieves significant complexity reduction. Finally, we concatenate the refined high/low-frequency features and forward the resulting output into subsequent layers. Since both Hi-Fi and Lo-Fi are not equipped with time-consuming operations such as dilated windows and recursion, the overall framework of HiLo is fast on both CPUs and GPUs. We show by comprehensive benchmarks that HiLo achieves advantage over the existing attention mechanisms in terms of performance, FLOPs, throughput and memory consumption. ",
144
+ "bbox": [
145
+ 173,
146
+ 599,
147
+ 826,
148
+ 780
149
+ ],
150
+ "page_idx": 1
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "Besides, we find the fixed relative positional encoding in LITv1 dramatically slows down its speed on dense prediction tasks due to the interpolation for different image resolutions. For better efficiency, we propose to adopt one $3 \\times 3$ depthwise convolutional layer with zero-padding in each FFN to incorporate the implicitly learned position information from zero-padding [27]. Moreover, the $3 \\times 3$ convolutional filters simultaneously help to enlarge the receptive field of the early multi-layer perceptron (MLP) blocks in LITv1. Finally, we conduct extensive experiments on ImageNet, COCO and ADE20K to evaluate the performance of LITv2. Comprehensive comparisons with SoTA models show that our architecture achieves competitive performance with faster throughput, making ViTs more feasible to run low-latency applications for real-world scenarios. ",
155
+ "bbox": [
156
+ 174,
157
+ 786,
158
+ 825,
159
+ 911
160
+ ],
161
+ "page_idx": 1
162
+ },
163
+ {
164
+ "type": "text",
165
+ "text": "2 Related Work ",
166
+ "text_level": 1,
167
+ "bbox": [
168
+ 174,
169
+ 88,
170
+ 321,
171
+ 106
172
+ ],
173
+ "page_idx": 2
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "Vision Transformers. Vision Transformers are neural networks that adopt self-attention mechanisms into computer vision tasks. In [18], Dosovitskiy et al. propose a ViT for image classification, which inherits the similar architecture from a standard Transformer [48] in natural language processing (NLP) tasks. Since then, subsequent works have been proposed to improve ViT by incorporating more convolutional layers [54, 61], introducing pyramid feature maps [51, 32], enhancing the locality [62], as well as automatically searching a well-performed architecture [5, 3] with neural architecture search (NAS). Some others also seek for token pruning to accelerate the inference speed of ViTs [37] or applying ViT into low-level vision tasks [47]. Compared to existing works, this paper focuses on a general ViT-based backbone for computer vision (CV) tasks and aims to achieve better efficiency on GPUs while maintaining competitive performance. ",
178
+ "bbox": [
179
+ 173,
180
+ 121,
181
+ 825,
182
+ 260
183
+ ],
184
+ "page_idx": 2
185
+ },
186
+ {
187
+ "type": "text",
188
+ "text": "Efficient attention mechanisms. Efficient attention mechanisms aim to reduce the quadratic complexity of standard MSAs. Existing efforts in NLP can be roughly categories into low-rank decomposition [50], kernelization [28, 39], memory [40] and sparsity mechanism [10]. However, simply adopting these method usually performs suboptimally in CV tasks [32, 63]. In CV, representative efficient self-attention mechanisms includes spatial reduction attention (SRA) [51], local window attention [32, 26] and Twins attention [12]. However, they only focus on either local or global attention at the same layer. To address this problem, TNT [21] introduced additional global tokens and MixFormer [6] mixed local window attention with depthwise convolutional layers. Some other attention mechanisms consider both simultaneously, such as Focal [60] and QuadTree [44]. However, due to the inefficient operations which are not hardware-friendly and cannot be reflected in FLOPs (e.g., multi-scale window partition, recursion), they are slow on GPUs even compared to standard MSA. To this end, the proposed HiLo attention simultaneously captures rich local-global information at the same MSA layer and is faster and more memory-efficient compared to the existing works. ",
189
+ "bbox": [
190
+ 173,
191
+ 266,
192
+ 825,
193
+ 445
194
+ ],
195
+ "page_idx": 2
196
+ },
197
+ {
198
+ "type": "text",
199
+ "text": "Frequency domain analysis in vision. The frequency domain analysis in CV has been well studied in the literature. According to [13, 16], the low frequencies in an image usually capture global structures and color information while the high frequencies contain fine details of objects (e.g., sharp edges). Based on this insight, a plethora of solutions have been proposed for image super-resolution [66, 19], generalization [25], image re-scaling [56] and neural network compression [59, 7]. Furthermore, Octave convolution [9] targeted convolutional layers and proposed to locally applies convolution on high/low-resolution feature maps, separately. Different from it, the proposed HiLo is a novel attention mechanism that captures both local and global relationships with self-attention. ",
200
+ "bbox": [
201
+ 173,
202
+ 452,
203
+ 826,
204
+ 563
205
+ ],
206
+ "page_idx": 2
207
+ },
208
+ {
209
+ "type": "text",
210
+ "text": "3 Background ",
211
+ "text_level": 1,
212
+ "bbox": [
213
+ 174,
214
+ 583,
215
+ 308,
216
+ 599
217
+ ],
218
+ "page_idx": 2
219
+ },
220
+ {
221
+ "type": "text",
222
+ "text": "Multi-head self-attention. Transformers are built upon multi-head self-attention, which enables to capture long-range relationships for tokens at different positions. Specifically, let $\\mathbf { X } \\in \\mathbb { R } ^ { N \\times D }$ be the input sequence into a standard MSA layer, where $N$ is the length of the input sequence and $D$ refers to the number of hidden dimensions. Each self-attention head calculates the query $\\mathbf { Q }$ , key $\\mathbf { K }$ and value $\\mathbf { V }$ matrices with a linear transformation from $\\mathbf { X }$ , ",
223
+ "bbox": [
224
+ 173,
225
+ 614,
226
+ 825,
227
+ 684
228
+ ],
229
+ "page_idx": 2
230
+ },
231
+ {
232
+ "type": "equation",
233
+ "img_path": "images/c1fd89169da1fefa24cbe96ed661e11d8afd14168940dc585676f86336059f32.jpg",
234
+ "text": "$$\n\\mathbf { Q } = \\mathbf { X } \\mathbf { W } _ { q } , \\mathbf { K } = \\mathbf { X } \\mathbf { W } _ { k } , \\mathbf { V } = \\mathbf { X } \\mathbf { W } _ { v } ,\n$$",
235
+ "text_format": "latex",
236
+ "bbox": [
237
+ 370,
238
+ 693,
239
+ 625,
240
+ 710
241
+ ],
242
+ "page_idx": 2
243
+ },
244
+ {
245
+ "type": "text",
246
+ "text": "where $\\mathbf { W } _ { q }$ , $\\mathbf { W } _ { k }$ , $\\mathbf { W } _ { v } \\in \\mathbb { R } ^ { D \\times D _ { h } }$ are learnable parameters and $D _ { h }$ is the number of hidden dimensions for a head. Next, the output of a self-attention head is a weighted sum over $N$ value vectors, ",
247
+ "bbox": [
248
+ 174,
249
+ 718,
250
+ 826,
251
+ 747
252
+ ],
253
+ "page_idx": 2
254
+ },
255
+ {
256
+ "type": "equation",
257
+ "img_path": "images/d931777fd853c7976e15b21ff0125a7bc5dbc6ecaf8ce629d91ff3870e192b3e.jpg",
258
+ "text": "$$\n\\mathrm { S A } _ { h } ( \\mathbf { X } ) = \\mathrm { S o f t m a x } ( \\frac { \\mathbf { Q } \\mathbf { K } ^ { \\top } } { \\sqrt { D _ { h } } } ) \\mathbf { V } .\n$$",
259
+ "text_format": "latex",
260
+ "bbox": [
261
+ 390,
262
+ 755,
263
+ 607,
264
+ 791
265
+ ],
266
+ "page_idx": 2
267
+ },
268
+ {
269
+ "type": "text",
270
+ "text": "For an MSA layer with $N _ { h }$ heads, the final output is computed by a linear projection of the concatenated outputs from each self-attention head, which can be formulated by ",
271
+ "bbox": [
272
+ 173,
273
+ 796,
274
+ 826,
275
+ 825
276
+ ],
277
+ "page_idx": 2
278
+ },
279
+ {
280
+ "type": "equation",
281
+ "img_path": "images/3653d25c5d2296682d81089ee2c4de639dc16fea7956a7bef56c15bc5fc3c3aa.jpg",
282
+ "text": "$$\n\\mathrm { M S A } ( \\mathbf { X } ) = \\operatorname * { c o n c a t } _ { h \\in [ N _ { h } ] } [ \\mathrm { S A } _ { h } ( \\mathbf { X } ) ] \\mathbf { W } _ { o } ,\n$$",
283
+ "text_format": "latex",
284
+ "bbox": [
285
+ 382,
286
+ 833,
287
+ 614,
288
+ 858
289
+ ],
290
+ "page_idx": 2
291
+ },
292
+ {
293
+ "type": "text",
294
+ "text": "where $\\mathbf { W } _ { o } \\in \\mathbb { R } ^ { ( N _ { h } \\times D _ { h } ) \\times D }$ is a learnable parameter. In practice, $D$ is usually equal to $N _ { h } \\times D _ { h }$ . Overall, a standard MSA layer have the computational cost of $4 N D ^ { 2 } + 2 N ^ { 2 } D$ , where $2 N ^ { 2 } D$ comes from Eq. (2), $3 N D ^ { 2 }$ and $\\dot { N } D ^ { 2 }$ comes from Eq. (1) and Eq. (3), respectively. ",
295
+ "bbox": [
296
+ 174,
297
+ 867,
298
+ 826,
299
+ 912
300
+ ],
301
+ "page_idx": 2
302
+ },
303
+ {
304
+ "type": "text",
305
+ "text": "Transformer blocks. A standard vision Transformer as described in [18] consists of a patch embedding layer, several blocks and a prediction head. Let $l$ be the index of a block. Then each block contains an MSA layer and a position-wise feed-forward network (FFN), which can expressed as ",
306
+ "bbox": [
307
+ 173,
308
+ 90,
309
+ 825,
310
+ 133
311
+ ],
312
+ "page_idx": 3
313
+ },
314
+ {
315
+ "type": "equation",
316
+ "img_path": "images/78a8b42683eec811d0e80b536a4caae6302d408de8b92407d593a57c61aca28c.jpg",
317
+ "text": "$$\n\\begin{array} { r } { \\mathbf { X } _ { l - 1 } ^ { ' } = \\mathbf { X } _ { l - 1 } + \\mathrm { M S A } ( \\mathrm { L N } ( \\mathbf { X } _ { l - 1 } ) ) , } \\\\ { \\mathbf { X } _ { l } = \\mathbf { X } _ { l - 1 } ^ { ' } + \\mathrm { F F N } ( \\mathrm { L N } ( \\mathbf { X } _ { l - 1 } ^ { ' } ) ) , } \\end{array}\n$$",
318
+ "text_format": "latex",
319
+ "bbox": [
320
+ 377,
321
+ 140,
322
+ 619,
323
+ 188
324
+ ],
325
+ "page_idx": 3
326
+ },
327
+ {
328
+ "type": "text",
329
+ "text": "where LN denotes the LayerNorm [2] and an FFN consists of two FC layers with GELU [24] nonlinearity in between. Recent works on ViT have proposed to divide the blocks into several stages (typically 4 stages) to generate pyramid feature maps for dense prediction tasks. Furthermore, to reduce the computational cost on high-resolution feature maps in the early stages, the MSA in Eq. (4) has been replaced with efficient alternatives, such as SRA [51] and W-MSA [32]. ",
330
+ "bbox": [
331
+ 174,
332
+ 190,
333
+ 825,
334
+ 261
335
+ ],
336
+ "page_idx": 3
337
+ },
338
+ {
339
+ "type": "text",
340
+ "text": "Bottlenecks of LITv1. Recent studies have shown that the MSA layers in the early stages in a model still focus on local patterns [14]. With the same observation, LITv1 [36] removes all early MSAs (i.e., exclude Eq. (4) in each block) while applying standard MSAs at the later stages. This design principle has achieved better efficiency with competitive performance on ImageNet compared to PVT [51] and Swin [32]. However, LITv1 still has two main bottlenecks in speed: 1) Given a high-resolution image, the standard MSAs in the later stages still result in huge computational cost. 2) The fixed relative positional encoding [32] dramatically slows down the speed when dealing with different image resolutions. This is due to interpolating the fixed-size positional encoding for each different image resolution. In the next section, we describe a novel attention mechanism with zero padding positional encoding to comprehensively accelerate LITv1. ",
341
+ "bbox": [
342
+ 173,
343
+ 270,
344
+ 825,
345
+ 409
346
+ ],
347
+ "page_idx": 3
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "4 Method ",
352
+ "text_level": 1,
353
+ "bbox": [
354
+ 174,
355
+ 429,
356
+ 269,
357
+ 446
358
+ ],
359
+ "page_idx": 3
360
+ },
361
+ {
362
+ "type": "text",
363
+ "text": "4.1 HiLo Attention ",
364
+ "text_level": 1,
365
+ "bbox": [
366
+ 174,
367
+ 462,
368
+ 318,
369
+ 477
370
+ ],
371
+ "page_idx": 3
372
+ },
373
+ {
374
+ "type": "text",
375
+ "text": "We propose to separately process high/low frequencies in a feature map at an attention layer. We name the new attention mechanism as HiLo, which is depicted in Figure 1. Essentially, the low-frequency attention branch (Lo-Fi) is to capture the global dependencies of the input (image/features), which does not need a high-resolution feature map but requires global attention. On the other hand, the high-frequency attention branch (Hi-Fi) is to capture the fine detailed local dependency, which requires a high-resolution feature map but can be done via local attention. In the next, we describe the two attentions in detail. ",
376
+ "bbox": [
377
+ 174,
378
+ 488,
379
+ 825,
380
+ 584
381
+ ],
382
+ "page_idx": 3
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "High-frequency attention. Intuitively, as high frequencies encode local details of objects, it can be redundant and computationally expensive to apply global attention on a feature map. Therefore, we propose to design Hi-Fi to capture fine-grained high frequencies with local window self-attention (e.g., $2 \\times 2$ windows), which saves significant computational complexity. Furthermore, we employ the simple non-overlapping window partition in Hi-Fi, which is more hardware-friendly compared to the time-consuming operations such as window shifting [32] or multi-scale window partition [60]. ",
387
+ "bbox": [
388
+ 174,
389
+ 590,
390
+ 825,
391
+ 674
392
+ ],
393
+ "page_idx": 3
394
+ },
395
+ {
396
+ "type": "text",
397
+ "text": "Low-frequency attention. Recent studies have shown that the global attention in MSA helps to capture low frequencies [38]. However, directly applying MSA to high-resolution feature maps requires huge computational cost. As averaging is a low-pass filter [49], Lo-Fi firstly applies average pooling to each window to get low-frequency signals in the input $\\mathbf { X }$ . Next, the average-pooled feature maps are projected into keys $\\mathbf { K } \\in \\mathbb { R } ^ { \\bar { N } / s ^ { 2 } \\times \\bar { D } _ { h } }$ and values $\\bar { \\mathbf { V } } \\in \\mathbb { R } ^ { N / s ^ { 2 } \\times D _ { h } }$ , where $s$ is the window size. The queries $\\mathbf { Q }$ in Lo-Fi still comes from the original feature map X. We then apply the standard attention to capture the rich low-frequency information in feature maps. Note that due to the spatial reduction of $\\mathbf { K }$ and $\\mathbf { V }$ , Lo-Fi simultaneously reduces the complexity for both Eq. (1) and Eq. (2). ",
398
+ "bbox": [
399
+ 174,
400
+ 680,
401
+ 825,
402
+ 795
403
+ ],
404
+ "page_idx": 3
405
+ },
406
+ {
407
+ "type": "text",
408
+ "text": "Head splitting. A naive solution for head assignment is to allocate both Hi-Fi and Lo-Fi the same number of heads as the standard MSA layer. However, doubling heads results in more computational cost. In order to achieve better efficiency, HiLo separates the same number of heads in an MSA into two groups with a split ratio $\\alpha$ , where $( 1 - \\alpha ) N _ { h }$ heads will be employed for Hi-Fi and the other $\\alpha N _ { h }$ heads are used for Lo-Fi. By doing so, as each attention has a lower complexity than a standard MSA, the entire framework of HiLo guarantees a low complexity and ensures high throughput on GPUs. Moreover, another benefit of head splitting is that the learnable parameter $\\mathbf { W } _ { o }$ can be decomposed into two smaller matrices, which helps to reduce model parameters. Finally, the output of HiLo is a ",
409
+ "bbox": [
410
+ 174,
411
+ 800,
412
+ 825,
413
+ 911
414
+ ],
415
+ "page_idx": 3
416
+ },
417
+ {
418
+ "type": "image",
419
+ "img_path": "images/c3dd3c5a05b524fb30cb83fbc377172c98779c266436e3c6dd34b30951bf6bec.jpg",
420
+ "image_caption": [
421
+ "Figure 2: FLOPs comparison for Hi-Fi and Lo-Fi under different image resolutions and equal number of heads (Figures a and b). A larger window size helps HiLo achieve better efficiency on highresolution images (Figure c). "
422
+ ],
423
+ "image_footnote": [],
424
+ "bbox": [
425
+ 173,
426
+ 88,
427
+ 825,
428
+ 237
429
+ ],
430
+ "page_idx": 4
431
+ },
432
+ {
433
+ "type": "text",
434
+ "text": "81.8 3.90 concatenation of the outputs from each attention ",
435
+ "bbox": [
436
+ 174,
437
+ 303,
438
+ 490,
439
+ 316
440
+ ],
441
+ "page_idx": 4
442
+ },
443
+ {
444
+ "type": "equation",
445
+ "img_path": "images/14f7369821c51ad15c970043bf07bac44ec93a13e7a38e06f8959173e93e2191.jpg",
446
+ "text": "$$\n\\mathrm { H i L o ( X ) } = \\mathrm { [ H i \\mathrm { - } F i ( X ) ; L o \\mathrm { - } F i ( X ) ] , }\n$$",
447
+ "text_format": "latex",
448
+ "bbox": [
449
+ 380,
450
+ 329,
451
+ 616,
452
+ 347
453
+ ],
454
+ "page_idx": 4
455
+ },
456
+ {
457
+ "type": "text",
458
+ "text": "81.2where $[ \\cdot ]$ denotes the concatenation operation. ",
459
+ "bbox": [
460
+ 176,
461
+ 358,
462
+ 473,
463
+ 373
464
+ ],
465
+ "page_idx": 4
466
+ },
467
+ {
468
+ "type": "text",
469
+ "text": "Complexity Analysis. Without loss of generality, we assume Hi-Fi and Lo-Fi have an equal number of heads (i.e., $\\alpha = 0 . 5$ ) and the feature map has equal width and height. Then, Hi-Fi and Lo-Fi have a computational cost of this result can be found $\\scriptstyle { \\frac { 7 } { 4 } } N D ^ { 2 } + s ^ { 2 } N D$ and ntar $( \\textstyle { \\frac { 3 } { 4 } } + \\textstyle { \\frac { 1 } { s ^ { 2 } } } ) N D ^ { 2 } + \\textstyle { \\frac { 1 } { s ^ { 2 } } } \\bar { N ^ { 2 } D }$ , respectively. Derivation forigure 2-(a) and (b), under a small input image resolution and a small value of $s$ (e.g., $s = 2$ ), both Hi-Fi and Lo-Fi are comparably efficient. However, with a much higher resolution, Lo-Fi will result in a huge computational cost as it still has a quadratic complexity in terms of $N$ in Eq. (2), i.e., $\\scriptstyle { \\frac { 1 } { s ^ { 2 } } } N ^ { 2 } D$ . In this case, slightly increasing $s$ (e.g., $s = 4$ ) helps Lo-Fi achieve better efficiency while preserving the accuracy. Combining the two attentions together, a larger window size also helps the overall framework of HiLo to reduce more FLOPs on high-resolution images, as shown in Figure 2-(c). Thus, we suggest a practical guideline for adopting HiLo into existing frameworks: increasing the window size in order to get better efficiency on high-resolution images. We further show in Section 5.2 that this principle helps LITv2 achieve a better speed and accuracy trade-off on downstream tasks, e.g., dense object detection. ",
470
+ "bbox": [
471
+ 174,
472
+ 393,
473
+ 825,
474
+ 574
475
+ ],
476
+ "page_idx": 4
477
+ },
478
+ {
479
+ "type": "text",
480
+ "text": "4.2 Positional Encoding ",
481
+ "text_level": 1,
482
+ "bbox": [
483
+ 174,
484
+ 597,
485
+ 351,
486
+ 612
487
+ ],
488
+ "page_idx": 4
489
+ },
490
+ {
491
+ "type": "text",
492
+ "text": "Positional encoding is essential to self-attention due to its permutation-invariant property. In LITv1, the later MSAs adopt the same relative positional encoding (RPE) scheme as Swin [32]. This approach has significantly improves Swin by $0 . 7 \\%$ in Top-1 accuracy on ImageNet compared to using absolute positional encoding [32]. However, on dense prediction tasks, the fixed RPE has to be interpolated for different image resolutions, which dramatically slows down the training/inference speed of LITv1. As a recent study [27] has shown that position information can be implicitly learned from zero-padding in CNNs, we propose to adopt one layer of $3 \\times 3$ depthwise convolutional layer with zero-padding in each FFN to replace the time-consuming RPE. Notably, due to the elimination of early MSAs, the early blocks in LITv1 only have FFNs left, which results in a tiny receptive field of $1 \\times 1$ . To this end, we show in Section 5.4 that the $3 \\times 3$ convolutional filters adopted in each FFN also improve LITv2 by simultaneously enlarging the receptive field in the early stages. ",
493
+ "bbox": [
494
+ 173,
495
+ 625,
496
+ 825,
497
+ 777
498
+ ],
499
+ "page_idx": 4
500
+ },
501
+ {
502
+ "type": "text",
503
+ "text": "4.3 Model Architecture ",
504
+ "text_level": 1,
505
+ "bbox": [
506
+ 176,
507
+ 799,
508
+ 349,
509
+ 814
510
+ ],
511
+ "page_idx": 4
512
+ },
513
+ {
514
+ "type": "text",
515
+ "text": "LITv2 has three variants: LITv2-S, LITv2-M and LITv2-B, corresponding to the small, medium and base settings in LITv1, respectively. For a fair comparison, we keep the network width and depth as the same as LITv1. The overall modifications are simply in two steps: 1) Adding one layer of depthwise convolution with zero-padding in each FFN and removing all relative positional encodings in all MSAs. 2) Replacing all attention layers with the proposed HiLo attention. Detailed architecture configurations can be found in the supplementary material. ",
516
+ "bbox": [
517
+ 174,
518
+ 827,
519
+ 825,
520
+ 911
521
+ ],
522
+ "page_idx": 4
523
+ },
524
+ {
525
+ "type": "text",
526
+ "text": "5 Experiment ",
527
+ "text_level": 1,
528
+ "bbox": [
529
+ 173,
530
+ 89,
531
+ 303,
532
+ 107
533
+ ],
534
+ "page_idx": 5
535
+ },
536
+ {
537
+ "type": "text",
538
+ "text": "In this section we conduct experiments to validate the effectiveness of the proposed LITv2. Following common practice [51, 32, 12, 60], we experiment LITv2 on three tasks, including image classification on ImageNet-1K [43], object detection and instance segmentation on COCO [31] and semantic segmentation on ADE20K [65]. ",
539
+ "bbox": [
540
+ 174,
541
+ 121,
542
+ 825,
543
+ 176
544
+ ],
545
+ "page_idx": 5
546
+ },
547
+ {
548
+ "type": "table",
549
+ "img_path": "images/00726d6e2a3615881f4d3b6d844b2a2abd03577fc61fd42969ca68e477adbb47.jpg",
550
+ "table_caption": [
551
+ "Table 1: Image classification results on ImageNet-1K. By default, the FLOPs, throughput and memory consumption are measured based on the resolution $2 2 4 \\times 2 2 4$ . We report the throughput and training/test time memory consumption with a batch size of 64. Throughput is tested on one NVIDIA RTX 3090 GPU and averaged over 30 runs. ResNet results are from \"ResNet Stikes Back\" [53]. “↑ 384” means a model is finetuned at the resolution $3 8 4 \\times 3 8 4$ . “OOM” means “out-of-memory”. "
552
+ ],
553
+ "table_footnote": [],
554
+ "table_body": "<table><tr><td>Model</td><td>Param (M)</td><td>FLOPs (G)</td><td>Throughput (imgs/s)</td><td>Train Mem (GB)</td><td>Test Mem (GB)</td><td>Top-1 (%)</td></tr><tr><td>ResNet-50 [53]</td><td>26</td><td>4.1</td><td>1,279</td><td>7.9</td><td>2.8</td><td>80.4</td></tr><tr><td>ConvNext-Ti [33]</td><td>28</td><td>4.5</td><td>1,079</td><td>8.3</td><td>1.7</td><td>82.1</td></tr><tr><td>PVT-S [51]</td><td>25</td><td>3.8</td><td>1,007</td><td>6.8</td><td>1.3</td><td>79.8</td></tr><tr><td>Swin-Ti [32]</td><td>28</td><td>4.5</td><td>961</td><td>6.1</td><td>1.5</td><td>81.3</td></tr><tr><td>CvT-13 [54]</td><td>20</td><td>4.5</td><td>947</td><td>6.1</td><td>1.5</td><td>81.6</td></tr><tr><td>Focal-Tiny [60]</td><td>29</td><td>4.9</td><td>384</td><td>12.2</td><td>3.3</td><td>82.2</td></tr><tr><td>Twins-PCPVT-S [12]</td><td>24</td><td>3.8</td><td>998</td><td>6.8</td><td>1.2</td><td>81.2</td></tr><tr><td>LITv1-S [36]</td><td>27</td><td>4.1</td><td>1,298</td><td>5.8</td><td>1.2</td><td>81.5</td></tr><tr><td>LITv2-S</td><td>28</td><td>3.7</td><td>1,471</td><td>5.1</td><td>1.2</td><td>82.0</td></tr><tr><td>ResNet-101[53]</td><td>45</td><td>7.9</td><td>722</td><td>10.5</td><td>3.0</td><td>81.5</td></tr><tr><td>ConvNext-S [33]</td><td>50</td><td>8.7</td><td>639</td><td>12.3</td><td>1.8</td><td>83.1</td></tr><tr><td>PVT-M [51]</td><td>44</td><td>6.7</td><td>680</td><td>9.3</td><td>1.5</td><td>81.2</td></tr><tr><td>Twins-SVT-B[12]</td><td>56</td><td>8.3</td><td>621</td><td>9.8</td><td>1.9</td><td>83.2</td></tr><tr><td>Swin-S [32]</td><td>50</td><td>8.7</td><td>582</td><td>9.7</td><td>1.7</td><td>83.0</td></tr><tr><td>LITv1-M [36]</td><td>48</td><td>8.6</td><td>638</td><td>12.0</td><td>1.4</td><td>83.0</td></tr><tr><td>LITv2-M</td><td>49</td><td>7.5</td><td>812</td><td>8.8</td><td>1.4</td><td>83.3</td></tr><tr><td>ResNet-152 [53]</td><td>60</td><td>11.6</td><td>512</td><td>13.4</td><td>2.9</td><td>82.0</td></tr><tr><td>ConvNext-B [33]</td><td>89</td><td>15.4</td><td>469</td><td>16.9</td><td>2.9</td><td>83.8</td></tr><tr><td>Twins-SVT-L [12]</td><td>99</td><td>14.8</td><td>440</td><td>13.7</td><td>3.1</td><td>83.7</td></tr><tr><td>Swin-B [32]</td><td>88</td><td>15.4</td><td>386</td><td>13.4</td><td>2.4</td><td>83.3</td></tr><tr><td>LITv1-B [36]</td><td>86</td><td>15.0</td><td>444</td><td>16.4</td><td>2.1</td><td>83.4</td></tr><tr><td>LITv2-B</td><td>87</td><td>13.2</td><td>602</td><td>12.2</td><td>2.1</td><td>83.6</td></tr><tr><td>DeiT-B↑ 384 [45]</td><td>86</td><td>55.4</td><td>159</td><td>39.9</td><td>2.5</td><td>83.1</td></tr><tr><td>Swin-B↑ 384 [32]</td><td>88</td><td>47.1</td><td>142</td><td>OOM</td><td>6.1</td><td>84.5</td></tr><tr><td>LITv2-B↑ 384</td><td>87</td><td>39.7</td><td>198</td><td>35.8</td><td>4.6</td><td>84.7</td></tr></table>",
555
+ "bbox": [
556
+ 184,
557
+ 258,
558
+ 810,
559
+ 671
560
+ ],
561
+ "page_idx": 5
562
+ },
563
+ {
564
+ "type": "text",
565
+ "text": "5.1 Image Classification on ImageNet-1K ",
566
+ "text_level": 1,
567
+ "bbox": [
568
+ 173,
569
+ 685,
570
+ 473,
571
+ 700
572
+ ],
573
+ "page_idx": 5
574
+ },
575
+ {
576
+ "type": "text",
577
+ "text": "We conduct image classification experiments on ImageNet-1K [43], a large-scale image dataset which contains ${ \\sim } 1 . 2 \\mathbf { M }$ training images and 50K validation images from 1K categories. We measure the model performance by Top-1 accuracy. Furthermore, we report the FLOPs, throughput, as well as training/test memory consumption on GPUs. We compare with two CNN-based models [53, 33] and several representative SoTA ViTs [51, 32, 54, 60, 12]. Note that this paper does not consider mobile-level architectures [8, 35]. Instead, we focus on models with the similar model size. Besides, we are also not directly comparable with NAS-based methods [3, 5] as LITv2 is manually designed. ",
578
+ "bbox": [
579
+ 173,
580
+ 710,
581
+ 825,
582
+ 809
583
+ ],
584
+ "page_idx": 5
585
+ },
586
+ {
587
+ "type": "text",
588
+ "text": "Implementation details. All models are trained for 300 epochs from scratch on 8 V100 GPUs. At training time, we set the total batch size as 1,024. The input images are resized and randomly cropped into $2 2 4 \\times 2 2 4$ . The initial learning rate is set to $1 \\times 1 0 ^ { - 5 }$ and the weight decay is set to $5 \\times \\mathrm { { 1 0 ^ { - 2 } } }$ . We use AdamW optimizer with a cosine decay learning rate scheduler. All training strategies including the data augmentation are same as in LITv1. For HiLo, the window size $s$ is set to 2. The split ratio $\\alpha$ is set to 0.9, which is chosen from a simple grid search on ImageNet-1K. The depthwise convolutional layers in FFNs are set with a kernel size of $3 \\times 3$ , stride of 1 and zero padding size of 1. ",
589
+ "bbox": [
590
+ 174,
591
+ 814,
592
+ 825,
593
+ 911
594
+ ],
595
+ "page_idx": 5
596
+ },
597
+ {
598
+ "type": "table",
599
+ "img_path": "images/5adc6b31ae9523262eef5088a4b3c4d00a52bcc4ed31f63edbb8fe8c582cf246.jpg",
600
+ "table_caption": [
601
+ "Table 2: Object detection and instance segmentation performance on the COCO val2017 split using the RetinaNet [30] and Mask R-CNN [22] framework. $\\mathrm { A P } ^ { b }$ and $\\mathrm { A P } ^ { m }$ denote the bounding box AP and mask AP, respectively. “\\*” indicates the model adopts a local window size of 4 in HiLo. "
602
+ ],
603
+ "table_footnote": [],
604
+ "table_body": "<table><tr><td rowspan=\"2\">Backbone</td><td colspan=\"4\">RetinaNet</td><td colspan=\"5\">MaskR-CNN</td></tr><tr><td>Params</td><td>FLOPs (G)</td><td>FPS</td><td>AP6</td><td>Params</td><td>FLOPs (G)</td><td>FPS</td><td>AP6</td><td>APm</td></tr><tr><td>ResNet-50 [23]</td><td>38M</td><td>239</td><td>18.5</td><td>36.3</td><td>44M</td><td>260</td><td>27.1</td><td>38.0</td><td>34.4</td></tr><tr><td>PVT-S [51]</td><td>34M</td><td>273</td><td>13.0</td><td>40.4</td><td>44M</td><td>292</td><td>16.2</td><td>40.4</td><td>37.8</td></tr><tr><td>Swin-T [32]</td><td>38M</td><td>251</td><td>17.0</td><td>41.5</td><td>48M</td><td>270</td><td>21.1</td><td>42.2</td><td>39.1</td></tr><tr><td>Twins-SVT-S[12]</td><td>34M</td><td>225</td><td>15.5</td><td>43.0</td><td>44M</td><td>244</td><td>20.4</td><td>43.4</td><td>40.3</td></tr><tr><td>LITv1-S [36]</td><td>39M</td><td>305</td><td>3.3</td><td>41.6</td><td>48M</td><td>324</td><td>3.2</td><td>42.9</td><td>39.6</td></tr><tr><td>LITv2-S</td><td>38M</td><td>242</td><td>18.7</td><td>44.0</td><td>47M</td><td>261</td><td>18.7</td><td>44.9</td><td>40.8</td></tr><tr><td>LITv2-S*</td><td>38M</td><td>230</td><td>20.4</td><td>43.7</td><td>47M</td><td>249</td><td>21.9</td><td>44.7</td><td>40.7</td></tr><tr><td>ResNet-101[23]</td><td>57M</td><td>315</td><td>15.2</td><td>38.5</td><td>63M</td><td>336</td><td>20.9</td><td>40.4</td><td>36.4</td></tr><tr><td>PVT-M[51]</td><td>54M</td><td>348</td><td>10.5</td><td>41.9</td><td>64M</td><td>367</td><td>10.8</td><td>42.0</td><td>39.0</td></tr><tr><td>Swin-S [32]</td><td>60M</td><td>343</td><td>13.3</td><td>44.5</td><td>69M</td><td>362</td><td>15.8</td><td>44.8</td><td>40.9</td></tr><tr><td>Twins-SVT-B[12]</td><td>67M</td><td>358</td><td>10.8</td><td>45.3</td><td>76M</td><td>377</td><td>12.7</td><td>45.2</td><td>41.5</td></tr><tr><td>LITv2-M</td><td>59M</td><td>348</td><td>12.2</td><td>46.0</td><td>68M</td><td>367</td><td>12.6</td><td>46.8</td><td>42.3</td></tr><tr><td>LITv2-M*</td><td>59M</td><td>312</td><td>14.8</td><td>45.8</td><td>68M</td><td>315</td><td>16.0</td><td>46.5</td><td>42.0</td></tr><tr><td>ResNeXt101-64x4d [58]</td><td>96M</td><td>473</td><td>10.3</td><td>41.0</td><td>102M</td><td>493</td><td>12.4</td><td>42.8</td><td>38.4</td></tr><tr><td>PVT-L [51]</td><td>71M</td><td>439</td><td>9.5</td><td>42.6</td><td>81M</td><td>457</td><td>8.3</td><td>42.9</td><td>39.5</td></tr><tr><td>Swin-B [32]</td><td>98M</td><td>488</td><td>11.0</td><td>44.7</td><td>107M</td><td>507</td><td>11.3</td><td>45.5</td><td>41.3</td></tr><tr><td>Twins-SVT-L [12]</td><td>111M</td><td>504</td><td>9.9</td><td>45.7</td><td>120M</td><td>524</td><td>10.1</td><td>45.9</td><td>41.6</td></tr><tr><td>LITv2-B</td><td>97M</td><td>481</td><td>9.5</td><td>46.7</td><td>106M</td><td>500</td><td>9.3</td><td>47.3</td><td>42.6</td></tr><tr><td>LITv2-B*</td><td>97M</td><td>430</td><td>11.8</td><td>46.3</td><td>106M</td><td>449</td><td>11.5</td><td>46.8</td><td>42.3</td></tr></table>",
605
+ "bbox": [
606
+ 176,
607
+ 140,
608
+ 821,
609
+ 415
610
+ ],
611
+ "page_idx": 6
612
+ },
613
+ {
614
+ "type": "text",
615
+ "text": "Results. In Table 1, we report the experiment results on ImageNet-1K. First, compared to LITv1 baselines, LITv2 achieves consistent improvement on Top-1 accuracy while using less FLOPs. Moreover, benefit from HiLo, LITv2 achieves faster throughput and significant training time memory reduction (e.g., $1 3 \\%$ , $2 7 \\%$ , $3 6 \\%$ inference speedup for the small, medium and base settings, respectively) compared to LITv1. Second, compared to CNNs, LITv2 models outperform all counterparts of ResNet and ConvNext in terms of FLOPs, throughput and memory consumption while achieving comparable performance. Last, compared to SoTA ViTs, LITv2 surpasses many models in terms of throughput and memory consumption with competitive performance. For example, under the similar amount of FLOPs, LITv2-S achieves faster inference speed than PVT-S and Twins-PCPVT-S with better performance. Although Focal-Tiny achieves better Top-1 accuracy than LITv2-S, it runs much slower (i.e., 384 vs. 1,471 images/s) and requires a large amount of memory to train. Besides, when finetuning on a higher resolution, LITv2-B outperforms both DeiT-B and Swin-B with a faster throughput and lower complexity. ",
616
+ "bbox": [
617
+ 173,
618
+ 417,
619
+ 826,
620
+ 597
621
+ ],
622
+ "page_idx": 6
623
+ },
624
+ {
625
+ "type": "text",
626
+ "text": "5.2 Object Detection and Instance Segmentation on COCO ",
627
+ "text_level": 1,
628
+ "bbox": [
629
+ 174,
630
+ 608,
631
+ 596,
632
+ 623
633
+ ],
634
+ "page_idx": 6
635
+ },
636
+ {
637
+ "type": "text",
638
+ "text": "In this section, we conduct experiments on COCO 2017, a common benchmark for object detection and instance segmentation which contains ${ \\sim } 1 1 8 \\mathrm { K }$ images for the training set and ${ \\sim } 5 \\mathrm { K }$ images for the validation set. Following common practice [12, 51], we experiment with two detection frameworks: RetinaNet [30] and Mask R-CNN [22]. We measure model performance by Average Precision (AP). ",
639
+ "bbox": [
640
+ 174,
641
+ 635,
642
+ 825,
643
+ 690
644
+ ],
645
+ "page_idx": 6
646
+ },
647
+ {
648
+ "type": "text",
649
+ "text": "Implementation details. All backbones are initialized with pretrained weights on ImageNet-1K. We train each model on 8 GPUs with $1 \\times$ schedule (12 epochs) and a total batch size of 16. For a fair comparison, we adopt the same training strategy and hyperparameter settings as in LITv1 [36]. Note that we pretrain LITv2 with a local window size of 2 and $\\alpha = 0 . 9$ on ImageNet-1K. Under the same $\\alpha$ , a larger window size helps to achieve lower complexity and thus improves the speed at high resolution, as explained in Section 4.1. In this case, we also train models with a slightly larger window size of $s = 4$ for better efficiency, which we denote with “\\*”. By default, FLOPs is evaluated based on the input resolution of $1 2 8 0 \\times 8 0 0$ . FPS is measured on one RTX 3090 GPU based on the mmdetection [4] framework. ",
650
+ "bbox": [
651
+ 173,
652
+ 696,
653
+ 825,
654
+ 821
655
+ ],
656
+ "page_idx": 6
657
+ },
658
+ {
659
+ "type": "text",
660
+ "text": "Results. In Table 2, we report the experimental results on COCO. In general, LITv2 outperforms LITv1 by a large margin in almost all metrics. Besides, our LITv2 significantly surpasses ResNet in terms of AP, though it runs slightly slower in some cases. More importantly, our LITv2 beats all the compared SoTA ViTs, achieving the best AP with compelling fast inference speed. Furthermore, by adopting a larger window size (i.e., $s = 4$ ), LITv2 achieves better efficiency with a slightly performance drop. ",
661
+ "bbox": [
662
+ 174,
663
+ 828,
664
+ 825,
665
+ 911
666
+ ],
667
+ "page_idx": 6
668
+ },
669
+ {
670
+ "type": "image",
671
+ "img_path": "images/e1c23fc80b9d93d228356c59d71a9cb8f9c3744fe4adfed45474b49f5b975b11.jpg",
672
+ "image_caption": [
673
+ "Figure 3: Comparison with other attention mechanisms based on LITv2-S. We report the FLOPs, throughput, and training/test time memory consumption. Evaluations are based on a batch size of 64 on one RTX 3090 GPU. The black cross symbol means “out-of-memory”. "
674
+ ],
675
+ "image_footnote": [],
676
+ "bbox": [
677
+ 184,
678
+ 126,
679
+ 812,
680
+ 353
681
+ ],
682
+ "page_idx": 7
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "5.3 Semantic Segmentation on ADE20K ",
687
+ "text_level": 1,
688
+ "bbox": [
689
+ 176,
690
+ 411,
691
+ 464,
692
+ 426
693
+ ],
694
+ "page_idx": 7
695
+ },
696
+ {
697
+ "type": "text",
698
+ "text": "In this section, we evaluate LITv2 on the semantic segmentation task. We conduct experiments on ADE20K [65], a widely adopted dataset for semantic segmentation which has $\\sim 2 0 \\mathrm { K }$ training images, ${ \\sim } 2 \\mathbf { K }$ validation images and ${ \\sim } 3 \\mathrm { K }$ test images. Following prior works, we adopt the framework of Semantic FPN [29] and measure the model performance by mIoU. We train each model on 8 GPUs with a total batch size of 16 with 80K iterations. All backbones are initialized with pretrained weights on ImageNet1K. The stochastic depth for the small, medium and base models of LITv2 are 0.2, 0.2 and 0.3, respectively. All other training strategies are the same as in LITv1 [36]. ",
699
+ "bbox": [
700
+ 174,
701
+ 438,
702
+ 485,
703
+ 645
704
+ ],
705
+ "page_idx": 7
706
+ },
707
+ {
708
+ "type": "text",
709
+ "text": "Results. In Table 3, we compare LITv2 with ResNet and representative ViTs on ADE20K. In general, LITv2 achieves fast speed while outperforming many SoTA models. For example, our LITv2-S, LITv2-M and LITv2-B surpass SwinTi, Swin-S and Swin-B by $2 . 8 \\%$ , $0 . 5 \\%$ and $1 . 2 \\%$ in mIoU with higher FPS, respectively. ",
710
+ "bbox": [
711
+ 174,
712
+ 651,
713
+ 485,
714
+ 748
715
+ ],
716
+ "page_idx": 7
717
+ },
718
+ {
719
+ "type": "table",
720
+ "img_path": "images/45be87d289d9b82fe1a7f42ec6b2f0612d98f68be6f2acd2741a7c795dc41394.jpg",
721
+ "table_caption": [
722
+ "Table 4: Performance comparisons with other efficient attention mechanisms in ViTs based on LITv2-S. We report the Top-1 accuracy on ImageNet-1K and mIoU on ADE20K. ",
723
+ "Table 3: Semantic segmentation performance of different backbones on the ADE20K validation set. FLOPs is evaluated based on the image resolution of $5 1 2 \\times 5 1 2$ . "
724
+ ],
725
+ "table_footnote": [],
726
+ "table_body": "<table><tr><td>Backbone</td><td>Params (M)</td><td>FLOPs (G)</td><td>FPS</td><td>mIoU (%)</td></tr><tr><td rowspan=\"3\">ResNet-50[23] PVT-S [51] Swin-Ti[32] Twins-SVT-S [12] LITv1-S [36]</td><td>29</td><td>45</td><td>45.4 38.7</td><td>36.7 39.8</td></tr><tr><td>28 32</td><td>40 46</td><td>39.6</td><td>41.5</td></tr><tr><td>28 32</td><td>37 46</td><td>34.5</td><td>43.2</td></tr><tr><td rowspan=\"3\">LITv2-S ResNet-101[23] PVT-M [51] Swin-S [32]</td><td>31</td><td>41</td><td>18.1 42.6</td><td>41.7 44.3</td></tr><tr><td>48 48</td><td>66 55</td><td>36.7 29.7</td><td>38.8 41.6</td></tr><tr><td>53</td><td>70</td><td></td><td></td></tr><tr><td rowspan=\"3\">Twins-SVT-B[12] LITv2-M</td><td></td><td></td><td>24.4</td><td>45.2</td></tr><tr><td>60</td><td>67</td><td>28.0</td><td>45.3</td></tr><tr><td>52</td><td>63</td><td>28.5</td><td>45.7</td></tr><tr><td rowspan=\"3\">PVT-L [51] Swin-B[32] Twins-SVT-L [12]</td><td>65</td><td>71</td><td>20.5</td><td>42.1</td></tr><tr><td>107</td><td>107</td><td>25.5</td><td>46.0</td></tr><tr><td>104</td><td>102</td><td>25.9</td><td>46.7</td></tr><tr><td>LITv2-B</td><td>90</td><td>93</td><td>27.5</td><td>47.2</td></tr><tr><td></td><td></td><td></td><td></td><td></td></tr></table>",
727
+ "bbox": [
728
+ 500,
729
+ 505,
730
+ 826,
731
+ 728
732
+ ],
733
+ "page_idx": 7
734
+ },
735
+ {
736
+ "type": "text",
737
+ "text": "5.4 Ablation Study ",
738
+ "text_level": 1,
739
+ "bbox": [
740
+ 174,
741
+ 767,
742
+ 318,
743
+ 781
744
+ ],
745
+ "page_idx": 7
746
+ },
747
+ {
748
+ "type": "text",
749
+ "text": "In this section, we provide ablation studies for LITv2, including the comparison with other efficient attention variants, the effect of $\\alpha$ in HiLo, as well as the effect of architecture modifications. By default, the throughput and memory consumption are measured on one RTX 3090 GPU with a batch size of 64 under the resolution of $2 2 4 \\times 2 2 4$ . ",
750
+ "bbox": [
751
+ 174,
752
+ 794,
753
+ 825,
754
+ 849
755
+ ],
756
+ "page_idx": 7
757
+ },
758
+ {
759
+ "type": "text",
760
+ "text": "Comparing HiLo with other attention mechanisms. Based on LITv2-S, we compare the performance of HiLo with other efficient attention mechanisms on ImageNet-1K, including spatial reduction attention (SRA) in PVT [51], shifted-window based attention (W-MSA) in Swin [32] and alternated local and global attention (T-MSA) in Twins [12]. In our implementation, we directly replace HiLo with each compared method. The results are reported in Table 4. In general, HiLo reduces more FLOPs while achieving better performance and faster speed than the compared methods. Furthermore, in Figure 3, we provide comprehensive benchmarks for more attention mechanisms based on different image resolutions, including Focal [60], QuadTree [44] and Performer [11]. Suffering from weak parallelizability, they are even slower than that of using standard MSAs on GPUs. Compared to them, HiLo achieves competitive results in terms of the FLOPs, throughput and memory consumption. Moreover, we conduct experiments based on ADE20K and Semantic FPN and show that HiLo achieves more performance gain than other attention mechanisms on the downstream dense prediction task. ",
761
+ "bbox": [
762
+ 174,
763
+ 856,
764
+ 825,
765
+ 911
766
+ ],
767
+ "page_idx": 7
768
+ },
769
+ {
770
+ "type": "image",
771
+ "img_path": "images/cbb1d473d79c8154b87f092117e77eb635c96c219d6956f092558d34b04d2fe6.jpg",
772
+ "image_caption": [
773
+ "Figure 4: Effect of $\\alpha$ based on LITv2-S. "
774
+ ],
775
+ "image_footnote": [],
776
+ "bbox": [
777
+ 176,
778
+ 90,
779
+ 450,
780
+ 236
781
+ ],
782
+ "page_idx": 8
783
+ },
784
+ {
785
+ "type": "table",
786
+ "img_path": "images/14d75b3f9a0e6fef330cd05b4e916e655390ad8bf66a114989f778a6af0c3c1f.jpg",
787
+ "table_caption": [
788
+ "Table 5: Effect of architecture modifications based on LITv1-S. “ConvFNN” means we add one layer of $3 \\times 3$ depthwise convolutional layer into each FFN. “RPE” refers to relative positional encoding [32]. "
789
+ ],
790
+ "table_footnote": [],
791
+ "table_body": "<table><tr><td rowspan=\"2\">Name</td><td colspan=\"2\">ImageNet-1K</td><td colspan=\"2\">COCO (RetinaNet)</td></tr><tr><td>FLOPs Mem (G) (GB)</td><td>Top-1 (%)</td><td>FLOPs FPS (G)</td><td>AP</td></tr><tr><td>LITv1-S [36]</td><td>4.1 5.8</td><td>81.5</td><td>305 3.3</td><td>41.6</td></tr><tr><td>+ ConvFFN</td><td>4.1 6.5</td><td>82.5</td><td>306 3.1</td><td>45.1</td></tr><tr><td>+ Remove RPE</td><td>4.1 6.5</td><td>82.3</td><td>306 13.3</td><td>44.7</td></tr><tr><td>+ HiLo</td><td>3.7 5.1</td><td>82.0</td><td>224 18.7</td><td>44.0</td></tr></table>",
792
+ "bbox": [
793
+ 483,
794
+ 147,
795
+ 813,
796
+ 251
797
+ ],
798
+ "page_idx": 8
799
+ },
800
+ {
801
+ "type": "image",
802
+ "img_path": "images/5daaae6e60488795ecfa600882462a6338d3c311c84c74c105beee391c097eea.jpg",
803
+ "image_caption": [
804
+ "Figure 5: Frequency magnitude $( 1 4 \\times 1 4 )$ from 8 output channels of Hi-Fi and Lo-Fi in LITv2-B. The magnitude is averaged over 100 samples. The lighter the color, the larger the magnitude. A pixel that is closer to the centre means a lower frequency. Visualization code can be found in the supplementary material. "
805
+ ],
806
+ "image_footnote": [],
807
+ "bbox": [
808
+ 171,
809
+ 261,
810
+ 823,
811
+ 380
812
+ ],
813
+ "page_idx": 8
814
+ },
815
+ {
816
+ "type": "text",
817
+ "text": "",
818
+ "bbox": [
819
+ 173,
820
+ 449,
821
+ 825,
822
+ 574
823
+ ],
824
+ "page_idx": 8
825
+ },
826
+ {
827
+ "type": "text",
828
+ "text": "Effect of $\\alpha$ . As shown in Figure 4, since the complexity of Lo-Fi is lower than Hi-Fi under the resolution of $2 2 4 \\times 2 2 4$ and the window size of 2, a larger $\\alpha$ helps to reduce more FLOPs as we allocate more heads to Lo-Fi. Moreover, we found HiLo performs badly with $\\alpha = 0$ , in which case only the Hi-Fi is left and HiLo only focuses on high frequencies. We speculate that low frequencies play an important role in self-attention. For other values of $\\alpha$ , we find the performance difference is around $0 . 2 \\%$ , where $\\alpha = 0 . 9$ achieves the best performance. However, it is worth noting that although the pure Lo-Fi branch $( \\alpha = 1 . 0$ ) can achieve competitive results on ImageNet-1K, high-frequency signals play an important role in capturing fine object details, which is particularly important for dense prediction tasks such as semantic segmentation. For example, with $\\alpha = 0 . 9$ , LITv2-S based Semantic FPN achieves more performance gain $( + 0 . 6 \\% )$ than that of using $\\alpha = 1 . 0 \\ : ( 4 3 . 7 \\% )$ . ",
829
+ "bbox": [
830
+ 173,
831
+ 580,
832
+ 825,
833
+ 718
834
+ ],
835
+ "page_idx": 8
836
+ },
837
+ {
838
+ "type": "text",
839
+ "text": "Effect of architecture modifications. Based on LITv2-S, we explore the effect of architecture modifications. As shown in Table 5, benefit from the enlarged receptive field in the early stages, the adoption of depthwise convolutions improves the performance on both ImageNet and COCO. Next, by removing the relative positional encoding, we significantly improve FPS on dense prediction tasks with a slightly performance drop on both datasets. Also note that since depthwise convolutions have encoded positional information by zero paddings [27], the elimination of RPE does not result in a significant performance drop compared to prior works [32]. Finally, benefit from HiLo, we achieve more gains in model efficiency on both ImageNet and COCO. ",
840
+ "bbox": [
841
+ 173,
842
+ 724,
843
+ 825,
844
+ 835
845
+ ],
846
+ "page_idx": 8
847
+ },
848
+ {
849
+ "type": "text",
850
+ "text": "Spectrum analysis of HiLo. In Figure 5, we visualize the magnitude of frequency component [42] by applying Fast Fourier Transform (FFT) to the output feature maps from Hi-Fi and Lo-Fi attentions, respectively. The visualisation indicates that Hi-Fi captures more high frequencies and Lo-Fi mainly focuses on low frequencies. This strongly aligns with our aim of disentangling high and low frequencies in feature maps at a single attention layer. ",
851
+ "bbox": [
852
+ 174,
853
+ 842,
854
+ 825,
855
+ 911
856
+ ],
857
+ "page_idx": 8
858
+ },
859
+ {
860
+ "type": "table",
861
+ "img_path": "images/8c7c24c6837bb11121aac01677d51c5b0262ae8c28578abe3a6c2e4834a41cb3.jpg",
862
+ "table_caption": [
863
+ "Table 6: Speed and performance comparisons between LITv2-S and other recent ViTs on different GPUs. All throughput results are averaged over 30 runs with a total batch size of 64 and image resolution of $2 2 4 \\times 2 2 4$ on one GPU card. We also report the Top-1 accuracy on ImageNet-1K. "
864
+ ],
865
+ "table_footnote": [],
866
+ "table_body": "<table><tr><td>Model</td><td>Params (M)</td><td>FLOPs (G)</td><td>A100</td><td>V100</td><td>RTX 6000</td><td>RTX 3090</td><td>Top-1 (%)</td></tr><tr><td>ResNet-50 [53]</td><td>26</td><td>4.1</td><td>1,424</td><td>1,123</td><td>877</td><td>1,279</td><td>80.4</td></tr><tr><td>PVT-S [51]</td><td>25</td><td>3.8</td><td>1,460</td><td>798</td><td>548</td><td>1,007</td><td>79.8</td></tr><tr><td>Twins-PCPVT-S[12]</td><td>24</td><td>3.8</td><td>1,455</td><td>792</td><td>529</td><td>998</td><td>81.2</td></tr><tr><td>Swin-Ti [32]</td><td>28</td><td>4.5</td><td>1,564</td><td>1,039</td><td>710</td><td>961</td><td>81.3</td></tr><tr><td>TNT-S [21]</td><td>24</td><td>5.2</td><td>802</td><td>431</td><td>298</td><td>534</td><td>81.3</td></tr><tr><td>CvT-13 [54]</td><td>20</td><td>4.5</td><td>1,595</td><td>716</td><td>379</td><td>947</td><td>81.6</td></tr><tr><td>CoAtNet-0 [15]</td><td>25</td><td>4.2</td><td>1,538</td><td>962</td><td>643</td><td>1,151</td><td>81.6</td></tr><tr><td>CaiT-XS24 [46]</td><td>27</td><td>5.4</td><td>991</td><td>484</td><td>299</td><td>623</td><td>81.8</td></tr><tr><td>PVTv2-B2 [52]</td><td>25</td><td>4.0</td><td>1,175</td><td>670</td><td>451</td><td>854</td><td>82.0</td></tr><tr><td>XCiT-S12[1]</td><td>26</td><td>4.8</td><td>1,727</td><td>761</td><td>504</td><td>1,068</td><td>82.0</td></tr><tr><td>ConvNext-Ti [33]</td><td>28</td><td>4.5</td><td>1,654</td><td>762</td><td>571</td><td>1,079</td><td>82.1</td></tr><tr><td>Focal-Tiny [60]</td><td>29</td><td>4.9</td><td>471</td><td>372</td><td>261</td><td>384</td><td>82.2</td></tr><tr><td>LITv2-S</td><td>28</td><td>3.7</td><td>1,874</td><td>1,304</td><td>928</td><td>1,471</td><td>82.0</td></tr></table>",
867
+ "bbox": [
868
+ 181,
869
+ 138,
870
+ 808,
871
+ 320
872
+ ],
873
+ "page_idx": 9
874
+ },
875
+ {
876
+ "type": "image",
877
+ "img_path": "images/c167131df68793aafbb163d5e125013626b52aa2596fd33f47cb38482ef2660f.jpg",
878
+ "image_caption": [
879
+ "Intel® Core i9-10900X CPU @ 3.70GHz ",
880
+ "NVIDIA GeForce RTX 3090 ",
881
+ "Figure 6: Throughput comparisons with more attention mechanisms on CPUs and GPUs based on a single attention layer and $1 4 \\times 1 4$ feature maps. "
882
+ ],
883
+ "image_footnote": [],
884
+ "bbox": [
885
+ 171,
886
+ 332,
887
+ 826,
888
+ 481
889
+ ],
890
+ "page_idx": 9
891
+ },
892
+ {
893
+ "type": "text",
894
+ "text": "Speed and performance comparisons with more ViTs on different GPUs. We compare the inference speed with more models and on more types of GPUs. Table 6 reports the results. It shows that LITv2-S still achieves consistent faster throughput (images/s) than many ViTs on NVIDIA A100, Tesla V100, RTX 6000, and RTX 3090. It is also worth noting that under similar performance $( 8 2 . 0 \\% )$ , LITv2-S is $2 . 1 \\times$ faster than PVTv2-B2 [52], $1 . 7 \\times$ faster than XCiT-S12 [1] and ConvNext-Ti [33], and $3 . 5 \\times$ faster than Focal-Tiny [60] on V100, which is another common GPU version for speed test in previous works [32, 45, 33, 64]. ",
895
+ "bbox": [
896
+ 173,
897
+ 518,
898
+ 826,
899
+ 616
900
+ ],
901
+ "page_idx": 9
902
+ },
903
+ {
904
+ "type": "text",
905
+ "text": "Throughput comparisons with more attention mechanisms on CPUs and GPUs. In Figure 6, we show that HiLo is consistently faster than many attention mechanisms [51, 32, 1, 50, 11, 17, 55, 60, 41, 44, 20, 18] on both CPUs and GPUs. In particular, under CPU testing, HiLo is $1 . 4 \\times$ faster than SRA [51], $1 . 6 \\times$ faster than local window attention [32] and $1 7 . 4 \\times$ faster than VAN [20]. Detailed benchmark configurations can be found in the supplementary material. ",
906
+ "bbox": [
907
+ 173,
908
+ 622,
909
+ 825,
910
+ 691
911
+ ],
912
+ "page_idx": 9
913
+ },
914
+ {
915
+ "type": "text",
916
+ "text": "6 Conclusion and Future Work ",
917
+ "text_level": 1,
918
+ "bbox": [
919
+ 176,
920
+ 700,
921
+ 449,
922
+ 717
923
+ ],
924
+ "page_idx": 9
925
+ },
926
+ {
927
+ "type": "text",
928
+ "text": "In this paper, we have introduced LITv2, a novel efficient vision Transformer backbone with fast speed on GPUs and outperforms most SoTA models on ImageNet and downstream tasks. We have also presented HiLo attention, the core of LITv2 which helps to achieve better efficiency especially on high-resolution images. With competitive performance, HiLo achieves great advantage over the existing attention mechanisms across FLOPs, throughput and memory consumption. Future work may include incorporating convolutional stem [57] and overlapping patch embedding [52] for better performance, or extending HiLo on more tasks such as speech recognition and video processing. ",
929
+ "bbox": [
930
+ 173,
931
+ 724,
932
+ 825,
933
+ 821
934
+ ],
935
+ "page_idx": 9
936
+ },
937
+ {
938
+ "type": "text",
939
+ "text": "Limitations and societal impact. HiLo adopts a head splitting ratio to assign different numbers of heads into Hi-Fi and Lo-Fi. In our experiments, this ratio is determined by a grid search on ImageNet (i.e., $\\alpha = 0 . 9$ ). However, different tasks may have different importance on high and low frequencies. Thus, the optimal value of $\\alpha$ is task-specific and needs to be set manually. Besides, our work potentially brings some negative societal impacts, such as the huge energy consumption and carbon emissions from large-scale training on GPU clusters. ",
940
+ "bbox": [
941
+ 174,
942
+ 828,
943
+ 825,
944
+ 911
945
+ ],
946
+ "page_idx": 9
947
+ },
948
+ {
949
+ "type": "text",
950
+ "text": "References ",
951
+ "text_level": 1,
952
+ "bbox": [
953
+ 174,
954
+ 90,
955
+ 267,
956
+ 106
957
+ ],
958
+ "page_idx": 10
959
+ },
960
+ {
961
+ "type": "text",
962
+ "text": "[1] A. Ali, H. Touvron, M. Caron, P. Bojanowski, M. Douze, A. Joulin, I. Laptev, N. Neverova, G. Synnaeve, J. Verbeek, and H. Jégou. Xcit: Cross-covariance image transformers. In NIPS, pages 20014–20027, 2021. \n[2] J. Ba, J. Kiros, and G. E. Hinton. Layer normalization. ArXiv, abs/1607.06450, 2016. \n[3] B. Chen, P. Li, C. Li, B. Li, L. Bai, C. Lin, M. Sun, J. Yan, and W. Ouyang. Glit: Neural architecture search for global and local image transformer. In ICCV, 2021. \n[4] K. Chen, J. Wang, J. Pang, Y. Cao, Y. Xiong, X. Li, S. Sun, W. Feng, Z. Liu, J. Xu, Z. Zhang, D. Cheng, C. Zhu, T. Cheng, Q. Zhao, B. Li, X. Lu, R. Zhu, Y. Wu, J. Dai, J. Wang, J. Shi, W. Ouyang, C. C. Loy, and D. Lin. MMDetection: Open mmlab detection toolbox and benchmark. arXiv preprint arXiv:1906.07155, 2019. \n[5] M. Chen, H. Peng, J. Fu, and H. Ling. Autoformer: Searching transformers for visual recognition. In ICCV, pages 12250–12260, 2021. \n[6] Q. Chen, Q. Wu, J. Wang, Q. Hu, T. Hu, E. Ding, J. Cheng, and J. Wang. Mixformer: Mixing features across windows and dimensions. In CVPR, pages 5239–5249, 2022. \n[7] W. Chen, J. T. Wilson, S. Tyree, K. Q. Weinberger, and Y. Chen. Compressing convolutional neural networks in the frequency domain. In KDD, pages 1475–1484. ACM, 2016. \n[8] Y. Chen, X. Dai, D. Chen, M. Liu, X. Dong, L. Yuan, and Z. Liu. Mobile-former: Bridging mobilenet and transformer. In CVPR, pages 5260–5269, 2022. \n[9] Y. Chen, H. Fan, B. Xu, Z. Yan, Y. Kalantidis, M. Rohrbach, S. Yan, and J. Feng. Drop an octave: Reducing spatial redundancy in convolutional neural networks with octave convolution. In ICCV, pages 3434–3443. IEEE, 2019. \n[10] R. Child, S. Gray, A. Radford, and I. Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019. \n[11] K. M. Choromanski, V. Likhosherstov, D. Dohan, X. Song, A. Gane, T. Sarlós, P. Hawkins, J. Q. Davis, A. Mohiuddin, L. Kaiser, D. B. Belanger, L. J. Colwell, and A. Weller. Rethinking attention with performers. In ICLR, 2021. \n[12] X. Chu, Z. Tian, Y. Wang, B. Zhang, H. Ren, X. Wei, H. Xia, and C. Shen. Twins: Revisiting the design of spatial attention in vision transformers. In NeurIPS, pages 9355–9366, 2021. \n[13] J. W. Cooley, P. A. W. Lewis, and P. D. Welch. The fast fourier transform and its applications. IEEE Transactions on Education, 12(1):27–34, 1969. \n[14] J. Cordonnier, A. Loukas, and M. Jaggi. On the relationship between self-attention and convolutional layers. In ICLR, 2020. \n[15] Z. Dai, H. Liu, Q. V. Le, and M. Tan. Coatnet: Marrying convolution and attention for all data sizes. In NeurIPS, pages 3965–3977, 2021. \n[16] G. Deng and L. Cahill. An adaptive gaussian filter for noise reduction and edge detection. In 1993 IEEE Conference Record Nuclear Science Symposium and Medical Imaging Conference, pages 1615–1619 vol.3, 1993. \n[17] X. Dong, J. Bao, D. Chen, W. Zhang, N. Yu, L. Yuan, D. Chen, and B. Guo. Cswin transformer: A general vision transformer backbone with cross-shaped windows. In CVPR, pages 12114–12124, 2022. \n[18] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. ICLR, 2021. \n[19] M. Fritsche, S. Gu, and R. Timofte. Frequency separation for real-world super-resolution. ICCVW, Oct 2019. \n[20] M.-H. Guo, C.-Z. Lu, Z.-N. Liu, M.-M. Cheng, and S.-M. Hu. Visual attention network. arXiv preprint arXiv:2202.09741, 2022. \n[21] K. Han, A. Xiao, E. Wu, J. Guo, C. Xu, and Y. Wang. Transformer in transformer. In NeurIPS, pages 15908–15919, 2021. \n[22] K. He, G. Gkioxari, P. Dollár, and R. B. Girshick. Mask R-CNN. In ICCV, pages 2980–2988, 2017. \n[23] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, pages 770–778, 2016. \n[24] D. Hendrycks and K. Gimpel. Gaussian error linear units (gelus). arXiv preprint arXiv:1606.08415, 2016. \n[25] J. Huang, D. Guan, A. Xiao, and S. Lu. Rda: Robust domain adaptation via fourier adversarial attacking. In ICCV, pages 8988–8999, 2021. \n[26] Z. Huang, Y. Ben, G. Luo, P. Cheng, G. Yu, and B. Fu. Shuffle transformer: Rethinking spatial shuffle for vision transformer. arXiv preprint arXiv:2106.03650, 2021. \n[27] M. A. Islam, S. Jia, and N. D. B. Bruce. How much position information do convolutional neural networks encode? In ICLR, 2020. \n[28] A. Katharopoulos, A. Vyas, N. Pappas, and F. Fleuret. Transformers are rnns: Fast autoregressive transformers with linear attention. In ICML, pages 5156–5165. PMLR, 2020. \n[29] A. Kirillov, R. B. Girshick, K. He, and P. Dollár. Panoptic feature pyramid networks. In CVPR, pages 6399–6408, 2019. \n[30] T. Lin, P. Goyal, R. B. Girshick, K. He, and P. Dollár. Focal loss for dense object detection. In ICCV, pages 2999–3007, 2017. \n[31] T. Lin, M. Maire, S. J. Belongie, J. Hays, P. Perona, D. Ramanan, P. Dollár, and C. L. Zitnick. Microsoft COCO: common objects in context. In D. J. Fleet, T. Pajdla, B. Schiele, and T. Tuytelaars, editors, ECCV, pages 740–755, 2014. \n[32] Z. Liu, Y. Lin, Y. Cao, H. Hu, Y. Wei, Z. Zhang, S. Lin, and B. Guo. Swin transformer: Hierarchical vision transformer using shifted windows. In ICCV, pages 9992–10002, 2021. \n[33] Z. Liu, H. Mao, C.-Y. Wu, C. Feichtenhofer, T. Darrell, and S. Xie. A convnet for the 2020s. In CVPR, pages 11966–11976, 2022. \n[34] N. Ma, X. Zhang, H.-T. Zheng, and J. Sun. Shufflenet v2: Practical guidelines for efficient cnn architecture design. In ECCV, pages 116–131, 2018. \n[35] S. Mehta and M. Rastegari. Mobilevit: Light-weight, general-purpose, and mobile-friendly vision transformer. In ICLR, 2022. \n[36] Z. Pan, B. Zhuang, H. He, J. Liu, and J. Cai. Less is more: Pay less attention in vision transformers. In AAAI, pages 2035–2043, 2022. \n[37] Z. Pan, B. Zhuang, J. Liu, H. He, and J. Cai. Scalable visual transformers with hierarchical pooling. In ICCV, pages 377–386, 2021. \n[38] N. Park and S. Kim. How do vision transformers work? In ICLR, 2022. \n[39] H. Peng, N. Pappas, D. Yogatama, R. Schwartz, N. A. Smith, and L. Kong. Random feature attention. In ICLR, 2021. \n[40] J. W. Rae, A. Potapenko, S. M. Jayakumar, and T. P. Lillicrap. Compressive transformers for long-range sequence modelling. In ICLR, 2020. \n[41] Y. Rao, W. Zhao, Y. Tang, J. Zhou, S.-L. Lim, and J. Lu. Hornet: Efficient high-order spatial interactions with recursive gated convolutions. In NeurIPS, 2022. \n[42] Y. Rao, W. Zhao, Z. Zhu, J. Lu, and J. Zhou. Global filter networks for image classification. In NeurIPS, pages 980–993, 2021. \n[43] O. Russakovsky, J. Deng, H. Su, J. Krause, S. Satheesh, S. Ma, Z. Huang, A. Karpathy, A. Khosla, M. Bernstein, et al. Imagenet large scale visual recognition challenge. IJCV, pages 211–252, 2015. \n[44] S. Tang, J. Zhang, S. Zhu, and P. Tan. Quadtree attention for vision transformers. ICLR, 2022. \n[45] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou. Training data-efficient image transformers & distillation through attention. In ICML, pages 10347–10357, 2021. \n[46] H. Touvron, M. Cord, A. Sablayrolles, G. Synnaeve, and H. Jégou. Going deeper with image transformers. In ICCV, pages 32–42. IEEE, 2021. \n[47] Z. Tu, H. Talebi, H. Zhang, F. Yang, P. Milanfar, A. Bovik, and Y. Li. Maxim: Multi-axis mlp for image processing. CVPR, pages 5759–5770, 2022. \n[48] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, L. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, pages 5998–6008, 2017. \n[49] E. Voigtman and J. D. Winefordner. Low-pass filters for signal averaging. Review of Scientific Instruments, 57(5):957–966, 1986. \n[50] S. Wang, B. Li, M. Khabsa, H. Fang, and H. Ma. Linformer: Self-attention with linear complexity. arXiv preprint arXiv:2006.04768, 2020. \n[51] W. Wang, E. Xie, X. Li, D.-P. Fan, K. Song, D. Liang, T. Lu, P. Luo, and L. Shao. Pyramid vision transformer: A versatile backbone for dense prediction without convolutions. In ICCV, pages 548–558, 2021. \n[52] W. Wang, E. Xie, X. Li, D.-P. Fan, K. Song, D. Liang, T. Lu, P. Luo, and L. Shao. Pvtv2: Improved baselines with pyramid vision transformer. Computational Visual Media, 8(3):1–10, 2022. \n[53] R. Wightman, H. Touvron, and H. Jégou. Resnet strikes back: An improved training procedure in timm. CoRR, abs/2110.00476, 2021. \n[54] H. Wu, B. Xiao, N. Codella, M. Liu, X. Dai, L. Yuan, and L. Zhang. Cvt: Introducing convolutions to vision transformers. In ICCV, pages 22–31, 2021. \n[55] Z. Xia, X. Pan, S. Song, L. E. Li, and G. Huang. Vision transformer with deformable attention. In CVPR, pages 4794–4803, 2022. \n[56] M. Xiao, S. Zheng, C. Liu, Y. Wang, D. He, G. Ke, J. Bian, Z. Lin, and T. Liu. Invertible image rescaling. In ECCV, pages 126–144, 2020. \n[57] T. Xiao, M. Singh, E. Mintun, T. Darrell, P. Dollár, and R. B. Girshick. Early convolutions help transformers see better. In NeurIPS, pages 30392–30400, 2021. \n[58] S. Xie, R. B. Girshick, P. Dollár, Z. Tu, and K. He. Aggregated residual transformations for deep neural networks. In CVPR, pages 5987–5995, 2017. \n[59] K. Xu, M. Qin, F. Sun, Y. Wang, Y. Chen, and F. Ren. Learning in the frequency domain. In CVPR, pages 1737–1746. Computer Vision Foundation / IEEE, 2020. \n[60] J. Yang, C. Li, P. Zhang, X. Dai, B. Xiao, L. Yuan, and J. Gao. Focal self-attention for local-global interactions in vision transformers. In NeurIPS, pages 30008–30022, 2021. \n[61] K. Yuan, S. Guo, Z. Liu, A. Zhou, F. Yu, and W. Wu. Incorporating convolution designs into visual transformers. In ICCV, pages 559–568, 2021. \n[62] L. Yuan, Y. Chen, T. Wang, W. Yu, Y. Shi, F. E. Tay, J. Feng, and S. Yan. Tokens-to-token vit: Training vision transformers from scratch on imagenet. In ICCV, pages 538–547, 2021. \n[63] P. Zhang, X. Dai, J. Yang, B. Xiao, L. Yuan, L. Zhang, and J. Gao. Multi-scale vision longformer: A new vision transformer for high-resolution image encoding. In ICCV, pages 2978–2988, 2021. \n[64] Q. Zhang, Y. Xu, J. Zhang, and D. Tao. Vsa: Learning varied-size window attention in vision transformers. ECCV, 2022. \n[65] B. Zhou, H. Zhao, X. Puig, T. Xiao, S. Fidler, A. Barriuso, and A. Torralba. Semantic understanding of scenes through the ADE20K dataset. IJCV, pages 302–321, 2019. \n[66] Y. Zhou, W. Deng, T. Tong, and Q. Gao. Guided frequency separation network for real-world superresolution. In CVPRW, pages 1722–1731, 2020. ",
963
+ "bbox": [
964
+ 171,
965
+ 111,
966
+ 828,
967
+ 919
968
+ ],
969
+ "page_idx": 10
970
+ },
971
+ {
972
+ "type": "text",
973
+ "text": "",
974
+ "bbox": [
975
+ 171,
976
+ 85,
977
+ 828,
978
+ 916
979
+ ],
980
+ "page_idx": 11
981
+ },
982
+ {
983
+ "type": "text",
984
+ "text": "",
985
+ "bbox": [
986
+ 171,
987
+ 97,
988
+ 828,
989
+ 800
990
+ ],
991
+ "page_idx": 12
992
+ },
993
+ {
994
+ "type": "text",
995
+ "text": "Checklist ",
996
+ "text_level": 1,
997
+ "bbox": [
998
+ 174,
999
+ 89,
1000
+ 254,
1001
+ 106
1002
+ ],
1003
+ "page_idx": 13
1004
+ },
1005
+ {
1006
+ "type": "text",
1007
+ "text": "1. For all authors... ",
1008
+ "bbox": [
1009
+ 214,
1010
+ 116,
1011
+ 339,
1012
+ 130
1013
+ ],
1014
+ "page_idx": 13
1015
+ },
1016
+ {
1017
+ "type": "text",
1018
+ "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 Section 6. \n(c) Did you discuss any potential negative societal impacts of your work? [Yes] See Section 6. \n(d) Have you read the ethics review guidelines and ensured that your paper conforms to them? [Yes] ",
1019
+ "bbox": [
1020
+ 238,
1021
+ 135,
1022
+ 825,
1023
+ 239
1024
+ ],
1025
+ "page_idx": 13
1026
+ },
1027
+ {
1028
+ "type": "text",
1029
+ "text": "2. If you are including theoretical results... ",
1030
+ "bbox": [
1031
+ 214,
1032
+ 243,
1033
+ 493,
1034
+ 258
1035
+ ],
1036
+ "page_idx": 13
1037
+ },
1038
+ {
1039
+ "type": "text",
1040
+ "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] ",
1041
+ "bbox": [
1042
+ 238,
1043
+ 262,
1044
+ 738,
1045
+ 294
1046
+ ],
1047
+ "page_idx": 13
1048
+ },
1049
+ {
1050
+ "type": "text",
1051
+ "text": "3. If you ran experiments... ",
1052
+ "bbox": [
1053
+ 212,
1054
+ 299,
1055
+ 393,
1056
+ 313
1057
+ ],
1058
+ "page_idx": 13
1059
+ },
1060
+ {
1061
+ "type": "text",
1062
+ "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] Code and pretrained models are included as a URL in the abstract. \n(b) Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? [Yes] See Section 5. \n(c) Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? [No] We use the same random seed as in recent works for fair comparison. \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] See Section 5. ",
1063
+ "bbox": [
1064
+ 238,
1065
+ 316,
1066
+ 825,
1067
+ 463
1068
+ ],
1069
+ "page_idx": 13
1070
+ },
1071
+ {
1072
+ "type": "text",
1073
+ "text": "4. If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... ",
1074
+ "bbox": [
1075
+ 218,
1076
+ 467,
1077
+ 823,
1078
+ 482
1079
+ ],
1080
+ "page_idx": 13
1081
+ },
1082
+ {
1083
+ "type": "text",
1084
+ "text": "(a) If your work uses existing assets, did you cite the creators? [Yes] See Section 5. \n(b) Did you mention the license of the assets? [No] The license of the public datasets can be found in their websites. \n(c) Did you include any new assets either in the supplemental material or as a URL? [Yes] Code and pretrained models are included as a URL in the abstract. \n(d) Did you discuss whether and how consent was obtained from people whose data you’re using/curating? [No] We use public datasets (e.g., ImageNet [43] and ADE20K [65]). \n(e) Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? [No] No such concerns as we are using widely adopted public datasets. ",
1085
+ "bbox": [
1086
+ 238,
1087
+ 486,
1088
+ 825,
1089
+ 633
1090
+ ],
1091
+ "page_idx": 13
1092
+ },
1093
+ {
1094
+ "type": "text",
1095
+ "text": "5. If you used crowdsourcing or conducted research with human subjects... ",
1096
+ "bbox": [
1097
+ 214,
1098
+ 638,
1099
+ 705,
1100
+ 654
1101
+ ],
1102
+ "page_idx": 13
1103
+ },
1104
+ {
1105
+ "type": "text",
1106
+ "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] ",
1107
+ "bbox": [
1108
+ 238,
1109
+ 657,
1110
+ 825,
1111
+ 747
1112
+ ],
1113
+ "page_idx": 13
1114
+ }
1115
+ ]
parse/dev/Pyd6Rh9r1OT/Pyd6Rh9r1OT_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/Pyd6Rh9r1OT/Pyd6Rh9r1OT_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/SF9o3-yP1WR/SF9o3-yP1WR.md ADDED
@@ -0,0 +1,485 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ROBUST AND PERSONALIZED FEDERATED LEARNING WITH SPURIOUS FEATURES: AN ADVERSARIAL APPROACH
2
+
3
+ Anonymous authors Paper under double-blind review
4
+
5
+ # ABSTRACT
6
+
7
+ A common approach for personalized federated learning is fine-tuning the global machine learning model to each local client. While this addresses some issues of statistical heterogeneity, we find that such personalization methods are often vulnerable to spurious features, leading to bias and diminished generalization performance. However, debiasing the personalized models under spurious features is difficult. To this end, we propose a strategy to mitigate the effect of spurious features based on our observation that the global model in the federated learning step has a low accuracy disparity due to statistical heterogeneity. Then, we estimate and mitigate the accuracy disparity of personalized models using the global model and adversarial transferability in the personalization step. We theoretically establish the connection between the adversarial transferability and the accuracy disparity between the global and personalized models. Empirical results on MNIST, CelebA, and Coil20 datasets show that our method reduces the accuracy disparity of the personalized model on the bias-conflicting data samples from $1 5 . 1 2 \%$ to $2 . 1 5 \%$ , compared to existing personalization approaches, while preserving the benefit of enhanced average accuracy from fine-tuning.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Federated learning (FL) is a leading framework for clients to collaboratively train a shared global machine learning (ML) model without releasing their local private datasets (McMahan et al., 2017; Kairouz et al., 2019). The jointly trained global model could be further fine-tuned on each client’s local dataset to produce personalized models (Fallah et al., 2020; T. Dinh et al., 2020; Li et al., 2021). While existing theoretical and empirical results highlight how personalized models improve accuracy on local data, few works consider what features the personalized models learn from the local dataset. Our motivating hypothesis is that not all local features are beneficial.
12
+
13
+ For example, consider a gender prediction task using face images, where the ML model learns to predict gender based on hair color because females are more likely to have blond hair (Sagawa et al., 2020). In this case, the hair color is called a spurious feature because it only statistically correlates with the gender on biased-aligned samples but not necessarily on the overall population. Thus, the accuracy of a model that relies on spurious features such as hair color is likely to drop significantly on bias-conflicting samples where the spurious correlation does not hold, e.g., for blond male images (Sagawa et al., 2020). This paper calls the accuracy difference of an ML model on the dataset with spurious features and the dataset without spurious features accuracy disparity. More broadly, the accuracy disparity caused by spurious features leads to issues in both fairness (McNamara et al., 2019; Zhao & Gordon, 2019; Agarwal et al., 2019; Chi et al., 2021), i.e., racial bias (Khani & Liang, 2021) and robustness, i.e., accuracy decrease under distribution shift (Zhao et al., 2019; Koh et al., 2021). Compared to the global model, because of the local fine-tuning, the personalized models are more vulnerable to spurious features and have a larger accuracy disparity.
14
+
15
+ Empirically, we observe that the typical non-i.i.d. data distributions in FL settings reduce the accuracy disparity of the global model. One potential explanation is that the statistical heterogeneity (Wang et al., 2021) under spurious features across users is larger than that of non-spurious features. As a result, the aggregation operation in the central server averages out the diverse shifts under the spurious features (Figure 1) so that the global model becomes more robust against spurious features on the benchmark datasets. On the other hand, the local fine-tuning step will result in a personalized model that entangles spurious features and becomes biased. Hence, it remains a key challenge how to debias the personalized models.
16
+
17
+ ![](images/943c4ccf76f89236f1cc76646f1d32ca12167db90f7fe554926cddd36b005ff0.jpg)
18
+ Figure 1: The statistical heterogeneity of spurious features leads to diverse gradients. The statistical heterogeneity leads to a global ML model with a low accuracy disparity in a federated learning setting because the aggregation step in the central server averages out the gradients resulted from local spurious features.
19
+
20
+ Various methods (Wang et al., 2019; Sagawa et al., 2020; Liu et al., 2021) have been developed to disentangle spurious features from ML models, but few can be easily applied to personalized models under the federated learning setting. The main reason lies in their reliance on bias-conflicting samples. The bias-conflicting samples can be rare. For example, in the CelebA dataset, only around 1.7k samples are bias-conflicting out of more than170k samples. If we distribute the CelebA dataset across users, nearly half do not have any bias-conflicting samples. Prior work (Li & Wang, 2019) has tried using a global proxy dataset for training FL models. However, a global proxy dataset may not characterize the local samples well. Furthermore, estimating the accuracy disparity of the personalized model becomes difficult without access to bias-conflicting samples.
21
+
22
+ To approach this problem, we propose a novel method to reduce the accuracy disparity of personalized models. Our proposed method does not rely on the bias-conflicting samples, e.g., blond male images in the aforementioned task of gender prediction, which are often rare and may not be available for every user. Instead, inspired by prior works (Tramer et al., 2017; Liang et al., 2021) on the \` transferability of adversarial examples, we use the global model as a reference and the adversarial transferability between the global model and the personalized models as a proxy to estimate the accuracy disparity of the personalized models. The intuition is that if two ML models use disjoint subsets of features, the adversarial examples that one ML model generates do not transfer to the other ML model. Based on this intuition, we propose the following hypothesis:
23
+
24
+ If the personalized models entangle spurious features (thus increasing the accuracy disparity), the adversarial examples generated by the global model (that uses non-spurious features) do not transfer to the personalized models.
25
+
26
+ Empirically, we show that the adversarial transferability between the global and personalized models strongly correlates with the accuracy disparity between the global and personalized models (Section 4), validating our hypothesis. We further theoretically connect the adversarial transferability to the accuracy disparity (Section 5). Based on the empirical observations and theoretical results, we develop a method that enforces adversarial transferability between the global and the personalized models to reduce the accuracy disparity of personalized models (Section 6). Our contributions are summarized as follows:
27
+
28
+ • We empirically evaluate the accuracy disparity of the global and personalized models in a federated learning setting with spurious features, highlighting a risk of existing personalization methods.
29
+ • We design a method to estimate the accuracy disparity of the personalized models, based on the low accuracy disparity global model and the adversarial transferability between the global and personalized models.
30
+
31
+ • We theoretically connect the adversarial transferability and the accuracy disparity of the global and personalized models. • We develop a methods to reduce the accuracy disparity of personalized models by enforcing the adversarial transferability between the global and personalized models.
32
+
33
+ Empirically, we conduct extensive experiments to validate the effectiveness of the proposed methods in mitigating accuracy disparity under the FL setting. Our experiments on MNIST (Deng, 2012), CelebA (Liu et al., 2015), and Coil20 (Nene et al., 1996) datasets show that the proposed approach reduces the accuracy disparity of personalized models from $1 5 . 1 2 \%$ to $2 . 1 5 \%$ , which is closer to that of the global model $( - 0 . 6 3 \% )$ . Our method also preserves the benefit of the enhanced average accuracy from fine-tuning, resulting in $3 . 4 3 \%$ accuracy improvement on the biased test set and $0 . 8 5 \%$ accuracy improvement on the biased-conflicting test set.
34
+
35
+ # 2 RELATED WORK
36
+
37
+ Personalized Federated Learning Fine-tuning is typical for personalization methods. The metalearning-based method first trains a global model and fine-tunes the global model locally (Fallah et al., 2020). Other methods using multi-task learning (Li et al., 2021) or Moreau envelopes (T. Dinh et al., 2020) have an interpretation as fine-tuning the local model along with training the global model. Fine-tuning is also compatible with clustering-based method (Ghosh et al., 2020).
38
+
39
+ Debiasing ML Models A few prior works (Li & Vasconcelos, 2019; Sagawa et al., 2020) utilize group labels, which might require human annotation, to debias ML models. For example, the group distributional robust optimization (DRO) method (Sagawa et al., 2020) aims to optimize the worst-case error rate of ML models across different (often manually annotated) groups. Some groups contain bias-conflicting samples while others do not. Residual learning-based methods (He et al., 2019; Nam et al., 2020; Liu et al., 2021) train a biased ML model and up-weight the residual, which mainly contains bias-conflicting samples that the biased ML model mis-predicts. Chi et al. (2021) aims to mitigate the accuracy disparity in regression problems via learning the appropriate representations. However, all these methods rely on the explicit access to the bias-conflicting samples, making them difficult to apply on personalized federated learning, where bias-conflicting samples may not be accessible for every client.
40
+
41
+ # 3 PRELIMINARIES
42
+
43
+ Definitions and Notation A data sample is a vector $\pmb { x } = [ \pmb { x } _ { r } , \pmb { x } _ { s } ]$ , where ${ \mathbf { \mathcal { x } } } _ { r }$ corresponds to the robust and non-spurious features and $\mathbf { \delta } _ { \mathbf { \mathcal { X } } _ { s } }$ are the spurious features. $d _ { s }$ is the dimension of spurious features. Let $y$ be a label, and define $\ell : \mathcal { V } \times \mathcal { V } \mathbb { R }$ to be a $\lambda$ -smooth, twice differentiable loss function and $\mathcal { L } ( f , \mathcal { D } ) = \mathbb { E } _ { ( \pmb { x } , \pmb { y } ) \sim \mathcal { D } } [ \ell ( f ( \pmb { x } ) , \pmb { y } ) ]$ to be the empirical risk. ${ \pmb w } _ { g }$ and ${ \pmb w } _ { p }$ are the weights for the global model $f _ { g } : \mathcal { X } \xrightarrow { } \mathcal { Y }$ and personalized model $f _ { p } : \mathcal { X } \mathcal { Y }$ , respectively. $\gamma$ is the ratio between the gradient norms of the global and personalized models, k∇x\`(fg(x),y)kk∇x\`(fp(x),y)k . Let $\operatorname { s u p p } ( \mathcal { D } )$ be the support of distribution $\mathcal { D }$ . We define a global data distribution $\mathcal { D } _ { g }$ , a biased local data distribution $\mathcal { D } _ { b }$ , and assume a bias-conflicting local data distribution $\mathcal { D } _ { b c }$ . We define the “pseudo-gradient” as the difference between the updated local model and the global model from the previous round (sometimes we will use the term “gradient” when it is clear from context). $\langle \cdot , \cdot \rangle$ denotes an inner product of two vectors and $\cdot \frown \cdot$ denotes a concatenation of two vectors. $\theta$ is the angle between $\nabla _ { \pmb { x } } \hat { \ell ( f _ { g } ( \pmb { x } ) , y ) }$ and $\nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , y )$ . $\theta _ { g }$ is the angle between $\nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y )$ and $\nabla _ { \pmb { x } _ { r } } \ell ( f _ { g } ( \pmb { x } ) , y ) \frown \pmb { 0 }$ , which measures the entanglement of the global model to spurious features.
44
+
45
+ Training and Personalization Methods We train the global model using the federated averaging algorithm (McMahan et al., 2017), which learns a model $f : \mathcal { X } \mathcal { Y }$ that minimizes: $\begin{array} { r } { \bar { \mathcal { L } } ( f , \mathcal { D } _ { g } ) \bar { = } } \end{array}$ $\begin{array} { r } { \sum _ { i = 1 } ^ { N } | \mathcal { D } _ { b _ { i } } | / | \mathcal { D } _ { g } | \cdot \mathbb { E } _ { \mathbf { x } , y \sim \mathcal { D } _ { b _ { i } } } \ell ( f ( \mathbf { x } ) , y ) . } \end{array}$ , where $N$ is the number of clients, $\mathcal { D } _ { b _ { i } }$ is the biased local dataset for client $i$ , and $\mathcal { D } _ { g } = \cup _ { i = 1 } ^ { N } \mathcal { D } _ { b _ { i } }$ is the global dataset. When the global model $f _ { g }$ converges, $f _ { g }$ will be sent to local clients for further fine-tuning by minimizing $\mathbb { E } _ { \pmb { x } , \pmb { y } \sim \mathcal { D } _ { b _ { i } } } \ell ( f ( \pmb { x } ) , \breve { y } )$ .
46
+
47
+ Adversarial Examples and Transferability We can generate an adversarial example $\mathbf { \Delta } \mathbf { x } _ { a d v }$ given data sample $_ { \textbf { \em x } }$ with label $y$ by solving:
48
+
49
+ $$
50
+ \pmb { x } _ { a d v } = \underset { \| \pmb { x } ^ { \prime } - \pmb { x } \| \leq \epsilon } { \arg \operatorname* { m a x } } \ell ( f ( \pmb { x } ^ { \prime } ) , y ) ,
51
+ $$
52
+
53
+ ![](images/7b06936813e961aed7b62c6236cf3173dc2923b7daa781525aa9d4e1ed242e65.jpg)
54
+ Figure 2: Datasets with spurious features. The object color spuriously correlates with the label in MNIST (a) and Coil20 (c) datasets. The hair color spuriously correlates with gender in the CelebA dataset (b).
55
+
56
+ ![](images/f5880ea92afd42c3fca9cb12c8c9b0477cb78da6832f2ceb437f243eb43a8cdb.jpg)
57
+ Figure 3: The accuracy of ML models on Biased Dataset and Bias-Conflicting Dataset under centralized and federated training settings. In the centralized setting, an ML model is trained by a single dataset that contains all the samples with a fixed spurious correlation. The global models in the federated setting achieve smaller accuracy disparities between biased and bias-conflicting datasets.
58
+
59
+ where $f$ is the victim ML model, and $\epsilon$ is the attack budget. In this example, we consider the $L _ { 2 }$ attacks, but extensions to general $L _ { p }$ attacks are straightforward. We say an adversarial example to be transferable if it also fools another ML model (e.g., a personalized model) other than the original victim model $f$ (e.g., the global model).
60
+
61
+ # 4 AN EMPIRICAL STUDY WITH SPURIOUS FEATURES
62
+
63
+ To gain some insights into the problem, we first perform an empirical study on the accuracy disparity of the global and personalized models in an FL setting. In this study, the personalization method is fine-tuning. Our results highlight the risk of existing fine-tuning-based personalization methods and the difficulty of mitigating the risk. We also highlight the correlation between the adversarial transferability and the accuracy disparity between the global and personalized models. We provide additional theoretical analysis in Section 5 to support the observed correlation. The spurious features in the empirical study are as follows.
64
+
65
+ Spurious Features We consider color as the spurious feature for the MNIST, CelebA, and Coil20 datasets. In the MNIST and Coil20 datasets, we manually color the objects according to their labels to create spurious correlations, as Figure 2 shows. The spurious correlations vary across clients for the MNIST and Coil20 data (e.g., the red color correlates with label zero on the first client and with label one on the second client) to create additional statistical heterogeneity. In the CelebA dataset, the hair color attribute correlates with the gender label. We assign disjoint subsets of celebrities to different users, which naturally increases statistical heterogeneity for the spurious correlation.
66
+
67
+ # 4.1 STATISTICAL HETEROGENEITY REDUCES ACCURACY DISPARITY
68
+
69
+ Figure 3 shows the accuracy disparity of ML models on biased and bias-conflicting test sets. Compared to the models trained in the centralized setting, where the spurious correlations are fixed, the accuracy disparity of models trained in the federated setting decreased significantly. These empirical results suggest that the global model in FL is more robust to spurious features if the spurious features are non-i.i.d. across clients.
70
+
71
+ To explain this observation, consider the relationship between the gradient directions and the learned features. For the spurious features, its correlation with the label may change across clients. As an example, in some users’ local datasets, the blond hair does not correlate with the gender label because the dataset does not contain any blond female image or the dataset has blond male images, as visualized in Figure 1a. Therefore, the gradient directions for the spurious features are diverse across clients, as shown in Figure 1b. The divergence between the gradient directions, as a consequence, makes learning spurious features difficult. In contrast, the non-spurious features, e.g., shape features, are more consistent across clients, leading to a more consistent gradient direction.
72
+
73
+ ![](images/0b36ed6b6b942aaaec3bb73437450c7587b9b11c40d452d532ccb00ba6a9f59e.jpg)
74
+ Figure 4: The accuracy of personalized model on Biased Dataset (Acc B) and Bias-Conflicting Dataset (Acc BC) with increasing fine-tuning batches. The personalized models entangle spurious features and increase accuracy disparities between biased and bias-conflicting datasets.
75
+
76
+ ![](images/97c373f19c43124da1b887c5b003ab07e32e8d52876ec7a861304d23fb4648dc.jpg)
77
+ Figure 5: The accuracy disparity of personalized models on biased dataset and bias-conflicting dataset (Acc B - Acc BC) and their accuracy on adversarial examples (Acc Adv). As the personalized models entangle spurious features and increase the accuracy disparity, the accuracy of the personalized models on adversarial examples increases, which indicates the adversarial transferability between the global and personalized models decreases.
78
+
79
+ # .2 PERSONALIZATION MAY EXACERBATE ACCURACY DISPARITY
80
+
81
+ Although the global model in the federated setting has a lower accuracy disparity than in the centralized setting, the advantage could vanish during the personalization step.
82
+
83
+ The Personalized Model Entangles Spurious Features As can be observed in Figure 4, the accuracy first increases and decreases on the MNIST bias-conflicting test set and slowly decreases on Coil20. These two observations indicate that the personalized model entangles spurious features and exacerbates the accuracy disparity in a few batches. Although in principle, one may resort to early stopping, this is not feasible when the bias-conflicting dataset is unavailable or scarce.
84
+
85
+ # 4.3 ADVERSARIAL TRANSFERABILITY INDICATES ACCURACY DISPARITY
86
+
87
+ Because the bias-conflicting test set is often unavailable, it is infeasible to directly measure the accuracy disparity across personalized models. To this end, in this section, we focus on methods that implicitly measure the accuracy disparity and determine whether the personalized models entangle spurious features. Following our hypothesis in Section 1, we consider using the adversarial transferability between the global and personalized models as a proxy for the accuracy disparity measurement. Figure 5 plots the accuracy disparity and the adversarial transferability during finetuning. As the accuracy disparity of the personalized models increases and drifts away from that of the global model, the adversarial transferability between the global and personalized models decreases. This result empirically validates our hypothesis.
88
+
89
+ # 5 THEORETICAL INSIGHTS
90
+
91
+ This section presents our theoretical result that supports our hypothesis in Section 1 and the experimental results in Section 4.3. Our theoretical result applies the loss, which has similar behavior to the accuracy as is shown in the empirical results in Section 7. Before we proceed, some additional definitions and notations are needed for the presentation, and we provide a table summarizing all the notations used in Appendix A to ease the reading. Then, we connect both the loss disparity and the adversarial transferability to the angle between the gradients of the global and personalized models. In what follows, we shall show an upper bound of the loss disparity of a personalized model, which consists of the adversarial transferability between the global and personalized models and an indicator of the entanglement of the global model to spurious features.
92
+
93
+ # 5.1 MORE DEFINITIONS AND NOTATION
94
+
95
+ We define natural perturbation $\pmb { \Delta }$ to model the distribution shift between the bias-conflicting $\mathcal { D } _ { b c }$ and biased $\mathcal { D } _ { b }$ . $\pmb { \Delta }$ could change a bias-aligned sample to a corresponding bias-conflicting sample. The distribution ${ \mathcal { D } } _ { \Delta | x }$ of the natural perturbation $\pmb { \Delta }$ conditions on the data sample $_ { \textbf { \em x } }$ . Formally, for any $\pmb { x } \in \mathcal { R } ^ { \mathrm { d } }$ , we have: $\begin{array} { r } { \operatorname* { P r } _ { \pmb { x } \sim \mathcal { D } _ { b c } } ( \pmb { x } ) = \sum _ { \pmb { x } ^ { \prime } \in \mathcal { R } ^ { \mathrm { d } } , \pmb { \Delta } \in \mathcal { R } ^ { \mathrm { d } } } \mathbf { 1 } _ { \{ \pmb { x } = \pmb { x } ^ { \prime } + \pmb { \Delta } \} } \cdot \operatorname* { P r } _ { \pmb { x } ^ { \prime } \sim \mathcal { D } _ { b } } ( \pmb { x } ^ { \prime } ) \cdot \operatorname* { P r } _ { \pmb { \Delta } \sim \mathcal { D } _ { \Delta } | \pmb { x } ^ { \prime } } ( \pmb { \Delta } ) . } \end{array}$ .
96
+
97
+ Running Example For a non-blond male image $_ { \textbf { \em x } }$ , we could draw a natural perturbation $\pmb { \Delta }$ from ${ \mathcal { D } } _ { \Delta | { \boldsymbol { x } } }$ that change the hair color in $_ { \textbf { \em x } }$ to blond. That is saying, $\pmb { x } + \pmb { \Delta }$ is a blond male image. Iteratively drawing data samples from the biased dataset and applying the sampled natural perturbations to the data samples result in a dataset with bias-conflicting samples.
98
+
99
+ Another perturbation to consider is the adversarial perturbation $\delta _ { f , \epsilon } = \pmb { x } _ { a d v } - \pmb { x }$ that is generated using $f$ with budget $\epsilon$ . Plugging the definition of $\delta _ { f , \epsilon }$ into Eq. (1), we have $\begin{array} { r } { \delta _ { f , \epsilon } = \arg \operatorname* { m a x } _ { \| \delta \| \leq \epsilon } \ell ( f ( \pmb { x } + } \end{array}$ $\delta ) , y )$ . Since the budget $\epsilon$ is small, we could approximate the loss function $\ell$ using the first-order gradient: $\begin{array} { r } { \delta _ { f , \epsilon } = \arg \operatorname* { m a x } _ { \| \delta \| \leq \epsilon } \nabla _ { \pmb { x } } \ell ( f ( \pmb { x } ) , y ) ^ { \top } \delta = \epsilon \cdot \frac { \nabla _ { \pmb { x } } \ell ( f ( \pmb { x } ) , y ) } { \| \nabla _ { \pmb { x } } \ell ( f ( \pmb { x } ) , y ) \| } } \end{array}$ (Miyato et al., 2018; Liang et al., 2021). With the adversarial perturbation, we define the adversarial transferability loss:
100
+
101
+ \` ${ } _ { t r a n s } ( f _ { g } , f _ { p } , \mathbf { x } , y ) = \Big ( \ell ( f _ { g } ( \mathbf { x } + \delta _ { f _ { g } , \epsilon } ) , y ) - \ell ( f _ { g } ( \mathbf { x } ) , y ) \Big ) - \Big ( \ell ( f _ { p } ( \mathbf { x } + \delta _ { f _ { g } , \epsilon } ) , y ) - \ell ( f _ { p } ( \mathbf { x } ) , y ) \Big ) ,$ which indicates the effectiveness of the adversarial perturbation generated using the global model applied to the personalized models.
102
+
103
+ # 5.2 LOSS DISPARITY AND ADVERSARIAL TRANSFERABILITY
104
+
105
+ With the definitions of natural and adversarial perturbations, this section shows that both the loss disparity and the adversarial transferability connect to an angle $\theta$ . Next, we outline the assumption:
106
+
107
+ Assumption 1. The distribution shift does not exacerbate the entanglement of a model $f$ to spurious features $\mathbf { \delta } _ { \mathbf { \mathcal { X } } _ { s } }$ , which is measured by $\dot { \nabla } _ { { \pmb x } _ { s } } \ell ( f ( { \pmb x } ) , y )$ :
108
+
109
+ $$
110
+ \mathbb { E } _ { ( \pmb { x } , y ) \sim \mathcal { D } _ { b } , \Delta \sim \mathcal { D } _ { \Delta | \pmb { x } , y } } [ \int _ { \alpha = 0 } ^ { 1 } \langle \nabla _ { \pmb { x } _ { s } } \ell \big ( f ( \pmb { x } + \alpha \cdot \Delta ) , y ) , \mathbf { 1 } \big ) \mathrm { d } \alpha ] \le \mathbb { E } _ { ( \pmb { x } , y ) \sim \mathcal { D } _ { b } } [ \langle \nabla _ { \pmb { x } _ { s } } \ell \big ( f ( \pmb { x } ) , y ) , \mathbf { 1 } \big ) ] .
111
+ $$
112
+
113
+ Under Assumption 1, the following Lemmas hold.
114
+
115
+ Lemma 1. Under Assumption $I$ , let $\Delta$ be the natural perturbation, $\theta$ be the angle between $\nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y )$ and $\nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , y )$ , $\theta _ { g }$ be the angle between $\nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y )$ and $\nabla _ { \pmb { x } _ { r } } \ell ( f _ { g } ( \pmb { x } ) , y ) $ 0, and γ $b e ~ { \frac { \| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , \pmb { y } ) \| } { \| \nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , \pmb { y } ) \| } }$ , we have:
116
+
117
+ $$
118
+ \begin{array} { r l } & { \mathcal { L } ( f _ { p } , \mathcal { D } _ { b c } ) - \mathcal { L } ( f _ { p } , \mathcal { D } _ { b } ) = \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { b } , \Delta \sim \mathcal { D } _ { \Delta | \alpha } } [ \displaystyle \int _ { \alpha = 0 } ^ { 1 } \left. \nabla _ { \alpha _ { s } } \ell ( f _ { p } ( x + \alpha \cdot \Delta ) , y ) , \mathbf { 1 } \right. \mathrm { d } \alpha ] } \\ & { \quad \quad \quad < \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { b } , \Delta \sim \mathcal { D } _ { \Delta | \alpha } } [ \displaystyle \frac { \sqrt { d _ { s } } } { \gamma } \cdot \| \nabla _ { \mathbf { x } } \ell ( f _ { g } ( x ) , y ) \| \cdot ( \sin \theta _ { g } + \sin \theta ) ] } \end{array}
119
+ $$
120
+
121
+ Lemma 1 connects the loss disparity to $\theta$ . The $\theta _ { g }$ , differing from $\theta$ , is an indicator of the entanglement of the global model to spurious features and is a constant during the personalization step.
122
+
123
+ Lemma 2. Let $\epsilon$ be the attack budget, $\theta$ be the angle between $\nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y )$ and $\nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , y )$ , $\gamma$ be $\frac { | | \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) | | } { | | \nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) | | }$ , and the loss function $\ell : \mathcal { V } \times \mathcal { V } \mathbb { R }$ be $\lambda$ -smooth, twice differentiable, we have
124
+
125
+ $$
126
+ \begin{array} { l } { \displaystyle \epsilon \cdot \| \nabla _ { x } \ell ( f _ { g } ( x ) , y ) \| \cdot ( 1 - \frac { 1 } { \gamma } \cdot \mathrm { c o s } \theta ) - \lambda \cdot \epsilon ^ { 2 } \leq \ell _ { t r a n s } ( f _ { g } , f _ { p } , x , y ) } \\ { \displaystyle \leq \epsilon \cdot \| \nabla _ { x } \ell ( f _ { g } ( x ) , y ) \| \cdot ( 1 - \frac { 1 } { \gamma } \cdot \mathrm { c o s } \theta ) + \lambda \cdot \epsilon ^ { 2 } } \end{array}
127
+ $$
128
+
129
+ Lemma 2 connects the adversarial transferability loss to $\theta$ . In the following analysis, we connect the loss disparity to adversarial transferability via $\theta$ .
130
+
131
+ # 5.3 A GENERALIZATION UPPER BOUND
132
+
133
+ We now present an upper bound of the disparity $\mathcal { L } ( f _ { p } , \mathcal { D } _ { b c } ) - \mathcal { L } ( f _ { p } , \mathcal { D } _ { b } )$ . The main idea is to derive an upper bound of $\| \bar { \nabla _ { \mathbf x } } \ell ( f _ { g } ( \mathbf x ) , y ) \| \cdot \sin \bar { \theta }$ in Eq. (2) from Eq. (3).
134
+
135
+ Theorem 3. Let $\gamma _ { \mathrm { m i n } }$ be the minimum of $\gamma$ , with Lemmas 1-2, we have:
136
+
137
+ $$
138
+ \begin{array} { l } { \displaystyle \mathcal { L } ( f _ { p } , \mathcal { D } _ { b c } ) - \mathcal { L } ( f _ { p } , \mathcal { D } _ { b } ) < \sqrt { d _ { s } } \cdot \Big ( ( \frac { \sin \theta _ { g } + \sqrt { 2 } } { \gamma _ { \mathrm { m i n } } } - 1 ) \cdot \mathbb { E } _ { ( { \pmb x } , { y } ) \sim \mathcal { D } _ { b } } [ \| \nabla _ { \pmb x } \ell ( f _ { g } ( { \pmb x } ) , { y } ) \| ] } \\ { \displaystyle \qquad + \frac { 1 } { \epsilon } \cdot \mathbb { E } _ { ( { \pmb x } , { y } ) \sim \mathcal { D } _ { b } } [ \ell _ { t r a n s } ( f _ { g } , f _ { p } , { \pmb x } , { y } ) ] + \lambda \cdot \epsilon \Big ) } \end{array}
139
+ $$
140
+
141
+ Theorem 3 suggests (1) debiasing the global model $f _ { g }$ , whose entanglement to spurious features is measured by $\theta _ { g }$ , and (2) enforcing the adversarial transferability between $f _ { g }$ and $f _ { p }$ help reducing the loss disparity of personalized models. For the constants $\gamma _ { \mathrm { m i n } }$ and $\lambda$ , we further explore their impacts in the following section and Appendix D.1, respectively.
142
+
143
+ # 6 METHODS
144
+
145
+ With the empirical and theoretical results in Sections 4.3 and 5, respectively, it is natural to ask if enforcing the adversarial transferability in the personalization step reduces the accuracy disparity. In this section, we first introduce adversarial examples to the personalization step as a regularization term added to the original loss function, aiming to enforce the adversarial transferability. However, the accuracy disparity still increases, albeit much slower, even if the adversarial transferability remains high. One possible reason is that the personalized model increases its gradient norm, which helps preserve the adversarial transferability but does not prevent the personalized model from entangling spurious features. To this end, we add an $L _ { 2 }$ regularization term to the loss function, aligning the gradient norms of the global and personalized models. Combing these two methods addresses the accuracy disparity. Both methods are relatively light-weight from a computational perspective.
146
+
147
+ # 6.1 ENFORCING ADVERSARIAL TRANSFERABILITY
148
+
149
+ We enforce that global and personalized models make consistent predictions on adversarial examples, such that adversarial examples transfer from one to the other.
150
+
151
+ Generating Adversarial Examples The projected gradient descent (PGD) attack (Madry et al., 2018) is an effective attack method that uses the neural network’s first-order gradient, and is easy to tion compute. Additionally, . The attack solves $t + 1$ , the adversarial example is: $\begin{array} { r } { \pmb { x } _ { a d v } ^ { t + 1 } = \mathrm { P r o j } _ { \| \pmb { x } _ { a d v } - \pmb { x } \| \leq \epsilon } ( \pmb { x } + \alpha \cdot \mathrm { s i g n } ( \nabla _ { \pmb { x } _ { a d v } ^ { t } } \ell ( f _ { g } ( \pmb { x } _ { a d v } ^ { t } ) , y ) ) ) , } \end{array}$ $\begin{array} { r } { \pmb { x } _ { a d v } = \arg \operatorname* { m a x } _ { \| \pmb { x } ^ { \prime } - \pmb { x } \| \leq \epsilon } \ell ( f ( \pmb { x } ^ { \prime } ) , y ) } \end{array}$ iteratively. At iterawhere Proj is a projection operator.
152
+
153
+ Enforcing Consistent Predictions Both the global model $f _ { g }$ and the personalized model $f _ { p }$ take the adversarial example $\mathbf { { x } } _ { a d v }$ as input and output $z _ { g }$ and $z _ { p }$ from their last layers, respectively. We enforce the adversarial transferability by adding the following regularization term, which maximizes the cross-entropy between $z _ { g }$ and $z _ { p }$ . Since the global model $f _ { g }$ is fixed as a reference in the personalization step and its low accuracy disparity is desirable, we use $z _ { g }$ as the ground-truth:
154
+
155
+ $$
156
+ R _ { a d v } ( z _ { g } , z _ { p } ) = \sum _ { i = 1 } ^ { K } [ z _ { g _ { i } } \cdot \log ( z _ { p _ { i } } ) + ( 1 - z _ { g _ { i } } ) \cdot \log ( 1 - z _ { p _ { i } } ) ] ,
157
+ $$
158
+
159
+ where $K$ is the number of classes. The local model has access to the global model, so there is no additional communication overhead for implementing this regularization. The adversarial examples are computed using the global model once for all. The computation only needs a few back-propagations, much less than training the global model.
160
+
161
+ # 6.2 ALIGNING GRADIENT NORMS
162
+
163
+ In Eq. (3), we have seen that the adversarial transferability loss depends not only on the angle $\theta$ , which connects the transferability to the disparity but also on $\begin{array} { r } { \gamma : = \frac { \| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , \dot { \boldsymbol { y } } ) \| } { \| \nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , \boldsymbol { y } ) \| } } \end{array}$ . A small $\gamma$ indicates that the personalized model increases its gradient norm. Then, the personalized model could entangle the spurious features and increase $\theta$ without decreasing the adversarial transferability.
164
+
165
+ To prevent $\gamma$ from decreasing, we employ a simple and effective strategy by adding an $L _ { 2 }$ regularization term $R _ { L _ { 2 } } = \| \pmb { w } _ { g } - \pmb { w } _ { p } \| ^ { 2 }$ to the loss function. The motivation behind the $L _ { 2 }$ term is straightforward: if two models have similar weights, they have similar gradients. Empirical results in Appendix D.2 show the effectiveness of the $L _ { 2 }$ term in controlling $\gamma$ . Although prior works (Li et al., 2020; T. Dinh et al., 2020; Li et al., 2021) have explored similar regularization methods, we develop the regularization term from a different perspective.
166
+
167
+ # 7 EXPERIMENTS
168
+
169
+ This section presents our experimental results, demonstrating that our method reduces the accuracy disparity. We also show that the benefit of enhanced average accuracy from fine-tuning is preserved.
170
+
171
+ # 7.1 SETTING
172
+
173
+ Data Partition We distribute the MNIST and Coil20 dataset across 50 clients where each client have 5 different classes. The local dataset on each client is further partitioned to train/validation/test set with a ratio of 72:8:20, following prior work (Li et al., 2021). We make two data partitions for CelebA: CelebA R using a real partition and CelebA S using a synthetic partition, both have 508 clients. In both CelebA partitions, each client represent a disjoint set of celebrity (Li et al., 2021).
174
+
175
+ Due to the limited space, we further detail the data partition in Appendix C.1, report the hyperparameters in Appendix C.2, and list the neural network architecture in Appendix C.3.
176
+
177
+ # 7.2 THE EFFECTIVENESS OF PROPOSED METHODS
178
+
179
+ We conduct an ablation study on the MNIST dataset. Figures 6b and 6f demonstrate the effectiveness of enforcing adversarial transferability. However, the accuracy and loss disparity still increase during personalization, which is potentially caused by the gradient norm issue (Section 6.2). Aligning the gradient norms by applying the $L _ { 2 }$ regularization term while enforcing adversarial transferability address the accuracy and loss disparity as Figures 6d and 6h show, respectively. Figure 6c and 6g further show that applying the $L _ { 2 }$ regularization term alone does not address the accuracy or loss disparity. Compared to naive fine-tuning, which is reported in Figures 6a and 6e, our method mitigates the accuracy and loss disparities by $\sim 5 0 \%$ .
180
+
181
+ # 7.3 ANALYSIS
182
+
183
+ We compare our method to no personalization (Global), naive fine-tuning (FT), Ditto (Li et al., 2021), up-weighting (UW) (Sagawa et al., 2020), and just train twice (JTT) (Liu et al., 2021). The up-weighting method is implemented via sampling bias-aligned and bias-conflicting samples with equal probability (Sagawa et al., 2020). Up-weighting and JTT are not applicable to Coil20 due to the lack of bias-conflicting samples. We use the local finetuning version of the Ditto solver because the local finetuning solver performs fewer local updates than that of the joint optimization solver and therefore entangles spurious features less. Each experiment is repeated 9 times with 3 random seeds for the federated learning step and 3 for the personalization step. We select models using the validation accuracy minus the decrease of adversarial transferability and using the validation accuracy for other baseline and competitor methods.
184
+
185
+ Tables 1 shows the main result. Our method reduces the accuracy disparity of personalized models from $1 5 . 1 2 \%$ to $2 . 1 5 \%$ , compared to other personalization methods. Our method also preserves the enhanced average accuracy from fine-tuning, resulting in $3 . 4 3 \%$ accuracy improvement on the biased test set and $0 . 8 \hat { 5 } \%$ improvement on the biased-conflicting test set compared to the global model. In contrast, the naive fine-tuning method sacrifices the accuracy on the bias-conflicting test set by up to $1 4 . 3 \%$ and increase the accuracy disparity by $1 5 . 1 2 \%$ . We also find that our methods outperform the supervised up-weighting method and the unsupervised JTT method, which increase the average accuracy disparity to $7 . 5 6 \%$ and $1 7 . 7 6 \%$ , respectively. One possible reason is that the diversity of the up-weighted bias-conflicting samples are small. Therefore, the neural network could memorize them instead of discarding spurious features. Appendix D.3 further shows empirical results that support our analysis.
186
+
187
+ ![](images/8a3e08843a3297b97a6b9f6be0798ecd6221a8e2a75417be1c756020cfa38c53.jpg)
188
+ Figure 6: The accuracy disparity (Acc B - Acc BC) and adversarial transferability accuracy (Acc Adv), and the loss disparity (Loss BC - Loss B) and adversarial transferability loss (MAX Loss Adv - Loss Adv) with different methods. Combining the two proposed methods addresses the accuracy and loss disparities. Acc BC/Loss BC and Acc B/Loss B are the accuracy/losses on the bias-conflicting and biased test sets, respectively. Acc Adv/Loss Adv is the accuracy/loss on adversarial examples. Acc Adv and MAX Loss Adv - Loss Adv, which measures the decrease of Loss Adv, indicate the decrease of adversarial transferability.
189
+
190
+ Table 1: Accuracy of personalized Models on Biased Test Set (Acc B) and Bias-Conflicting Test Set (Acc B). Our proposed method achieves the lowest accuracy disparity $( 2 . 1 5 \% )$ compared to other personalization methods $( 1 5 . 1 2 \% / 1 5 . 3 8 \% )$ , and $3 . 4 3 \%$ accuracy improvement on the biased test set and $0 . 8 5 \%$ improvement on the biased-conflicting test set compared to the global model.
191
+
192
+ <table><tr><td rowspan="2">Method</td><td colspan="2">MNIST</td><td colspan="2">CelebA_S</td><td colspan="2">CelebAR</td></tr><tr><td>Acc_B Acc_BC</td><td>Acc_B</td><td>Acc_BC</td><td>Acc_B Acc_BC</td><td>Acc_B</td><td>Acc_BC</td></tr><tr><td>Global</td><td>.852 ±2e-4 .847 ±6e-4</td><td>.930</td><td>)± 5e-5.910 ± 3e-4</td><td>.909 ± 6e-5.929</td><td>±5e-5</td><td>1.882 ± 6e-4. .903 ±7e-4</td></tr><tr><td>FT</td><td>.989 ±6e-7.704</td><td>±3e-4</td><td>.952 ± 6e-5 .786 ± 5e-4</td><td>.963 ± 6e-6 .849</td><td>±1e-3</td><td>.931 ± le-4 .891 ±2e-4</td></tr><tr><td>Ditto</td><td>.982 ± 3e-6 .724 ± 1e-3</td><td></td><td>.948 ± 5e-5 .715 ± 5e-4</td><td>.966 ± 1e-5 .884 ± 2e-4</td><td></td><td>.939 ± 4e-5 .897 ± 3e-4</td></tr><tr><td>UW</td><td>.968 ±2e-5.823</td><td>3±7e-4</td><td>930 ± 7e-6 .889 ± 5e-4</td><td>.936 ± 1e-5 .895 ± 4e-4</td><td></td><td>N/A N/A</td></tr><tr><td>JTT</td><td>.985 ± 2e-7 .707</td><td>±6e-5 .952</td><td>2±2e-6.817 1±3e-4</td><td>.956 ± 2e-5 .836 ± 1e-3</td><td></td><td>N/A N/A</td></tr><tr><td>Ours</td><td>.951 ±2e-5.870</td><td>±8e-4 .932</td><td>± 3e-5 .910 ± 2e-4</td><td>.925 ±2e-5.927</td><td>±8e-5</td><td>.901 ± 3e-4 .916 ± 5e-8</td></tr></table>
193
+
194
+ # 8 CONCLUSION
195
+
196
+ In this work, we show the risk of prior federated learning personalization methods with spurious features, which lead to high accuracy disparity between the global and local models. Then, we develop a strategy by enforcing the adversarial transferability between the global and personalized models to reduce the accuracy disparity. Both empirical and theoretical results show that our strategy is effective.
197
+
198
+ # 9 ETHICS STATEMENT
199
+
200
+ Our method mitigates the issue of spurious features, which lead to bias towards minority groups, in personalized federated learning. However, completely disentangling spurious features remains challenging and is an issue for many federated learning methods.
201
+
202
+ # 10 REPRODUCIBILITY STATEMENT
203
+
204
+ Our implementation, including data partition scripts, is based on the FedML library (He et al., 2020), which is open-sourced. The proofs of the theoretical results are in Appendix B. The datasets in our experiments are publicly available. We detail the data partition in Appendix C.1, report the hyper-parameter tuning in Appendix C.2, and list the neural network architecture in Appendix C.3.
205
+
206
+ # REFERENCES
207
+
208
+ Alekh Agarwal, Miroslav Dud´ık, and Zhiwei Steven Wu. Fair regression: Quantitative definitions and reduction-based algorithms. In International Conference on Machine Learning, pp. 120–129. PMLR, 2019.
209
+
210
+ Jianfeng Chi, Yuan Tian, Geoffrey J Gordon, and Han Zhao. Understanding and mitigating accuracy disparity in regression. In International Conference on Machine Learning (ICML), 2021.
211
+
212
+ Li Deng. The mnist database of handwritten digit images for machine learning research. IEEE Signal Processing Magazine, 29(6):141–142, 2012.
213
+
214
+ Alireza Fallah, Aryan Mokhtari, and Asuman Ozdaglar. Personalized federated learning with theoretical guarantees: A model-agnostic meta-learning approach. Advances in Neural Information Processing Systems, 33, 2020.
215
+
216
+ Avishek Ghosh, Jichan Chung, Dong Yin, and Kannan Ramchandran. An efficient framework for clustered federated learning. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 19586–19597. Curran Associates, Inc., 2020. URL https://proceedings.neurips.cc/paper/2020/ file/e32cc80bf07915058ce90722ee17bb71-Paper.pdf.
217
+
218
+ Chaoyang He, Songze Li, Jinhyun So, Mi Zhang, Hongyi Wang, Xiaoyang Wang, Praneeth Vepakomma, Abhishek Singh, Hang Qiu, Li Shen, Peilin Zhao, Yan Kang, Yang Liu, Ramesh Raskar, Qiang Yang, Murali Annavaram, and Salman Avestimehr. Fedml: A research library and benchmark for federated machine learning. arXiv preprint arXiv:2007.13518, 2020.
219
+
220
+ He He, Sheng Zha, and Haohan Wang. Unlearn dataset bias in natural language inference by fitting the residual. arXiv preprint arXiv:1908.10763, 2019.
221
+
222
+ Peter Kairouz, H Brendan McMahan, Brendan Avent, Aurelien Bellet, Mehdi Bennis, Arjun Nitin ´ Bhagoji, Keith Bonawitz, Zachary Charles, Graham Cormode, Rachel Cummings, et al. Advances and open problems in federated learning. arXiv preprint arXiv:1912.04977, 2019.
223
+
224
+ Fereshte Khani and Percy Liang. Removing spurious features can hurt accuracy and affect groups disproportionately. In Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency, pp. 196–205, 2021.
225
+
226
+ Diederik P. Kingma and Jimmy Ba. Adam: A method for stochastic optimization. In Yoshua Bengio and Yann LeCun (eds.), 3rd International Conference on Learning Representations, ICLR 2015, San Diego, CA, USA, May 7-9, 2015, Conference Track Proceedings, 2015. URL http: //arxiv.org/abs/1412.6980.
227
+
228
+ Pang Wei Koh, Shiori Sagawa, Sang Michael Xie, Marvin Zhang, Akshay Balsubramani, Weihua Hu, Michihiro Yasunaga, Richard Lanas Phillips, Irena Gao, Tony Lee, et al. Wilds: A benchmark of in-the-wild distribution shifts. In International Conference on Machine Learning, pp. 5637–5664. PMLR, 2021.
229
+
230
+ Daliang Li and Junpu Wang. Fedmd: Heterogenous federated learning via model distillation. arXiv preprint arXiv:1910.03581, 2019.
231
+
232
+ Tian Li, Anit Kumar Sahu, Manzil Zaheer, Maziar Sanjabi, Ameet Talwalkar, and Virginia Smith. Federated optimization in heterogeneous networks. In I. Dhillon, D. Papailiopoulos, and V. Sze (eds.), Proceedings of Machine Learning and Systems, volume 2, pp. 429–450, 2020. URL https://proceedings.mlsys.org/paper/2020/file/ 38af86134b65d0f10fe33d30dd76442e-Paper.pdf.
233
+
234
+ Tian Li, Shengyuan Hu, Ahmad Beirami, and Virginia Smith. Ditto: Fair and robust federated learning through personalization. In International Conference on Machine Learning, pp. 6357–6368. PMLR, 2021.
235
+
236
+ Yi Li and Nuno Vasconcelos. Repair: Removing representation bias by dataset resampling. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp. 9572–9581, 2019.
237
+
238
+ Kaizhao Liang, Jacky Y Zhang, Boxin Wang, Zhuolin Yang, Sanmi Koyejo, and Bo Li. Uncovering the connections between adversarial transferability and knowledge transferability. In International Conference on Machine Learning, pp. 6577–6587. PMLR, 2021.
239
+
240
+ Evan Z Liu, Behzad Haghgoo, Annie S Chen, Aditi Raghunathan, Pang Wei Koh, Shiori Sagawa, Percy Liang, and Chelsea Finn. Just train twice: Improving group robustness without training group information. In International Conference on Machine Learning, pp. 6781–6792. PMLR, 2021.
241
+
242
+ Ziwei Liu, Ping Luo, Xiaogang Wang, and Xiaoou Tang. Deep learning face attributes in the wild. In Proceedings of International Conference on Computer Vision (ICCV), December 2015.
243
+
244
+ Aleksander Madry, Aleksandar Makelov, Ludwig Schmidt, Dimitris Tsipras, and Adrian Vladu. Towards deep learning models resistant to adversarial attacks. In International Conference on Learning Representations, 2018. URL https://openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } }$ rJzIBfZAb.
245
+
246
+ Brendan McMahan, Eider Moore, Daniel Ramage, Seth Hampson, and Blaise Aguera y Arcas. Communication-efficient learning of deep networks from decentralized data. In Artificial Intelligence and Statistics, pp. 1273–1282. PMLR, 2017.
247
+
248
+ Daniel McNamara, Cheng Soon Ong, and Robert C Williamson. Costs and benefits of fair representation learning. In Proceedings of the 2019 AAAI/ACM Conference on AI, Ethics, and Society, pp. 263–270, 2019.
249
+
250
+ Takeru Miyato, Shin-ichi Maeda, Masanori Koyama, and Shin Ishii. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 41(8):1979–1993, 2018.
251
+
252
+ Junhyun Nam, Hyuntak Cha, Sungsoo Ahn, Jaeho Lee, and Jinwoo Shin. Learning from failure: Training debiased classifier from biased classifier. In Advances in Neural Information Processing Systems, 2020.
253
+
254
+ Sameer A. Nene, Shree K. Nayar, and Hiroshi Murase. Columbia object image library (coil-20. Technical report, 1996.
255
+
256
+ Yurii Nesterov. Introductory lectures on convex optimization: A basic course, volume 87. Springer Science & Business Media, 2003.
257
+
258
+ Shiori Sagawa, Pang Wei Koh, Tatsunori B. Hashimoto, and Percy Liang. Distributionally robust neural networks. In International Conference on Learning Representations, 2020. URL https: //openreview.net/forum?id $\underline { { \underline { { \mathbf { \Pi } } } } } =$ ryxGuJrFvS.
259
+
260
+ Canh T. Dinh, Nguyen Tran, and Josh Nguyen. Personalized federated learning with moreau envelopes. In H. Larochelle, M. Ranzato, R. Hadsell, M. F. Balcan, and H. Lin (eds.), Advances in Neural Information Processing Systems, volume 33, pp. 21394–21405. Curran Associates, Inc., 2020.
261
+
262
+ Florian Tramer, Nicolas Papernot, Ian Goodfellow, Dan Boneh, and Patrick McDaniel. The space of \` transferable adversarial examples. arXiv preprint arXiv:1704.03453, 2017.
263
+
264
+ Haohan Wang, Zexue He, Zachary L. Lipton, and Eric P. Xing. Learning robust representations by projecting superficial statistics out. In International Conference on Learning Representations, 2019. URL https://openreview.net/forum?id $=$ rJEjjoR9K7.
265
+
266
+ Jianyu Wang, Zachary Charles, Zheng Xu, Gauri Joshi, H Brendan McMahan, Maruan Al-Shedivat, Galen Andrew, Salman Avestimehr, Katharine Daly, Deepesh Data, et al. A field guide to federated optimization. arXiv preprint arXiv:2107.06917, 2021.
267
+
268
+ Han Zhao and Geoff Gordon. Inherent tradeoffs in learning fair representations. Advances in neural information processing systems, 32:15675–15685, 2019.
269
+
270
+ Han Zhao, Remi Tachet Des Combes, Kun Zhang, and Geoffrey Gordon. On learning invariant representations for domain adaptation. In International Conference on Machine Learning, pp. 7523–7532. PMLR, 2019.
271
+
272
+ # Appendix
273
+
274
+ A NOTATION
275
+
276
+ # Symbol
277
+
278
+ # Description
279
+
280
+ $x , y$ A pair of data sample and label
281
+ $\mathbf { \delta } _ { \mathbf { \mathcal { X } } _ { r } , \mathbf { \delta } _ { \mathbf { \mathcal { X } } _ { s } } }$ The robust feature and spurious features in $\pmb { x } = [ \pmb { x } _ { r } , \pmb { x } _ { s } ]$ , respectively
282
+ $d , d _ { r } , d _ { s }$ The dimension of $_ { \textbf { \em x } }$ , ${ \pmb x } _ { r }$ , $\mathbf { \delta } _ { \mathbf { \mathcal { X } } _ { s } }$ , respectively
283
+ $f _ { g }$ The global model
284
+ $f _ { p }$ The personlized local model
285
+ $\delta _ { f _ { g , \epsilon } }$ An adversarial purtubation generated by the global model $f _ { g }$ with attack budget $\epsilon$
286
+ $\pmb { \Delta }$ An natural perturbation, which could flip the spurious attribute
287
+ $\mathcal { D } _ { g }$ The global distribution, which is the union of local distributions
288
+ Db A biased local distribution
289
+ Dbc A bias-conflicting local distribution
290
+ D∆|x,y The distribution of natural perturbation
291
+ $\operatorname { s u p p } ( \mathcal { D } )$ The support of distribution $\mathcal { D }$
292
+ $\langle \cdot , \cdot \rangle$ An inner product of two vectors
293
+ $\frown$ · A concatenation of two vectors
294
+
295
+ # B PROOFS
296
+
297
+ # B.1 PROOF OF LEMMA 1
298
+
299
+ Lemma 1. Let $\Delta$ be the natural perturbation, $\theta$ be the angle between $\nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y )$ and $\nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) ,$ $\theta _ { g }$ be the angle between $\nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y )$ and $\nabla _ { x _ { r } } \ell ( f _ { g } ( { \pmb x } ) , y ) \ \frown \ \mathbf { \bar { 0 } }$ , and $\gamma$ be k∇x\`(fg(x),y)kk∇x\`(fp(x),y)k , we have:
300
+
301
+ $$
302
+ \begin{array} { r l } & { \mathcal { L } ( f _ { p } , \mathcal { D } _ { b c } ) - \mathcal { L } ( f _ { p } , \mathcal { D } _ { b } ) = \mathbb { E } _ { ( \boldsymbol { x } , \boldsymbol { y } ) \sim \mathcal { D } _ { b } , \Delta \sim \mathcal { D } _ { \Delta | \infty } } [ \displaystyle \int _ { \alpha = 0 } ^ { 1 } \langle \nabla _ { \boldsymbol { x } _ { s } } \ell ( f _ { p } ( \boldsymbol { x } + \boldsymbol { \alpha } \cdot \Delta ) , \boldsymbol { y } ) , \mathbf { 1 } \rangle \mathrm { d } \alpha ] } \\ & { \quad \quad \quad \quad < \mathbb { E } _ { ( \boldsymbol { x } , \boldsymbol { y } ) \sim \mathcal { D } _ { b } } [ \displaystyle \frac { \sqrt { d _ { s } } } { \gamma } \cdot \| \nabla _ { \boldsymbol { x } } \ell ( f _ { g } ( \boldsymbol { x } ) , \boldsymbol { y } ) \| \cdot ( \mathrm { s i n } \theta _ { g } + \mathrm { s i n } \theta ) ] } \end{array}
303
+ $$
304
+
305
+ Proof. Rewriting $\mathcal { L } ( f _ { p } , \mathcal { D } _ { b c } )$ and introducing $\pmb { \Delta }$ :
306
+
307
+ $$
308
+ \begin{array} { r l } { \mathcal { L } ( f _ { p } , \mathcal { D } _ { \theta c } ) = \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \theta c } } [ \ell ( f _ { p } ( x ) , y ) ] } \\ & { = \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \theta c } , \Delta \sim \mathcal { D } _ { \Delta \ln } } [ \ell ( f _ { p } ( x + \Delta ) , y ) ] } \\ & { = \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \delta } , \Delta \sim \mathcal { D } _ { \Delta \ln } } [ \ell ( f _ { p } ( x ) , y ) + \ell ( f _ { p } ( x + \Delta ) , y ) - \ell ( f _ { p } ( x ) , y ) ] } \\ & { = \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \delta } , \Delta \sim \mathcal { D } _ { \Delta \ln } } [ \ell ( f _ { p } ( x ) , y ) ] } \\ & { \quad + \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \theta c } , \Delta \sim \mathcal { D } _ { \Delta \ln } } [ \ell ( f _ { p } ( x + \Delta ) , y ) ] - \ell ( f _ { p } ( x ) , y ) ] } \\ & { = \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \theta c } } [ \ell ( f _ { p } ( x ) , y ) ] } \\ & { \quad + \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \delta } , \Delta \sim \mathcal { D } _ { \Delta \ln } } [ \ell ( f _ { p } ( x + \Delta ) , y ) ] - \ell ( f _ { p } ( x ) , y ) ] } \\ & { = \mathcal { L } ( f _ { p } , \mathcal { D } _ { \theta c } ) + \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \Delta \ln } } [ \ell ( f _ { p } ( x + \Delta ) , y ) ] } \\ & { = \mathcal { L } ( f _ { p } , \mathcal { D } _ { \theta c } ) + \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \Delta \ln } } [ \int _ { \alpha = 0 } ^ { 1 } \langle \nabla _ { \pi } \ell ( f _ { p } ( x + \alpha \cdot \Delta ) , y ) , 1 \rangle \mathrm { d } \alpha ] } \\ & = \mathcal { L } ( f _ { p } , \mathcal { D } _ { \theta c } ) + \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { \delta } , \Delta \sim \mathcal { D } _ { \Delta \ln } } [ \int _ \end{array}
309
+ $$
310
+
311
+ Moving $\mathcal { L } ( f _ { p } , \mathcal { D } _ { b } )$ to the left-hand-side (LHS), we have:
312
+
313
+ $$
314
+ \mathcal { L } ( f _ { p } , \mathcal { D } _ { b c } ) - \mathcal { L } ( f _ { p } , \mathcal { D } _ { b } ) = \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { b } , \Delta \sim \mathcal { D } _ { \Delta | \alpha } } [ \int _ { \alpha = 0 } ^ { 1 } \langle \nabla _ { x _ { s } } \ell ( f _ { p } ( x + \alpha \cdot \Delta ) , y ) , \mathbf { 1 } \rangle \mathrm { d } \alpha ] .
315
+ $$
316
+
317
+ According to Assumption 1, we further have:
318
+
319
+ $$
320
+ \mathbb { E } _ { ( \boldsymbol { x } , \boldsymbol { y } ) \sim \mathcal { D } _ { b } , \Delta \setminus \mathcal { D } _ { \Delta | \infty } } [ \int _ { \alpha = 0 } ^ { 1 } \left. \nabla _ { \boldsymbol { x } _ { s } } \ell \big ( f _ { p } ( \boldsymbol { x } + \boldsymbol { \alpha } \cdot \Delta ) , \boldsymbol { y } \big ) , \mathbf { 1 } \right. ] \le \mathbb { E } _ { \boldsymbol { x } \sim \mathcal { D } _ { b } } [ \left. \nabla _ { \boldsymbol { x } _ { s } } \ell \big ( f _ { p } ( \boldsymbol { x } ) , \boldsymbol { y } \big ) , \mathbf { 1 } \right. ]
321
+ $$
322
+
323
+ Next, we connect $\langle \nabla _ { \pmb { x } _ { s } } \ell ( f _ { p } ( \pmb { x } + \alpha \cdot \pmb { \Delta } ) , y ) , \mathbf { 1 } \rangle$ to $\| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \| \cdot \mathrm { s i n } \theta$ . The first step is connecting $\langle \nabla _ { \pmb { x } _ { s } } \ell ( f _ { p } ( \pmb { x } + \alpha \cdot \pmb { \Delta } ) , y ) , \pmb { 1 } \rangle$ to $\| \nabla _ { { \pmb x } _ { s } } \ell ( f _ { p } ( { \pmb x } ) , y ) \|$ using Cauchy-Schwarz inequality:
324
+
325
+ $$
326
+ \begin{array} { r l } & { \langle \nabla _ { x _ { s } } \ell ( f _ { p } ( { \pmb x } + { \alpha } \cdot { \pmb \Delta } ) , y ) , { \bf 1 } \rangle } \\ & { \quad \le \sqrt { \langle \nabla _ { x _ { s } } \ell ( f _ { p } ( { \pmb x } + { \alpha } \cdot { \pmb \Delta } ) , y ) , \nabla _ { { \pmb x } _ { s } } \ell ( f _ { p } ( { \pmb x } + { \alpha } \cdot { \pmb \Delta } ) , y ) \rangle \cdot \langle { \bf 1 } , { \bf 1 } \rangle } } \\ & { \quad = \sqrt { d _ { s } } \cdot \| \nabla _ { { \pmb x } _ { s } } \ell ( f _ { p } ( { \pmb x } ) , y ) \| } \end{array}
327
+ $$
328
+
329
+ Then, we connect $\| \nabla _ { { \pmb x } _ { s } } \ell ( f _ { p } ( { \pmb x } ) , y ) \|$ to $\| \nabla _ { x } \ell ( f _ { g } ( x ) , y ) \|$ . Assuming the global model $f _ { g }$ entangles spurious features and the angle between $\nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y )$ and $\nabla _ { \pmb { x } _ { r } } \ell ( \bar { f } _ { g } ( \pmb { x } ) , \bar { \mathbf { \xi } } y ) \frown \mathbf { 0 }$ is $\theta _ { g }$ , we have:
330
+
331
+ $$
332
+ \begin{array} { r } { \| \nabla _ { \pmb { x } _ { s } } \ell ( f _ { p } ( \pmb { x } ) , y ) \| \leq \| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \| \cdot \sin ( \theta _ { g } + \theta ) . } \end{array}
333
+ $$
334
+
335
+ Since it is easy to see that $\theta \in [ 0 , \frac { \pi } { 4 } ]$ and the gradient of $\mathrm { s i n } \theta$ is monotonically decreasing in $[ 0 , \textstyle { \frac { \pi } { 4 } } ]$ , we have:
336
+
337
+ $$
338
+ \begin{array} { l } { \displaystyle \sin ( \theta _ { g } + \theta ) = \int _ { 0 } ^ { \theta _ { g } + \theta } \nabla \mathrm { s i n } \theta \mathrm { d } \theta } \\ { \displaystyle = \int _ { 0 } ^ { \theta _ { g } + \theta } \mathrm { c o s } \theta \mathrm { d } \theta } \\ { \displaystyle < \int _ { 0 } ^ { \theta _ { g } } \mathrm { c o s } \theta \mathrm { d } \theta + \int _ { 0 } ^ { \theta } \mathrm { c o s } \theta \mathrm { d } \theta } \\ { \displaystyle = \mathrm { s i n } \theta _ { g } + \mathrm { s i n } \theta } \end{array}
339
+ $$
340
+
341
+ Combining Eq. (7) and Eq. (8), we have:
342
+
343
+ $$
344
+ \| \nabla _ { \pmb { x } _ { s } } \ell ( f _ { p } ( \pmb { x } ) , y ) \| < \| \nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) \| \cdot ( \mathrm { s i n } \theta _ { g } + \mathrm { s i n } \theta )
345
+ $$
346
+
347
+ Recalling the defition of $\begin{array} { r } { \gamma : = \frac { \| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \| } { \| \nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) \| } } \end{array}$ and combining Eq. (4), Eq. (5), Eq. (6), Eq. (9) complete the proof.
348
+
349
+ # B.2 PROOF OF LEMMA 2
350
+
351
+ Lemma 2. Let  be the attack budget, $\theta$ be the angle between $\nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y )$ and $\nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) ,$ $\gamma$ be $\frac { | | \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , \pmb { y } ) | | } { | | \nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , \pmb { y } ) | | }$ , and the loss function $\ell : \mathcal { V } \times \mathcal { V } \mathbb { R }$ be $\lambda$ -smooth, twice differentiable, we have
352
+
353
+ $$
354
+ \begin{array} { l } { \displaystyle \epsilon \cdot \| \nabla _ { x } \ell ( f _ { g } ( x ) , y ) \| \cdot ( 1 - \frac { 1 } { \gamma } \cdot \mathrm { c o s } \theta ) - \lambda \cdot \epsilon ^ { 2 } \leq \ell _ { t r a n s } ( f _ { g } , f _ { p } , x , y ) } \\ { \displaystyle \leq \epsilon \cdot \| \nabla _ { x } \ell ( f _ { g } ( x ) , y ) \| \cdot ( 1 - \frac { 1 } { \gamma } \cdot \mathrm { c o s } \theta ) + \lambda \cdot \epsilon ^ { 2 } } \end{array}
355
+ $$
356
+
357
+ Proof. Under the definition of the adversarial perturbation, it is easy to see that δf, = · ∇x\`(f(x),y)k∇x\`(f(x),y)k and $\delta _ { f , \epsilon }$ increases the loss by:
358
+
359
+ $$
360
+ \begin{array} { r l r } & { } & { \ell ( f _ { g } ( { \pmb x } + \delta _ { f _ { g } , \epsilon } ) , { y } ) - \ell ( f _ { g } ( { \pmb x } ) , { y } ) = \delta _ { f _ { g } , \epsilon } \nabla _ { \pmb x } \ell ( f _ { g } ( { \pmb x } ) , { y } ) + \displaystyle \frac { 1 } { 2 } \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \tilde { \pmb x } _ { g } } ^ { 2 } \ell ( f _ { g } ( \tilde { \pmb x } _ { g } ) , { y } ) \delta _ { f _ { g } , \epsilon } } \\ & { } & { = \epsilon \cdot \| \nabla _ { \pmb x } \ell ( f _ { g } ( { \pmb x } ) , { y } ) \| + \displaystyle \frac { 1 } { 2 } \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \tilde { \pmb x } _ { g } } ^ { 2 } \ell ( f _ { g } ( \tilde { \pmb x } _ { g } ) , { y } ) \delta _ { f _ { g } , \epsilon } } \end{array}
361
+ $$
362
+
363
+ where $\tilde { \mathbf { { x } } } _ { g }$ is a linear interpolation between $_ { \textbf { \em x } }$ and $\boldsymbol { x } + \delta _ { f _ { g } , \epsilon }$ , by the Lagrange’s mean-value theorem. Similarly, for a transferable adversarial example from $f _ { g }$ applies to $f _ { p } , \delta _ { f _ { g } , \epsilon }$ could increase the loss of $f _ { p }$ by:
364
+
365
+ $$
366
+ \begin{array} { r l } & { \ell ( f _ { p } ( x + \delta _ { f _ { g } , \epsilon } ) , y ) - \ell ( f _ { p } ( x ) , y ) = \delta _ { f _ { g } , \epsilon } \nabla _ { \mathbf x } \ell ( f _ { p } ( \mathbf x ) , y ) + \displaystyle \frac 1 2 \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \tilde { \mathbf x } _ { p } } ^ { 2 } \ell ( f _ { p } ( \tilde { \mathbf x } _ { p } ) , y ) \delta _ { f _ { g } , \epsilon } } \\ & { \quad \quad \quad \quad \quad = \epsilon \cdot \| \nabla _ { \mathbf x } \ell ( f _ { p } ( \mathbf x ) , y ) \| \cdot \mathrm { c o s } \theta + \frac 1 2 \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \tilde { \mathbf x } _ { p } } ^ { 2 } \ell ( f _ { p } ( \tilde { \mathbf x } _ { p } ) , y ) \delta _ { f _ { g } , \epsilon } } \end{array}
367
+ $$
368
+
369
+ where $\begin{array} { r } { \mathrm { c o s } \theta = \frac { \nabla _ { \mathbf { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \cdot \nabla _ { \mathbf { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) } { \| \nabla _ { \mathbf { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \| \| \nabla _ { \mathbf { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) \| } } \end{array}$ . Plugging the approximations above to the adversarial transferability loss, we have:
370
+
371
+ $$
372
+ \begin{array} { l } { \tiny { \mathrm { \tiny \mathrm { \Gamma } } } _ { t r a n s } ( f _ { g } , f _ { p } , \pmb { x } , y ) = \Big ( \ell ( f _ { g } ( \pmb { x } + \delta _ { f _ { g } , \epsilon } ) , y ) - \ell ( f _ { g } ( \pmb { x } ) , y ) \Big ) - \Big ( \ell ( f _ { p } ( \pmb { x } + \delta _ { f _ { g } , \epsilon } ) , y ) - \ell ( f _ { p } ( \pmb { x } ) , y ) \Big ) } \\ { = \epsilon \cdot \big \| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \big \| - \epsilon \cdot \big \| \nabla _ { \pmb { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) \big \| \cdot \cos \theta } \\ { \quad \Big . \Big . \Big . \Big . \Big . \Big . \Big . \Big . + \frac { 1 } { 2 } \cdot \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \tilde { \pmb { x } } _ { g } } ^ { 2 } \ell ( f _ { g } ( \tilde { \pmb { x } } _ { g } ) , y ) \delta _ { f _ { g } , \epsilon } - \frac { 1 } { 2 } \cdot \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \tilde { \pmb { x } } _ { g } } ^ { 2 } \ell ( f _ { p } ( \tilde { \pmb { x } } _ { p } ) , y ) \delta _ { f _ { g } , \epsilon } } \end{array}
373
+ $$
374
+
375
+ Under the $\lambda$ -smooth assumption on the loss function, the spectral norms of the Hessian metrics are bounded. Therefore, we could bound the norm of the deviate between the quadratic terms (Nesterov, 2003, Proof of Theorem 2.1.5) in the adversarial transferability loss:
376
+
377
+ $$
378
+ \begin{array} { r } { \| \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \bar { x } _ { g } } ^ { 2 } \ell ( f _ { g } ( \tilde { x } _ { g } ) , y ) \delta _ { f _ { g } , \epsilon } - \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \bar { x } _ { p } } ^ { 2 } \ell ( f _ { p } ( \tilde { x } _ { p } ) , y ) \delta _ { f _ { g } , \epsilon } \| \leq 2 \lambda \cdot \delta _ { f _ { g } , \epsilon } ^ { \top } \delta _ { f _ { g } , \epsilon } = 2 \lambda \cdot \epsilon ^ { 2 } } \end{array}
379
+ $$
380
+
381
+ Since the quadratic terms in Eq. (10) are scalars, we have:
382
+
383
+ $$
384
+ - 2 \lambda \cdot \epsilon ^ { 2 } \le \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \tilde { x } _ { g } } ^ { 2 } \ell ( f _ { g } ( \tilde { x } _ { g } ) , y ) \delta _ { f _ { g } , \epsilon } - \delta _ { f _ { g } , \epsilon } ^ { \top } \nabla _ { \tilde { x } _ { p } } ^ { 2 } \ell ( f _ { p } ( \tilde { x } _ { p } ) , y ) \delta _ { f _ { g } , \epsilon } \le 2 \lambda \cdot \epsilon ^ { 2 }
385
+ $$
386
+
387
+ Plugging Eq. (11) and the definition of $\gamma$ to $\ell _ { t r a n s } ( f _ { g } , f _ { p } , \pmb { x } , y )$ completes the proof.
388
+
389
+ # B.3 PROOF OF THEOREM 3
390
+
391
+ Theorem 3. Let $\gamma _ { \mathrm { m i n } }$ be the minimum of $\gamma _ { i }$ , under Assumptions $^ { l }$ and Lemmas 1-2, we have:
392
+
393
+ $$
394
+ \begin{array} { l } { \displaystyle \mathcal { L } ( f _ { p } , \mathcal { D } _ { b c } ) - \mathcal { L } ( f _ { p } , \mathcal { D } _ { b } ) < \sqrt { d _ { s } } \cdot \Big ( ( \frac { \sin \theta _ { g } + \sqrt { 2 } } { \gamma _ { \mathrm { m i n } } } - 1 ) \cdot \mathbb { E } _ { ( { \pmb x } , { y } ) \sim \mathcal { D } _ { b } } [ \| \nabla _ { \pmb x } \ell ( f _ { g } ( { \pmb x } ) , { y } ) \| ] } \\ { \displaystyle \qquad + \frac { 1 } { \epsilon } \cdot \mathbb { E } _ { ( { \pmb x } , { y } ) \sim \mathcal { D } _ { b } } [ \ell _ { t r a n s } ( f _ { g } , f _ { p } , { \pmb x } , { y } ) ] + \lambda \cdot \epsilon \Big ) } \end{array}
395
+ $$
396
+
397
+ Proof. According to Lemma 2, we know:
398
+
399
+ $$
400
+ \ell _ { t r a n s } ( f _ { g } , f _ { p } , \pmb { x } , y ) \ge \epsilon \cdot \| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \| \cdot ( 1 - \frac { 1 } { \gamma } \cdot \mathrm { c o s } \theta ) - \lambda \cdot \epsilon ^ { 2 }
401
+ $$
402
+
403
+ where $\begin{array} { r } { \mathrm { c o s } \theta = \frac { \nabla _ { \mathbf { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \nabla _ { \mathbf { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) } { \| \nabla _ { \mathbf { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \| \| \nabla _ { \mathbf { x } } \ell ( f _ { p } ( \pmb { x } ) , y ) \| } } \end{array}$ . Then, we derive an upper bound of $\| \nabla _ { x } \ell ( f _ { g } ( \pmb { x } ) , y ) \|$ · $\mathrm { s i n } \theta$ from $\ell _ { t r a n s } ( f _ { g } , f _ { p } , \pmb { x } , y )$ . It is easy to see that $\theta \in [ 0 , \frac { \pi } { 4 } ]$ . Therefore, we have:
404
+
405
+ $$
406
+ \begin{array} { r l } & { \varepsilon _ { \mathrm { C O } } ( \varepsilon _ { 3 } , t , \varepsilon _ { 1 } , \varepsilon _ { 2 } , \varepsilon _ { 3 } ) } \\ & { = \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 2 } , \varepsilon _ { 3 } ) } \\ & { = \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & { = \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 2 } , \varepsilon _ { 3 } ) } \\ & { - \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & { - \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & { - \varepsilon _ { 1 } ( \varepsilon _ { 4 } , t , \varepsilon _ { 4 } ) } \\ & { = \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 4 } ) } \\ & { - \varepsilon _ { 1 } ( \varepsilon _ { 4 } , t , \varepsilon _ { 4 } ) } \\ & { \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 4 } ) } \\ & { + \varepsilon _ { 1 } ( \varepsilon _ { 4 } , t , \varepsilon _ { 5 } ) } \\ & { \qquad \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 5 } ) } \\ & { \qquad \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 1 } ) } \\ & { \qquad \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 2 } ) } \\ & { \qquad \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & { \qquad \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 4 } ) } \\ & { \qquad \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 2 } ) } \\ & { \qquad \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & { \qquad \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & { \qquad \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & { \qquad \varepsilon _ { 1 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 2 } ) } \\ & { \qquad \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & { \qquad \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & { \qquad \varepsilon _ { 2 } ( \varepsilon _ { 3 } , t , \varepsilon _ { 3 } ) } \\ & \qquad \varepsilon _ { 1 } ( \varepsilon _ 3 \end{array}
407
+ $$
408
+
409
+ Moving $\| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \| \cdot \mathrm { s i n } \theta$ to the left hand side (LHS):
410
+
411
+ $$
412
+ \begin{array} { r l } & { \| \nabla _ { \mathbf x } \ell ( f _ { g } ( { \boldsymbol x } ) , { \boldsymbol y } ) \| \cdot \sin \theta } \\ & { \qquad \le \frac { \gamma } \epsilon \ell _ { t r a n s } ( f _ { g } , f _ { p } , { \boldsymbol x } , { \boldsymbol y } ) + ( \sqrt 2 - \gamma ) \cdot \| \nabla _ { \mathbf x } \ell ( f _ { g } ( { \boldsymbol x } ) , { \boldsymbol y } ) \| + \gamma \cdot \lambda \cdot \epsilon } \end{array}
413
+ $$
414
+
415
+ According to Lemma 1, we know:
416
+
417
+ $$
418
+ \begin{array} { r l } & { \mathcal { L } \big ( f _ { p } , \mathcal { D } _ { b c } \big ) - \mathcal { L } \big ( f _ { p } , \mathcal { D } _ { b } \big ) = \mathbb { E } _ { ( \boldsymbol { x } , \boldsymbol { y } ) \sim \mathcal { D } _ { b } , \Delta \sim \mathcal { D } _ { \Delta | \alpha } } [ \int _ { \alpha = 0 } ^ { 1 } \langle \nabla _ { \boldsymbol { x } _ { s } } \ell \big ( f _ { p } ( \boldsymbol { x } + \boldsymbol { \alpha } \cdot \Delta ) , \boldsymbol { y } \big ) , \mathbf { 1 } \rangle \mathrm { d } \alpha ] } \\ & { \quad \quad \quad \quad < \mathbb { E } _ { ( \boldsymbol { x } , \boldsymbol { y } ) \sim \mathcal { D } _ { b } } [ \frac { \sqrt { d _ { s } } } { \gamma } \cdot \| \nabla _ { \boldsymbol { x } } \ell \big ( f _ { g } ( \boldsymbol { x } ) , \boldsymbol { y } \big ) \| \cdot ( \mathrm { s i n } \theta _ { g } + \mathrm { s i n } \theta ) ] } \end{array}
419
+ $$
420
+
421
+ Combining Eq. (13) and Eq. (12), and taking expectation of $x , y$ over $\mathcal { D } _ { b }$ :
422
+
423
+ $$
424
+ \begin{array} { r l } & { \mathbb { E } _ { \alpha \sim \mathcal { D } _ { b } } [ \frac { \sqrt { d _ { s } } } { \gamma } \cdot \| \nabla _ { x } \ell ( f _ { g } ( x ) , y ) \| \cdot ( \sin \theta _ { g } + \sin \theta ) ] } \\ & { \quad \le \frac { \sqrt { d _ { s } } } { \gamma } \cdot \Big ( \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { b } } [ \| \nabla _ { x } \ell ( f _ { g } ( x ) , y ) \| \cdot \sin \theta _ { g } ] + \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { b } } [ \frac { \gamma } { \epsilon } \cdot \ell _ { t r a n s } ( f _ { g } , f _ { p } , x , y ) ] } \\ & { \quad \quad + \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { b } } [ ( \sqrt { 2 } - \gamma ) \cdot \| \nabla _ { x } \ell ( f _ { g } ( x ) , y ) \| ] + \gamma \cdot \lambda \cdot \epsilon \Big ) } \\ & { \quad \le \sqrt { d _ { s } } \cdot \Big ( ( \frac { \sin \theta _ { g } + \sqrt { 2 } } { \gamma \operatorname* { m i n } } - 1 ) \cdot \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { b } } [ \| \nabla _ { x } \ell ( f _ { g } ( x ) , y ) \| ] } \\ & { \quad \quad + \frac { 1 } { \epsilon } \cdot \mathbb { E } _ { ( \alpha , y ) \sim \mathcal { D } _ { b } } [ \ell _ { t r a n s } ( f _ { g } , f _ { p } , x , y ) ] + \lambda \cdot \epsilon \Big ) } \end{array}
425
+ $$
426
+
427
+ Plugging Eq. (14) back to Eq. (13) completes the proof.
428
+
429
+ # C MORE EXPERIMENTAL SETTING
430
+
431
+ # C.1 DATA PARTITION
432
+
433
+ We distribute the MNIST and Coil20 dataset across 50 clients. Each client has data from 5 different classes. The local dataset on each client is further partitioned to train/validation/test set with a ratio of 72:8:20, following prior work (Li et al., 2021). The test set here is biased. We alternate the spurious features in biased test sets by recoloring the data to create a bias-conflicting test set. For the CelebA dataset, we consider two partitions. In the first partition (CelebA R), each client represents 20 celebrities. One celebrity only appears on one client. The blond male images in the biased test sets are copied to bias-conflicting test sets. We use all clients for training the global model. In the personalization step, we select the clients who have more than 5 blond female training samples and more than 5 blond male test samples. We select these clients because they provide enough samples to create spurious correlations and bias-conflicting test sets. Although the first partition on CelebA is real, the number (161) of blond male images is small. To make the result clearer, we create another synthetic CelebA partition. In the second partition (CelebA S), there are 650 blond male images, which achieve a similar bias-conflicting test set size as prior works Sagawa et al. (2020); Liu et al. (2021). The 650 images are distributed to 3 clients with 2350 other images. The rest of the images are distributed in the same way as the first partition. Tables 3, 4, and 5 provide more details about the 3 clients.
434
+
435
+ Table 3: Number of Train and Validation Samples in CelebA S
436
+
437
+ <table><tr><td>Client ID</td><td>Non-blond Female</td><td>Non-Blond Male</td><td>Blond Female</td><td>Blond Male</td></tr><tr><td>0</td><td>55</td><td>31</td><td>12</td><td>2</td></tr><tr><td>1</td><td>30</td><td>68</td><td>0</td><td>2</td></tr><tr><td>2</td><td>59</td><td>28</td><td>11</td><td>2</td></tr></table>
438
+
439
+ Table 4: Number of Biased Test Samples in CelebA S
440
+
441
+ <table><tr><td>Client ID</td><td>Non-blond Female</td><td>Non-Blond Male</td><td>Blond Female</td><td>Blond Male</td></tr><tr><td>0</td><td>115</td><td>60</td><td>45</td><td>2</td></tr><tr><td>1</td><td>60</td><td>75</td><td>79</td><td>0</td></tr><tr><td>2</td><td>86</td><td>111</td><td>14</td><td>0</td></tr></table>
442
+
443
+ Table 5: Number of Biased-Conflicting Test Samples in CelebA S
444
+
445
+ <table><tr><td>Client ID1</td><td>Non-blond FemaleNon-Blond Male</td><td></td><td>Blond Female </td><td>Blond Male</td></tr><tr><td>0</td><td>0</td><td>0</td><td>0</td><td>200</td></tr><tr><td>1</td><td>0</td><td>0</td><td>0</td><td>203</td></tr><tr><td>2</td><td>0</td><td>0</td><td>0</td><td>204</td></tr></table>
446
+
447
+ # C.2 HYPER-PARAMETERS
448
+
449
+ We use Adam optimizer (Kingma & Ba, 2015) throughout our experiments with learning rate 1e-4. Although stochastic gradient descent (SGD) optimizer is more common in vision-related tasks, we find that the Adam optimizer always leads to lower accuracy disparity. We train the global model for 500 rounds. 5 clients are selected per round, and each performs 5 epochs of local updates. We tune the coefficients of the adversarial transferability and $L _ { 2 }$ regularization terms from $\{ \bar { 0 . 0 1 } , 0 . 1 , 1 . 0 , 1 0 . 0 \}$ and select the largest value that does not decrease the validation accuracy during penalization. We start the attack budget at 0.031 and gradually decrease it such that $3 0 \% - 5 0 \%$ of the attack succeeds. A large budget will make the attack too strong and push the adversarial examples far across the decision boundary, making the regularization method less effective. We configure $\epsilon$ to $0 . 0 3 1 / 0 . 0 1 / 0 . 0 1 5$ for MNIST/CelebA/Coil20, respectively. We fine-tune the global model for 5 epochs on MNIST and
450
+
451
+ 10 epochs on CelebA/Coil20, which are sufficient for the personalized models to converge. The clients with the most data samples fine-tune the penalized models for a total of 80/40/30 batches on MNIST/CelebA/Coil20 datasets. Note that we may not select the personalized model with the most fine-tuning batches for reporting. In the just train twice (JTT) method, we up-sample the residuel by a factor of 50. In Ditto, we tune its $\lambda$ from $\lbrace 0 . 1 , 1 . 0 \rbrace$ .
452
+
453
+ # C.3 NEURAL NETWORK ARCHITECTURE
454
+
455
+ We use CNN $2 8 \mathbf { x } 2 8$ for MNIST dataset and CNN 64x64 for CelebA and Coil20 datasets.
456
+
457
+ Table 6: Neural Network Architecture
458
+
459
+ <table><tr><td>CNN 28x28</td><td>CNN 64x64</td></tr><tr><td>Input: R3.28-28</td><td>Input: R3-64.64</td></tr><tr><td>4·4 conv, 64 BN LReLU, stride 2</td><td>4·4 conv, 64 BN LReLU, stride 2</td></tr><tr><td>4·4 conv, 128 BN LReLU, stride 2</td><td>4·4 conv, 64 BN LReLU, stride 2</td></tr><tr><td>FC4096ReLU</td><td>FC4096ReLU</td></tr><tr><td>FC10</td><td>FC10</td></tr></table>
460
+
461
+ # D MORE EXPERIMENTAL RESULTS
462
+
463
+ # D.1 FIRST-ORDER APPROXIMATION OF ADVERSARIAL TRANSFERABILITY LOSS
464
+
465
+ To explore the impact of the $\lambda$ term in Lemma 2 and Theorem 3, we measure the relative difference between $\ell _ { t r a n s } ( f _ { g } , f _ { p } , \pmb { x } , y )$ and $\begin{array} { r } { \epsilon \cdot \| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \| \cdot ( 1 - \frac { 1 } { \gamma } \cdot \mathrm { c o s } \theta ) } \end{array}$ . In other words, we measured the accuracy of a first-order approximation of $\ell _ { t r a n s } ( f _ { g } , f _ { p } , \pmb { x } , y )$ . If the approximation is accuracy is high, it implies that the impact of $\lambda \cdot \epsilon ^ { 2 }$ is low. Specifically, we compute an approximation error:
466
+
467
+ $$
468
+ \mathbb { E } _ { ( \pmb { x } , \pmb { y } ) \sim \mathcal { D } _ { b } } \Big [ \Big | \frac { \ell _ { t r a n s } ( f _ { g } , f _ { p } , \pmb { x } , \pmb { y } ) - \epsilon \cdot \| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , \pmb { y } ) \| \cdot ( 1 - \frac { 1 } { \gamma } \cdot \mathrm { c o s } \theta ) } { \ell _ { t r a n s } ( f _ { g } , f _ { p } , \pmb { x } , \pmb { y } ) } \Big | \Big ] .
469
+ $$
470
+
471
+ On MNIST, CelebA and Coil20 datasets, we find that the approximation error is 0.019, 0.058, 0.084, respectively. These results suggests that using $\begin{array} { r } { \epsilon \cdot \| \nabla _ { \pmb { x } } \ell ( f _ { g } ( \pmb { x } ) , y ) \| \cdot ( 1 - \frac { 1 } { \gamma } \cdot \mathrm { c o s } \theta ) } \end{array}$ to approximate $\ell _ { t r a n s } ( f _ { g } , f _ { p } , \pmb { x } , y )$ results in a decent accuracy and the impact of $\lambda \cdot \epsilon ^ { 2 }$ is low. The possible reason is that the attack budget $\epsilon$ is usually small (e.g., 0.031), such that the gradient of a function changes little in a small neighborhood defined by $\epsilon$ .
472
+
473
+ # D.2 EFFECTIVENESS OF $L _ { 2 }$ REGULARIZATION TERM
474
+
475
+ Figure 7 shows the distribution of $\gamma$ before and after applying the $L _ { 2 }$ regularization term on the CelebA dataset. Here, the $\gamma$ is computed once per data sample. We keep the global model fixed and fine-tune the personalized model for 1 epoch.
476
+
477
+ ![](images/a426ec5307f3f0d205674c7700f41b5e5c571a21eee3acea8b55f7738fa13c10.jpg)
478
+ Figure 7: With the $L _ { 2 }$ regularization term, the distribution of $\gamma$ is centered around 1, with a small variance. The minimum of $\gamma$ is closer to 1.
479
+
480
+ # D.3 DIVERSITY OF BIAS-CONFLICTING SAMPLES IMPACTS DEBIASING
481
+
482
+ To explore the impact of the diversity of bias-conflicting samples on debiasing, we vary the diversity of bias-conflicting samples and adjust the up-weighting factors accordingly. Specifically, we sample a factor of 0.02, 0.025, 0.033, 0.05, and 0.1 biased data samples from the MNIST dataset and re-color them to become bias-conflicting. The factor in the sampling step is called sampling factor. Then, we up-weight the bias-conflicting samples by a factor of 50, 40, 30, 20, 10, respectively, keeping the total number of bias-conflicting samples consistent. Here, the bias-conflicting samples have less diversity if generated by a small number of biased data samples with a large up-weighting factor. Experimental results in Figure 8 show that, as the diversity reduces, the accuracy disparity of personalized model on the biased dataset and bias-conflicting dataset increases, supporting our analysis. Therefore, our method is applicable in the scarcity of bias-conflicting samples while the up-weighting method fails.
483
+
484
+ ![](images/2c1224b82f19d0ecce4a94c61256458ead2f6ada0ecec8ce9d6a145fd76eb884.jpg)
485
+ Figure 8: The up-weighting method is less effective, resulting in large accuracy disparity of personalized model on biased dataset and bias-conflicting dataset, if the bias-conflicting samples is generated by a small number of biased data samples using a small sampling factor and a large up-weighting factor. The up-weighting factor is set to be the reciprocal of the sampling factor.
parse/dev/SF9o3-yP1WR/SF9o3-yP1WR_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/SF9o3-yP1WR/SF9o3-yP1WR_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/SF9o3-yP1WR/SF9o3-yP1WR_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/aD7uesX1GF_/aD7uesX1GF_.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/aD7uesX1GF_/aD7uesX1GF__middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/iAWNOXfLz0/iAWNOXfLz0.md ADDED
@@ -0,0 +1,380 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # AnoFormer: Time Series Anomaly Detection using Transformer-based GAN with Two-Step Masking
2
+
3
+ Anonymous Author(s)
4
+ Affiliation
5
+ Address
6
+ email
7
+
8
+ # Abstract
9
+
10
+ Time series anomaly detection is a task that determines whether an unseen signal is normal or abnormal, and it is a crucial function in various real-world applications. Typical approach is to learn normal data representation using generative models, like Generative Adversarial Network (GAN), to discriminate between normal and abnormal signals. Recently, a few studies actively adopt transformer to model time series data, but there is no transformer-based GAN framework for time series anomaly detection. As a pioneer work, we propose a new transformerbased GAN framework, called AnoFormer, and its effective training strategy for better representation learning. Specifically, we improve the detection ability of our model by introducing two-step masking strategies. The first step is Random masking: we design a random mask pool to hide parts of the signal randomly. This allows our model to learn the representation of normal data. The second step is Exclusive and Entropy-based Re-masking: we propose a novel refinement step to provide feedback to accurately model the exclusive and uncertain parts in the first step. We empirically demonstrate the effectiveness of re-masking step that our model generates more normal-like signals robustly. Extensive experiments on various datasets show that AnoFormer significantly outperforms the state-of-the-art methods in time series anomaly detection.
11
+
12
+ # 19 1 Introduction
13
+
14
+ 20 Time series anomaly detection is a crucial technology to prevent potential risks and financial losses
15
+ 21 in a variety of areas, such as detecting anomalies on sensor data of large-scale plants [1], ECG
16
+ 22 monitoring [2], and the network traffic analysis [3]. To deal with this task, from the classic methods
17
+ 23 [4, 5, 6] to the recent deep learning-based methods [2, 7, 8, 9, 10, 11, 12, 13], many studies have
18
+ 24 focused on unsupervised learning methods due to the lack of labeled anomalies and highly nonlinear
19
+ 25 temporal dependencies.
20
+ 26 One of major deep learning-based approaches is a reconstruction-based method. It typically uses an
21
+ 27 autoencoder (AE) or Generative Adversarial Network (GAN) to learn the representation of normal
22
+ 28 data and to reconstruct a normal-like signal from an input always. As a backbone network, the
23
+ 29 existing studies widely utilize CNN (Convolutional Neural Networks) [2] or RNN (Recurrent Neural
24
+ 30 Networks) [8, 9, 10]. More recently, there have been attempts to apply transformer [14] to time
25
+ 31 series anomaly detection, and it shows remarkable performances [11]. In this work, we also adopt
26
+ 32 transformer to embed time series representation, but design an adversarial framework for anomaly
27
+ 33 detection.
28
+ 34 If we devise GAN using a transformer encoder, we expect that the model learns normal time series
29
+ 35 data and eventually generates real normal-like signals. However, there is a major issue. Unlike the
30
+ 36 AE structure, a pure transformer encoder-based generator does not have a compressed latent space,
31
+ 37 i.e., it makes the model find the trivial solution, just copying an input and pasting to the output for the
32
+ 38 reconstruction. Therefore, we need a new training method for the generator to learn the distribution
33
+ 39 of normal time series data. To address this issue, we introduce a novel two-step masking strategy.
34
+ 40 From this approach, the next question is where to mask an input signal to detect anomalies effectively.
35
+ 41 Understandably, in order to make the normal-like output, the best masking positions are abnormal
36
+ 42 points in the input signal. It is a challenging to mask the abnormal areas selectively because we do
37
+ 43 not know where the abnormal parts are in advance.
38
+ 44 In this paper, we propose AnoFormer, which is a novel transformer-based GAN utilizing a pure
39
+ 45 transformer encoder only. To learn data representation effectively, we adopt a masking strategy. We
40
+ 46 first train transformer-based GAN with random masking (Step 1) for representation learning of the
41
+ 47 normal time series data. While filling the randomly masked parts of the input at Step 1, the model
42
+ 48 learns the distribution of normal data effectively. In Step 1 alone, all parts of the input signal cannot
43
+ 49 be considered, and this randomness is a big problem in anomaly detection. Therefore, we solve this
44
+ 50 problem by re-masking the exclusive parts of Step 1. Also, to find the best masking positions, we
45
+ 51 calculate entropy from the attention maps of transformer blocks and re-mask the parts with high
46
+ 52 entropy that is likely to be abnormal points with high uncertainty. This exclusive and entropy-based
47
+ 53 re-masking (Step 2) provides feedback for better representation learning, eventually improving the
48
+ 54 anomaly detection performance. We experimentally prove that the proposed two-step masking is
49
+ 55 essential for AnoFormer to solve anomaly detection problem successfully.
50
+
51
+ 56 Our contributions can be summarized as follows:
52
+
53
+ • We propose a simple yet effective transformer-based GAN framework having a generator and a discriminator for unsupervised time series anomaly detection, called AnoFormer. Moreover, we present pre-processing and embedding methods for our framework to deal with time series data effectively.
54
+ • We introduce a new two-step masking method to encode the distribution of normal time series data. A newly proposed entropy-based re-masking helps our model to provide the feedback to the uncertain parts based on entropy. From the extensive ablations, we empirically verify that our two-step masking makes our model robust and successfully embed the representation of normal time series data.
55
+ • AnoFormer achieves new state-of-the-art results with significant improvements on various unsupervised time series anomaly detection datasets: NeurIPS-TS, MIT-BIH, 2D-gesture, and Power-demand.
56
+
57
+ # 69 2 Related Work
58
+
59
+ 70 Generative models using transformer have been proposed and applied to diverse domains, e.g.,
60
+ 71 computer vision [15, 16, 17, 18], natural language processing [19, 20], and sequence modeling
61
+ 72 [21, 22]. In particular, these models are used to solve various tasks in the image domain, such
62
+ 73 as scene generation [15, 16, 23], saliency prediction [18], semantic segmentation [24], and sketch
63
+ 74 synthesis [25]. Moreover, transformer is presented to solve graph-to-sequence transduction task
64
+ 75 using graph neural network [26], text generation task [27], and time series forecasting task with
65
+ 76 the modified self-attention mechanism [28]. We also utilize transformer to construct a generative
66
+ 77 framework, i.e., having both a generator and a discriminator. In this framework, we propose an
67
+ 78 appropriate embedding method and loss form to effectively solve the anomaly detection problems.
68
+ 79 Many studies have used masking to the transformer architecture for effective representation learning.
69
+ 80 Including BERT [29], which proposes the Masked Language Model (MLM) technique to pretrain
70
+ 81 the language representation, many studies also adopt the masking methods, like [30] for action
71
+ 82 recognition, [30] for text classification task, [31] for text log anomaly detection, [32, 33] for visual
72
+ 83 representation learning. In [34], the CNN-based model learns the semantic context features by using
73
+ 84 a multi-scale mask across the whole image with different scales for anomaly detection in image
74
+ 85 domain. We also use masking in our transformer-based GAN for time series anomaly detection, but
75
+ 86 unlike the above studies, we propose the two-step masking strategy for training and test to provide
76
+ 87 feedback that boosts the model to generate the uncertain parts successfully.
77
+
78
+ ![](images/7115bd0fec0ddd2e3db41bbe484d7135d01fb4409712ae48ff3ddde0e1a8c791.jpg)
79
+ Figure 1: Overview of the proposed AnoFormer. For simplicity, this figure shows the univariate case. In Step 1 (random masking), a pre-processed input $\tilde { \boldsymbol { X } }$ is masked with a randomly selected mask from a predefined mask pool. After passing the masked input $\tilde { \pmb X } _ { m } ^ { 1 }$ to the generator, $\hat { X } _ { 1 }$ is generated as the output by passing through embedding, transformer encoder, and inverse embedding layers. In Step 2 (exclusive and entropy-based re-masking), based on the entropy calculated from attention maps of all layers in Step 1, $\tilde { \boldsymbol { X } }$ is re-masked and ${ \hat { \mathbf { X } } } _ { 2 }$ is generated again from the generator. Final output $\hat { \pmb X }$ is constructed via the combination of the masked parts of Step 1 and Step 2. With an aid of a critic, the generator is able to generate more normal-like signals. Here, $\mathcal { L } _ { a d v }$ is the adversarial loss, including $\mathcal { L } _ { a d v } ^ { g }$ and $\mathcal { L } _ { a d v } ^ { c }$ . Note that the critic is used only for the train time.
80
+
81
+ # 88 3 AnoFormer
82
+
83
+ 89 In this section, we propose AnoFormer for unsupervised time series anomaly detection. We first
84
+ 90 define the target task including an algorithm procedure briefly in Section 3.1. We then describe how
85
+ 91 to construct a transformer-based GAN framework based on a transformer encoder in Section 3.2.
86
+ 92 Next, we introduce two different masking steps for our model to encode time series data effectively
87
+ 93 in Section 3.3. Finally, we present the whole training scheme of AnoFormer in Section 3.4. Figure 1
88
+ 94 shows the overall architecture of AnoFormer.
89
+
90
+ # 3.1 Problem Definition
91
+
92
+ Let $\begin{array} { r c l } { { \textbf { { X } } } } & { { = } } & { { \left\{ { \pmb x } _ { 1 } , { \pmb x } _ { 2 } , \cdot \cdot \cdot , { \pmb x } _ { T } \right\} \ \in \ \mathbb { R } ^ { T \times n } } } \end{array}$ be an input signal of $T$ lengths, where $\begin{array} { r l } { \mathbf { \boldsymbol { x } } _ { t } } & { { } = } \end{array}$ $\left\{ \pmb { x } _ { t } ^ { 1 } , \pmb { x } _ { t } ^ { 2 } , \cdot \cdot \cdot , \pmb { x } _ { t } ^ { n } \right\} \in \mathbb { R } ^ { n }$ at time step $t$ is a vector of dimension $n$ . Since it is easier to get normal time series data compared to abnormal ones, we train a generator $\mathbf { G }$ and a discriminator $\mathrm { D }$ using only normal data without any label in an unsupervised manner. After training, for each unseen signal $\boldsymbol { X }$ , which can be normal or abnormal, the generator $G$ generates a normal-like signal $\hat { X }$ . From the generated signal, we can determine whether the observed signal $\boldsymbol { X }$ is normal or not based on the reconstruction errors between the given signal $\boldsymbol { X }$ and the generated signal $\hat { X }$ .
93
+
94
+ # 3.2 Transformer-based GAN for Time Series Data
95
+
96
+ Pre-Processing. To deal with an input signal for a transformer encoder, we need a pre-processing step that makes the input signal discrete tokens. To this end, we normalize each time series input $\boldsymbol { X }$ between $^ { - 1 }$ and 1 by using the min-max scaling. Then, we quantize the normalized real value within a specific range $[ 0 , K )$ , where the integer $K$ is a hyperparameter controlling the quantization resolution, and use the corresponding integer value as a token. Let $\tilde { \pmb X } \in \mathbb { R } ^ { T \times n }$ be the pre-processed signal. We set $K = 4 0 0$ for all the experiments, in which the pre-processed signal $\tilde { X }$ looks almost like the input $\boldsymbol { X }$ . In total of $K$ tokens (quantization levels), we add a [MASK] token to utilize it for both training and test. To sum up, the input signal $\boldsymbol { X }$ is pre-processed to be $\tilde { \boldsymbol { X } }$ by applying scaling and quantization sequentially.
97
+
98
+ 113 Embedding. An embedding step embeds discrete tokens into the embedding vectors. Here we use
99
+ 114 a token embedding layer to map each token to the corresponding entry in an embedding weight
100
+ 115 $W ^ { e } \in \mathbb { R } ^ { ( K + 1 ) \times d }$ . We denote $z ^ { \prime } \in \mathbb { R } ^ { T \times d }$ as the output token embedding, where $d$ is an embedding
101
+
102
+ dimension. We add a sinusoidal positional embedding 116 $\pmb { p } ^ { \prime }$ to the token embedding $z ^ { \prime }$ to allow the 117 model to attend relative positions as follows:
103
+
104
+ $$
105
+ z = z ^ { \prime } + p ^ { \prime } .
106
+ $$
107
+
108
+ 118 Transformer Encoder. A transformer encoder uses the embedding $z \in \mathbb { R } ^ { T \times d }$ as the input, and
109
+ 119 outputs $\hat { \boldsymbol { z } } \in \mathbb { R } ^ { T \times d }$ . Each block of the transformer encoder contains a multi-head self-attention layer
110
+ 120 and a feed-forward network, followed by a residual connection and a layer normalization. Through
111
+ 121 the self-attention mechanism, it is possible to attend the relevant information of each time step at
112
+ 122 once, while multiple attention heads can consider different periodicities in time series data [35].
113
+ 123 Inverse Embedding. We need to invert the output $\hat { z }$ into the original form of time series, $\hat { \boldsymbol { X } } \in \mathbb { R } ^ { T \times n }$ .
114
+ 124 To this end, we introduce an inverse embedding layer to our model. We calculate the cosine similarity
115
+ 125 between the output embedding $\hat { z }$ and the embedding weight $\pmb { W } ^ { e }$ taken from the token embedding
116
+ 126 layer, and apply the softmax operation as follows:
117
+
118
+ $$
119
+ \hat { \pmb { p } } = s o f t m a x \left( \frac { \hat { \boldsymbol { z } } \cdot \mathbf { W } ^ { e ^ { \top } } } { \lVert \hat { \boldsymbol { z } } \rVert \left. \mathbf { W } ^ { e ^ { \top } } \right. } \right) .
120
+ $$
121
+
122
+ 127 From the above equation, we obtain the probability distribution $\hat { \pmb { p } } \in \mathbb { R } ^ { T \times K }$ , where $\hat { p } _ { t , k }$ means the
123
+ 128 probability that $k$ will be selected in the range of $[ 0 , K )$ except the [MASK] token at the position $t$ .
124
+ 129 We then extract an index $\hat { \mathbf { x } } _ { t }$ of the maximum probability for each time step $t \in [ 1 , 2 , \cdots , T ]$ , using
125
+ 130 the soft-argmax operation as follows:
126
+
127
+ $$
128
+ \begin{array} { r } { \hat { \pmb { x } } _ { t } = s o f t - a r g m a x ( \hat { \pmb { p } } _ { t } ) = \sum _ { i = 0 } ^ { K - 1 } \frac { e ^ { \beta \hat { \pmb { p } } _ { t , i } } } { \sum _ { j = 0 } ^ { K - 1 } e ^ { \beta \hat { \pmb { p } } _ { t , j } } } i , } \end{array}
129
+ $$
130
+
131
+ 131 where $\beta$ is a sufficiently large value, such as 1000. Then, the indices in all time steps are concatenated to reconstruct the quantized output 132 $\hat { X }$ as follows:
132
+
133
+ $$
134
+ \hat { \pmb X } = \left\{ \hat { \pmb x } _ { 1 } , \hat { \pmb x } _ { 2 } , \hat { \star } \hat { \star } \hat { \ b } _ { T } \right\} .
135
+ $$
136
+
137
+ 133 Transformer-based GAN Framework. To enhance the generation quality of $\hat { X }$ , we design an
138
+ 134 adversarial framework using transformer encoders. Following the notation of WGAN-GP [36], from
139
+ 135 now on we use the term critic $C$ instead of the discriminator $D$ . Same as the generator $G$ , we
140
+ 136 construct the critic $C$ using the transformer encoder, but in the critic $C$ , a [CLS] token is added in
141
+ 137 front of the input tokens for classification. After passing through the transformer encoder, the linear
142
+ 138 classifier outputs the critic score using only the [CLS] token. While classifying the real input $\tilde { \boldsymbol X }$ and
143
+ 139 the fake output $\hat { X }$ , the critic $C$ guides the generator $G$ to reconstruct more normal-like signal $\hat { X }$ . As
144
+ 140 a result, our model can distinguish $\tilde { \boldsymbol X }$ whether it is normal or abnormal according to the difference
145
+ 141 between the input signal $\tilde { \boldsymbol { X } }$ and the reconstructed signal $\hat { X }$ from the generator $G$ at test time.
146
+
147
+ # 3.3 Two-Step Masking for Time Series Encoding
148
+
149
+ 143 In the previous section, we introduce the transformer-based GAN framework for time series data.
150
+ 144 However, we empirically find that the representation learning of the proposed transformer-based
151
+ 145 GAN is not possible because the generator $G$ just copies the input as the output always. Inspired by
152
+ 146 recent studies [35, 32, 33] that effectively learn the representation through masking in transformer,
153
+ 147 we propose two different masking steps during training and test time: 1) random masking and 2)
154
+ 148 exclusive and entropy-based re-masking. We experimentally demonstrate that the proposed two-step
155
+ 149 masking is essential for our framework to learn the distribution of normal time series data successfully.
156
+ 150 In the following content, we describe how to mask the input effectively in each step with details.
157
+
158
+ Step 1: Random Masking. As the first step, we partially hide the input signal $\tilde { \boldsymbol { X } }$ using a randomly selected mask from a mask pool. To construct the mask pool, we design a single mask in which the mask and the non-mask sections alternately appear. We then generate multiple masks by applying sliding window to the single mask, and group them as the mask pool. The composition of the mask pool depends on a length $l _ { m }$ of a single mask section, a ratio $r _ { m }$ of all mask parts, and a stride $s _ { m }$ for the sliding window. The number of masks $n _ { m }$ in the predefined mask pool is determined as follows:
159
+
160
+ $$
161
+ n _ { m } = 2 \times \left\lceil { \frac { l _ { m } } { s _ { m } } } \right\rceil .
162
+ $$
163
+
164
+ 157 Using the above equation, we generate the enough number of masks in the pool to cover all sections
165
+ 158 of the signal. During the train and test time, the mask is randomly selected in the predefined mask
166
+ 159 pool per each signal, and the generator $G$ reconstructs $\hat { X } _ { 1 }$ from the masked input $\bar { \tilde { \mathbf { X } } } _ { m } ^ { 1 }$ .
167
+ 160 Step 2: Exclusive and Entropy-based Re-Masking. After $\hat { \pmb X } _ { 1 }$ is generated from Step 1, we again
168
+ 161 mask the exclusive parts that are not covered in Step 1 for our model to consider all parts of the
169
+ 162 input. To avoid the error accumulation, here we re-mask the input $\tilde { \boldsymbol X }$ , instead of the first output $\hat { X } _ { 1 }$ .
170
+ 163 In addition, we provide feedback to our model by re-masking the parts that the model considers
171
+ 164 uncertain during Step 1. To this end, we get an attention map from each layer of the generator as
172
+ 165 follows:
173
+
174
+ $$
175
+ \begin{array} { c } { { A ^ { l , h } = s o f t m a x \left( \displaystyle \frac { Q ^ { h } K ^ { h ^ { T } } } { \sqrt { d } } \right) , } } \\ { { A ^ { l } = \displaystyle \frac { 1 } { H } \sum _ { h = 1 } ^ { H } A ^ { l , h } , } } \end{array}
176
+ $$
177
+
178
+ 166 where $l \in [ 1 , 2 , \cdots , L ]$ and $A ^ { l }$ is the attention map in the $l$ -th layer, calculated by the average of all
179
+ 167 attention maps for individual heads, $A ^ { l , h }$ . This layer-wise attention map determines how much a
180
+ 168 specific time step focuses on the other parts of the input per signal. In this context, the uniformly
181
+ 169 distributed attention means that the model does not know which connections are valuable [37], i.e.,
182
+ 170 the prediction is uncertain. To quantify the uncertainty, we calculate an entropy $H _ { \hat { X } _ { 1 } }$ of the masked
183
+ 171 input ${ \hat { X } } _ { 1 }$ as follows:
184
+
185
+ $$
186
+ \begin{array} { r } { H ( t ) = - \displaystyle \frac { 1 } { L } \sum _ { l = 1 } ^ { L } \sum _ { j = 1 } ^ { T } A _ { t , j } ^ { l } \log A _ { t , j } ^ { l } , } \\ { H _ { \hat { \pmb X } _ { 1 } } = \{ H ( 1 ) , H ( 2 ) , \cdots , H ( T ) \} . } \end{array}
187
+ $$
188
+
189
+ 172 To provide feedback on the high entropy parts, we re-mask $50 \%$ of the parts already masked in Step
190
+ 173 1. Then the generator $G$ re-generates the second output ${ \hat { \mathbf { X } } } _ { 2 }$ from the masked signal ${ \tilde { \bf X } } _ { 2 }$ . Finally,
191
+ 174 we combine the masked parts generated from Step 1 and the ones from Step 2 to construct the final
192
+ 175 output $\hat { X }$ . If there are overlapped parts between Step 1 and Step 2, the parts of Step 2 are used. From
193
+ 176 this re-masking step, we experimentally prove that our model becomes robust to unexplored and
194
+ 177 uncertain parts within a fixed model size. We also use the same random masking and re-masking
195
+ 178 strategies at test time.
196
+
197
+ # 3.4 Training AnoFormer
198
+
199
+ To train AnoFormer, we apply the cross-entropy loss to reconstruct the same input 80 $\tilde { \boldsymbol X }$ from the final output 81 $\hat { X }$ as follows:
200
+
201
+ $$
202
+ \mathcal { L } _ { r e c } = - \sum _ { i = 1 } ^ { T } \sum _ { j = 1 } ^ { K } \tilde { X } _ { i , j } \cdot \log \left( \hat { p } _ { i , j } \right) ,
203
+ $$
204
+
205
+ where 182 $\tilde { X } _ { i , j }$ denotes the one-hot label vector from the input and $\hat { p } _ { i , j }$ denotes the probability distribu183 tion of the final output $\hat { X }$ . Using $\hat { X }$ from the generator $G$ during two-step masking, the critic $C$ tries 184 to minimize the following loss function:
206
+
207
+ $$
208
+ \begin{array} { c } { { X ^ { \prime } = \epsilon \tilde { X } + ( 1 - \epsilon ) \hat { X } , } } \\ { { { \mathcal { L } } _ { C , a d v } = \left( \mathbb { E } \left[ C \left( \hat { X } \right) \right] - \mathbb { E } \left[ C \left( \tilde { X } \right) \right] \right) + \lambda \mathbb { E } _ { X ^ { \prime } \sim P _ { X ^ { \prime } } } \left[ \left( \left. \nabla _ { X ^ { \prime } } C \left( X ^ { \prime } \right) \right. _ { 2 } - 1 \right) ^ { 2 } \right] , } } \end{array}
209
+ $$
210
+
211
+ 185 where $\epsilon$ is randomly chosen between zero and one. The first term measures the Wasserstein distance
212
+ 186 and the second term is the gradient penalty, where $X ^ { \prime }$ is a random sample from $P _ { X ^ { \prime } }$ to enforce the
213
+ 187 Lipschitz constraint. The coefficient is a harmonic parameter to balance the Wasserstein distance and
214
+ 188 the gradient penalty, where we use the value of 10. The loss function of the generator $G$ is as follows:
215
+ 189
216
+
217
+ $$
218
+ \mathcal { L } _ { a d v } ^ { g } = - \mathbb { E } \left[ C \left( \hat { \boldsymbol { X } } \right) \right] ,
219
+ $$
220
+
221
+ Table 1: Quantitative comparisons in four datasets. For all of the metrics, a higher value indicates a better performance.
222
+
223
+ <table><tr><td rowspan="2">Metric</td><td rowspan="2">Base Architecture</td><td rowspan="2">Method</td><td colspan="6">NeurIPS-TS</td><td rowspan="2">MIT-BIH</td><td rowspan="2">2D-gesture</td><td rowspan="2">Power-demand</td></tr><tr><td>Global</td><td>Contextual</td><td>Shapelet</td><td>Seasonal</td><td>Trend</td><td>Average</td></tr><tr><td rowspan="6">AUROC</td><td>CNN</td><td>BeatGAN</td><td>0.9753</td><td>0.6128</td><td>0.7398</td><td>0.9742</td><td>1.0000</td><td>0.8372</td><td>0.9475</td><td>0.7256</td><td>0.5796</td></tr><tr><td>RNN</td><td>TadGAN</td><td>1.0000</td><td>0.4285</td><td>0.9834</td><td>0.9744</td><td>0.9327</td><td>0.9726</td><td>0.8256</td><td>0.5294</td><td>0.8438</td></tr><tr><td></td><td>RAE-ensemble</td><td>0.5226</td><td>0.9348</td><td>0.9244</td><td>0.9625</td><td>0.7246</td><td>0.8138</td><td>-</td><td>0.7808</td><td>0.6587</td></tr><tr><td></td><td>RAMED</td><td>0.5265</td><td>0.9325</td><td>0.9084</td><td>0.9628</td><td>0.7259</td><td>0.8112</td><td>-</td><td>0.7839</td><td>0.6787</td></tr><tr><td>Transformer</td><td>Anomaly Transformer</td><td>0.9931</td><td>0.6224</td><td>0.7407</td><td>0.9332</td><td>0.9976</td><td>0.8400</td><td>0.8108</td><td>0.7868</td><td>0.7739</td></tr><tr><td></td><td>AnoFormer (Ours)</td><td>1.0000</td><td>0.9758</td><td>0.9900</td><td>0.9985</td><td>0.9985</td><td>0.9911</td><td>0.9552</td><td>0.8407</td><td>0.8667</td></tr><tr><td rowspan="6">AUPRC</td><td>CNN</td><td>BeatGAN</td><td>0.9855</td><td>0.7051</td><td>0.6817</td><td>0.9748</td><td>1.0000</td><td>0.9634</td><td>0.9143</td><td>0.4952</td><td>0.1228</td></tr><tr><td>RNN</td><td>TadGAN</td><td>1.0000</td><td>0.3603</td><td>0.9565</td><td>0.9754</td><td>0.8731</td><td>0.9806</td><td>0.4621</td><td>0.4367</td><td>0.3098</td></tr><tr><td></td><td>RAE-ensemble</td><td>0.0453</td><td>0.8297</td><td>0.8159</td><td>0.9191</td><td>0.1378</td><td>0.5496</td><td>-</td><td>0.5287</td><td>0.1400</td></tr><tr><td></td><td>RAMED</td><td>0.0443</td><td>0.8223</td><td>0.6873</td><td>0.9109</td><td>0.1291</td><td>0.5188</td><td>-</td><td>0.5331</td><td>0.1627</td></tr><tr><td>Transformer</td><td>Anomaly Transformer</td><td>0.9959</td><td>0.6957</td><td>0.6630</td><td>0.9364</td><td>0.9978</td><td>0.9639</td><td>0.5603</td><td>0.5607</td><td>0.4967</td></tr><tr><td></td><td>AnoFormer (Ours)</td><td>1.0000</td><td>0.9854</td><td>0.9901</td><td>0.9985</td><td>0.9987</td><td>0.9982</td><td>0.9187</td><td>0.6142</td><td>0.5584</td></tr><tr><td rowspan="6">F1 score</td><td>CNN</td><td>BeatGAN</td><td>0.9345</td><td>0.7348</td><td>0.6136</td><td>0.9487</td><td>1.0000</td><td>0.9008</td><td>0.8015</td><td>0.4941</td><td>0.2266</td></tr><tr><td>RNN</td><td>TadGAN</td><td>1.0000</td><td>0.3590</td><td>0.9331</td><td>0.9844</td><td>0.8170</td><td>0.9380</td><td>0.5289</td><td>0.4138</td><td>0.5714</td></tr><tr><td></td><td>RAE-ensemble</td><td>0.0853</td><td>0.8343</td><td>0.7750</td><td>0.9181</td><td>0.3889</td><td>0.6003</td><td>-</td><td>0.5511</td><td>0.2678</td></tr><tr><td></td><td>RAMED</td><td>0.0838</td><td>0.8272</td><td>0.6203</td><td>0.8782</td><td>0.4040</td><td>0.5627</td><td>-</td><td>0.5633</td><td>0.2934</td></tr><tr><td>Transformer</td><td>Anomaly Transformer</td><td>0.9751</td><td>0.7358</td><td>0.6115</td><td>0.8730</td><td>0.9958</td><td>0.9014</td><td>0.5446</td><td>0.6486</td><td>0.6053</td></tr><tr><td></td><td>AnoFormer (Ours)</td><td>1.0000</td><td>0.9400</td><td>0.9696</td><td>0.9913</td><td>0.9974</td><td>0.9798</td><td>0.8410</td><td>0.6667</td><td>0.6226</td></tr></table>
224
+
225
+ which makes the critic 190 $C$ not be able to classify the generated $\hat { X }$ . To sum up, the proposed AnoFormer 191 is trained via the following loss functions for the generator $G$ and the critic $C$ :
226
+
227
+ $$
228
+ \begin{array} { c } { { \mathcal { L } _ { G } = \lambda _ { r e c } \mathcal { L } _ { r e c } + \lambda _ { a d v } \mathcal { L } _ { a d v } ^ { g } , } } \\ { { \mathcal { L } _ { C } = \mathcal { L } _ { a d v } ^ { c } , } } \end{array}
229
+ $$
230
+
231
+ 192 where we set $\lambda _ { r e c }$ and $\lambda _ { a d v }$ as 1.
232
+
233
+ # 4 Experiments
234
+
235
+ Datasets. We evaluated AnoFormer on four real-world benchmarks: 1) MIT-BIH 1 contains 48 ECG records of test subjects from Beth Israel Hospital, 2) 2D-gesture contains time series of X and Y coordinates of an actor’s right hand, 3) Power-demand is a dataset measuring the power comsumption for the Dutch research facility, and 4) NeurIPS-TS 2 [38] is a synthetic dataset including five different time series anomaly scenarios as point-global, point-contextual, pattern-shapelet, pattern-seasonal, and pattern-trend. More details on each dataset are summarized in Appendix A.
236
+
237
+ Baselines. We compared our model with various baselines, including CNN, RNN, and transformerbased reconstruction models. BeatGAN [2] and TadGAN [8] are CNN and LSTM-based GAN models, respectively. RAE-ensemble [9] is an ensemble of RNNs with sparse skip connections in autoencoder. RAMED [10] additionally uses the multiresolution decoding based on RAE-ensemble. Anomaly Transformer [11] develops the transformer architecture to utilize association information.
238
+
239
+ Implementation Details. For both the generator $G$ and the critic $C$ , we utilized the basic transformer encoders with 9 and 6 layers for MIT-BIH, and 4 and 2 layers for other datasets, respectively. The embedding dimension and the number of heads are 128 and 8, respectively. The mask length $l _ { m }$ is about $10 \%$ of the sequence length $T$ , and the mask stride $s _ { m }$ is about half of the mask length $l _ { m }$ We used Adam optimizer with initial learning rate, momentum $\beta _ { 1 }$ , and $\beta _ { 2 }$ as 0.0001, 0.5, and 0.999, respectively. We implemented our model using PyTorch and trained on a NVIDIA RTX 3090 GPU.
240
+
241
+ # 4.1 Quantitative Results
242
+
243
+ Table 1 shows the anomaly detection performances of each baseline on three different real-world datasets (i.e., MIT-BIH, 2D-gesture, and Power-demand), and a synthetic dataset (i.e., NeurIPS-TS [38]). Overall, RNN or transformer-based models showed high performances except MIT-BIH. In MIT-BIH, BeatGAN showed the second-best performances among all the benchmarks. In case of the proposed AnoFormer, this model outperformed all the baselines in four different datasets. In
244
+
245
+ ![](images/47b408cd47c8108b2ae4f17f6296ca554263ab559cf561bb93d4146ced1092e0.jpg)
246
+ Figure 2: Output visualization in Point-Contextual (NeurIPS-TS) and MIT-BIH datasets. Left: visualization of abnormal input and the normal-like output. Middle: reconstruction results of random masking (blue). Right: reconstruction results of exclusive (green) and entropy-based (red) re-masking. Vest viewed in color.
247
+
248
+ 217 particular, our model performed well on NeurIPS-TS containing five types of outliers, and it means
249
+ 218 AnoFormer is robust to the various types of outliers. AnoFormer achieved the state-of-the-art results
250
+ 219 from small datasets (e.g., 2D-gesture and Power-demand) with about 1,000 training sets to large
251
+ 220 datasets (e.g., NeurIPS-TS and MIT-BIH) with about tens of thousands of training sets, and from
252
+ 221 univariate to multivariate cases. The experimental results demonstrate that the proposed transformer
253
+ 222 based GAN framework with the two-step masking strategy is effective to reconstruct normal time
254
+ 223 series data for anomaly detection.
255
+
256
+ # 4.2 Qualitative Results
257
+
258
+ Figure 2 shows the qualitative examples of AnoFormer. First column (Figure 2(a) and Figure 2(d)) shows the abnormal examples of point-contextual of NeurIPS-TS and MIT-BIH datasets, respectively. The other columns show that the proposed rnadom masking and re-masking strategies actually provide feedback to our framework. For example, the incorrectly copied parts in Step 1 was refined by the entropy-based re-masking (please see the black circles in the figure). As shown in the figure, when the abnormal inputs were received, the model generated the normal-like outputs. Therefore, AnoFormer can detect the abnormal points through the difference between the input and the output.
259
+
260
+ # 4.3 Ablation Study
261
+
262
+ We conducted various ablation studies to analyze the effectiveness of the proposed transformerbased GAN framework and two-step masking. All of the ablation studies were performed on the Point-Contextual dataset of NeurIPS-TS, since it is the most difficult task to detect the anomalies out of the five types of outliers. Figure 2 shows an example of Point-Contextual dataset, which has the small glitches as the outliers. In Appendix B, we additionally examined the sensitivity of each hyperparameter newly adopted in our model.
263
+
264
+ # 4.3.1 Transformer-based GAN Framework
265
+
266
+ We first investigated the effectiveness of the transformer-based adversarial framework in our model. In this experiment, we used BeatGAN as a CNN-based baseline. Table 2 shows the ablation results when the generator and the critic use different backbone networks, such as CNN, and transformer. As shown in the table, the transformer-based generator showed higher performances on all of metrics with large margins than the CNN-based generator. Interestingly, we empirically found that there was no synergy when using CNN-based critic with the transformer-based generator. It means, it is not helpful for the transformer-based generator to construct the critic with an inappropriate baseline. On
267
+
268
+ Table 2: Ablation study of the proposed transformer-based GAN.
269
+
270
+ <table><tr><td>Generator</td><td>Critic</td><td>AUROC</td><td>AUPRC</td><td>F1 score</td></tr><tr><td>CNN</td><td>CNN</td><td>0.6128</td><td>0.7051</td><td>0.7348</td></tr><tr><td>Transformer</td><td>-</td><td>0.9572</td><td>0.9735</td><td>0.9093</td></tr><tr><td>Transformer</td><td>CNN</td><td>0.9510</td><td>0.9675</td><td>0.9026</td></tr><tr><td>Transformer</td><td>Transformer</td><td>0.9758</td><td>0.9854</td><td>0.9400</td></tr></table>
271
+
272
+ Table 3: Ablation study of the proposed two-step masking.
273
+
274
+ <table><tr><td>Step1</td><td>Step 2</td><td>AUROC</td><td>AUPRC</td><td>F1 score</td></tr><tr><td>-</td><td>-</td><td>0.5000</td><td>0.3602</td><td>0.2386</td></tr><tr><td>Random</td><td>■</td><td>0.8557</td><td>0.7959</td><td>0.7548</td></tr><tr><td>Mask pool</td><td>■</td><td>0.9109</td><td>0.8651</td><td>0.8200</td></tr><tr><td>Mask pool</td><td>Mask pool (50%)</td><td>0.9277</td><td>0.8590</td><td>0.7808</td></tr><tr><td>Mask pool</td><td>Exclusive (50%)</td><td>0.9489</td><td>0.9622</td><td>0.9057</td></tr><tr><td>Mask pool</td><td>Exclusive +Random (75%)</td><td>0.9709</td><td>0.9466</td><td>0.9004</td></tr><tr><td>Mask pool</td><td>Exclusive + Anomaly score (75%)</td><td>0.9747</td><td>0.9533</td><td>0.9119</td></tr><tr><td>Mask pool</td><td>Exclusive+ Entropy (75%)</td><td>0.9758</td><td>0.9854</td><td>0.9400</td></tr></table>
275
+
276
+ 247 the other hand, the transformer-based critic showed better performances than the baseline without
277
+ 248 the critic, which means it encourages the generated output to be close to the normal signal. From
278
+ 249 this result, we demonstrate that our transformer-based GAN framework trained with the proposed
279
+ 250 masking strategy is effective to reconstruct normal time series data for anomaly detection.
280
+
281
+ # 4.3.2 Two-Step Masking
282
+
283
+ As shown in Table 3, we investigated the effect of two-step masking in our model. The first row means a naive form of the transformer-based GAN without any masking. The result was 0.5 of AUROC, which means the naive transformer-based GAN cannot distinguish between normal and abnormal signals at all. To overcome this critical issue, we adopted various masking strategies. First, we investigated the masking for Step 1. Here, Random means a fully random masking without any predefined mask pool. Mask Pool means our predefined mask pool defined in Section 3.3. The results showed that regardless of the masking strategy, masking itself during training and test enabled the transformer-based GAN to effectively learn the distribution of normal time series data. Moreover, we confirmed that Mask Pool is much better than Random masking, because each mask in the mask pool definitely covers the different parts from each other, providing a complementary effect.
284
+
285
+ 262 Next, we conducted in-depth experiments to evaluate and compare different re-masking strategies in
286
+ 263 Step 2. Mask pool method in Step 1 can be also used for re-masking. Exclusive method re-masks the
287
+ 264 exclusive parts of the random mask selected in Step 1. From the results, we found that re-masking
288
+ 265 improved the detection ability of our model, and especially, exclusive masking strategy was really
289
+ 266 effective. This is because the model can consider the characteristic of whole signal during two-step
290
+ 267 masking. To provide more feedback to our model, we additionally re-masked the masked parts in
291
+ 268 Step 1. We experimented the following three cases: 1) Random method re-masks the signal randomly,
292
+ 269 2) Anomaly score method re-masks the parts with high anomaly scores, and 3) Entropy method
293
+ 270 re-masks the parts with high entropy values. The results showed that masking the uncertain parts
294
+ 271 provided the proper feedback to our model, resulting in the highest scores among all the baselines.
295
+ 272 Therefore, we confirmed that the entropy-based re-masking is more effective than the other additional
296
+ 273 masking methods.
297
+
298
+ # 5 Discussion
299
+
300
+ 275 We further conducted analysis to demonstrate the effectiveness of the proposed two-step masking
301
+ 276 strategy. To confirm the importance of Step 2, we compared our method with the absence of Step 2.
302
+ 277 Here, we also used Point-Contextual dataset in NeurIPS-TS for analysis.
303
+ 278 The Effectiveness of Re-Masking. First, we investigated the validity of re-masking step. We reported
304
+ 279 the average AUROC and std for all masks in the predefined mask pool in Figure 3. In Step 1, there
305
+ 280 was a problem that the standard deviation (std) was too high because both training and test time
306
+ 281 had randomness in selecting the mask parts. By re-masking through Step 2, the randomness of the
307
+ 282 masked parts was eliminated and the std was significantly reduced. The performance of anomaly
308
+ 283 detection also increased with a large margin by referring to the entire signal.
309
+ 284 Analysis on Entropy-based Re-Masking. To understand the effectiveness of entropy-based re
310
+ 285 masking intuitively, we visualized the relation between entropy and anomaly score in Figure 3(b) and
311
+ 286 Figure 3(c) for both cases of normal and abnormal. Since the entropy-based method re-masked the
312
+ 287 parts selected in Step 1, we measured the anomaly score only in the parts corresponding to Step 1. We
313
+ 288 found two meaningful insights through the analysis. First, the higher the entropy, the more incorrect
314
+ 289 signal the model generates. In training phase, the high anomaly score means that the model generates
315
+ 290 output incorrectly, because only normal data is used. From the result of Figure 3(b), the entropy was
316
+ 291 also high in the parts with high anomaly score, which means that the model did not generate signals
317
+ 292 well in the parts with high entropy during Step 1. This is because in the high entropy the attention is
318
+ 293 uniformly distributed and the meaningful connection is not learned. By re-masking these parts in Step
319
+ 294 2, anomaly score was significantly reduces, which means that the model reconstructed the normal
320
+ 295 data well in the training process. Second, the entropy-based masking improves the discriminative
321
+ 296 ability between normal and abnormal in test time. As shown in Figure 3(c), likewise in the case of
322
+ 297 normal, the higher the entropy, the higher the anomaly score in abnormal case. However, there was
323
+ 298 also a part with a high entropy and a low anomaly score. These parts mean that the model copied
324
+ 299 the abnormal input as it was without making it normal. It is possible to provide feedback in both
325
+ 300 cases with entropy-based re-masking. By re-masking the parts with high entropy, anomaly score was
326
+ 301 considerably increased, and it means the parts that were not well generated due to copying in Step 1
327
+ 302 were well re-generated. This makes it possible to further discriminate between normal and abnormal
328
+ 303 through anomaly score. In fact, a large anomaly score does not mean getting close to normal data. We
329
+ 304 used a NeurIPS-TS dataset to see if the output gets closer to normal data through re-masking. Since
330
+ 305 we synthesized abnormal datasets by injecting sporadic outliers in an additive manner, we could
331
+ 306 easily get the original normal version of the abnormal data. From this, we confirmed that the output
332
+ 307 was correctly getting closer to the original normal through Step 2. We further experimented about
333
+ 308 which layer’s entropy information should be used? From the results in Appendix C, we calculated
334
+ 309 entropy from all layers and averaged them.
335
+
336
+ ![](images/ed4625d277a62b4ec5b0601fff9fc4d34c1c943f2d384494de37abcbde8e24f6.jpg)
337
+ Figure 3: (a) AUROC and std of all masks in the predefined mask pool. (b) Analysis on the entropy-based re-masking strategy (normal-case). (c) Analysis on the entropy-based re-masking strategy (abnormal-case).
338
+
339
+ # 0 6 Conclusion
340
+
341
+ 311 In this paper, we introduce AnoFormer, a novel transformer-based GAN for time series anomaly
342
+ 312 detection. To learn time series data directly with our model, we propose pre-processing and embedding
343
+ 313 methods suitable for time series data. A new training scheme based on two-step masking enables
344
+ 314 AnoFormer to embed the representation of normal signals. Especially, the exclusive and entropy
345
+ 315 based re-masking method significantly improves the anomaly detection performances on several
346
+ 316 benchmark datasets. From the extensive experiments, we empirically demonstrate that our model
347
+ 317 is really effective to solve time series anomaly detection. As future work, we plan to study novel
348
+ 318 techniques for shorter inference time, and deal with time series data longer than an hour or a day.
349
+
350
+ 319 References [1] Ailin Deng and Bryan Hooi. Graph neural network-based anomaly detection in multivariate time series. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 4027–4035, 2021. [2] Bin Zhou, Shenghua Liu, Bryan Hooi, Xueqi Cheng, and Jing Ye. Beatgan: Anomalous rhythm detection using adversarially generated time series. In IJCAI, pages 4433–4439, 2019. [3] Zekai Chen, Dingshuo Chen, Xiao Zhang, Zixuan Yuan, and Xiuzhen Cheng. Learning graph structures with transformer for multivariate time series anomaly detection in iot. IEEE Internet of Things Journal, 2021. [4] Markus M Breunig, Hans-Peter Kriegel, Raymond T $\mathrm { N g }$ , and Jörg Sander. Lof: identifying density-based local outliers. In Proceedings of the 2000 ACM SIGMOD international conference on Management of data, pages 93–104, 2000. [5] Bernhard Schölkopf, John C Platt, John Shawe-Taylor, Alex J Smola, and Robert C Williamson. Estimating the support of a high-dimensional distribution. Neural computation, 13(7):1443– 1471, 2001. [6] David MJ Tax and Robert PW Duin. Support vector data description. Machine learning, 54(1):45–66, 2004. [7] Lifeng Shen, Zhuocong Li, and James Kwok. Timeseries anomaly detection using temporal hierarchical one-class network. Advances in Neural Information Processing Systems, 33:13016– 13026, 2020. [8] Alexander Geiger, Dongyu Liu, Sarah Alnegheimish, Alfredo Cuesta-Infante, and Kalyan Veeramachaneni. Tadgan: Time series anomaly detection using generative adversarial networks. In 2020 IEEE International Conference on Big Data (Big Data), pages 33–43. IEEE, 2020. [9] Tung Kieu, Bin Yang, Chenjuan Guo, and Christian S Jensen. Outlier detection for time series with recurrent autoencoder ensembles. In IJCAI, pages 2725–2732, 2019.
351
+ 344 [10] Lifeng Shen, Zhongzhong Yu, Qianli Ma, and James T Kwok. Time series anomaly detection with multiresolution ensemble decoding. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 35, pages 9567–9575, 2021.
352
+ 347 [11] Jiehui Xu, Haixu Wu, Jianmin Wang, and Mingsheng Long. Anomaly transformer: Time series anomaly detection with association discrepancy. In International Conference on Learning Representations, 2022. [12] Chuxu Zhang, Dongjin Song, Yuncong Chen, Xinyang Feng, Cristian Lumezanu, Wei Cheng, Jingchao Ni, Bo Zong, Haifeng Chen, and Nitesh V Chawla. A deep neural network for unsupervised anomaly detection and diagnosis in multivariate time series data. In Proceedings of the AAAI conference on artificial intelligence, volume 33, pages 1409–1416, 2019. [13] Julien Audibert, Pietro Michiardi, Frédéric Guyard, Sébastien Marti, and Maria A Zuluaga. Usad: unsupervised anomaly detection on multivariate time series. In Proceedings of the 26th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining, pages 3395–3404, 2020.
353
+ 358 [14] Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. Advances in neural information processing systems, 30, 2017.
354
+ 361 [15] Aljaz Bozic, Pablo Palafox, Justus Thies, Angela Dai, and Matthias Nießner. Transformerfusion: Monocular rgb scene reconstruction using transformers. Advances in Neural Information Processing Systems, 34, 2021. [16] Dor Arad Hudson and Larry Zitnick. Compositional transformers for scene generation. Advances in Neural Information Processing Systems, 34, 2021.
355
+ 366 [17] Yifan Jiang, Shiyu Chang, and Zhangyang Wang. Transgan: Two pure transformers can make one strong gan, and that can scale up. Advances in Neural Information Processing Systems, 34, 2021.
356
+ 369 [18] Jing Zhang, Jianwen Xie, Nick Barnes, and Ping Li. Learning generative vision transformer with energy-based latent space for saliency prediction. Advances in Neural Information Processing Systems, 34, 2021.
357
+ 372 [19] Yufei Wang, Can Xu, Huang Hu, Chongyang Tao, Stephen Wan, Mark Dras, Mark Johnson, and Daxin Jiang. Neural rule-execution tracking machine for transformer-based text generation. Advances in Neural Information Processing Systems, 34, 2021.
358
+ 375 [20] 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, pages 10578–10587, 2020. [21] Lili Chen, Kevin Lu, Aravind Rajeswaran, Kimin Lee, Aditya Grover, Misha Laskin, Pieter Abbeel, Aravind Srinivas, and Igor Mordatch. Decision transformer: Reinforcement learning via sequence modeling. Advances in neural information processing systems, 34, 2021. [22] Jiehui Xu, Jianmin Wang, Mingsheng Long, et al. Autoformer: Decomposition transformers with auto-correlation for long-term series forecasting. Advances in Neural Information Processing Systems, 34, 2021. [23] Dor Arad Hudson and Larry Zitnick. Compositional transformers for scene generation. Advances in Neural Information Processing Systems, 34, 2021. [24] Enze Xie, Wenhai Wang, Zhiding Yu, Anima Anandkumar, Jose M Alvarez, and Ping Luo. Segformer: Simple and efficient design for semantic segmentation with transformers. Advances in Neural Information Processing Systems, 34, 2021. [25] Mingrui Zhu, Changcheng Liang, Nannan Wang, Xiaoyu Wang, Zhifeng Li, and Xinbo Gao. A sketch-transformer network for face photo-sketch synthesis. In International Joint Conference on Artificial Intelligence, 2021. [26] Deng Cai and Wai Lam. Graph transformer for graph-to-sequence learning. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 7464–7471, 2020. [27] Zhidong Liu, Junhui Li, and Muhua Zhu. Improving text generation with dynamic masking and recovering. In IJCAI, 2021. [28] Haoyi Zhou, Shanghang Zhang, Jieqi Peng, Shuai Zhang, Jianxin Li, Hui Xiong, and Wancai Zhang. Informer: Beyond efficient transformer for long sequence time-series forecasting. In Proceedings of AAAI, 2021. [29] Jacob Devlin, Ming-Wei Chang, Kenton Lee, and Kristina Toutanova. BERT: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers), pages 4171–4186, Minneapolis, Minnesota, June 2019. Association for Computational Linguistics.
359
+ 404 [30] Yi-Bin Cheng, Xipeng Chen, Dongyu Zhang, and Liang Lin. Motion-transformer: selfsupervised pre-training for skeleton-based action recognition. In Proceedings of the 2nd ACM International Conference on Multimedia in Asia, pages 1–6, 2021. [31] Haixuan Guo, Shuhan Yuan, and Xintao Wu. Logbert: Log anomaly detection via bert. In 2021 International Joint Conference on Neural Networks (IJCNN), pages 1–8, 2021.
360
+ 409 [32] Zhaowen Li, Zhiyang Chen, Fan Yang, Wei Li, Yousong Zhu, Chaoyang Zhao, Rui Deng, Liwei Wu, Rui Zhao, Ming Tang, et al. Mst: Masked self-supervised transformer for visual representation. Advances in Neural Information Processing Systems, 34, 2021.
361
+ 412 [33] Hangbo Bao, Li Dong, Songhao Piao, and Furu Wei. BEit: BERT pre-training of image transformers. In International Conference on Learning Representations, 2022.
362
+
363
+ 414 [34] Xudong Yan, Huaidong Zhang, Xuemiao Xu, Xiaowei Hu, and Pheng-Ann Heng. Learning
364
+ 415 semantic context from normal samples for unsupervised anomaly detection. In Proceedings of
365
+ 416 the AAAI Conference on Artificial Intelligence, volume 35, pages 3110–3118, 2021.
366
+ 417 [35] George Zerveas, Srideepika Jayaraman, Dhaval Patel, Anuradha Bhamidipaty, and Carsten
367
+ 418 Eickhoff. A transformer-based framework for multivariate time series representation learning.
368
+ 419 In Proceedings of the 27th ACM SIGKDD Conference on Knowledge Discovery & Data Mining,
369
+ 420 pages 2114–2124, 2021.
370
+ 421 [36] Ishaan Gulrajani, Faruk Ahmed, Martin Arjovsky, Vincent Dumoulin, and Aaron C Courville.
371
+ 422 Improved training of wasserstein gans. In I. Guyon, U. V. Luxburg, S. Bengio, H. Wallach,
372
+ 423 R. Fergus, S. Vishwanathan, and R. Garnett, editors, Advances in Neural Information Processing
373
+ 424 Systems, volume 30. Curran Associates, Inc., 2017.
374
+ 425 [37] Edward Choi, Zhen Xu, Yujia Li, Michael Dusenberry, Gerardo Flores, Emily Xue, and Andrew
375
+ 426 Dai. Learning the graphical structure of electronic health records with graph convolutional
376
+ 427 transformer. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages
377
+ 428 606–613, 2020.
378
+ 429 [38] Kwei-Herng Lai, Daochen Zha, Junjie Xu, Yue Zhao, Guanchu Wang, and Xia Hu. Revisiting
379
+ 430 time series outlier detection: Definitions and benchmarks. In Thirty-fifth Conference on Neural
380
+ 431 Information Processing Systems Datasets and Benchmarks Track (Round 1), 2021.
parse/dev/iAWNOXfLz0/iAWNOXfLz0_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/kxXvopt9pWK/kxXvopt9pWK_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/o4uFFg9_TpV/o4uFFg9_TpV.md ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Visual Prompting via Image Inpainting
2
+
3
+ Amir Bar∗ 1,2, Yossi Gandelsman∗ 1, Trevor Darrell1, Amir Globerson2,3, Alexei A. Efros1
4
+
5
+ 1UC Berkeley
6
+
7
+ 2Tel Aviv University
8
+
9
+ 3Google Research
10
+
11
+ # Abstract
12
+
13
+ How does one adapt a pre-trained visual model to novel downstream tasks without task-specific finetuning or any model modification? Inspired by prompting in NLP, this paper investigates visual prompting: given input-output image example(s) of a new task at test time and a new input image, the goal is to automatically produce the output image, consistent with the given examples. We show that posing this problem as simple image inpainting – literally just filling in a hole in a concatenated visual prompt image – turns out to be surprisingly effective, provided that the inpainting algorithm has been trained on the right data. We train masked auto-encoders on a new dataset that we curated $- 8 8 \mathrm { k }$ unlabeled figures from academic papers sources on Arxiv. We apply visual prompting to these pretrained models and demonstrate results on various downstream image-to-image tasks, including foreground segmentation, single object detection, colorization, edge detection, etc.1
14
+
15
+ # 1 Introduction
16
+
17
+ In the past few years, self-supervised learning has gained popularity in computer vision and natural language processing (NLP). The growing capacity of modern deep learning models made them prone to overfitting when trained on relatively small labeled datasets. Self-supervised learning provides a solution to this problem by generating “free labels” for any dataset, without the need for manual annotation, addressing the data hunger in these high-capacity deep learning models. However, features learned via self-supervision are not “ready for use” – they typically need to be adapted for a given downstream task by fine-tuning on some labeled dataset. Could this fine-tuning be avoided?
18
+
19
+ In NLP, prompting [5] has recently emerged as a way to employ a model for a new task without any additional training. A common way of task-prompting for a specific language understanding task at test time is to provide the trained model with an input corresponding to example(s) of the target task together with the query. E.g., typing the following input prompt:
20
+
21
+ Je suis désolé J’adore la glace
22
+
23
+ I’m sorry
24
+
25
+ will prompt the model [5] to perform the task of French-to-English translation, returning: I love ice cream
26
+
27
+ Can this idea of test-time task prompting be generalized to the visual domain? That is, instead of the current situation in computer vision, where each trained model serves its predefined task (e.g. segmentation, detection, classification), can we have a single general model that can perform a wide range of user-specified tasks without any fine-tuning (i.e., weight modification)?
28
+
29
+ In this paper we take a step toward this goal by demonstrating that large-capacity image inpainting models, when trained on the right data, can be surprisingly effective tools for visual prompting.
30
+
31
+ ![](images/fec7d4f1c4f22fc04019a2d3145f43606b948aaba229095b8b23ad7299c7715b.jpg)
32
+ Figure 1: Visual prompting via Image Inpainting. Top: Prompting Image Inpainting Models. Given inputoutput example(s) $( x _ { 1 } , y _ { 1 } )$ and image query $x _ { q }$ , we construct a grid-like single image called a visual prompt $x _ { v p }$ . The visual prompt is composed of the desired task example(s) and a new query image (all in green). The inpainting model goal is then to predict the masked region (red) such that it is consistent with the example(s). Bottom: an inpainting model can solve this way various computer vision tasks, given that it was trained on the right data. The model predictions are annotated in red.
33
+
34
+ As shown in Figure 1, we define each task by constructing a new grid-like image that contains an input-output example(s) of the task and a novel query (green border). The input-output example describes the task, and the image query defines a new input. The model then produces the result by simply inpainting the rest of the image (red border). This setting is most similar to the classic Image Analogies [22] formulation, but is less constrained: instead of explicitly defining the A, A’, and B images separately, we simply concatenate them into a single image with a hole (hence, visual prompting is not exactly an analogy since there is no implied left-to-right ordering). Our goal is also not dissimilar from the aims of meta-learning and few-shot learning methods, except that we make no distinction between tasks and example pairs. The only requirement of our formulation is that the tasks must be defined as image-to-image translations, which is a very large subset of vision problems.
35
+
36
+ To obtain training data that is most useful for our framework, we utilize a domain that spans across a variety of computer vision tasks - figures and infographics from computer vision articles available on Arxiv. We build a large dataset of 88 thousand figures, many of which contain grids of images and their corresponding task results (e.g. images and their segmentation masks/stylized versions/edges, etc.). We then train large-capacity inpainting models to predict randomly masked patches from figures given other patches from the same figure.
37
+
38
+ Our main contributions are as follows. First, we present a simple yet surprisingly powerful general approach for visual prompting. We show that various computer vision tasks can be treated as grid inpainting problems, given a few examples of task inputs and outputs and a query image. Second, we provide a new dataset that allows a model to learn such grid structures without any labeling, task descriptions, or any additional information about the grid structure. Finally, we show that while using our new dataset for training is essential, adding more generic image data from other sources (e.g. ImageNet) further improves the results.
39
+
40
+ # 2 Related Work
41
+
42
+ Natural Image Inpainting. Filling empty regions in an image has been widely explored for natural images. Earlier methods used data from the input image itself for inpainting [14, 4, 11, 3, 49], whereas later works utilized datasets of images as source data [19, 38, 56, 30, 31]. Recent methods have attempted to apply transformers to visual synthesis tasks [8, 58, 15, 57, 7]. Due to the exponentially large number of completion options for a single output patch, these approaches rely on a discrete latent codebook [51, 40, 15] which serves as a smaller yet expressive vocabulary. To tackle the multimodal nature of synthesis, different approaches have been proposed to model the distribution over possible completions [15, 57, 7]. For example, [15, 57] proposed to synthesize images line-by-line using an autoregressive model and [7] have proposed iterative parallel decoding. While the standard inpainting task typically aims to complete blank parts in natural images, our focus is on completing grid-like visual prompts, which require reasoning across multiple images within the visual prompt image.
43
+
44
+ Hole-filling as a Pretext task. Recent work has shown that self-supervised pretraining can generate powerful representations for transfer learning, even outperforming its supervised counterparts on challenging vision benchmarks [37, 18, 9, 21, 6, 10, 35, 16]. Pathak et al. [38] first proposed using hole-filling as a pretext task for self-supervision with Context Encoders, where the goal is to predict an random image region given its context. Based on the recent success of Vision Transformers (ViTs) [13], multiple works have proposed to hole-filling a self-supervised pretext task for ViTs [1, 20, 54]. For example, in MAE [20], the goals is to reconstruct the image given a small subset of input patches. After pretraining on unlabeled data, MAE can produce representations that transfer well when fine-tuned on downstream tasks. Here, we use visual prompting to adapt these models to downstream tasks without any finetuning.
45
+
46
+ Few-Shot Learning. In this setting, the algorithm is trained on a labeled dataset of base classes, from which it should transfer to a set of novel classes given only a few training examples (like 10 or 30) [36, 27, 32, 53, 55, 48, 59, 2]. Unlike Few-Shot approaches, here we do not assume access to a large training set of base-classes, and our architecture is not task-specific. Our approach is Few-Shot only in the sense that we construct a visual prompt that contains one or two task examples.
47
+
48
+ Image Analogies. Hertzmann et. al. [22] proposed the framework of Image Analogies for texture synthesis, where the algorithm is given a pair of training images (A and A’) and a query image (B). The goal is to synthesize a new image (B’) conditioned on the query, following the relationship inferred from the training pair. Other works have used analogies in style transfer [50], and as a supervised image synthesis task [41]. Predicting the correct completion was previously modeled as a classification problem [43, 23], and other works have explored analogies in the context of learning different transformations between pairs of images [34, 46]. Unlike these approaches, we use inpainting MAE models that learn from data, without assuming any predefined analogies structure.
49
+
50
+ Prompting in NLP. With the recent success of large unsupervised language models [44, 12], Brown et al. [5] presented how a variety of NLP problems can be reformulated to a text completion problem given a predefined prompt, which can be used to solve different tasks without any finetuning. Prompting was shown to be a useful tool for solving various NLP tasks and benchmarks [39, 5]. More recently different approaches to prompting have emerged including Prompt Engineering [5, 33], Prompt Ensembling [25], and Prompt Prefix Tuning [29, 28]. Inspired by the success of prompting in NLP, we aim to study prompting in computer vision where prompting hasn’t been widely explored.
51
+
52
+ # 3 Visual Prompting via Image Inpainting
53
+
54
+ We turn to describe how to perform visual prompting using Image Inpainting models. In Section 3.1, we describe our proposed inpainting model, which is a combination of MAE and VQGAN. We then proceed to discuss visual prompting and propose different ways to create visual prompts in Section 3.2 (see example in Figure 1). Finally, we describe the dataset we collected for training our model in Section 3.3. The training process is illustrated in Figure 2
55
+
56
+ ![](images/ecffaf0dad8bf931711f0f0e8faef13d41e8dba16c073af72f769f0c6689dbcc.jpg)
57
+ Figure 2: MAE-VQGAN Architecture. During training, an input image is patchified, masked and fed into an MAE [20]. For each masked token, the decoder outputs a distribution over a pretrained VQGAN [15] codebook. The model is trained using cross entropy loss.
58
+
59
+ # 3.1 Inpainting using MAE-VQGAN
60
+
61
+ Given an input image $\boldsymbol { x } \in \mathbb { R } ^ { H \times W \times 3 }$ and a binary mask $\bar { m } \in \{ 0 , 1 \} ^ { H \times W }$ , the goal of an inpainting function $f$ is to synthesize a new image $\mathbf { \chi } _ { y } ^ { \star } \in \mathbb { R } ^ { \breve { H } \times W \times 3 }$ , with the masked regions filled:
62
+
63
+ $$
64
+ y = f ( x , m )
65
+ $$
66
+
67
+ To implement $f$ with a neural network, it is necessary to consider design choices like the network architecture, how to train it, and whether it outputs a distribution over possible completions or pixels. We propose the MAE-VQGAN model, which combines ideas from MAE [20] and VQGAN [15]. Following the design of MAE, the model is based on ViT [52, 13] and it is trained via masked auto-encoding by randomly masking image patches and then applying $f$ to reconstruct the image from the non-masked parts. MAE-VQGAN models the distribution $p _ { \theta } ( z _ { i } | x , m )$ , where $z _ { i } \in V$ is a visual token from a VQGAN vocabulary $V$ that corresponds to the $i ^ { t h }$ ViT patch. For simplicity, we use a fixed ImageNet pretrained VQGAN codebook.2 Unlike MAE which directly predicts pixels, MAE-VQGAN assigns probabilities to visual tokens via a softmax layer, which is better suited for capturing ambiguities. During training, we obtain ground truth visual tokens by mapping the image to visual tokens indices using the VQGAN encoder. The model is trained using cross entropy loss.
68
+
69
+ Let $\hat { z } = ( { \hat { z } } _ { 1 } , . . . , { \hat { z } } _ { k } )$ be the ordered set of predicted visual tokens. To obtain $\hat { z } _ { i }$ , we use argmax:
70
+
71
+ $$
72
+ \hat { z } _ { i } = \arg \operatorname* { m a x } _ { z _ { i } } p _ { \theta } ( z _ { i } | x , m )
73
+ $$
74
+
75
+ Then, to decode the visual tokens to pixels, we apply VQGAN decoder to $\hat { z }$ to obtain $y$
76
+
77
+ # 3.2 Prompting Inpainting Models
78
+
79
+ To prompt an inpainting model, we construct a visual prompt, a grid-like image composed of task input-output example(s), and a new query image. The model then has to inpaint the rest of the image such that it is consistent with the task defined in the examples (see Figure 1).
80
+
81
+ Let $S = \{ ( x _ { i } , y _ { i } ) \} _ { i = 1 } ^ { n }$ be the set of input-output examples where $x _ { i }$ is an image and $y _ { i }$ is a function of $x _ { i }$ (e.g $y _ { i }$ is a segmentation mask). We assume $n$ is small (one or few examples). Then, given $S$ and a new input query $x _ { q }$ , the goal is to predict the corresponding label $y _ { q }$ . To prompt the inpainting model discussed in Section 3.1, we need to define a function $g$ that maps the examples set $S$ and query image $x _ { q }$ to a new image and a mask:
82
+
83
+ $$
84
+ [ x _ { v p } , m ] = g ( S , x _ { q } )
85
+ $$
86
+
87
+ The image $x _ { v p }$ is the visual prompt and the mask $m$ defines the masked region $f$ has to predict. For a given task, there might exist multiple implementations of $g$ that can be considered. The goal of the inpainting model is to reason about the visual prompt $x _ { v p }$ , and output a plausible completion without performing any additional training:
88
+
89
+ $$
90
+ y _ { v p } = f ( x _ { v p } , m )
91
+ $$
92
+
93
+ To obtain $y _ { q }$ , we just take the part of $y _ { v p }$ corresponding to the mask $m$ .
94
+
95
+ Visual Prompt Engineering. For the visual prompting to work, $g$ should output a good visual prompt, composed of the examples $S$ and query image $x _ { q }$ . Therefore, $g$ has to determine where and how to embed the inputs in the visual prompt image, considering the nature of the completion task. All the functions $g$ used in this work were hard-coded and manually engineered. In most cases, $g$ stacks the examples and image query horizontally by creating an image grid of $( n + 1 ) \times 2$ cells, where the $i ^ { t h }$ example is placed in the $i ^ { t h }$ row, and the image query is in the last row. The grid has a fixed size, and therefore before populating it the input-output example pair(s) and query are first resized. Another consideration is how to draw every $( x _ { i } , y _ { i } )$ pair. For example, if $y _ { i }$ is a segmentation mask, we can choose to use different colors to draw it. In Section 4.4, we describe different prompt design choices and their effect on the results.
96
+
97
+ Visual Prompt Ensembling. There could be multiple options to define $g$ . The idea in prompt ensembling, inspired by NLP [25, 28], is to construct multiple different prompts, apply the inpainting model $f$ on each prompt individually to obtain a set of predictions. The final prediction can be determined, for example, via majority voting, or weighted average. For simplicity, here we use a simple average.
98
+
99
+ # 3.3 The Computer Vision Figures Dataset
100
+
101
+ The images produced by $g$ are by construction not natural. Specifically, these images have a grid-like figure structure that stitches together images coming from different distributions, like natural images and segmentation masks. Therefore, a model trained on a standard dataset (e.g., ImageNet [42]) might struggle to process these grid-like images. To mitigate the domain gap, we collected a new dataset.
102
+
103
+ ![](images/8a7b2296c82977e9981ac9504467bad93e2894c68e0e878e8fa9b9751d4e0448.jpg)
104
+ Figure 3: Random images from our Computer Vision Figures dataset. We curated a dataset of 88k unlabeled figures from Computer Vision academic papers. During training, we randomly sample crops from these figures, without any additional parsing.
105
+
106
+ The Computer Vision Figures (Figures) dataset consists of 88, 645 images that more closely resemble the structure of our visual prompts. The dataset was collected from Arxiv, the open-access web archive for scholarly articles from a variety of academic fields. Arxiv sources are publicly available to download starting from 2010. We downloaded all paper sources from 2010 to 2022 and selected the Computer-Vision partition “cs.CV” sources, as they contain images that more closely resemble a grid structure, as shown in Figure 3. To remove unrelated source images like graphs or charts, we manually tagged 2000 images and trained a binary image classifier to assign a high score to source images in a figure-like structure with at least one natural image. We then used the classifier over the entire data to keep only the most informative source images, coming from 23, 302 different papers. We randomly partitioned $9 0 \%$ of the data to train and left the rest for validation. We include a datasheet with more information in the Supplementary Material.
107
+
108
+ # 4 Experiments and Results
109
+
110
+ To study visual prompting, we pretrain different models (see Section 4.1) on ImageNet and on the Figures dataset, then quantitatively evaluate the models using different prompts on simple downstream computer vision tasks (see Section 4.2). Using a synthetic dataset, we assess how the choice of model and data affect the success of visual prompting in Section 4.3, and explore different prompting design choices in Section 4.4. We provide a large variate of qualitative results both in this section as well as in the Supplementary Material.
111
+
112
+ # 4.1 Models and Baselines
113
+
114
+ To study the effect of model choice on prompting results, we experiment using different models, including MAE-VQGAN (see Section 3.1) and several other inpainting models briefly described below.
115
+
116
+ VQGAN [15] is an autoregressive transformer model used for inpainting and image generation. Visual tokens are predicted sequentially, line-by-line, and the model is trained using cross-entropy loss. The VQGAN model codebook is used to encode visual tokens, and it is trained beforehand using perceptual loss [26] and GAN loss [17]. We train it on ImageNet and our Figures dataset, following hyperparams in [15], and use a pretrained codebook with a vocabulary of size $| V | = 1 0 2 4$
117
+
118
+ BEiT [1] is a masked auto-encoder. The model maps each input $1 6 \times 1 6$ patch to a visual token from a d-VAE [40] vocabulary of size 8192. To encode each visual token, the image is first resized to $1 1 2 \times 1 1 2$ and then mapped to 196 tokens. We use the publicly available BEiT large model, pretrained on ImageNet-21k. We also pretrain a large BEiT model on Figures for 1000 epochs.
119
+
120
+ MAE [20]. Similar to BEiT, MAEs attempt to reconstruct a masked input image. Unlike in BEiT, the model directly regresses pixels and it is trained with l2 loss. During pretraining, only non-masked tokens are fed into the encoder, which results in a faster training time. We use a publicly released checkpoint pretrained on ImageNet, and pretrain another model for 1000 epochs on our dataset.
121
+
122
+ Table 1: Visual prompting results on computer vision tasks. For Foreground Segmentation and Single Object Detection, we report the mIOU score. For Colorization, we report the MSE.
123
+
124
+ <table><tr><td rowspan="2">Model</td><td colspan="4">Foreground Segmentation ↑</td><td colspan="3">Single Object Detection ↑</td><td colspan="3">Colorization↓</td></tr><tr><td>Split 0</td><td>Split 1</td><td>Split 2</td><td>Split 3</td><td>Split 1</td><td>Split 2</td><td>Split 3</td><td>Split 4</td><td>MSE</td><td>LPIPS</td></tr><tr><td>Copy</td><td>12.92</td><td>17.90</td><td>13.52</td><td>15.29</td><td>12.14</td><td>13.50</td><td>13.03</td><td>12.38</td><td>2.63</td><td>0.75</td></tr><tr><td>BEiT (IN-21k)</td><td>0.38</td><td>0.93</td><td>0.90</td><td>0.95</td><td>0.24</td><td>0.32</td><td>0.19</td><td>0.10</td><td>1.25</td><td>0.73</td></tr><tr><td>VQGAN (IN-1k)</td><td>6.96</td><td>10.55</td><td>9.59</td><td>9.43</td><td>5.19</td><td>4.99</td><td>5.09</td><td>5.10</td><td>2.44</td><td>0.66</td></tr><tr><td>MAE (IN-1k)</td><td>1.92</td><td>6.76</td><td>3.85</td><td>4.57</td><td>1.37</td><td>1.98</td><td>1.62</td><td>1.62</td><td>1.13</td><td>0.87</td></tr><tr><td>MAE-VQGAN (IN-1k)</td><td>2.22</td><td>7.07</td><td>5.48</td><td>6.28</td><td>3.34</td><td>3.21</td><td>2.80</td><td>2.80</td><td>3.31</td><td>0.75</td></tr><tr><td>BEiT (Figures)</td><td>5.38</td><td>3.94</td><td>3.20</td><td>3.29</td><td>0.17</td><td>0.02</td><td>0.14</td><td>0.16</td><td>0.60</td><td>0.70</td></tr><tr><td>VQGAN (Figures)</td><td>12.56</td><td>17.51</td><td>14.27</td><td>15.06</td><td>2.27</td><td>2.37</td><td>2.48</td><td>1.99</td><td>1.50</td><td>0.56</td></tr><tr><td>MAE (Figures)</td><td>17.42</td><td>25.70</td><td>18.64</td><td>16.53</td><td>5.49</td><td>4.98</td><td>5.24</td><td>5.84</td><td>0.43</td><td>0.55</td></tr><tr><td>MAE-VQGAN (Figures)</td><td>27.83</td><td>30.44</td><td>26.15</td><td>24.25</td><td>24.19</td><td>25.20</td><td>25.36</td><td>25.23</td><td>0.67</td><td>0.40</td></tr></table>
125
+
126
+ Copy Example. This simple baseline simply replicates the first example label as the output.
127
+
128
+ Implementation Details. All the models we describe are large transformer-based models [52, 13], with patch size $1 6 \times 1 6$ , embedding dim 1024, 24 layers, and 16 heads. For training, we used a machine with 8 Quadro RTX 6000 GPUs, with a batch size of 48. The input image size is $2 2 4 \times 2 2 4$
129
+
130
+ # 4.2 Downstream Computer Vision Tasks
131
+
132
+ We quantitatively evaluate the inpainting models described above on computer vision tasks.
133
+
134
+ Visual Prompt. Given one example pair and a query image, we structure the prompt in the same fashion for all tasks. We construct a grid of $2 \times 2$ sub-images, where the example pair is embedded in the first row, and the query image appears in the bottom left cell. See the example in Figure 1.
135
+
136
+ Computer vision tasks. We evaluate the inpainting models on standard image to image tasks like Foreground Segmentation, Single Object Detection and Colorization.
137
+
138
+ • Foreground Segmentation. The goal is to binary-segment the query image to Foreground and Background. The example is an image and corresponding binary segmentation mask. The query is a new image, and the goal is to complete a corresponding segmentation mask. We use the Pascal-5i [45] dataset, which is comprised of 4 different image splits where every split contains between 346 and 725 images and associated segmentation masks. For each class, the data contains a few image-mask pairs, together with held-out image queries. For every image query, we choose one random example pair. To evaluate, every pixel in the completed image is first mapped to the nearest Foreground or Background color. Finally, we report the mean IOU (mIOU) metric.
139
+
140
+ • Single Object Detection. Similarly to Foreground Segmentation, the goal here is to binary-segment the object that appears in the query image. However, this task is more challenging than Foreground Segmentation because the example mask is obtained from a bounding box which is more coarse than a segmentation mask. We use the Pascal VOC 2012 dataset using images and their associated detection boxes. For simplicity, we use Pascal annotations to include only images with a single object and filter out trivial images that have an object covering more than $5 0 \%$ of the image. We randomly select an example pair and image query of the same object class and repeat the process with 4 different random seeds. For evaluation, we follow a similar process as in Foreground Segmentation to obtain a binary segmentation mask. Then we keep the connected component with the largest area using morphological operations and draw a bounding box around it. We report the mIOU results.
141
+
142
+ • Colorization. The goal is to map a gray-scale image to a color image. The example pair is a grayscaled image and the corresponding color image, as shown in Figures 1 and 4. We randomly sampled 1000 example pairs and image query from ImageNet [42] validation set and converted them to grayscale to obtain gray-scale and color version for each image. We report the MSE loss and LPIPS [60].
143
+
144
+ Results. We include quantitative results in Table 1, and qualitative completion results in Figure 4. Training on the Figures dataset improves the results for most models in all the downstream tasks. MAE-VQGAN outperforms the other models by a large margin for detection and segmentation and generates much sharper images than the MAE. We find that VQGAN struggles to output accurate results, likely due to sequential decoding. The BEiT model is outperformed by MAE, most likely because its training process is less sample efficient. For more results, see the Supplementary Material.
145
+
146
+ ![](images/50fc9c05fe7bec156e23b7112259dfe11ed57bb88e120d184fd3d871bb6d1c68.jpg)
147
+ Figure 4: Visual prompting prediction examples. Each visual prompt was fed to an MAE-VQGAN model trained on the Figures dataset. For each visual prompt, the result is marked in red.
148
+
149
+ ![](images/406ff3ca2c3f93e1221d153ed3058b7c8ae47bbc249b604c59a3b16e52b67037.jpg)
150
+ Figure 5: Synthetic data study results. MAE-VQGAN predictions are annotated with a red square.
151
+
152
+ # 4.3 Synthetic Data Study
153
+
154
+ To assess the compositional prediction capabilities of inpainting models, we created a set of 3 simple synthetic tasks and 3 of their combinations, and evaluated each model on 100 examples per task.
155
+
156
+ Visual Prompt. Given two example pairs and a query image, we structure the prompt in the same fashion for all tasks. We construct a grid of $3 \times 2$ sub-images, where the example pairs are embedded in the first two rows, and the query image in the bottom left cell. We include examples in Figure 5.
157
+
158
+ Change prediction tasks. Each example pair is an image of a colored shape, and a corresponding image with an introduced change. The change can be either in color, shape, size or a combination of two changes. Next, we describe each individual task in more detail.
159
+
160
+ • Resize. Each example pair contains an image of a circle, and a corresponding image with the circle smaller in size. The goal is to predict the image with the resized version given image query.
161
+ • Shape. Here every example pair is an image with circle, and a corresponding image with a rectangle. Both are similar in size and appear in the same location. The goal is to predict the image with rectangle, given a new image query.
162
+ • Color. Each example pair contains an image of a circle appearing in the same location, with the color changed from green to blue. Given a new image query, the goal is to predict the corresponding image with the circle colored in blue.
163
+
164
+ Evaluation. We map each predicted pixel to its nearest neighbor color from a predefined set of options: black, white, blue, or green. We then measure and report the color-aware mIOU, by considering pixel predictions that appear in the ground-truth shape color as foreground and treat the rest as background.
165
+
166
+ Table 2: Synthetic data study results. We report the color-aware mIOU on the six tasks.
167
+
168
+ <table><tr><td></td><td>Color</td><td>Shape</td><td>Size</td><td>Color &amp; Shape</td><td>Color &amp; Size</td><td>Shape &amp; Size</td></tr><tr><td>Copy</td><td>5.53</td><td>6.71</td><td>1.17</td><td>6.74</td><td>1.17</td><td>1.86</td></tr><tr><td>VQGAN (IN-1k)</td><td>0.91</td><td>6.51</td><td>6.24</td><td>2.40</td><td>0.70</td><td>6.53</td></tr><tr><td>BEiT (IN-22k)</td><td>15.99</td><td>9.08</td><td>1.26</td><td>7.23</td><td>2.84</td><td>2.66</td></tr><tr><td>MAE (IN-1k)</td><td>0.00</td><td>2.07</td><td>1.20</td><td>0.00</td><td>0.00</td><td>1.56</td></tr><tr><td>MAE-VQGAN (IN-1k)</td><td>0.13</td><td>2.94</td><td>3.71</td><td>0.00</td><td>0.01</td><td>3.60</td></tr><tr><td>VQGAN (Figures)</td><td>6.96</td><td>19.11</td><td>16.21</td><td>7.40</td><td>2.24</td><td>18.41</td></tr><tr><td>BEiT (Figures)</td><td>40.92</td><td>31.43</td><td>7.12</td><td>33.10</td><td>21.21</td><td>12.98</td></tr><tr><td>MAE (Figures)</td><td>70.23</td><td>43.99</td><td>34.72</td><td>19.30</td><td>18.99</td><td>46.02</td></tr><tr><td>MAE-VQGAN (Figures)</td><td>40.40</td><td>46.53</td><td>42.04</td><td>20.41</td><td>18.27</td><td>40.33</td></tr></table>
169
+
170
+ Table 3: Comparison to Fine Tuning and Classic 1-Shot Segmentation baselines. MAE-VQGAN image query and output resolution is $1 1 1 \times 1 1 1$ . CyCTR and FWB resolution is $4 7 3 \times 4 7 3$ and $5 1 2 \times 5 1 2$ , both approach utilize Pascal 5i labeled baseclasses data.
171
+
172
+ <table><tr><td>Pretraining</td><td># Labeled Images</td><td># Shots</td><td>Model</td><td>Split 0</td><td>Split 1</td><td>Split 2</td><td>Split3</td></tr><tr><td rowspan="3">Unlabeled ImageNet</td><td>1 4</td><td>1</td><td rowspan="3">Finetune MAE</td><td>11.1</td><td>13.4</td><td>13.0</td><td>12.3</td></tr><tr><td></td><td>4</td><td>12.9</td><td>15.8</td><td>14.3</td><td>15.0</td></tr><tr><td>16</td><td>16</td><td>13.7</td><td>16.1</td><td>16.8</td><td>17.1</td></tr><tr><td>Unlabeled Figures</td><td>1</td><td>1</td><td>MAE-VQGAN</td><td>32.5</td><td>33.8</td><td>32.7</td><td>27.2</td></tr><tr><td rowspan="2">Labeled Pascal 5i (Segmentation masks)</td><td rowspan="2">2086-5883</td><td>1</td><td>FWB [36]</td><td>51.3</td><td>64.5</td><td>56.7</td><td>52.2</td></tr><tr><td>1</td><td>CyCTR [59]</td><td>67.2</td><td>71.1</td><td>57.6</td><td>59.0</td></tr></table>
173
+
174
+ Results. The results are presented in Table 2, for MAE-VQGAN prediction examples see Figure 5. Without training on the Figures dataset, inpainting models fail to generalize to these previously unseen tasks. The performance of all models improves when they are trained on the Figures dataset. Yet, the same models struggle with combinations of tasks due to the increasing complexity. The VQGAN model utilizes sequential decoding and therefore lacks context, which leads to poor performance. The MAE model outperforms MAE-VQGAN on color, and BEiT performs poorly in size. These models rely on pretrained codebooks (VQGAN and dVAE) that are likely not geared towards these tasks.
175
+
176
+ ![](images/4d479f20ec0adabd6774aab11ac2476fb287114cc60ec55bf15ccb2bad7e6151.jpg)
177
+ Figure 6: More examples, better results. Left: we construct visual prompts with increasing number of inputoutput pair examples, for a fixed query image (inpaintings annotated in red). Right: We observe that more examples improve the overall mIOU results on the four Pascal-5i splits.
178
+
179
+ # 4.4 Analysis
180
+
181
+ Comparison to finetuning and Few-Shot baselines. We include a comparison to baselines that utilize $K = \{ 1 , 4 , 1 6 \}$ training examples for each target class. For completeness, we also include the results of FWB [36] and CyCTR [59], classic 1-shot baselines, which we view as an upper-bound of our approach. FWB and CyCTR utilize a fully labeled base classes train set (2086 to 5883 on different Pascal 5i splits). Additionally, their architecture was designed for the foreground segmentation task (e.g, they operate in higher resolution). The results in Table 3 indicate that the Visual Prompting results of MAE-VQGAN trained on Figures are significantly superior to standard finetuning baselines of MAEs pretrained on unlabeled ImageNet. FWB [36] and CyCTR [59] outperform Visual Prompting, mainly because they pretrain on a large tagged base classes dataset and utilize architectures that are specific to image segmentation.
182
+
183
+ Dataset effect. We evaluate the effect of pretraining on a larger and more diverse dataset. We compare training on ImageNet only, Figures only, and a combination of the two. We report the mIOU results on Pascal 5i for Foreground Segmentation in Figure 7. The MAE-VQGAN trained on ImageNet achieves a consistently low $\sim 5$ points mIOU. The model trained on the combined dataset performs best, which demonstrates that MAE-VQGAN can benefit from additional amounts of unlabeled images.
184
+
185
+ More examples, better results. We study how increasing the number of input-output pair examples in the visual prompt affects the results. Intuitively, we expect that including more examples should reduce ambiguities and lead to better results. We use an MAE-VQGAN pretrained on the Figures dataset, and use data from PASCAL-5i. We construct a large grid that can populate up to 8 examples and an image query. We randomly choose different numbers of examples and randomize the placements. The results in Figure 6 confirm that using more examples leads to better segmentation results.
186
+
187
+ ![](images/5b45da93e6131f551712beeb89669a58ba627d761ff1210e58753c722072bc3e.jpg)
188
+ Figure 7: Training MAE-VQGAN on more data improves visual prompting results. Foreground Segmentation results on Pascal5i, when trained over the Figures dataset and on the combined Figuresand ImageNet dataset.
189
+
190
+ Prompt Engineering. We explore the effect of constructing different visual prompts for Foreground Segmentation and their corresponding MAE-VQGAN results (see Figure 8.a-b). The model generates plausible completions when changing the prompt layout (e.g. horizontal order vs. vertical order) and when changing the mask colors, texture or using only edges (see Figure 9). The mIOU results in Table 4 indicate that the model performs better with a vertical layout and when the segmentation mask colors are black and white. Interestingly, by analyzing the average attention heads of a masked patch token, we observe that the attention changes following the change in the prompts layout (see Figures 8.d-e).
191
+
192
+ Prompt Ensembling. Inspired by Prompt Ensembling in NLP [28], given the same example pair and image query, we construct multiple different visual prompts (e.g, horizontal and vertical layouts, see Figure 8.a-b). We then average the completion results. The results in Table 4 on the Synthetic Study tasks demonstrate that utilizing multiple prompts can lead to improved, and more stable performance.
193
+
194
+ ![](images/77bec893e9ddaa82e5ff92d096e940d40c9d7807bcd2a29f7903fed058b30fc8.jpg)
195
+ Figure 8: Prompt layout design. Two prompt orderings, and the corresponding average attention maps of the selected patch (annotated with black bounding box). The highest attention values appear on similar (corresponding) areas in the query image.
196
+
197
+ Style/content extrapolation. Inspired by the classic example from Tenenbaum and Freeman [47] (on the task originally suggested by Hofstadter [24]), we use MAE-VQGAN to extrapolate letter sequences printed in different fonts (see Figure 10). We find that the model can extrapolate given style and new content (Figure 10a) but that it struggles to extrapolate new content (Figure 10b). The model also struggles to extrapolate more complex letter sequences; the performance deteriorates even if both style and content are given (Figure 10 c-d).
198
+
199
+ Limitations. The focus of this work is to present a proof of concept that shows it is possible to visually prompt simple image inpainting models trained on noisy, unlabeled data. Specifically, we demonstrate how to pre-train a network once, then prompt it to perform reasonably well on many tasks. The fact that this is possible is surprising and scientifically interesting, although this approach is not competitive with supervised task-specific models. For visual prompting to work, the inpainting models require training on the Computer Vision Figures dataset. However, our initial experiments suggest that it can benefit from training on additional natural image data (see Figure 7). Other limitations include ambiguities in the task definition, reliance on a pretrained VQGAN decoder, and worse performance when the input-output example(s) are not aligned (see examples in Figure 11).
200
+
201
+ ![](images/9b26e80b8533e1e791b620e9e99bb0d8ae1c1b03809149bdcab2c09bcad72cfe.jpg)
202
+ Figure 9: Task performance under different label choices. Prompting results when using different mask colors (e.g, purple/yellow vs. green/red), when drawing full mask compared to edges only, and when changing the mask texture. Compared to other alternatives, purple/yellow and black/white (see Figure 8) masks works best.
203
+
204
+ Table 4: Prompt Engineering. Foreground Segmentation mIOU results on Pascal-5i when using different prompt colors.
205
+
206
+ <table><tr><td></td><td>Horizontal</td><td>Vertical</td></tr><tr><td>Black/White</td><td>27.17</td><td>31.57</td></tr><tr><td>Purple/Yellow</td><td>23.44</td><td>28.47</td></tr></table>
207
+
208
+ Table 5: Prompt Ensembling. We report here color-aware mIOU. In every line, the result is based on an ensemble of all previous prompts.
209
+
210
+ <table><tr><td>Prompt Layout</td><td>Color</td><td>Shape</td><td>Size</td></tr><tr><td>Horizontal</td><td>39.97</td><td>46.54</td><td>42.01</td></tr><tr><td>+ Vertical</td><td>41.31</td><td>54.71</td><td>46.18</td></tr><tr><td>+ Vertical w/ Rows Swap</td><td>44.14</td><td>60.42</td><td>49.42</td></tr></table>
211
+
212
+ ![](images/f72269bb4b1dfe33e456cc91aca8532c2467560cd63dbebe6b8e5aeff5c72189.jpg)
213
+ Figure 10: Style and content extrapolation using MAE-VQGAN. The model can extrapolate the style of a new content (a), but fails to predict a new content (b). The model struggles to extrapolate new style and content of longer sequences (c-e).
214
+
215
+ ![](images/5c145695da893b1cc8057206066e75a10d2b1e2224940ab735f49ec32149595b.jpg)
216
+ Figure 11: Limitations and failure cases. Single input-output example might be ambiguous and can lead to unintended completions. The MAE-VQGAN model performs worse given non-aligned input-output example, and by using a VQGAN vocabulary, it is limited in synthesizing out-of-distribution pixels (like blurry images).
217
+
218
+ # 5 Discussion
219
+
220
+ Why does our proposed method, despite its simplicity, perform so well on a large subset of visual tasks? At this point, we do not have a good answer. Clearly, the specific training data we use plays an important role, but the amount of generalization observed is still surprising. Perhaps some of these image-to-image tasks are actually simpler than we believed. But it’s also evident that contemporary large-scale inpainting models are learning quite sophisticated long-range co-occurrences and symmetries in the data which can often enable impressive visual reasoning. We hope that our work will encourage further research to better our understanding of what is being learned by inpainting.
221
+
222
+ Acknowledgements: We would like to thank Assaf Shocher for insightful discussions and ideas related to the Figures dataset. We thank Aaron Hertzmann, Sanjay Subramanian, Ofir Press and Ben Bogin for helpful feedback on the manuscript. This project has received funding from the European Research Council (ERC) under the European Unions Horizon 2020 research and innovation programme (grant ERC HOLI 819080). Prof. Darrell’s group was supported in part by DoD including DARPA’s LwLL and/or SemaFor programs, as well as BAIR’s industrial alliance programs. Prof. Efros’s group was supported by in part by DoD including DARPA’s MCS and/or ONR MURI, as well as funding from SAP.
223
+
224
+ # References
225
+
226
+ [1] Bao, H., Dong, L., Wei, F.: Beit: Bert pre-training of image transformers. arXiv preprint arXiv:2106.08254 (2021)
227
+ [2] Bar, A., Wang, X., Kantorov, V., Reed, C.J., Herzig, R., Chechik, G., Rohrbach, A., Darrell, T., Globerson, A.: Detreg: Unsupervised pretraining with region priors for object detection. arXiv preprint arXiv:2106.04550 (2021) [3] Barnes, C., Shechtman, E., Finkelstein, A., Goldman, D.B.: Patchmatch: A randomized correspondence algorithm for structural image editing. ACM Trans. Graph. 28(3), 24 (2009) [4] Bertalmio, M., Sapiro, G., Caselles, V., Ballester, C.: Image inpainting. In: Proceedings of the 27th annual conference on Computer graphics and interactive techniques. pp. 417–424 (2000)
228
+ [5] Brown, T.B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D.M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., Amodei, D.: Language models are few-shot learners. CoRR abs/2005.14165 (2020), https://arxiv.org/abs/2005.14165 [6] Caron, M., Misra, I., Mairal, J., Goyal, P., Bojanowski, P., Joulin, A.: Unsupervised learning of visual features by contrasting cluster assignments. NeurIPS (2020)
229
+ [7] Chang, H., Zhang, H., Jiang, L., Liu, C., Freeman, W.T.: Maskgit: Masked generative image transformer. arXiv preprint arXiv:2202.04200 (2022)
230
+ [8] Chen, M., Radford, A., Child, R., Wu, J., Jun, H., Luan, D., Sutskever, I.: Generative pretraining from pixels. In: International Conference on Machine Learning. pp. 1691–1703. PMLR (2020)
231
+ [9] Chen, T., Kornblith, S., Norouzi, M., Hinton, G.: A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709 (2020)
232
+ [10] Chen, X., Fan, H., Girshick, R., He, K.: Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297 (2020)
233
+ [11] Criminisi, A., Pérez, P., Toyama, K.: Region filling and object removal by exemplar-based image inpainting. IEEE Transactions on image processing 13(9), 1200–1212 (2004)
234
+ [12] Devlin, J., Chang, M.W., Lee, K., Toutanova, K.: Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 (2018)
235
+ [13] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al.: An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929 (2020)
236
+ [14] Efros, A.A., Leung, T.K.: Texture synthesis by non-parametric sampling. In: IEEE International Conference on Computer Vision. pp. 1033–1038. Corfu, Greece (September 1999)
237
+ [15] Esser, P., Rombach, R., Ommer, B.: Taming transformers for high-resolution image synthesis. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 12873–12883 (2021)
238
+ [16] Gidaris, S., Bursuc, A., Komodakis, N., Pérez, P., Cord, M.: Learning representations by predicting bags of visual words. In: CVPR (2020)
239
+ [17] Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., Bengio, Y.: Generative adversarial nets. Advances in neural information processing systems 27 (2014)
240
+ [18] Goyal, P., Mahajan, D., Gupta, A., Misra, I.: Scaling and benchmarking self-supervised visual representation learning. In: ICCV (2019)
241
+ [19] Hays, J., Efros, A.A.: Scene completion using millions of photographs. ACM Transactions on Graphics (SIGGRAPH 2007) 26(3) (2007)
242
+ [20] He, K., Chen, X., Xie, S., Li, Y., Dollár, P., Girshick, R.B.: Masked autoencoders are scalable vision learners. CoRR abs/2111.06377 (2021), https://arxiv.org/abs/2111.06377
243
+ [21] He, K., Fan, H., Wu, Y., Xie, S., Girshick, R.: Momentum contrast for unsupervised visual representation learning. In: CVPR (2020)
244
+ [22] Hertzmann, A., Jacobs, C.E., Oliver, N., Curless, B., Salesin, D.H.: Image analogies. In: Proceedings of the 28th annual conference on Computer graphics and interactive techniques. pp. 327–340 (2001)
245
+ [23] Hill, F., Santoro, A., Barrett, D.G., Morcos, A.S., Lillicrap, T.: Learning to make analogies by contrasting abstract relational structure. arXiv preprint arXiv:1902.00120 (2019)
246
+ [24] Hofstadter, D.R.: Fluid concepts and creative analogies: Computer models of the fundamental mechanisms of thought. Basic books (1995)
247
+ [25] Jiang, Z., Xu, F.F., Araki, J., Neubig, G.: How can we know what language models know? Transactions of the Association for Computational Linguistics 8, 423–438 (2020)
248
+ [26] Johnson, J., Alahi, A., Fei-Fei, L.: Perceptual losses for real-time style transfer and super-resolution. In: European conference on computer vision. pp. 694–711. Springer (2016)
249
+ [27] Kang, B., Liu, Z., Wang, X., Yu, F., Feng, J., Darrell, T.: Few-shot object detection via feature reweighting. In: Proceedings of the IEEE/CVF International Conference on Computer Vision. pp. 8420–8429 (2019)
250
+ [28] Lester, B., Al-Rfou, R., Constant, N.: The power of scale for parameter-efficient prompt tuning. CoRR abs/2104.08691 (2021), https://arxiv.org/abs/2104.08691
251
+ [29] Li, X.L., Liang, P.: Prefix-tuning: Optimizing continuous prompts for generation. arXiv preprint arXiv:2101.00190 (2021)
252
+ [30] Liu, G., Reda, F.A., Shih, K.J., Wang, T.C., Tao, A., Catanzaro, B.: Image inpainting for irregular holes using partial convolutions. In: Proceedings of the European conference on computer vision (ECCV). pp. 85–100 (2018)
253
+ [31] Liu, G., Reda, F.A., Shih, K.J., Wang, T.C., Tao, A., Catanzaro, B.: Image inpainting for irregular holes using partial convolutions. In: Proceedings of the European Conference on Computer Vision (ECCV) (September 2018)
254
+ [32] Liu, Y., Zhang, X., Zhang, S., He, X.: Part-aware prototype network for few-shot semantic segmentation. In: European Conference on Computer Vision. pp. 142–158. Springer (2020)
255
+ [33] Lu, Y., Bartolo, M., Moore, A., Riedel, S., Stenetorp, P.: Fantastically ordered prompts and where to find them: Overcoming few-shot prompt order sensitivity. arXiv preprint arXiv:2104.08786 (2021)
256
+ [34] Memisevic, R., Hinton, G.: Unsupervised learning of image transformations. In: 2007 IEEE Conference on Computer Vision and Pattern Recognition. pp. 1–8. IEEE (2007)
257
+ [35] Misra, I., Maaten, L.v.d.: Self-supervised learning of pretext-invariant representations. In: CVPR (2020)
258
+ [36] Nguyen, K., Todorovic, S.: Feature weighting and boosting for few-shot segmentation. In: Proceedings of the IEEE/CVF International Conference on Computer Vision. pp. 622–631 (2019)
259
+ [37] Van den Oord, A., Li, Y., Vinyals, O.: Representation learning with contrastive predictive coding. arXiv e-prints pp. arXiv–1807 (2018)
260
+ [38] Pathak, D., Krahenbuhl, P., Donahue, J., Darrell, T., Efros, A.A.: Context encoders: Feature learning by inpainting. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 2536–2544 (2016)
261
+ [39] Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al.: Language models are unsupervised multitask learners. OpenAI blog 1(8), 9 (2019)
262
+ [40] Ramesh, A., Pavlov, M., Goh, G., Gray, S., Voss, C., Radford, A., Chen, M., Sutskever, I.: Zero-shot text-to-image generation. In: International Conference on Machine Learning. pp. 8821–8831. PMLR (2021)
263
+ [41] Reed, S.E., Zhang, Y., Zhang, Y., Lee, H.: Deep visual analogy-making. Advances in neural information processing systems 28 (2015)
264
+ [42] Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., Berg, A.C., Fei-Fei, L.: ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV) 115(3), 211–252 (2015). https://doi.org/10.1007/s11263-015-0816-y
265
+ [43] Sadeghi, F., Zitnick, C.L., Farhadi, A.: Visalogy: Answering visual analogy questions. Advances in Neural Information Processing Systems 28 (2015)
266
+ [44] Sarzynska-Wawer, J., Wawer, A., Pawlak, A., Szymanowska, J., Stefaniak, I., Jarkiewicz, M., Okruszek, L.: Detecting formal thought disorder by deep contextualized word representations. Psychiatry Research 304, 114135 (2021)
267
+ [45] Shaban, A., Bansal, S., Liu, Z., Essa, I., Boots, B.: One-shot learning for semantic segmentation. CoRR abs/1709.03410 (2017), http://arxiv.org/abs/1709.03410
268
+ [46] Taylor, G.W., Fergus, R., LeCun, Y., Bregler, C.: Convolutional learning of spatio-temporal features. In: European conference on computer vision. pp. 140–153. Springer (2010)
269
+ [47] Tenenbaum, J.B., Freeman, W.T.: Separating style and content with bilinear models. Neural computation 12(6), 1247–1283 (2000)
270
+ [48] Tian, Z., Zhao, H., Shu, M., Yang, Z., Li, R., Jia, J.: Prior guided feature enrichment network for few-shot segmentation. IEEE transactions on pattern analysis and machine intelligence (2020)
271
+ [49] Ulyanov, D., Vedaldi, A., Lempitsky, V.: Deep image prior. arXiv:1711.10925 (2017)
272
+ [50] Upchurch, P., Snavely, N., Bala, K.: From a to z: supervised transfer of style and content using deep neural network generators. arXiv preprint arXiv:1603.02003 (2016)
273
+ [51] Van Den Oord, A., Vinyals, O., et al.: Neural discrete representation learning. Advances in neural information processing systems 30 (2017)
274
+ [52] Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., Polosukhin, I.: Attention is all you need. Advances in neural information processing systems 30 (2017)
275
+ [53] Wang, X., Huang, T.E., Darrell, T., Gonzalez, J.E., Yu, F.: Frustratingly simple few-shot object detection. arXiv preprint arXiv:2003.06957 (2020)
276
+ [54] Xie, Z., Zhang, Z., Cao, Y., Lin, Y., Bao, J., Yao, Z., Dai, Q., Hu, H.: Simmim: A simple framework for masked image modeling. arXiv preprint arXiv:2111.09886 (2021)
277
+ [55] Yang, B., Liu, C., Li, B., Jiao, J., Ye, Q.: Prototype mixture models for few-shot semantic segmentation. In: European Conference on Computer Vision. pp. 763–778. Springer (2020)
278
+ [56] Yang, C., Lu, X., Lin, Z., Shechtman, E., Wang, O., Li, H.: High-resolution image inpainting using multi-scale neural patch synthesis. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 6721–6729 (2017)
279
+ [57] Yu, J., Li, X., Koh, J.Y., Zhang, H., Pang, R., Qin, J., Ku, A., Xu, Y., Baldridge, J., Wu, Y.: Vector-quantized image modeling with improved vqgan. arXiv preprint arXiv:2110.04627 (2021)
280
+ [58] Yu, Y., Zhan, F., Wu, R., Pan, J., Cui, K., Lu, S., Ma, F., Xie, X., Miao, C.: Diverse image inpainting with bidirectional and autoregressive transformers. In: Proceedings of the 29th ACM International Conference on Multimedia. pp. 69–78 (2021)
281
+ [59] Zhang, G., Kang, G., Yang, Y., Wei, Y.: Few-shot segmentation via cycle-consistent transformer. Advances in Neural Information Processing Systems 34 (2021)
282
+ [60] Zhang, R., Isola, P., Efros, A.A., Shechtman, E., Wang, O.: The unreasonable effectiveness of deep features as a perceptual metric. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 586–595 (2018)
parse/dev/o4uFFg9_TpV/o4uFFg9_TpV_content_list.json ADDED
@@ -0,0 +1,1260 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Visual Prompting via Image Inpainting ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 259,
8
+ 122,
9
+ 738,
10
+ 148
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Amir Bar∗ 1,2, Yossi Gandelsman∗ 1, Trevor Darrell1, Amir Globerson2,3, Alexei A. Efros1",
17
+ "bbox": [
18
+ 186,
19
+ 199,
20
+ 810,
21
+ 215
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "1UC Berkeley ",
28
+ "bbox": [
29
+ 235,
30
+ 228,
31
+ 326,
32
+ 243
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "2Tel Aviv University ",
39
+ "bbox": [
40
+ 416,
41
+ 228,
42
+ 553,
43
+ 243
44
+ ],
45
+ "page_idx": 0
46
+ },
47
+ {
48
+ "type": "text",
49
+ "text": "3Google Research ",
50
+ "bbox": [
51
+ 642,
52
+ 228,
53
+ 763,
54
+ 243
55
+ ],
56
+ "page_idx": 0
57
+ },
58
+ {
59
+ "type": "text",
60
+ "text": "Abstract ",
61
+ "text_level": 1,
62
+ "bbox": [
63
+ 462,
64
+ 279,
65
+ 535,
66
+ 295
67
+ ],
68
+ "page_idx": 0
69
+ },
70
+ {
71
+ "type": "text",
72
+ "text": "How does one adapt a pre-trained visual model to novel downstream tasks without task-specific finetuning or any model modification? Inspired by prompting in NLP, this paper investigates visual prompting: given input-output image example(s) of a new task at test time and a new input image, the goal is to automatically produce the output image, consistent with the given examples. We show that posing this problem as simple image inpainting – literally just filling in a hole in a concatenated visual prompt image – turns out to be surprisingly effective, provided that the inpainting algorithm has been trained on the right data. We train masked auto-encoders on a new dataset that we curated $- 8 8 \\mathrm { k }$ unlabeled figures from academic papers sources on Arxiv. We apply visual prompting to these pretrained models and demonstrate results on various downstream image-to-image tasks, including foreground segmentation, single object detection, colorization, edge detection, etc.1 ",
73
+ "bbox": [
74
+ 233,
75
+ 309,
76
+ 766,
77
+ 489
78
+ ],
79
+ "page_idx": 0
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "1 Introduction ",
84
+ "text_level": 1,
85
+ "bbox": [
86
+ 174,
87
+ 512,
88
+ 310,
89
+ 530
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "In the past few years, self-supervised learning has gained popularity in computer vision and natural language processing (NLP). The growing capacity of modern deep learning models made them prone to overfitting when trained on relatively small labeled datasets. Self-supervised learning provides a solution to this problem by generating “free labels” for any dataset, without the need for manual annotation, addressing the data hunger in these high-capacity deep learning models. However, features learned via self-supervision are not “ready for use” – they typically need to be adapted for a given downstream task by fine-tuning on some labeled dataset. Could this fine-tuning be avoided? ",
96
+ "bbox": [
97
+ 174,
98
+ 542,
99
+ 825,
100
+ 640
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "In NLP, prompting [5] has recently emerged as a way to employ a model for a new task without any additional training. A common way of task-prompting for a specific language understanding task at test time is to provide the trained model with an input corresponding to example(s) of the target task together with the query. E.g., typing the following input prompt: ",
107
+ "bbox": [
108
+ 174,
109
+ 647,
110
+ 825,
111
+ 703
112
+ ],
113
+ "page_idx": 0
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "Je suis désolé J’adore la glace ",
118
+ "bbox": [
119
+ 209,
120
+ 708,
121
+ 348,
122
+ 736
123
+ ],
124
+ "page_idx": 0
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "I’m sorry ",
129
+ "bbox": [
130
+ 447,
131
+ 708,
132
+ 526,
133
+ 722
134
+ ],
135
+ "page_idx": 0
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "will prompt the model [5] to perform the task of French-to-English translation, returning: I love ice cream ",
140
+ "bbox": [
141
+ 173,
142
+ 742,
143
+ 823,
144
+ 770
145
+ ],
146
+ "page_idx": 0
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "Can this idea of test-time task prompting be generalized to the visual domain? That is, instead of the current situation in computer vision, where each trained model serves its predefined task (e.g. segmentation, detection, classification), can we have a single general model that can perform a wide range of user-specified tasks without any fine-tuning (i.e., weight modification)? ",
151
+ "bbox": [
152
+ 174,
153
+ 776,
154
+ 826,
155
+ 833
156
+ ],
157
+ "page_idx": 0
158
+ },
159
+ {
160
+ "type": "text",
161
+ "text": "In this paper we take a step toward this goal by demonstrating that large-capacity image inpainting models, when trained on the right data, can be surprisingly effective tools for visual prompting. ",
162
+ "bbox": [
163
+ 174,
164
+ 839,
165
+ 823,
166
+ 867
167
+ ],
168
+ "page_idx": 0
169
+ },
170
+ {
171
+ "type": "image",
172
+ "img_path": "images/fec7d4f1c4f22fc04019a2d3145f43606b948aaba229095b8b23ad7299c7715b.jpg",
173
+ "image_caption": [
174
+ "Figure 1: Visual prompting via Image Inpainting. Top: Prompting Image Inpainting Models. Given inputoutput example(s) $( x _ { 1 } , y _ { 1 } )$ and image query $x _ { q }$ , we construct a grid-like single image called a visual prompt $x _ { v p }$ . The visual prompt is composed of the desired task example(s) and a new query image (all in green). The inpainting model goal is then to predict the masked region (red) such that it is consistent with the example(s). Bottom: an inpainting model can solve this way various computer vision tasks, given that it was trained on the right data. The model predictions are annotated in red. "
175
+ ],
176
+ "image_footnote": [],
177
+ "bbox": [
178
+ 176,
179
+ 88,
180
+ 825,
181
+ 329
182
+ ],
183
+ "page_idx": 1
184
+ },
185
+ {
186
+ "type": "text",
187
+ "text": "As shown in Figure 1, we define each task by constructing a new grid-like image that contains an input-output example(s) of the task and a novel query (green border). The input-output example describes the task, and the image query defines a new input. The model then produces the result by simply inpainting the rest of the image (red border). This setting is most similar to the classic Image Analogies [22] formulation, but is less constrained: instead of explicitly defining the A, A’, and B images separately, we simply concatenate them into a single image with a hole (hence, visual prompting is not exactly an analogy since there is no implied left-to-right ordering). Our goal is also not dissimilar from the aims of meta-learning and few-shot learning methods, except that we make no distinction between tasks and example pairs. The only requirement of our formulation is that the tasks must be defined as image-to-image translations, which is a very large subset of vision problems. ",
188
+ "bbox": [
189
+ 174,
190
+ 426,
191
+ 825,
192
+ 565
193
+ ],
194
+ "page_idx": 1
195
+ },
196
+ {
197
+ "type": "text",
198
+ "text": "To obtain training data that is most useful for our framework, we utilize a domain that spans across a variety of computer vision tasks - figures and infographics from computer vision articles available on Arxiv. We build a large dataset of 88 thousand figures, many of which contain grids of images and their corresponding task results (e.g. images and their segmentation masks/stylized versions/edges, etc.). We then train large-capacity inpainting models to predict randomly masked patches from figures given other patches from the same figure. ",
199
+ "bbox": [
200
+ 174,
201
+ 570,
202
+ 825,
203
+ 655
204
+ ],
205
+ "page_idx": 1
206
+ },
207
+ {
208
+ "type": "text",
209
+ "text": "Our main contributions are as follows. First, we present a simple yet surprisingly powerful general approach for visual prompting. We show that various computer vision tasks can be treated as grid inpainting problems, given a few examples of task inputs and outputs and a query image. Second, we provide a new dataset that allows a model to learn such grid structures without any labeling, task descriptions, or any additional information about the grid structure. Finally, we show that while using our new dataset for training is essential, adding more generic image data from other sources (e.g. ImageNet) further improves the results. ",
210
+ "bbox": [
211
+ 174,
212
+ 660,
213
+ 825,
214
+ 757
215
+ ],
216
+ "page_idx": 1
217
+ },
218
+ {
219
+ "type": "text",
220
+ "text": "2 Related Work ",
221
+ "text_level": 1,
222
+ "bbox": [
223
+ 174,
224
+ 780,
225
+ 321,
226
+ 797
227
+ ],
228
+ "page_idx": 1
229
+ },
230
+ {
231
+ "type": "text",
232
+ "text": "Natural Image Inpainting. Filling empty regions in an image has been widely explored for natural images. Earlier methods used data from the input image itself for inpainting [14, 4, 11, 3, 49], whereas later works utilized datasets of images as source data [19, 38, 56, 30, 31]. Recent methods have attempted to apply transformers to visual synthesis tasks [8, 58, 15, 57, 7]. Due to the exponentially large number of completion options for a single output patch, these approaches rely on a discrete latent codebook [51, 40, 15] which serves as a smaller yet expressive vocabulary. To tackle the multimodal nature of synthesis, different approaches have been proposed to model the distribution over possible completions [15, 57, 7]. For example, [15, 57] proposed to synthesize images line-by-line using an autoregressive model and [7] have proposed iterative parallel decoding. While the standard inpainting task typically aims to complete blank parts in natural images, our focus is on completing grid-like visual prompts, which require reasoning across multiple images within the visual prompt image. ",
233
+ "bbox": [
234
+ 174,
235
+ 814,
236
+ 825,
237
+ 911
238
+ ],
239
+ "page_idx": 1
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "",
244
+ "bbox": [
245
+ 174,
246
+ 90,
247
+ 825,
248
+ 147
249
+ ],
250
+ "page_idx": 2
251
+ },
252
+ {
253
+ "type": "text",
254
+ "text": "Hole-filling as a Pretext task. Recent work has shown that self-supervised pretraining can generate powerful representations for transfer learning, even outperforming its supervised counterparts on challenging vision benchmarks [37, 18, 9, 21, 6, 10, 35, 16]. Pathak et al. [38] first proposed using hole-filling as a pretext task for self-supervision with Context Encoders, where the goal is to predict an random image region given its context. Based on the recent success of Vision Transformers (ViTs) [13], multiple works have proposed to hole-filling a self-supervised pretext task for ViTs [1, 20, 54]. For example, in MAE [20], the goals is to reconstruct the image given a small subset of input patches. After pretraining on unlabeled data, MAE can produce representations that transfer well when fine-tuned on downstream tasks. Here, we use visual prompting to adapt these models to downstream tasks without any finetuning. ",
255
+ "bbox": [
256
+ 173,
257
+ 154,
258
+ 825,
259
+ 292
260
+ ],
261
+ "page_idx": 2
262
+ },
263
+ {
264
+ "type": "text",
265
+ "text": "Few-Shot Learning. In this setting, the algorithm is trained on a labeled dataset of base classes, from which it should transfer to a set of novel classes given only a few training examples (like 10 or 30) [36, 27, 32, 53, 55, 48, 59, 2]. Unlike Few-Shot approaches, here we do not assume access to a large training set of base-classes, and our architecture is not task-specific. Our approach is Few-Shot only in the sense that we construct a visual prompt that contains one or two task examples. ",
266
+ "bbox": [
267
+ 174,
268
+ 297,
269
+ 825,
270
+ 367
271
+ ],
272
+ "page_idx": 2
273
+ },
274
+ {
275
+ "type": "text",
276
+ "text": "Image Analogies. Hertzmann et. al. [22] proposed the framework of Image Analogies for texture synthesis, where the algorithm is given a pair of training images (A and A’) and a query image (B). The goal is to synthesize a new image (B’) conditioned on the query, following the relationship inferred from the training pair. Other works have used analogies in style transfer [50], and as a supervised image synthesis task [41]. Predicting the correct completion was previously modeled as a classification problem [43, 23], and other works have explored analogies in the context of learning different transformations between pairs of images [34, 46]. Unlike these approaches, we use inpainting MAE models that learn from data, without assuming any predefined analogies structure. ",
277
+ "bbox": [
278
+ 173,
279
+ 373,
280
+ 825,
281
+ 484
282
+ ],
283
+ "page_idx": 2
284
+ },
285
+ {
286
+ "type": "text",
287
+ "text": "Prompting in NLP. With the recent success of large unsupervised language models [44, 12], Brown et al. [5] presented how a variety of NLP problems can be reformulated to a text completion problem given a predefined prompt, which can be used to solve different tasks without any finetuning. Prompting was shown to be a useful tool for solving various NLP tasks and benchmarks [39, 5]. More recently different approaches to prompting have emerged including Prompt Engineering [5, 33], Prompt Ensembling [25], and Prompt Prefix Tuning [29, 28]. Inspired by the success of prompting in NLP, we aim to study prompting in computer vision where prompting hasn’t been widely explored. ",
288
+ "bbox": [
289
+ 173,
290
+ 491,
291
+ 826,
292
+ 589
293
+ ],
294
+ "page_idx": 2
295
+ },
296
+ {
297
+ "type": "text",
298
+ "text": "3 Visual Prompting via Image Inpainting ",
299
+ "text_level": 1,
300
+ "bbox": [
301
+ 174,
302
+ 611,
303
+ 532,
304
+ 628
305
+ ],
306
+ "page_idx": 2
307
+ },
308
+ {
309
+ "type": "text",
310
+ "text": "We turn to describe how to perform visual prompting using Image Inpainting models. In Section 3.1, we describe our proposed inpainting model, which is a combination of MAE and VQGAN. We then proceed to discuss visual prompting and propose different ways to create visual prompts in Section 3.2 (see example in Figure 1). Finally, we describe the dataset we collected for training our model in Section 3.3. The training process is illustrated in Figure 2 ",
311
+ "bbox": [
312
+ 174,
313
+ 645,
314
+ 485,
315
+ 782
316
+ ],
317
+ "page_idx": 2
318
+ },
319
+ {
320
+ "type": "image",
321
+ "img_path": "images/ecffaf0dad8bf931711f0f0e8faef13d41e8dba16c073af72f769f0c6689dbcc.jpg",
322
+ "image_caption": [
323
+ "Figure 2: MAE-VQGAN Architecture. During training, an input image is patchified, masked and fed into an MAE [20]. For each masked token, the decoder outputs a distribution over a pretrained VQGAN [15] codebook. The model is trained using cross entropy loss. "
324
+ ],
325
+ "image_footnote": [],
326
+ "bbox": [
327
+ 527,
328
+ 722,
329
+ 789,
330
+ 912
331
+ ],
332
+ "page_idx": 2
333
+ },
334
+ {
335
+ "type": "text",
336
+ "text": "3.1 Inpainting using MAE-VQGAN ",
337
+ "text_level": 1,
338
+ "bbox": [
339
+ 176,
340
+ 803,
341
+ 434,
342
+ 818
343
+ ],
344
+ "page_idx": 2
345
+ },
346
+ {
347
+ "type": "text",
348
+ "text": "Given an input image $\\boldsymbol { x } \\in \\mathbb { R } ^ { H \\times W \\times 3 }$ and a binary mask $\\bar { m } \\in \\{ 0 , 1 \\} ^ { H \\times W }$ , the goal of an inpainting function $f$ is to synthesize a new image $\\mathbf { \\chi } _ { y } ^ { \\star } \\in \\mathbb { R } ^ { \\breve { H } \\times W \\times 3 }$ , with the masked regions filled: ",
349
+ "bbox": [
350
+ 173,
351
+ 828,
352
+ 486,
353
+ 886
354
+ ],
355
+ "page_idx": 2
356
+ },
357
+ {
358
+ "type": "equation",
359
+ "img_path": "images/1b63b03f46f7ee344cdb86802301722b70546066ba845ea2163c24e13d6bbf84.jpg",
360
+ "text": "$$\ny = f ( x , m )\n$$",
361
+ "text_format": "latex",
362
+ "bbox": [
363
+ 284,
364
+ 895,
365
+ 372,
366
+ 912
367
+ ],
368
+ "page_idx": 2
369
+ },
370
+ {
371
+ "type": "text",
372
+ "text": "To implement $f$ with a neural network, it is necessary to consider design choices like the network architecture, how to train it, and whether it outputs a distribution over possible completions or pixels. We propose the MAE-VQGAN model, which combines ideas from MAE [20] and VQGAN [15]. Following the design of MAE, the model is based on ViT [52, 13] and it is trained via masked auto-encoding by randomly masking image patches and then applying $f$ to reconstruct the image from the non-masked parts. MAE-VQGAN models the distribution $p _ { \\theta } ( z _ { i } | x , m )$ , where $z _ { i } \\in V$ is a visual token from a VQGAN vocabulary $V$ that corresponds to the $i ^ { t h }$ ViT patch. For simplicity, we use a fixed ImageNet pretrained VQGAN codebook.2 Unlike MAE which directly predicts pixels, MAE-VQGAN assigns probabilities to visual tokens via a softmax layer, which is better suited for capturing ambiguities. During training, we obtain ground truth visual tokens by mapping the image to visual tokens indices using the VQGAN encoder. The model is trained using cross entropy loss. ",
373
+ "bbox": [
374
+ 174,
375
+ 90,
376
+ 826,
377
+ 246
378
+ ],
379
+ "page_idx": 3
380
+ },
381
+ {
382
+ "type": "text",
383
+ "text": "Let $\\hat { z } = ( { \\hat { z } } _ { 1 } , . . . , { \\hat { z } } _ { k } )$ be the ordered set of predicted visual tokens. To obtain $\\hat { z } _ { i }$ , we use argmax: ",
384
+ "bbox": [
385
+ 169,
386
+ 251,
387
+ 792,
388
+ 265
389
+ ],
390
+ "page_idx": 3
391
+ },
392
+ {
393
+ "type": "equation",
394
+ "img_path": "images/36aad6b119100f9a4c6777a6de19c0cf4ad704ccbccb12e2abbac4e9674cd914.jpg",
395
+ "text": "$$\n\\hat { z } _ { i } = \\arg \\operatorname* { m a x } _ { z _ { i } } p _ { \\theta } ( z _ { i } | x , m )\n$$",
396
+ "text_format": "latex",
397
+ "bbox": [
398
+ 411,
399
+ 270,
400
+ 584,
401
+ 292
402
+ ],
403
+ "page_idx": 3
404
+ },
405
+ {
406
+ "type": "text",
407
+ "text": "Then, to decode the visual tokens to pixels, we apply VQGAN decoder to $\\hat { z }$ to obtain $y$ ",
408
+ "bbox": [
409
+ 174,
410
+ 296,
411
+ 745,
412
+ 313
413
+ ],
414
+ "page_idx": 3
415
+ },
416
+ {
417
+ "type": "text",
418
+ "text": "3.2 Prompting Inpainting Models ",
419
+ "text_level": 1,
420
+ "bbox": [
421
+ 176,
422
+ 327,
423
+ 419,
424
+ 343
425
+ ],
426
+ "page_idx": 3
427
+ },
428
+ {
429
+ "type": "text",
430
+ "text": "To prompt an inpainting model, we construct a visual prompt, a grid-like image composed of task input-output example(s), and a new query image. The model then has to inpaint the rest of the image such that it is consistent with the task defined in the examples (see Figure 1). ",
431
+ "bbox": [
432
+ 174,
433
+ 353,
434
+ 823,
435
+ 395
436
+ ],
437
+ "page_idx": 3
438
+ },
439
+ {
440
+ "type": "text",
441
+ "text": "Let $S = \\{ ( x _ { i } , y _ { i } ) \\} _ { i = 1 } ^ { n }$ be the set of input-output examples where $x _ { i }$ is an image and $y _ { i }$ is a function of $x _ { i }$ (e.g $y _ { i }$ is a segmentation mask). We assume $n$ is small (one or few examples). Then, given $S$ and a new input query $x _ { q }$ , the goal is to predict the corresponding label $y _ { q }$ . To prompt the inpainting model discussed in Section 3.1, we need to define a function $g$ that maps the examples set $S$ and query image $x _ { q }$ to a new image and a mask: ",
442
+ "bbox": [
443
+ 173,
444
+ 401,
445
+ 825,
446
+ 470
447
+ ],
448
+ "page_idx": 3
449
+ },
450
+ {
451
+ "type": "equation",
452
+ "img_path": "images/8c3643e3c2a4a1e836de013249defa7eed9d3aebe5ed43b88e535219aa3b2535.jpg",
453
+ "text": "$$\n[ x _ { v p } , m ] = g ( S , x _ { q } )\n$$",
454
+ "text_format": "latex",
455
+ "bbox": [
456
+ 431,
457
+ 474,
458
+ 566,
459
+ 492
460
+ ],
461
+ "page_idx": 3
462
+ },
463
+ {
464
+ "type": "text",
465
+ "text": "The image $x _ { v p }$ is the visual prompt and the mask $m$ defines the masked region $f$ has to predict. For a given task, there might exist multiple implementations of $g$ that can be considered. The goal of the inpainting model is to reason about the visual prompt $x _ { v p }$ , and output a plausible completion without performing any additional training: ",
466
+ "bbox": [
467
+ 173,
468
+ 496,
469
+ 825,
470
+ 553
471
+ ],
472
+ "page_idx": 3
473
+ },
474
+ {
475
+ "type": "equation",
476
+ "img_path": "images/9b50b1234d445635d32c942653d15a30b5d4e84ef2f8c155b94e6edaaf466eba.jpg",
477
+ "text": "$$\ny _ { v p } = f ( x _ { v p } , m )\n$$",
478
+ "text_format": "latex",
479
+ "bbox": [
480
+ 441,
481
+ 550,
482
+ 555,
483
+ 568
484
+ ],
485
+ "page_idx": 3
486
+ },
487
+ {
488
+ "type": "text",
489
+ "text": "To obtain $y _ { q }$ , we just take the part of $y _ { v p }$ corresponding to the mask $m$ . ",
490
+ "bbox": [
491
+ 173,
492
+ 569,
493
+ 638,
494
+ 584
495
+ ],
496
+ "page_idx": 3
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "Visual Prompt Engineering. For the visual prompting to work, $g$ should output a good visual prompt, composed of the examples $S$ and query image $x _ { q }$ . Therefore, $g$ has to determine where and how to embed the inputs in the visual prompt image, considering the nature of the completion task. All the functions $g$ used in this work were hard-coded and manually engineered. In most cases, $g$ stacks the examples and image query horizontally by creating an image grid of $( n + 1 ) \\times 2$ cells, where the $i ^ { t h }$ example is placed in the $i ^ { t h }$ row, and the image query is in the last row. The grid has a fixed size, and therefore before populating it the input-output example pair(s) and query are first resized. Another consideration is how to draw every $( x _ { i } , y _ { i } )$ pair. For example, if $y _ { i }$ is a segmentation mask, we can choose to use different colors to draw it. In Section 4.4, we describe different prompt design choices and their effect on the results. ",
501
+ "bbox": [
502
+ 173,
503
+ 589,
504
+ 825,
505
+ 729
506
+ ],
507
+ "page_idx": 3
508
+ },
509
+ {
510
+ "type": "text",
511
+ "text": "Visual Prompt Ensembling. There could be multiple options to define $g$ . The idea in prompt ensembling, inspired by NLP [25, 28], is to construct multiple different prompts, apply the inpainting model $f$ on each prompt individually to obtain a set of predictions. The final prediction can be determined, for example, via majority voting, or weighted average. For simplicity, here we use a simple average. ",
512
+ "bbox": [
513
+ 174,
514
+ 734,
515
+ 825,
516
+ 791
517
+ ],
518
+ "page_idx": 3
519
+ },
520
+ {
521
+ "type": "text",
522
+ "text": "3.3 The Computer Vision Figures Dataset ",
523
+ "text_level": 1,
524
+ "bbox": [
525
+ 174,
526
+ 806,
527
+ 475,
528
+ 821
529
+ ],
530
+ "page_idx": 3
531
+ },
532
+ {
533
+ "type": "text",
534
+ "text": "The images produced by $g$ are by construction not natural. Specifically, these images have a grid-like figure structure that stitches together images coming from different distributions, like natural images and segmentation masks. Therefore, a model trained on a standard dataset (e.g., ImageNet [42]) might struggle to process these grid-like images. To mitigate the domain gap, we collected a new dataset. ",
535
+ "bbox": [
536
+ 174,
537
+ 833,
538
+ 825,
539
+ 888
540
+ ],
541
+ "page_idx": 3
542
+ },
543
+ {
544
+ "type": "image",
545
+ "img_path": "images/8a7b2296c82977e9981ac9504467bad93e2894c68e0e878e8fa9b9751d4e0448.jpg",
546
+ "image_caption": [
547
+ "Figure 3: Random images from our Computer Vision Figures dataset. We curated a dataset of 88k unlabeled figures from Computer Vision academic papers. During training, we randomly sample crops from these figures, without any additional parsing. "
548
+ ],
549
+ "image_footnote": [],
550
+ "bbox": [
551
+ 174,
552
+ 88,
553
+ 823,
554
+ 309
555
+ ],
556
+ "page_idx": 4
557
+ },
558
+ {
559
+ "type": "text",
560
+ "text": "The Computer Vision Figures (Figures) dataset consists of 88, 645 images that more closely resemble the structure of our visual prompts. The dataset was collected from Arxiv, the open-access web archive for scholarly articles from a variety of academic fields. Arxiv sources are publicly available to download starting from 2010. We downloaded all paper sources from 2010 to 2022 and selected the Computer-Vision partition “cs.CV” sources, as they contain images that more closely resemble a grid structure, as shown in Figure 3. To remove unrelated source images like graphs or charts, we manually tagged 2000 images and trained a binary image classifier to assign a high score to source images in a figure-like structure with at least one natural image. We then used the classifier over the entire data to keep only the most informative source images, coming from 23, 302 different papers. We randomly partitioned $9 0 \\%$ of the data to train and left the rest for validation. We include a datasheet with more information in the Supplementary Material. ",
561
+ "bbox": [
562
+ 173,
563
+ 382,
564
+ 825,
565
+ 535
566
+ ],
567
+ "page_idx": 4
568
+ },
569
+ {
570
+ "type": "text",
571
+ "text": "4 Experiments and Results ",
572
+ "text_level": 1,
573
+ "bbox": [
574
+ 176,
575
+ 554,
576
+ 413,
577
+ 571
578
+ ],
579
+ "page_idx": 4
580
+ },
581
+ {
582
+ "type": "text",
583
+ "text": "To study visual prompting, we pretrain different models (see Section 4.1) on ImageNet and on the Figures dataset, then quantitatively evaluate the models using different prompts on simple downstream computer vision tasks (see Section 4.2). Using a synthetic dataset, we assess how the choice of model and data affect the success of visual prompting in Section 4.3, and explore different prompting design choices in Section 4.4. We provide a large variate of qualitative results both in this section as well as in the Supplementary Material. ",
584
+ "bbox": [
585
+ 174,
586
+ 585,
587
+ 825,
588
+ 669
589
+ ],
590
+ "page_idx": 4
591
+ },
592
+ {
593
+ "type": "text",
594
+ "text": "4.1 Models and Baselines ",
595
+ "text_level": 1,
596
+ "bbox": [
597
+ 174,
598
+ 685,
599
+ 362,
600
+ 699
601
+ ],
602
+ "page_idx": 4
603
+ },
604
+ {
605
+ "type": "text",
606
+ "text": "To study the effect of model choice on prompting results, we experiment using different models, including MAE-VQGAN (see Section 3.1) and several other inpainting models briefly described below. ",
607
+ "bbox": [
608
+ 174,
609
+ 710,
610
+ 825,
611
+ 739
612
+ ],
613
+ "page_idx": 4
614
+ },
615
+ {
616
+ "type": "text",
617
+ "text": "VQGAN [15] is an autoregressive transformer model used for inpainting and image generation. Visual tokens are predicted sequentially, line-by-line, and the model is trained using cross-entropy loss. The VQGAN model codebook is used to encode visual tokens, and it is trained beforehand using perceptual loss [26] and GAN loss [17]. We train it on ImageNet and our Figures dataset, following hyperparams in [15], and use a pretrained codebook with a vocabulary of size $| V | = 1 0 2 4$ ",
618
+ "bbox": [
619
+ 174,
620
+ 746,
621
+ 825,
622
+ 815
623
+ ],
624
+ "page_idx": 4
625
+ },
626
+ {
627
+ "type": "text",
628
+ "text": "BEiT [1] is a masked auto-encoder. The model maps each input $1 6 \\times 1 6$ patch to a visual token from a d-VAE [40] vocabulary of size 8192. To encode each visual token, the image is first resized to $1 1 2 \\times 1 1 2$ and then mapped to 196 tokens. We use the publicly available BEiT large model, pretrained on ImageNet-21k. We also pretrain a large BEiT model on Figures for 1000 epochs. ",
629
+ "bbox": [
630
+ 174,
631
+ 820,
632
+ 825,
633
+ 877
634
+ ],
635
+ "page_idx": 4
636
+ },
637
+ {
638
+ "type": "text",
639
+ "text": "MAE [20]. Similar to BEiT, MAEs attempt to reconstruct a masked input image. Unlike in BEiT, the model directly regresses pixels and it is trained with l2 loss. During pretraining, only non-masked tokens are fed into the encoder, which results in a faster training time. We use a publicly released checkpoint pretrained on ImageNet, and pretrain another model for 1000 epochs on our dataset. ",
640
+ "bbox": [
641
+ 174,
642
+ 883,
643
+ 821,
644
+ 911
645
+ ],
646
+ "page_idx": 4
647
+ },
648
+ {
649
+ "type": "table",
650
+ "img_path": "images/1db81a50400c8adca3502953638f6a8929e61f02680144551df2d2433d539ccb.jpg",
651
+ "table_caption": [
652
+ "Table 1: Visual prompting results on computer vision tasks. For Foreground Segmentation and Single Object Detection, we report the mIOU score. For Colorization, we report the MSE. "
653
+ ],
654
+ "table_footnote": [],
655
+ "table_body": "<table><tr><td rowspan=\"2\">Model</td><td colspan=\"4\">Foreground Segmentation ↑</td><td colspan=\"3\">Single Object Detection ↑</td><td colspan=\"3\">Colorization↓</td></tr><tr><td>Split 0</td><td>Split 1</td><td>Split 2</td><td>Split 3</td><td>Split 1</td><td>Split 2</td><td>Split 3</td><td>Split 4</td><td>MSE</td><td>LPIPS</td></tr><tr><td>Copy</td><td>12.92</td><td>17.90</td><td>13.52</td><td>15.29</td><td>12.14</td><td>13.50</td><td>13.03</td><td>12.38</td><td>2.63</td><td>0.75</td></tr><tr><td>BEiT (IN-21k)</td><td>0.38</td><td>0.93</td><td>0.90</td><td>0.95</td><td>0.24</td><td>0.32</td><td>0.19</td><td>0.10</td><td>1.25</td><td>0.73</td></tr><tr><td>VQGAN (IN-1k)</td><td>6.96</td><td>10.55</td><td>9.59</td><td>9.43</td><td>5.19</td><td>4.99</td><td>5.09</td><td>5.10</td><td>2.44</td><td>0.66</td></tr><tr><td>MAE (IN-1k)</td><td>1.92</td><td>6.76</td><td>3.85</td><td>4.57</td><td>1.37</td><td>1.98</td><td>1.62</td><td>1.62</td><td>1.13</td><td>0.87</td></tr><tr><td>MAE-VQGAN (IN-1k)</td><td>2.22</td><td>7.07</td><td>5.48</td><td>6.28</td><td>3.34</td><td>3.21</td><td>2.80</td><td>2.80</td><td>3.31</td><td>0.75</td></tr><tr><td>BEiT (Figures)</td><td>5.38</td><td>3.94</td><td>3.20</td><td>3.29</td><td>0.17</td><td>0.02</td><td>0.14</td><td>0.16</td><td>0.60</td><td>0.70</td></tr><tr><td>VQGAN (Figures)</td><td>12.56</td><td>17.51</td><td>14.27</td><td>15.06</td><td>2.27</td><td>2.37</td><td>2.48</td><td>1.99</td><td>1.50</td><td>0.56</td></tr><tr><td>MAE (Figures)</td><td>17.42</td><td>25.70</td><td>18.64</td><td>16.53</td><td>5.49</td><td>4.98</td><td>5.24</td><td>5.84</td><td>0.43</td><td>0.55</td></tr><tr><td>MAE-VQGAN (Figures)</td><td>27.83</td><td>30.44</td><td>26.15</td><td>24.25</td><td>24.19</td><td>25.20</td><td>25.36</td><td>25.23</td><td>0.67</td><td>0.40</td></tr></table>",
656
+ "bbox": [
657
+ 176,
658
+ 126,
659
+ 823,
660
+ 270
661
+ ],
662
+ "page_idx": 5
663
+ },
664
+ {
665
+ "type": "text",
666
+ "text": "",
667
+ "bbox": [
668
+ 176,
669
+ 297,
670
+ 825,
671
+ 325
672
+ ],
673
+ "page_idx": 5
674
+ },
675
+ {
676
+ "type": "text",
677
+ "text": "Copy Example. This simple baseline simply replicates the first example label as the output. ",
678
+ "bbox": [
679
+ 174,
680
+ 332,
681
+ 776,
682
+ 347
683
+ ],
684
+ "page_idx": 5
685
+ },
686
+ {
687
+ "type": "text",
688
+ "text": "Implementation Details. All the models we describe are large transformer-based models [52, 13], with patch size $1 6 \\times 1 6$ , embedding dim 1024, 24 layers, and 16 heads. For training, we used a machine with 8 Quadro RTX 6000 GPUs, with a batch size of 48. The input image size is $2 2 4 \\times 2 2 4$ ",
689
+ "bbox": [
690
+ 174,
691
+ 352,
692
+ 825,
693
+ 395
694
+ ],
695
+ "page_idx": 5
696
+ },
697
+ {
698
+ "type": "text",
699
+ "text": "4.2 Downstream Computer Vision Tasks ",
700
+ "text_level": 1,
701
+ "bbox": [
702
+ 176,
703
+ 411,
704
+ 467,
705
+ 426
706
+ ],
707
+ "page_idx": 5
708
+ },
709
+ {
710
+ "type": "text",
711
+ "text": "We quantitatively evaluate the inpainting models described above on computer vision tasks. ",
712
+ "bbox": [
713
+ 173,
714
+ 438,
715
+ 771,
716
+ 452
717
+ ],
718
+ "page_idx": 5
719
+ },
720
+ {
721
+ "type": "text",
722
+ "text": "Visual Prompt. Given one example pair and a query image, we structure the prompt in the same fashion for all tasks. We construct a grid of $2 \\times 2$ sub-images, where the example pair is embedded in the first row, and the query image appears in the bottom left cell. See the example in Figure 1. ",
723
+ "bbox": [
724
+ 174,
725
+ 458,
726
+ 825,
727
+ 500
728
+ ],
729
+ "page_idx": 5
730
+ },
731
+ {
732
+ "type": "text",
733
+ "text": "Computer vision tasks. We evaluate the inpainting models on standard image to image tasks like Foreground Segmentation, Single Object Detection and Colorization. ",
734
+ "bbox": [
735
+ 171,
736
+ 506,
737
+ 821,
738
+ 534
739
+ ],
740
+ "page_idx": 5
741
+ },
742
+ {
743
+ "type": "text",
744
+ "text": "• Foreground Segmentation. The goal is to binary-segment the query image to Foreground and Background. The example is an image and corresponding binary segmentation mask. The query is a new image, and the goal is to complete a corresponding segmentation mask. We use the Pascal-5i [45] dataset, which is comprised of 4 different image splits where every split contains between 346 and 725 images and associated segmentation masks. For each class, the data contains a few image-mask pairs, together with held-out image queries. For every image query, we choose one random example pair. To evaluate, every pixel in the completed image is first mapped to the nearest Foreground or Background color. Finally, we report the mean IOU (mIOU) metric. ",
745
+ "bbox": [
746
+ 174,
747
+ 542,
748
+ 825,
749
+ 654
750
+ ],
751
+ "page_idx": 5
752
+ },
753
+ {
754
+ "type": "text",
755
+ "text": "• Single Object Detection. Similarly to Foreground Segmentation, the goal here is to binary-segment the object that appears in the query image. However, this task is more challenging than Foreground Segmentation because the example mask is obtained from a bounding box which is more coarse than a segmentation mask. We use the Pascal VOC 2012 dataset using images and their associated detection boxes. For simplicity, we use Pascal annotations to include only images with a single object and filter out trivial images that have an object covering more than $5 0 \\%$ of the image. We randomly select an example pair and image query of the same object class and repeat the process with 4 different random seeds. For evaluation, we follow a similar process as in Foreground Segmentation to obtain a binary segmentation mask. Then we keep the connected component with the largest area using morphological operations and draw a bounding box around it. We report the mIOU results. ",
756
+ "bbox": [
757
+ 174,
758
+ 659,
759
+ 825,
760
+ 796
761
+ ],
762
+ "page_idx": 5
763
+ },
764
+ {
765
+ "type": "text",
766
+ "text": "• Colorization. The goal is to map a gray-scale image to a color image. The example pair is a grayscaled image and the corresponding color image, as shown in Figures 1 and 4. We randomly sampled 1000 example pairs and image query from ImageNet [42] validation set and converted them to grayscale to obtain gray-scale and color version for each image. We report the MSE loss and LPIPS [60]. ",
767
+ "bbox": [
768
+ 176,
769
+ 803,
770
+ 825,
771
+ 858
772
+ ],
773
+ "page_idx": 5
774
+ },
775
+ {
776
+ "type": "text",
777
+ "text": "Results. We include quantitative results in Table 1, and qualitative completion results in Figure 4. Training on the Figures dataset improves the results for most models in all the downstream tasks. MAE-VQGAN outperforms the other models by a large margin for detection and segmentation and generates much sharper images than the MAE. We find that VQGAN struggles to output accurate results, likely due to sequential decoding. The BEiT model is outperformed by MAE, most likely because its training process is less sample efficient. For more results, see the Supplementary Material. ",
778
+ "bbox": [
779
+ 174,
780
+ 869,
781
+ 825,
782
+ 911
783
+ ],
784
+ "page_idx": 5
785
+ },
786
+ {
787
+ "type": "image",
788
+ "img_path": "images/50fc9c05fe7bec156e23b7112259dfe11ed57bb88e120d184fd3d871bb6d1c68.jpg",
789
+ "image_caption": [
790
+ "Figure 4: Visual prompting prediction examples. Each visual prompt was fed to an MAE-VQGAN model trained on the Figures dataset. For each visual prompt, the result is marked in red. "
791
+ ],
792
+ "image_footnote": [],
793
+ "bbox": [
794
+ 173,
795
+ 88,
796
+ 825,
797
+ 296
798
+ ],
799
+ "page_idx": 6
800
+ },
801
+ {
802
+ "type": "image",
803
+ "img_path": "images/406ff3ca2c3f93e1221d153ed3058b7c8ae47bbc249b604c59a3b16e52b67037.jpg",
804
+ "image_caption": [
805
+ "Figure 5: Synthetic data study results. MAE-VQGAN predictions are annotated with a red square. "
806
+ ],
807
+ "image_footnote": [],
808
+ "bbox": [
809
+ 173,
810
+ 347,
811
+ 825,
812
+ 452
813
+ ],
814
+ "page_idx": 6
815
+ },
816
+ {
817
+ "type": "text",
818
+ "text": "",
819
+ "bbox": [
820
+ 174,
821
+ 501,
822
+ 826,
823
+ 542
824
+ ],
825
+ "page_idx": 6
826
+ },
827
+ {
828
+ "type": "text",
829
+ "text": "4.3 Synthetic Data Study ",
830
+ "text_level": 1,
831
+ "bbox": [
832
+ 174,
833
+ 563,
834
+ 359,
835
+ 578
836
+ ],
837
+ "page_idx": 6
838
+ },
839
+ {
840
+ "type": "text",
841
+ "text": "To assess the compositional prediction capabilities of inpainting models, we created a set of 3 simple synthetic tasks and 3 of their combinations, and evaluated each model on 100 examples per task. ",
842
+ "bbox": [
843
+ 171,
844
+ 589,
845
+ 823,
846
+ 617
847
+ ],
848
+ "page_idx": 6
849
+ },
850
+ {
851
+ "type": "text",
852
+ "text": "Visual Prompt. Given two example pairs and a query image, we structure the prompt in the same fashion for all tasks. We construct a grid of $3 \\times 2$ sub-images, where the example pairs are embedded in the first two rows, and the query image in the bottom left cell. We include examples in Figure 5. ",
853
+ "bbox": [
854
+ 174,
855
+ 623,
856
+ 825,
857
+ 665
858
+ ],
859
+ "page_idx": 6
860
+ },
861
+ {
862
+ "type": "text",
863
+ "text": "Change prediction tasks. Each example pair is an image of a colored shape, and a corresponding image with an introduced change. The change can be either in color, shape, size or a combination of two changes. Next, we describe each individual task in more detail. ",
864
+ "bbox": [
865
+ 174,
866
+ 671,
867
+ 825,
868
+ 713
869
+ ],
870
+ "page_idx": 6
871
+ },
872
+ {
873
+ "type": "text",
874
+ "text": "• Resize. Each example pair contains an image of a circle, and a corresponding image with the circle smaller in size. The goal is to predict the image with the resized version given image query. \n• Shape. Here every example pair is an image with circle, and a corresponding image with a rectangle. Both are similar in size and appear in the same location. The goal is to predict the image with rectangle, given a new image query. \n• Color. Each example pair contains an image of a circle appearing in the same location, with the color changed from green to blue. Given a new image query, the goal is to predict the corresponding image with the circle colored in blue. ",
875
+ "bbox": [
876
+ 173,
877
+ 728,
878
+ 826,
879
+ 854
880
+ ],
881
+ "page_idx": 6
882
+ },
883
+ {
884
+ "type": "text",
885
+ "text": "Evaluation. We map each predicted pixel to its nearest neighbor color from a predefined set of options: black, white, blue, or green. We then measure and report the color-aware mIOU, by considering pixel predictions that appear in the ground-truth shape color as foreground and treat the rest as background. ",
886
+ "bbox": [
887
+ 174,
888
+ 869,
889
+ 826,
890
+ 911
891
+ ],
892
+ "page_idx": 6
893
+ },
894
+ {
895
+ "type": "table",
896
+ "img_path": "images/c5de3f8db561a9cba1d81db9ee467b7b05c3b4790be20b1906c5255ef0c408ba.jpg",
897
+ "table_caption": [
898
+ "Table 2: Synthetic data study results. We report the color-aware mIOU on the six tasks. "
899
+ ],
900
+ "table_footnote": [],
901
+ "table_body": "<table><tr><td></td><td>Color</td><td>Shape</td><td>Size</td><td>Color &amp; Shape</td><td>Color &amp; Size</td><td>Shape &amp; Size</td></tr><tr><td>Copy</td><td>5.53</td><td>6.71</td><td>1.17</td><td>6.74</td><td>1.17</td><td>1.86</td></tr><tr><td>VQGAN (IN-1k)</td><td>0.91</td><td>6.51</td><td>6.24</td><td>2.40</td><td>0.70</td><td>6.53</td></tr><tr><td>BEiT (IN-22k)</td><td>15.99</td><td>9.08</td><td>1.26</td><td>7.23</td><td>2.84</td><td>2.66</td></tr><tr><td>MAE (IN-1k)</td><td>0.00</td><td>2.07</td><td>1.20</td><td>0.00</td><td>0.00</td><td>1.56</td></tr><tr><td>MAE-VQGAN (IN-1k)</td><td>0.13</td><td>2.94</td><td>3.71</td><td>0.00</td><td>0.01</td><td>3.60</td></tr><tr><td>VQGAN (Figures)</td><td>6.96</td><td>19.11</td><td>16.21</td><td>7.40</td><td>2.24</td><td>18.41</td></tr><tr><td>BEiT (Figures)</td><td>40.92</td><td>31.43</td><td>7.12</td><td>33.10</td><td>21.21</td><td>12.98</td></tr><tr><td>MAE (Figures)</td><td>70.23</td><td>43.99</td><td>34.72</td><td>19.30</td><td>18.99</td><td>46.02</td></tr><tr><td>MAE-VQGAN (Figures)</td><td>40.40</td><td>46.53</td><td>42.04</td><td>20.41</td><td>18.27</td><td>40.33</td></tr></table>",
902
+ "bbox": [
903
+ 178,
904
+ 112,
905
+ 825,
906
+ 268
907
+ ],
908
+ "page_idx": 7
909
+ },
910
+ {
911
+ "type": "table",
912
+ "img_path": "images/3b2c686288b3706107418d16844eea4e2f4ebf008cf28a808b6adcc6d4070a2e.jpg",
913
+ "table_caption": [
914
+ "Table 3: Comparison to Fine Tuning and Classic 1-Shot Segmentation baselines. MAE-VQGAN image query and output resolution is $1 1 1 \\times 1 1 1$ . CyCTR and FWB resolution is $4 7 3 \\times 4 7 3$ and $5 1 2 \\times 5 1 2$ , both approach utilize Pascal 5i labeled baseclasses data. "
915
+ ],
916
+ "table_footnote": [],
917
+ "table_body": "<table><tr><td>Pretraining</td><td># Labeled Images</td><td># Shots</td><td>Model</td><td>Split 0</td><td>Split 1</td><td>Split 2</td><td>Split3</td></tr><tr><td rowspan=\"3\">Unlabeled ImageNet</td><td>1 4</td><td>1</td><td rowspan=\"3\">Finetune MAE</td><td>11.1</td><td>13.4</td><td>13.0</td><td>12.3</td></tr><tr><td></td><td>4</td><td>12.9</td><td>15.8</td><td>14.3</td><td>15.0</td></tr><tr><td>16</td><td>16</td><td>13.7</td><td>16.1</td><td>16.8</td><td>17.1</td></tr><tr><td>Unlabeled Figures</td><td>1</td><td>1</td><td>MAE-VQGAN</td><td>32.5</td><td>33.8</td><td>32.7</td><td>27.2</td></tr><tr><td rowspan=\"2\">Labeled Pascal 5i (Segmentation masks)</td><td rowspan=\"2\">2086-5883</td><td>1</td><td>FWB [36]</td><td>51.3</td><td>64.5</td><td>56.7</td><td>52.2</td></tr><tr><td>1</td><td>CyCTR [59]</td><td>67.2</td><td>71.1</td><td>57.6</td><td>59.0</td></tr></table>",
918
+ "bbox": [
919
+ 176,
920
+ 333,
921
+ 821,
922
+ 443
923
+ ],
924
+ "page_idx": 7
925
+ },
926
+ {
927
+ "type": "text",
928
+ "text": "Results. The results are presented in Table 2, for MAE-VQGAN prediction examples see Figure 5. Without training on the Figures dataset, inpainting models fail to generalize to these previously unseen tasks. The performance of all models improves when they are trained on the Figures dataset. Yet, the same models struggle with combinations of tasks due to the increasing complexity. The VQGAN model utilizes sequential decoding and therefore lacks context, which leads to poor performance. The MAE model outperforms MAE-VQGAN on color, and BEiT performs poorly in size. These models rely on pretrained codebooks (VQGAN and dVAE) that are likely not geared towards these tasks. ",
929
+ "bbox": [
930
+ 173,
931
+ 468,
932
+ 826,
933
+ 566
934
+ ],
935
+ "page_idx": 7
936
+ },
937
+ {
938
+ "type": "image",
939
+ "img_path": "images/4d479f20ec0adabd6774aab11ac2476fb287114cc60ec55bf15ccb2bad7e6151.jpg",
940
+ "image_caption": [
941
+ "Figure 6: More examples, better results. Left: we construct visual prompts with increasing number of inputoutput pair examples, for a fixed query image (inpaintings annotated in red). Right: We observe that more examples improve the overall mIOU results on the four Pascal-5i splits. "
942
+ ],
943
+ "image_footnote": [],
944
+ "bbox": [
945
+ 174,
946
+ 579,
947
+ 825,
948
+ 714
949
+ ],
950
+ "page_idx": 7
951
+ },
952
+ {
953
+ "type": "text",
954
+ "text": "4.4 Analysis ",
955
+ "text_level": 1,
956
+ "bbox": [
957
+ 174,
958
+ 787,
959
+ 271,
960
+ 803
961
+ ],
962
+ "page_idx": 7
963
+ },
964
+ {
965
+ "type": "text",
966
+ "text": "Comparison to finetuning and Few-Shot baselines. We include a comparison to baselines that utilize $K = \\{ 1 , 4 , 1 6 \\}$ training examples for each target class. For completeness, we also include the results of FWB [36] and CyCTR [59], classic 1-shot baselines, which we view as an upper-bound of our approach. FWB and CyCTR utilize a fully labeled base classes train set (2086 to 5883 on different Pascal 5i splits). Additionally, their architecture was designed for the foreground segmentation task (e.g, they operate in higher resolution). The results in Table 3 indicate that the Visual Prompting results of MAE-VQGAN trained on Figures are significantly superior to standard finetuning baselines of MAEs pretrained on unlabeled ImageNet. FWB [36] and CyCTR [59] outperform Visual Prompting, mainly because they pretrain on a large tagged base classes dataset and utilize architectures that are specific to image segmentation. ",
967
+ "bbox": [
968
+ 174,
969
+ 814,
970
+ 825,
971
+ 911
972
+ ],
973
+ "page_idx": 7
974
+ },
975
+ {
976
+ "type": "text",
977
+ "text": "",
978
+ "bbox": [
979
+ 174,
980
+ 90,
981
+ 825,
982
+ 133
983
+ ],
984
+ "page_idx": 8
985
+ },
986
+ {
987
+ "type": "text",
988
+ "text": "Dataset effect. We evaluate the effect of pretraining on a larger and more diverse dataset. We compare training on ImageNet only, Figures only, and a combination of the two. We report the mIOU results on Pascal 5i for Foreground Segmentation in Figure 7. The MAE-VQGAN trained on ImageNet achieves a consistently low $\\sim 5$ points mIOU. The model trained on the combined dataset performs best, which demonstrates that MAE-VQGAN can benefit from additional amounts of unlabeled images. ",
989
+ "bbox": [
990
+ 174,
991
+ 140,
992
+ 550,
993
+ 263
994
+ ],
995
+ "page_idx": 8
996
+ },
997
+ {
998
+ "type": "text",
999
+ "text": "More examples, better results. We study how increasing the number of input-output pair examples in the visual prompt affects the results. Intuitively, we expect that including more examples should reduce ambiguities and lead to better results. We use an MAE-VQGAN pretrained on the Figures dataset, and use data from PASCAL-5i. We construct a large grid that can populate up to 8 examples and an image query. We randomly choose different numbers of examples and randomize the placements. The results in Figure 6 confirm that using more examples leads to better segmentation results. ",
1000
+ "bbox": [
1001
+ 174,
1002
+ 271,
1003
+ 547,
1004
+ 353
1005
+ ],
1006
+ "page_idx": 8
1007
+ },
1008
+ {
1009
+ "type": "image",
1010
+ "img_path": "images/5b45da93e6131f551712beeb89669a58ba627d761ff1210e58753c722072bc3e.jpg",
1011
+ "image_caption": [
1012
+ "Figure 7: Training MAE-VQGAN on more data improves visual prompting results. Foreground Segmentation results on Pascal5i, when trained over the Figures dataset and on the combined Figuresand ImageNet dataset. "
1013
+ ],
1014
+ "image_footnote": [],
1015
+ "bbox": [
1016
+ 562,
1017
+ 145,
1018
+ 823,
1019
+ 258
1020
+ ],
1021
+ "page_idx": 8
1022
+ },
1023
+ {
1024
+ "type": "text",
1025
+ "text": "",
1026
+ "bbox": [
1027
+ 176,
1028
+ 354,
1029
+ 823,
1030
+ 395
1031
+ ],
1032
+ "page_idx": 8
1033
+ },
1034
+ {
1035
+ "type": "text",
1036
+ "text": "Prompt Engineering. We explore the effect of constructing different visual prompts for Foreground Segmentation and their corresponding MAE-VQGAN results (see Figure 8.a-b). The model generates plausible completions when changing the prompt layout (e.g. horizontal order vs. vertical order) and when changing the mask colors, texture or using only edges (see Figure 9). The mIOU results in Table 4 indicate that the model performs better with a vertical layout and when the segmentation mask colors are black and white. Interestingly, by analyzing the average attention heads of a masked patch token, we observe that the attention changes following the change in the prompts layout (see Figures 8.d-e). ",
1037
+ "bbox": [
1038
+ 174,
1039
+ 401,
1040
+ 549,
1041
+ 580
1042
+ ],
1043
+ "page_idx": 8
1044
+ },
1045
+ {
1046
+ "type": "text",
1047
+ "text": "Prompt Ensembling. Inspired by Prompt Ensembling in NLP [28], given the same example pair and image query, we construct multiple different visual prompts (e.g, horizontal and vertical layouts, see Figure 8.a-b). We then average the completion results. The results in Table 4 on the Synthetic Study tasks demonstrate that utilizing multiple prompts can lead to improved, and more stable performance. ",
1048
+ "bbox": [
1049
+ 174,
1050
+ 587,
1051
+ 549,
1052
+ 698
1053
+ ],
1054
+ "page_idx": 8
1055
+ },
1056
+ {
1057
+ "type": "image",
1058
+ "img_path": "images/77bec893e9ddaa82e5ff92d096e940d40c9d7807bcd2a29f7903fed058b30fc8.jpg",
1059
+ "image_caption": [
1060
+ "Figure 8: Prompt layout design. Two prompt orderings, and the corresponding average attention maps of the selected patch (annotated with black bounding box). The highest attention values appear on similar (corresponding) areas in the query image. "
1061
+ ],
1062
+ "image_footnote": [],
1063
+ "bbox": [
1064
+ 562,
1065
+ 405,
1066
+ 821,
1067
+ 618
1068
+ ],
1069
+ "page_idx": 8
1070
+ },
1071
+ {
1072
+ "type": "text",
1073
+ "text": "Style/content extrapolation. Inspired by the classic example from Tenenbaum and Freeman [47] (on the task originally suggested by Hofstadter [24]), we use MAE-VQGAN to extrapolate letter sequences printed in different fonts (see Figure 10). We find that the model can extrapolate given style and new content (Figure 10a) but that it struggles to extrapolate new content (Figure 10b). The model also struggles to extrapolate more complex letter sequences; the performance deteriorates even if both style and content are given (Figure 10 c-d). ",
1074
+ "bbox": [
1075
+ 174,
1076
+ 704,
1077
+ 825,
1078
+ 787
1079
+ ],
1080
+ "page_idx": 8
1081
+ },
1082
+ {
1083
+ "type": "text",
1084
+ "text": "Limitations. The focus of this work is to present a proof of concept that shows it is possible to visually prompt simple image inpainting models trained on noisy, unlabeled data. Specifically, we demonstrate how to pre-train a network once, then prompt it to perform reasonably well on many tasks. The fact that this is possible is surprising and scientifically interesting, although this approach is not competitive with supervised task-specific models. For visual prompting to work, the inpainting models require training on the Computer Vision Figures dataset. However, our initial experiments suggest that it can benefit from training on additional natural image data (see Figure 7). Other limitations include ambiguities in the task definition, reliance on a pretrained VQGAN decoder, and worse performance when the input-output example(s) are not aligned (see examples in Figure 11). ",
1085
+ "bbox": [
1086
+ 173,
1087
+ 794,
1088
+ 825,
1089
+ 891
1090
+ ],
1091
+ "page_idx": 8
1092
+ },
1093
+ {
1094
+ "type": "image",
1095
+ "img_path": "images/9b26e80b8533e1e791b620e9e99bb0d8ae1c1b03809149bdcab2c09bcad72cfe.jpg",
1096
+ "image_caption": [
1097
+ "Figure 9: Task performance under different label choices. Prompting results when using different mask colors (e.g, purple/yellow vs. green/red), when drawing full mask compared to edges only, and when changing the mask texture. Compared to other alternatives, purple/yellow and black/white (see Figure 8) masks works best. "
1098
+ ],
1099
+ "image_footnote": [],
1100
+ "bbox": [
1101
+ 174,
1102
+ 88,
1103
+ 823,
1104
+ 184
1105
+ ],
1106
+ "page_idx": 9
1107
+ },
1108
+ {
1109
+ "type": "table",
1110
+ "img_path": "images/0e5f79f94b0c37d10c59b3f428842c3c371dba2a465aaf69283a9cb421d70171.jpg",
1111
+ "table_caption": [
1112
+ "Table 4: Prompt Engineering. Foreground Segmentation mIOU results on Pascal-5i when using different prompt colors. "
1113
+ ],
1114
+ "table_footnote": [],
1115
+ "table_body": "<table><tr><td></td><td>Horizontal</td><td>Vertical</td></tr><tr><td>Black/White</td><td>27.17</td><td>31.57</td></tr><tr><td>Purple/Yellow</td><td>23.44</td><td>28.47</td></tr></table>",
1116
+ "bbox": [
1117
+ 176,
1118
+ 295,
1119
+ 475,
1120
+ 356
1121
+ ],
1122
+ "page_idx": 9
1123
+ },
1124
+ {
1125
+ "type": "table",
1126
+ "img_path": "images/6a883fd5b41d08cc3e35bc5d2800189148379b554e7eed1aa09d40c3a153d28c.jpg",
1127
+ "table_caption": [
1128
+ "Table 5: Prompt Ensembling. We report here color-aware mIOU. In every line, the result is based on an ensemble of all previous prompts. "
1129
+ ],
1130
+ "table_footnote": [],
1131
+ "table_body": "<table><tr><td>Prompt Layout</td><td>Color</td><td>Shape</td><td>Size</td></tr><tr><td>Horizontal</td><td>39.97</td><td>46.54</td><td>42.01</td></tr><tr><td>+ Vertical</td><td>41.31</td><td>54.71</td><td>46.18</td></tr><tr><td>+ Vertical w/ Rows Swap</td><td>44.14</td><td>60.42</td><td>49.42</td></tr></table>",
1132
+ "bbox": [
1133
+ 508,
1134
+ 295,
1135
+ 820,
1136
+ 354
1137
+ ],
1138
+ "page_idx": 9
1139
+ },
1140
+ {
1141
+ "type": "image",
1142
+ "img_path": "images/f72269bb4b1dfe33e456cc91aca8532c2467560cd63dbebe6b8e5aeff5c72189.jpg",
1143
+ "image_caption": [
1144
+ "Figure 10: Style and content extrapolation using MAE-VQGAN. The model can extrapolate the style of a new content (a), but fails to predict a new content (b). The model struggles to extrapolate new style and content of longer sequences (c-e). "
1145
+ ],
1146
+ "image_footnote": [],
1147
+ "bbox": [
1148
+ 174,
1149
+ 364,
1150
+ 825,
1151
+ 470
1152
+ ],
1153
+ "page_idx": 9
1154
+ },
1155
+ {
1156
+ "type": "text",
1157
+ "text": "",
1158
+ "bbox": [
1159
+ 171,
1160
+ 544,
1161
+ 825,
1162
+ 573
1163
+ ],
1164
+ "page_idx": 9
1165
+ },
1166
+ {
1167
+ "type": "image",
1168
+ "img_path": "images/5c145695da893b1cc8057206066e75a10d2b1e2224940ab735f49ec32149595b.jpg",
1169
+ "image_caption": [
1170
+ "Figure 11: Limitations and failure cases. Single input-output example might be ambiguous and can lead to unintended completions. The MAE-VQGAN model performs worse given non-aligned input-output example, and by using a VQGAN vocabulary, it is limited in synthesizing out-of-distribution pixels (like blurry images). "
1171
+ ],
1172
+ "image_footnote": [],
1173
+ "bbox": [
1174
+ 174,
1175
+ 584,
1176
+ 823,
1177
+ 693
1178
+ ],
1179
+ "page_idx": 9
1180
+ },
1181
+ {
1182
+ "type": "text",
1183
+ "text": "5 Discussion ",
1184
+ "text_level": 1,
1185
+ "bbox": [
1186
+ 173,
1187
+ 750,
1188
+ 294,
1189
+ 766
1190
+ ],
1191
+ "page_idx": 9
1192
+ },
1193
+ {
1194
+ "type": "text",
1195
+ "text": "Why does our proposed method, despite its simplicity, perform so well on a large subset of visual tasks? At this point, we do not have a good answer. Clearly, the specific training data we use plays an important role, but the amount of generalization observed is still surprising. Perhaps some of these image-to-image tasks are actually simpler than we believed. But it’s also evident that contemporary large-scale inpainting models are learning quite sophisticated long-range co-occurrences and symmetries in the data which can often enable impressive visual reasoning. We hope that our work will encourage further research to better our understanding of what is being learned by inpainting. ",
1196
+ "bbox": [
1197
+ 173,
1198
+ 780,
1199
+ 825,
1200
+ 878
1201
+ ],
1202
+ "page_idx": 9
1203
+ },
1204
+ {
1205
+ "type": "text",
1206
+ "text": "Acknowledgements: We would like to thank Assaf Shocher for insightful discussions and ideas related to the Figures dataset. We thank Aaron Hertzmann, Sanjay Subramanian, Ofir Press and Ben Bogin for helpful feedback on the manuscript. This project has received funding from the European Research Council (ERC) under the European Unions Horizon 2020 research and innovation programme (grant ERC HOLI 819080). Prof. Darrell’s group was supported in part by DoD including DARPA’s LwLL and/or SemaFor programs, as well as BAIR’s industrial alliance programs. Prof. Efros’s group was supported by in part by DoD including DARPA’s MCS and/or ONR MURI, as well as funding from SAP. ",
1207
+ "bbox": [
1208
+ 173,
1209
+ 90,
1210
+ 826,
1211
+ 202
1212
+ ],
1213
+ "page_idx": 10
1214
+ },
1215
+ {
1216
+ "type": "text",
1217
+ "text": "References ",
1218
+ "text_level": 1,
1219
+ "bbox": [
1220
+ 174,
1221
+ 219,
1222
+ 266,
1223
+ 236
1224
+ ],
1225
+ "page_idx": 10
1226
+ },
1227
+ {
1228
+ "type": "text",
1229
+ "text": "[1] Bao, H., Dong, L., Wei, F.: Beit: Bert pre-training of image transformers. arXiv preprint arXiv:2106.08254 (2021) \n[2] Bar, A., Wang, X., Kantorov, V., Reed, C.J., Herzig, R., Chechik, G., Rohrbach, A., Darrell, T., Globerson, A.: Detreg: Unsupervised pretraining with region priors for object detection. arXiv preprint arXiv:2106.04550 (2021) [3] Barnes, C., Shechtman, E., Finkelstein, A., Goldman, D.B.: Patchmatch: A randomized correspondence algorithm for structural image editing. ACM Trans. Graph. 28(3), 24 (2009) [4] Bertalmio, M., Sapiro, G., Caselles, V., Ballester, C.: Image inpainting. In: Proceedings of the 27th annual conference on Computer graphics and interactive techniques. pp. 417–424 (2000) \n[5] Brown, T.B., Mann, B., Ryder, N., Subbiah, M., Kaplan, J., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., Agarwal, S., Herbert-Voss, A., Krueger, G., Henighan, T., Child, R., Ramesh, A., Ziegler, D.M., Wu, J., Winter, C., Hesse, C., Chen, M., Sigler, E., Litwin, M., Gray, S., Chess, B., Clark, J., Berner, C., McCandlish, S., Radford, A., Sutskever, I., Amodei, D.: Language models are few-shot learners. CoRR abs/2005.14165 (2020), https://arxiv.org/abs/2005.14165 [6] Caron, M., Misra, I., Mairal, J., Goyal, P., Bojanowski, P., Joulin, A.: Unsupervised learning of visual features by contrasting cluster assignments. NeurIPS (2020) \n[7] Chang, H., Zhang, H., Jiang, L., Liu, C., Freeman, W.T.: Maskgit: Masked generative image transformer. arXiv preprint arXiv:2202.04200 (2022) \n[8] Chen, M., Radford, A., Child, R., Wu, J., Jun, H., Luan, D., Sutskever, I.: Generative pretraining from pixels. In: International Conference on Machine Learning. pp. 1691–1703. PMLR (2020) \n[9] Chen, T., Kornblith, S., Norouzi, M., Hinton, G.: A simple framework for contrastive learning of visual representations. arXiv preprint arXiv:2002.05709 (2020) \n[10] Chen, X., Fan, H., Girshick, R., He, K.: Improved baselines with momentum contrastive learning. arXiv preprint arXiv:2003.04297 (2020) \n[11] Criminisi, A., Pérez, P., Toyama, K.: Region filling and object removal by exemplar-based image inpainting. IEEE Transactions on image processing 13(9), 1200–1212 (2004) \n[12] Devlin, J., Chang, M.W., Lee, K., Toutanova, K.: Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 (2018) \n[13] Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al.: An image is worth 16x16 words: Transformers for image recognition at scale. arXiv preprint arXiv:2010.11929 (2020) \n[14] Efros, A.A., Leung, T.K.: Texture synthesis by non-parametric sampling. In: IEEE International Conference on Computer Vision. pp. 1033–1038. Corfu, Greece (September 1999) \n[15] Esser, P., Rombach, R., Ommer, B.: Taming transformers for high-resolution image synthesis. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. pp. 12873–12883 (2021) \n[16] Gidaris, S., Bursuc, A., Komodakis, N., Pérez, P., Cord, M.: Learning representations by predicting bags of visual words. In: CVPR (2020) \n[17] Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., Bengio, Y.: Generative adversarial nets. Advances in neural information processing systems 27 (2014) \n[18] Goyal, P., Mahajan, D., Gupta, A., Misra, I.: Scaling and benchmarking self-supervised visual representation learning. In: ICCV (2019) \n[19] Hays, J., Efros, A.A.: Scene completion using millions of photographs. ACM Transactions on Graphics (SIGGRAPH 2007) 26(3) (2007) \n[20] He, K., Chen, X., Xie, S., Li, Y., Dollár, P., Girshick, R.B.: Masked autoencoders are scalable vision learners. CoRR abs/2111.06377 (2021), https://arxiv.org/abs/2111.06377 \n[21] He, K., Fan, H., Wu, Y., Xie, S., Girshick, R.: Momentum contrast for unsupervised visual representation learning. In: CVPR (2020) \n[22] Hertzmann, A., Jacobs, C.E., Oliver, N., Curless, B., Salesin, D.H.: Image analogies. In: Proceedings of the 28th annual conference on Computer graphics and interactive techniques. pp. 327–340 (2001) \n[23] Hill, F., Santoro, A., Barrett, D.G., Morcos, A.S., Lillicrap, T.: Learning to make analogies by contrasting abstract relational structure. arXiv preprint arXiv:1902.00120 (2019) \n[24] Hofstadter, D.R.: Fluid concepts and creative analogies: Computer models of the fundamental mechanisms of thought. Basic books (1995) \n[25] Jiang, Z., Xu, F.F., Araki, J., Neubig, G.: How can we know what language models know? Transactions of the Association for Computational Linguistics 8, 423–438 (2020) \n[26] Johnson, J., Alahi, A., Fei-Fei, L.: Perceptual losses for real-time style transfer and super-resolution. In: European conference on computer vision. pp. 694–711. Springer (2016) \n[27] Kang, B., Liu, Z., Wang, X., Yu, F., Feng, J., Darrell, T.: Few-shot object detection via feature reweighting. In: Proceedings of the IEEE/CVF International Conference on Computer Vision. pp. 8420–8429 (2019) \n[28] Lester, B., Al-Rfou, R., Constant, N.: The power of scale for parameter-efficient prompt tuning. CoRR abs/2104.08691 (2021), https://arxiv.org/abs/2104.08691 \n[29] Li, X.L., Liang, P.: Prefix-tuning: Optimizing continuous prompts for generation. arXiv preprint arXiv:2101.00190 (2021) \n[30] Liu, G., Reda, F.A., Shih, K.J., Wang, T.C., Tao, A., Catanzaro, B.: Image inpainting for irregular holes using partial convolutions. In: Proceedings of the European conference on computer vision (ECCV). pp. 85–100 (2018) \n[31] Liu, G., Reda, F.A., Shih, K.J., Wang, T.C., Tao, A., Catanzaro, B.: Image inpainting for irregular holes using partial convolutions. In: Proceedings of the European Conference on Computer Vision (ECCV) (September 2018) \n[32] Liu, Y., Zhang, X., Zhang, S., He, X.: Part-aware prototype network for few-shot semantic segmentation. In: European Conference on Computer Vision. pp. 142–158. Springer (2020) \n[33] Lu, Y., Bartolo, M., Moore, A., Riedel, S., Stenetorp, P.: Fantastically ordered prompts and where to find them: Overcoming few-shot prompt order sensitivity. arXiv preprint arXiv:2104.08786 (2021) \n[34] Memisevic, R., Hinton, G.: Unsupervised learning of image transformations. In: 2007 IEEE Conference on Computer Vision and Pattern Recognition. pp. 1–8. IEEE (2007) \n[35] Misra, I., Maaten, L.v.d.: Self-supervised learning of pretext-invariant representations. In: CVPR (2020) \n[36] Nguyen, K., Todorovic, S.: Feature weighting and boosting for few-shot segmentation. In: Proceedings of the IEEE/CVF International Conference on Computer Vision. pp. 622–631 (2019) \n[37] Van den Oord, A., Li, Y., Vinyals, O.: Representation learning with contrastive predictive coding. arXiv e-prints pp. arXiv–1807 (2018) \n[38] Pathak, D., Krahenbuhl, P., Donahue, J., Darrell, T., Efros, A.A.: Context encoders: Feature learning by inpainting. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 2536–2544 (2016) \n[39] Radford, A., Wu, J., Child, R., Luan, D., Amodei, D., Sutskever, I., et al.: Language models are unsupervised multitask learners. OpenAI blog 1(8), 9 (2019) \n[40] Ramesh, A., Pavlov, M., Goh, G., Gray, S., Voss, C., Radford, A., Chen, M., Sutskever, I.: Zero-shot text-to-image generation. In: International Conference on Machine Learning. pp. 8821–8831. PMLR (2021) \n[41] Reed, S.E., Zhang, Y., Zhang, Y., Lee, H.: Deep visual analogy-making. Advances in neural information processing systems 28 (2015) \n[42] Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M., Berg, A.C., Fei-Fei, L.: ImageNet Large Scale Visual Recognition Challenge. International Journal of Computer Vision (IJCV) 115(3), 211–252 (2015). https://doi.org/10.1007/s11263-015-0816-y \n[43] Sadeghi, F., Zitnick, C.L., Farhadi, A.: Visalogy: Answering visual analogy questions. Advances in Neural Information Processing Systems 28 (2015) \n[44] Sarzynska-Wawer, J., Wawer, A., Pawlak, A., Szymanowska, J., Stefaniak, I., Jarkiewicz, M., Okruszek, L.: Detecting formal thought disorder by deep contextualized word representations. Psychiatry Research 304, 114135 (2021) \n[45] Shaban, A., Bansal, S., Liu, Z., Essa, I., Boots, B.: One-shot learning for semantic segmentation. CoRR abs/1709.03410 (2017), http://arxiv.org/abs/1709.03410 \n[46] Taylor, G.W., Fergus, R., LeCun, Y., Bregler, C.: Convolutional learning of spatio-temporal features. In: European conference on computer vision. pp. 140–153. Springer (2010) \n[47] Tenenbaum, J.B., Freeman, W.T.: Separating style and content with bilinear models. Neural computation 12(6), 1247–1283 (2000) \n[48] Tian, Z., Zhao, H., Shu, M., Yang, Z., Li, R., Jia, J.: Prior guided feature enrichment network for few-shot segmentation. IEEE transactions on pattern analysis and machine intelligence (2020) \n[49] Ulyanov, D., Vedaldi, A., Lempitsky, V.: Deep image prior. arXiv:1711.10925 (2017) \n[50] Upchurch, P., Snavely, N., Bala, K.: From a to z: supervised transfer of style and content using deep neural network generators. arXiv preprint arXiv:1603.02003 (2016) \n[51] Van Den Oord, A., Vinyals, O., et al.: Neural discrete representation learning. Advances in neural information processing systems 30 (2017) \n[52] Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A.N., Kaiser, Ł., Polosukhin, I.: Attention is all you need. Advances in neural information processing systems 30 (2017) \n[53] Wang, X., Huang, T.E., Darrell, T., Gonzalez, J.E., Yu, F.: Frustratingly simple few-shot object detection. arXiv preprint arXiv:2003.06957 (2020) \n[54] Xie, Z., Zhang, Z., Cao, Y., Lin, Y., Bao, J., Yao, Z., Dai, Q., Hu, H.: Simmim: A simple framework for masked image modeling. arXiv preprint arXiv:2111.09886 (2021) \n[55] Yang, B., Liu, C., Li, B., Jiao, J., Ye, Q.: Prototype mixture models for few-shot semantic segmentation. In: European Conference on Computer Vision. pp. 763–778. Springer (2020) \n[56] Yang, C., Lu, X., Lin, Z., Shechtman, E., Wang, O., Li, H.: High-resolution image inpainting using multi-scale neural patch synthesis. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 6721–6729 (2017) \n[57] Yu, J., Li, X., Koh, J.Y., Zhang, H., Pang, R., Qin, J., Ku, A., Xu, Y., Baldridge, J., Wu, Y.: Vector-quantized image modeling with improved vqgan. arXiv preprint arXiv:2110.04627 (2021) \n[58] Yu, Y., Zhan, F., Wu, R., Pan, J., Cui, K., Lu, S., Ma, F., Xie, X., Miao, C.: Diverse image inpainting with bidirectional and autoregressive transformers. In: Proceedings of the 29th ACM International Conference on Multimedia. pp. 69–78 (2021) \n[59] Zhang, G., Kang, G., Yang, Y., Wei, Y.: Few-shot segmentation via cycle-consistent transformer. Advances in Neural Information Processing Systems 34 (2021) \n[60] Zhang, R., Isola, P., Efros, A.A., Shechtman, E., Wang, O.: The unreasonable effectiveness of deep features as a perceptual metric. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 586–595 (2018) ",
1230
+ "bbox": [
1231
+ 173,
1232
+ 244,
1233
+ 826,
1234
+ 916
1235
+ ],
1236
+ "page_idx": 10
1237
+ },
1238
+ {
1239
+ "type": "text",
1240
+ "text": "",
1241
+ "bbox": [
1242
+ 171,
1243
+ 94,
1244
+ 830,
1245
+ 912
1246
+ ],
1247
+ "page_idx": 11
1248
+ },
1249
+ {
1250
+ "type": "text",
1251
+ "text": "",
1252
+ "bbox": [
1253
+ 171,
1254
+ 88,
1255
+ 828,
1256
+ 571
1257
+ ],
1258
+ "page_idx": 12
1259
+ }
1260
+ ]
parse/dev/o4uFFg9_TpV/o4uFFg9_TpV_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/dev/o4uFFg9_TpV/o4uFFg9_TpV_model.json ADDED
The diff for this file is too large to render. See raw diff