ZHANGYUXUAN-zR commited on
Commit
9a2ac2b
·
verified ·
1 Parent(s): 2b44614

Add files using upload-large-folder tool

Browse files
parse/train/B1lnbRNtwr/B1lnbRNtwr.md ADDED
@@ -0,0 +1,213 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # GLOBAL RELATIONAL MODELS OF SOURCE CODE
2
+
3
+ Vincent J. Hellendoorn, Petros Maniatis, Rishabh Singh, Charles Sutton, David Bieber Google Research {vhellendoorn,maniatis,rising,charlessutton,dbieber}@google.com
4
+
5
+ # ABSTRACT
6
+
7
+ Models of code can learn distributed representations of a program’s syntax and semantics to predict many non-trivial properties of a program. Recent state-ofthe-art models leverage highly structured representations of programs, such as trees, graphs and paths therein (e.g., data-flow relations), which are precise and abundantly available for code. This provides a strong inductive bias towards semantically meaningful relations, yielding more generalizable representations than classical sequence-based models. Unfortunately, these models primarily rely on graph-based message passing to represent relations in code, which makes them de facto local due to the high cost of message-passing steps, quite in contrast to modern, global sequence-based models, such as the Transformer. In this work, we bridge this divide between global and structured models by introducing two new hybrid model families that are both global and incorporate structural bias: Graph Sandwiches, which wrap traditional (gated) graph message-passing layers in sequential message-passing layers; and Graph Relational Embedding Attention Transformers (GREAT for short), which bias traditional Transformers with relational information from graph edge types. By studying a popular, non-trivial program repair task, variable-misuse identification, we explore the relative merits of traditional and hybrid model families for code representation. Starting with a graph-based model that already improves upon the prior state-of-the-art for this task by $20 \%$ , we show that our proposed hybrid models improve an additional $1 0 { - } 1 5 \%$ , while training both faster and using fewer parameters.
8
+
9
+ # 1 INTRODUCTION
10
+
11
+ Well-trained models of source code can learn complex properties of a program, such as its implicit type structure (Hellendoorn et al., 2018), naming conventions (Allamanis et al., 2015), and potential bugs and repairs (Vasic et al., 2019). This requires learning to represent a program’s latent, semantic properties based on its source. Initial representations of source code relied on sequential models from natural-language processing, such as $n$ -gram language models (Hindle et al., 2012; Allamanis & Sutton, 2013; Hellendoorn & Devanbu, 2017) and Recurrent Neural Networks (RNNs) (White et al., 2015), but these models struggle to capture the complexity of source code.
12
+
13
+ Source code is rich in structured information, such as a program’s abstract syntax tree, data and control flow. Allamanis et al. (2018b) proposed to model some of this structure directly, providing a powerful inductive bias towards semantically meaningful relations in the code. Their Gated Graph Neural Network (GGNN) model for embedding programs was shown to learn better, more generalizable representations faster than classical RNN-based sequence models.
14
+
15
+ However, the debate on effective modeling of code is far from settled. Graph neural networks typically rely on synchronous message passing, which makes them inherently local, requiring many iterations of message passing to aggregate information from distant parts of the code. However, state-of-the-art graph neural networks for code often use as few as eight message-passing iterations (Allamanis et al., 2018b; Fernandes et al., 2018), primarily for computational reasons: program graphs can be very large, and training time grows linearly with the number of message passes. This is in contrast to, e.g., Transformer models (Vaswani et al., 2017), which allow program-wide information flow at every step, yet lack the powerful inductive bias from knowing the code’s structure.
16
+
17
+ This leads us to a basic research question: is there a fundamental dichotomy between global, unstructured and local, structured models? Our answer is an emphatic no. Our starting point is the sequence-to-pointer model of Vasic et al. (2019), which is state-of-the-art for the task of localizing and repairing a particular type of bug. As a sequence model, their architecture can (at least potentially) propagate information globally, but it lacks access to the known semantic structure of code. To this end, we replace the sequence encoder of Vasic et al. (2019) with a GGNN, yielding a new graph-to-mutlihead-pointer model. Remarkably, this model alone yields a $2 0 \%$ improvement over the state of the art, though at the cost of being significantly larger than the sequence model.
18
+
19
+ Motivated by this result, we propose two new families of models that efficiently combine longerdistance information, such as the sequence model can represent, with the semantic structural information available to the GGNN. One family, the Graph Sandwich, alternates between message passing and sequential information flow through a chain of nodes within the graph; the other, the Graph Relational Embedding Attention Transformer (GREAT), generalizes the relative position embeddings in Transformers by Shaw et al. (2018) to convey structural relations instead. We show that our proposed model families outperform all prior results, as well as our new, already stronger baseline by an additional $10 \%$ each, while training both substantially faster and using fewer parameters.
20
+
21
+ # 2 RELATED WORK
22
+
23
+ Distributed Representation of Programs: There has been increasing interest in modeling source code using machine learning (Allamanis et al., 2018a). Hindle et al. (2012) model programs as sequences of tokens and use an $n$ -gram model for predicting code completions. Raychev et al. (2015) use conditional random fields (CRFs) to predict program properties over a set of pairwise program features obtained from the program’s dependency graph. Many approaches use neural language models to embed programs as sequences of tokens (Bhoopchand et al., 2016; White et al., 2015). Some techniques leverage the ASTs of programs in tree-structured recurrent models (Piech et al., 2015; Parisotto et al., 2016; Chen et al., 2018). code2vec (Alon et al., 2018) and code2seq (Alon et al., 2019) model programs as a weighted combination of a set of leaf-to-leaf paths in the abstract syntax tree. Finally, Allamanis et al. (2018b) proposed using GGNNs for embedding program graphs consisting of ASTs together with control-flow and data-flow edges. Some recent models of code embed run-time information of programs, e.g., program traces, besides syntactic information (Wang et al., 2018). In this paper, we explore the space of combining sequence-based and graph-based representations of programs, as well as introduce a Transformer-based model with additional program-edge information to learn program representations. Fernandes et al. (2018) also combine an RNN and a GNN architecture, achieving slight improvements over a GGNN. However, they only consider a single RNN layer inserted at the start; we include larger and more diverse hybrids, as well as entirely different combinations of structural and sequential features.
24
+
25
+ Neural Program Repair: Automatically generating fixes to repair program bugs is an active field of research with many proposed approaches based on genetic programming, program analysis and formal methods, and machine learning (Monperrus, 2018; Gazzola et al., 2019). In this paper, we focus on a specific class of repair task called VarMisuse as proposed by Allamanis et al. (2018b), who use a graph-based embedding of programs to predict the most likely variable at each variable-use location and generate a repair prediction whenever the predicted variable is different from the one present, using an enumerative approach. Vasic et al. (2019) improved this approach by jointly predicting both the bug and repair locations using a two-headed pointer mechanism. Our multi-headed pointer graph, graph-sandwich and GREAT models significantly outperform these approaches.
26
+
27
+ # 3 SEMI-STRUCTURED MODELS OF SOURCE CODE
28
+
29
+ Models of code have so far either been structured (GNNs) or unstructured (RNNs, Transformers). Considering the graph-based models’ substantially superior performance compared to RNNs despite their locality limitations, we may ask: to what extent could global information help GNNs, and to what extent could structural features help sequence-based models?
30
+
31
+ # 3.1 MODELS
32
+
33
+ We address the questions of combining local and global information with two families of models.
34
+
35
+ Graph-sandwich Models Let $T = \langle t _ { 1 } , t _ { 2 } , \cdot \cdot \cdot , t _ { n } \rangle$ denote a program’s token sequence and $\mathcal { G } =$ $( \nu , \mathcal { E } )$ denote the corresponding program graph, where $\nu$ is the set of node vertices and $\mathcal { E }$ is the list of edge sets for different edge types. In both graph and sequence based models, the nodes $v$ maintain a state vector $h ^ { ( v ) }$ that is initialized with initial node embedding $\boldsymbol { x } ^ { ( v ) } \in \mathbb { R } ^ { D }$ .
36
+
37
+ In a GGNN layer, messages of type $k$ are sent from each node $v \in \mathcal V$ to its neighbors computed as mk $m _ { k } ^ { ( v ) } = \mathrm { L i n e a r L a y e r } _ { k } ( h ^ { ( v ) } )$ . After the message passing step, the set of messages at each node are aggregated as $\begin{array} { r } { m ^ { ( v ) } \ = \ \Sigma _ { e _ { k } ( u , v ) \in \mathcal { E } } \ m _ { k } ^ { ( u ) } } \end{array}$ Finally, the state vector of a node $v$ is updated as $h _ { \mathrm { n e w } } ^ { ( v ) } = \mathrm { G R U } ( m ^ { ( v ) } , h ^ { ( v ) } )$ . In aated as e of a node . A Transfo $v$ (correspondmer compute l, $t _ { i }$ $T$ $h _ { \mathrm { n e w } } ^ { ( v ) } = f ( t _ { v } , h ^ { ( t _ { i - 1 } ) } )$ $t _ { v } \mathbf { q _ { t } } , \mathbf { k _ { t } } , \mathbf { v _ { t } }$ corresponding to a query, key and value for each token.1 Each token then computes its attention to√ all other tokens using $e _ { i j } = ( { \bf q _ { i } } { \bf k _ { j } } ^ { \top } ) / \sqrt { N } ,$ 2 which can be soft-maxed to yield attention probabilities $a _ { i j } = \exp ( e _ { i j } ) / \Sigma \exp ( \bar { e } _ { i , : } )$ .
38
+
39
+ Our first class of models follows from the observation that $T \subseteq V$ ; i.e., the source code tokens used by sequence models, like RNNs, are by definition also nodes in the program graph, so GGNNs update their state with every message pass. We can thus envision a combined model that uses each of these as a building block; for instance, assuming initial node features $\boldsymbol { x } ^ { ( v ) } \in \mathbb { R } ^ { D }$ , the formula [RNN, GGNN(3), RNN] describes a model in which we first run an RNN on all tokens $\in \mathcal { T }$ (in lexical ordering), then, using these as initial states for $v \in T$ while using the default node-type embeddings for all other nodes, run three message passing steps using a GGNN, after which we again gather the nodes corresponding to $T$ and update their state with an additional RNN pass.
40
+
41
+ The resulting family of models alternates GGNN-style message passing operations and layers of sequence-based models. By varying the number and size of sequential layers and blocks of GGNNstyle message passing, this variant particularly provides insight into the first question above (how can global information help GNNs?), by showing the transition in performance potential of models that increasingly incorporate sequential features. We refer to this class of models as sandwich models.
42
+
43
+ Graph Relational Embedding Attention Transformer The above family of models still rely on explicit message passing for their structural bias, thereby only indirectly combining structural and global information to the model. We may wish to instead directly encode structural bias into a sequence-based model, which requires a relaxation of the ‘hard’ inductive bias from the GGNN. For Transformer-based architectures, Shaw et al. (2018) show that relational features can be incorporated directly into the attention function by changing the attention computation to:3√ $e _ { i j } = ( { \bf q _ { i } } + b _ { i j } ) { { \bf k _ { j } } ^ { \top } } / \sqrt { N }$ where ${ \bf q _ { i } }$ and $\mathbf { k _ { j } }$ correspond to the query and key vectors as described above, $b _ { i j }$ is an added bias term for the specific attention weight between tokens $i$ and $j$ , and $N$ is the per-head attention dimension. In our case, we compute $b _ { i j } = W _ { e } ^ { \top } { \mathbf e } + b _ { e }$ , where $W _ { e } \in \mathbb { R } ^ { N } , b _ { e } \in \mathbb { R }$ , and $\mathbf { e } \in \mathbb { R } ^ { N }$ is an embedding of the edge type connecting nodes $i$ and $j$ , if any. If multiple edge types are present between two nodes, the resulting biases are simply added. We name this model GREAT, for Graph Relational Embedding Attention Transformer.
44
+
45
+ # 3.2 ARCHITECTURAL DETAILS
46
+
47
+ In this section, we present details of different architectures we compare and their hyperparameters.
48
+
49
+ General: All of our models follow the structure proposed by Vasic et al. (2019), stacking an initial token-embedding layer, a ‘core’ model that computes a distributed representation of the code under inspection (in their case, an LSTM), followed by a projection into two pointers for the localization and repair tasks (see Section 4). This core model is the part varied in our work. We use
50
+
51
+ SubwordTextEncoder from Tensor2Tensor (Vaswani et al., 2018) to generate a 10K sub-token vocabulary from training data and embed each token by averaging embeddings of its sub-token(s).
52
+
53
+ GGNN: Many types of graph-based message-passing neural networks have been proposed for code, mostly differing in how a node’s state is updated based on ‘messages’ sent by nodes it is connected to. Most commonly used is the gated graph neural network (GGNN) (Li et al., 2015), which uses a GRU cell (Cho et al., 2014) to update a node’s state. Although other options sometimes outperform this architecture, the improvements are generally minor, so we rely on this model for our baseline. One hyperparameter of the architecture is whether to use different transformations at each message-passing step, or to reuse one set of transformations for multiple message passes. Following Allamanis et al. (2018b), we use blocks of two message-passing layers, in which the first layer is repeated three times, for four message passes per block. We then sweep over GGNN architectures that repeat these blocks 1 to 4 times (thus yielding 4 to 16 message passes). By default, the message dimension is set to 128, but we include an ablation with 256-dimensional messages as well.
54
+
55
+ RNNs: We experimented with the one-directional entailment-attention-based RNN proposed by Vasic et al. (2019), but found a simpler bi-directional RNN architecture to work even better. We use GRUs as the recurrent cells, vary the number of layers from 1 to 3, and the hidden dimension (of the concatenated forward and backward component) in $\{ 1 2 8 , 2 5 6 , 5 1 2 \}$ .
56
+
57
+ Transformers: We base our architecture on the original Transformer (Vaswani et al., 2017), varying the number of layers from 1 to 10 and the attention dimension in $\{ 1 2 8 , 2 5 6 , 5 1 2 , 1 0 2 4 \}$ .
58
+
59
+ Sandwich Models: We distinguish between two types of sandwich models: ‘small’ sandwiches, which add a single RNN or Transformer to a GGNN architecture, and ‘large’ sandwiches, which wrap every message-passing block (as defined above) with a 128-dimensional (bi-directional) RNN/Transformer layer. We vary the number of message-passing blocks from 1 to 3 (corresponding to 4 to 12 message passes) to span a similar parameter domain as the GGNNs above (ca. $1 . 5 { \mathbf { M } } -$ 5M), increasing the number of layers to 2 and their dimension to 512 for a later ablation.
60
+
61
+ GREAT: Uses the same architectural variations as the Transformer family; edge-type embedding dimensions are fixed at the per-head attention dimension, as described above.
62
+
63
+ Global hyper-parameters: We train most of our models with batch sizes of $\{ 1 2 . 5 \mathrm { K } , 2 5 \mathrm { K } , 5 0 \mathrm { K } \}$ tokens, with the exception of the Transformer architectures; due to the quadratic nature of the attention computation, 25K tokens was too large for these models, so we additionally trained these with 6.25K-token batches.4 Learning rates were varied in $\left\{ 1 \mathrm { e } { - } 3 , 4 \mathrm { - } \mathrm { e } 4 , 1 \mathrm { e } { - } 4 , 4 \mathrm { e } { - } 5 , 1 \mathrm { e } { - } 5 \right\}$ using an Adam optimizer, where we omitted the first option for our GGNN models and the last for our RNNs due to poor performance. Sub-tokens were embedded using 128-dimensional embeddings.
64
+
65
+ Hardware: all our models were trained on a single Tesla P100 GPU on 25 million samples, which required between 40 and 250 hours for our various models. However, we emphasize that overall training time is not our main objective; we primarily assess the ultimated converged accuracy of our models and present training behavior over time for reference of our various models’ training behavior.
66
+
67
+ # 3.3 ABOUT GRAPH REPRESENTATIONS OF CODE
68
+
69
+ Our program graphs borrow many edge types from Allamanis et al. (2018b), such as data-flow (e.g., read & write), adjacent-token, and syntactic edges, which we further augment with edges between control-flow statements and function calls. When representing programs as graphs, a key decision needs to be made regarding the Abstract Syntax Tree (AST). Typically, one of the edge types in the graphs represents syntactic parent-child relationships in the AST. Additionally, some of the edges representing relations (e.g., control-flow) are naturally represented as edges between internal nodes in this tree, e.g., between two IfStatement nodes. However, ablations often find that the effectiveness of including the AST is limited in graph-based models (Allamanis et al., 2018b).
70
+
71
+ This raises the question of whether it is possible to represent programs as graphs that include sequential and semantic information, but not syntax. To this end, we propose a leaves-only graph representation for code as follows: edges that represent semantic relationships such as control flow and data flow can easily be moved down from internal nodes – which typically represent a span of multiple tokens – to those leaf nodes in the graph that represent the begin token of that span. Thus, an edge that used to connect two IfStatement interior AST nodes is moved down to connect the corresponding if tokens. Now, the AST can be omitted entirely, thereby removing parent-child relations among syntax nodes, producing what we call a leaves-only graph. This latter representation is substantially more compressed than the graphs with ASTs, often using $2 { - } 3 \mathbf { x }$ fewer nodes (while retaining most of the edges), and additionally aligns better with sequence-based models, because all edges are directly connected to the original code tokens.5 We compare both settings for each graph-based model, but unless otherwise specified, we use the ‘full’ graphs for the regular GGNN model and the ‘leaves-only’ graphs (without ASTs) for the sandwich and GREAT models.
72
+
73
+ # 4 EXPERIMENTAL SETUP
74
+
75
+ The VarMisuse Task We focus our study on the variable-misuse localization-and-repair task (Vasic et al., 2019): given a function, predict two pointers into the function’s tokens, one pointer for the location of a variable use containing the wrong variable (or a special no-bug location), and one pointer for any occurrence of the correct variable that should be used at the faulty location instead.
76
+
77
+ Synthetic Dataset We used the ETH Py150 dataset (Raychev et al., 2016), which is based on GitHub Python code, and already partitioned into train and test splits (100K and 50K files, respectively). We further split the 100K train files into 90K train and 10K validation examples and applied a deduplication step on that dataset (Allamanis, 2018). We extracted all top-level function definitions from these files; any function that uses multiple variables can be turned into a training example by randomly replacing one variable usage with another. As there may be many candidates for such bugs in a function, we limit our extraction to up to three samples per function to avoid biasing our dataset too strongly towards longer functions. For every synthetically generated buggy example, an unperturbed, bug-free example of the function is included as well, to keep our dataset balanced, yielding ca. 2M total training and 755K test samples. Finally, we train with functions with up to 250 tokens; at test time, we raise this to 1,000 to study our models’ generalization to longer functions.
78
+
79
+ Metrics As we are mainly interested in contrasting the behavior of different models of code, we focus most of our results on the various models’ learning curves by tracking development-set accuracy on 25K held-out samples every 250K samples as the models train. Here, we measure two accuracy metrics: localization accuracy (whether the model correctly identifies the bug’s location for buggy samples); and (independently) repair accuracy (whether the model points to the correct variable to repair the bug). Note that these metrics focus on buggy samples; the models also determine whether a function is buggy, which we discuss below. We group all models by their ‘family’, as categorized in Section 3.2, reporting the maximum held-out performance per family.
80
+
81
+ For deeper insight into the fully trained models’ performance, we also analyze the performance of the best models in each family in more depth on the test portion of our synthetic dataset. Specifically, we assess their bugginess-classification accuracy (whether the model correctly identifies the method as (non-)buggy) and their joint localization and repair accuracy (for buggy samples, how often the model correctly localizes and repairs the bug). Here, we also increase the maximum function size to 1,000 tokens and analyze the impact of longer functions on our models’ performance.
82
+
83
+ # 4.1 DATA & CODE RELEASE
84
+
85
+ We release a public implementation of the GREAT model based on Tensorflow, as well as the program graphs for all samples in our training and evaluation datasets whose license permits us to redistribute these at: https://doi.org/10.5281/zenodo.3668323, which tracks the latest release of our Github repository at: https://github.com/VHellendoorn/ ICLR20-Great.
86
+
87
+ # 5 RESULTS
88
+
89
+ There are many degrees of freedom in our family of models, so we structure our results around a series of comparisons, which we analyze and discuss in this section. We start with our key result, which compares all our model families (RNNs, Transformers, GGNNs, Sandwich hybrids, and GREAT models) across a comparable parameter domain (ca. 1.4M – 5.5M parameters) in Figure 1.
90
+
91
+ ![](images/96061ba572ebf13a72a349a63a2a4c26ec4970bd22d2b93d03adfbc9020773de.jpg)
92
+ Figure 1: Comparison of top-performing models from all model families across a comparable parameter domain of $1 . 5 \mathrm { M } - 5 \mathrm { M }$ parameters. Performance visualized using the localization (left) and repair (right) accuracy Pareto fronts w.r.t. both training time (top) and number of training samples seen (bottom), both log-scaled, where an epoch is ca. 2M samples. In all cases, our proposed models substantially outperform GGNNs from early in the training process.
93
+
94
+ Although there are subtle differences between the models’ behavior on localization and repair accuracy, the overall picture is consistent: whereas our newly proposed graph-to-multihead-pointer models already substantially outperform RNN-based models (the previous state-of-the-art), and sometimes Transformers, the hybrid global & structured models achieve significantly better results faster.
95
+
96
+ Time-wise (the top two figures), the GGNN models take the longest to converge, continuing to improve slightly even after a week of training mainly because their largest (16-layer) architecture starts to dominate the 12-layer version’s performance after ca. 170h. The Sandwich models follow its training curve, but are more accurate and faster to converge, achieving especially good results for limited training budgets, partly because they succeeded with just 4 – 8 layers of message passing by relying on their global components.
97
+
98
+ The Transformer architecture, although slower at first, widely outperforms the RNN as a baseline model. The GREAT model tracks its learning curve, starting out slower than the models with explicit message passing, but gradually overtaking them after ca. 10h, as the underlying Transformer becomes increasingly effective. We note that this model achieves state-of-the-art results despite having, at the time of this writing, received less training time (ca. 64h compared to up to 240h).
99
+
100
+ The bottom half of Figure 1 abstracts away the potentially confounding issue of implementation speed of our models by tracking performance w.r.t the number of training samples. Naturally, the end-points of the curves (the converged accuracy) are identical, but importantly the various models’ training curves are quite similar; even here, the GGNN is only able to outperform some of our proposed models briefly, yielding inferior performance to all within just one epoch.
101
+
102
+ The RNN and GGNN models appear to be particularly complementary; even though the RNN’s localization accuracy is very poor compared to the GGNN, the combined model still sustains a ${ \sim } 5 \%$ improvement on the latter.6 However, the Transformer Sandwich does not seem to benefit similarly, showing virtually no difference in performance with the RNN Sandwich model. This strongly suggests that the Transformer’s ability to access long-distance information overlaps in large part (though not entirely, given GREAT’s performance) with the GGNNs’ ability to do so using message passing. We conjecture that the Transformer learns to infer many of the same connections (e.g., data-flow, control-flow) that are encoded explicitly in the graph’s message passing.
103
+
104
+ To understand the behavior of the many models and combinations that may be used for code, we now explore the variations on our choices of parameters, models, and metrics.
105
+
106
+ # 5.1 LARGER MODELS
107
+
108
+ Model capacity is a potential threat to any comparison between models of different families. We aimed to ensure a fair comparison in the previous section by selecting a range of hyper-parameters (which includes the number of stacked layers) for these architectures that span a similar parameter count range. For instance, a 6-layer Transformer with 512-dimensional attention is comparable to a 2-layer 512-dimensional bi-directional RNN and an 8-layer GGNN. However, all these architectures are relatively modest, having at most ${ \sim } 5 \mathbf { M }$ parameters. By increasing the number, and dimensionality of their layers, we can evaluate a second family of models with ca. 5–20M parameters.
109
+
110
+ Figure 2 shows the performance for the low- and high-parameter variations for each of our bestperforming model families. Overall, while providing more parameters to the GGNNs made virtually no difference, all our hybrid models increase $2 - 3 \%$ in both localization and repair accuracy, providing further support for combining global, structured models. The best-performing instances of each model family were consistently the larger architectures, 15M parameters for the GGNN, 12.5M & 10M for the RNN and Transformer Sandwiches respectively and 7.9M for GREAT.7
111
+
112
+ ![](images/891bb76b8b22cc3f22d8d35865dbfce9b0f0a82d9df045cca8830b19b5be6265.jpg)
113
+ Figure 2: Comparison of smaller (1.5–5M parameter) and larger (5–20M parameter, identified with $\cdot _ { + + } ,$ variants of each model family. Localization and repair accuracy Pareto-front w.r.t. time.
114
+
115
+ # 5.2 ON SYNTACTIC INFORMATION
116
+
117
+ In the previous results, the GGNN models were trained on ‘full’ graphs (as described in Section 3.3), that use the code’s AST structure, and the sandwich models on ‘leaves-only’ graphs, with only source token nodes, and edges moved to connect these directly. These settings are arguably each appropriate to the underlying model, but both models can also use the alternative setting.
118
+
119
+ ![](images/a820488f09223f97e60319c333a9fc46ccb028312e07b0032199bdaa49aa909f.jpg)
120
+ Figure 3: Comparing impact of graph representation on GGNNs and RNN Sandwich models. Localization and repair accuracy Pareto-front w.r.t time. Note: y-axis cropped to simplify comparison.
121
+
122
+ Figure 3 shows the training curves for the alternative settings. In all cases, the models that do not use syntax train substantially faster because each sample’s graph representation is more than twice as small, so these models naturally lead in accuracy early on in training. However, whereas the GGNN equipped with syntax overtakes its counter-part within ca. 48h, the sandwich models display a much longer lag, with no cross-over observed at all on localization accuracy in this time window.8
123
+
124
+ The sandwich model on full graphs still compares favorably with the GGNN baseline, though its early training behavior is not as effective. It is also interesting to note that the best-performing Sandwich models in this setting were consistently architectures with more message-passing steps. This may be due to the additional distance between information propagated along the tokens and along semantic edges, which in this setting are almost universally connected to AST-internal nodes.
125
+
126
+ # 5.3 RNNS IN SANDWICHES: SINGLE VS. MANY
127
+
128
+ Recent work on neural summarization also mixed RNNs and GGNNs (Fernandes et al., 2018), but did so by inserting a single RNN layer into a GNN architecture, before any message passing. We compare this architecture to a full Sandwich model in Figure 4. Although a single RNN certainly helps compared to the GGNN, interleaving RNNs and GGNN-style message passes performed substantially better. In fact, the best performing full Sandwiches used fewer parameters than the Single models because they used 8 message passes instead of 12, relying more heavily on the RNNs.9
129
+
130
+ # 5.4 TEST-SET ANALYSIS
131
+
132
+ Having identified our best-performing models in each family, we now study their performance on the test data, specifically using the metrics used in Vasic et al. (2019) (see Section 4) in Table 1. In general, the two metrics correlated well; models that accurately determined whether a function contained a bug also accurately identified the bug (and repair), as may be expected. The baseline RNN model achieves a modest $44 \%$ accuracy at the latter task; this is slightly lower than reported in prior work (Vasic et al., 2019), which is likely due in part to our dataset de-duplication. Transformers and GGNNs perform substantially better (and comparably, though the latter trained 6x longer for this performance), but still fall well short of our hybrid models’ performance, which are especially much more accurate on long functions. The GREAT model shows most promise on the repair task, already outperforming the sandwich models despite having so far had limited training time.
133
+
134
+ ![](images/4e04d6ea7dd5bfb2ef01a6dfd6d452ab0dbf57732e286b392cbf2337a905571b.jpg)
135
+ Figure 4: Comparison of RNN sandwiches with a single RNN vs. those with RNNs around every message-passing block (‘Multi’). Localization and repair accuracy Pareto-front w.r.t. time.
136
+
137
+ Table 1: Test-set results of best-performing models by family, on metrics of Vasic et al. (2019). Grouped by maximum length; $6 . 5 \%$ of test set samples exceeded 250 tokens (the training limit).
138
+
139
+ <table><tr><td rowspan=1 colspan=4>Model Family</td><td rowspan=1 colspan=1>Class. Accuracy≤ 250 ≤1000</td><td rowspan=1 colspan=1>Loc &amp; Rep Accuracy≤ 250 ≤1000</td><td rowspan=1 colspan=1>Parameters</td><td rowspan=1 colspan=1>TrainingTime</td></tr><tr><td rowspan=1 colspan=4>RNN1</td><td rowspan=1 colspan=1>71.8% 70.6%</td><td rowspan=1 colspan=1>44.4% 42.5%</td><td rowspan=1 colspan=1>4.3M</td><td rowspan=1 colspan=1>31.3h</td></tr><tr><td rowspan=3 colspan=4>TransformerGGNN</td><td rowspan=1 colspan=1>75.9% 73.2%</td><td rowspan=1 colspan=1>67.7% 63.0%</td><td rowspan=1 colspan=1>3.7M</td><td rowspan=1 colspan=1>41.5h</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2>GGNN</td><td rowspan=1 colspan=1>81.4% 79.2%</td><td rowspan=1 colspan=1>64.0% 60.9%</td><td rowspan=1 colspan=1>5.5M</td><td rowspan=1 colspan=1>241h</td></tr><tr><td rowspan=2 colspan=4>RNN Sandwich</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan=1 colspan=1>82.5% 81.9%</td><td rowspan=1 colspan=1>75.8% 73.8%</td><td rowspan=1 colspan=1>12.6M</td><td rowspan=1 colspan=1>109h</td></tr><tr><td rowspan=1 colspan=4>Transformer Sandwich</td><td rowspan=1 colspan=1>81.1% 78.1%</td><td rowspan=1 colspan=1>74.5% 71.4%</td><td rowspan=1 colspan=1>10M</td><td rowspan=1 colspan=1>161h</td></tr><tr><td rowspan=1 colspan=4>GREAT</td><td rowspan=1 colspan=1>80.1% 76.9%</td><td rowspan=1 colspan=1>76.4% 73.1%</td><td rowspan=1 colspan=1>7.9M</td><td rowspan=1 colspan=1>120h</td></tr></table>
140
+
141
+ 1: a stronger version of the model proposed in Vasic et al. (2019) (previous SOTA).
142
+
143
+ # 5.5 REAL BUGS ANALYSIS
144
+
145
+ We want to ensure that our models can be useful for real bugs and do not simply overfit to the synthetic data generation that we used. This risk exists because we did not filter our introduced bugs based on whether they would be difficult to detect, for instance because they conflate variables with similar names, usage, or data types; presumably, such bugs are more likely to escape a developer’s notice and find their way into real code bases. It is therefore expected that performance on realworld bugs will be lower for all our models, but we must assert that our proposed models do not just outperform GGNNs on synthetic data, e.g. by memorizing characteristics of synthetic bugs.
146
+
147
+ To mitigate this threat, we collect real variable misuse bugs from code on Github. Specifically, we collect ca. 1 million commits that modify Python files from Github. We extracted all changes to functions from these commits, filtering these according to the same criteria that we used to introduce variable-misuse bugs: we looked for commits that exclusively changed a single variable usage in a function body from one variable in scope to another. We focus on functions with up to 250 tokens, since all our models performed substantially better on these in Table 1. We identified 170 such changes, in which we assumed that the version before the change was buggy and the updated version correct. We removed any functions that had occurred in our training data, of which we found 9 and paired the remaining functions up (correct and buggy) to create a real-world evaluation set with 322 functions, which we presented to our models.
148
+
149
+ Table 2 shows the results of running our various models on these bugs. In general, these were clearly substantially more difficult for all our models than the synthetic samples we generated. However, we see a clear difference in performance with all our proposed models performing substantially better than previous baselines, and showing favorable precision/recall trade-offs.
150
+
151
+ Table 2: Results on 322 paired buggy and non-buggy samples from 161 real variable misuse bugs mined from Github commits. ‘Class.’ measures accuracy at identifying non-buggy samples; ‘Prec.’ and ‘Rec.’ capture the precision and recall at identifying the correct localization and repair on the buggy samples.
152
+
153
+ <table><tr><td>Model Family</td><td colspan="2"> All Samples</td><td>Precision at Recall = 5%</td><td>Precision at Recall = 10%</td></tr><tr><td>RNN</td><td>Class. Prec. 52.8% 13.3%</td><td>Rec. 46.6%</td><td>44.4%</td><td>23.5%</td></tr><tr><td>Transformer</td><td>62.1% 15.8%</td><td>47.2%</td><td>33.3%</td><td>17.6%</td></tr><tr><td>GGNN</td><td>65.8% 17.7%</td><td>42.2%</td><td>44.4%</td><td>23.5%</td></tr><tr><td>RNN Sandwich</td><td>69.6% 28.6%</td><td>43.5%</td><td>77.8%</td><td>64.7%</td></tr><tr><td>Trans.Sandwich</td><td>75.2% 21.5%</td><td>40.4%</td><td>33.3%</td><td>35.3%</td></tr><tr><td>GREAT</td><td>70.2% 23.7%</td><td>36.7%</td><td>44.4%</td><td>29.4%</td></tr></table>
154
+
155
+ # 6 CONCLUSION
156
+
157
+ We demonstrate that models leveraging richly structured representations of source code do not have to be confined to local contexts. Instead, models that leverage only limited message passing in combination with global models learn much more powerful representations faster. We proposed two different architectures for combining local and global information: sandwich models that combine two different message-passing schedules and achieve highly competitive models quickly, and the GREAT model which adds information from a sparse graph to a Transformer to achieve stateof-the-art results. In the process, we raise the state-of-the-art performance on the VarMisuse bug localization and repair task by over $30 \%$ .
158
+
159
+ # REFERENCES
160
+
161
+ Miltiadis Allamanis. The adverse effects of code duplication in machine learning models of code. CoRR, abs/1812.06469, 2018. URL http://arxiv.org/abs/1812.06469.
162
+
163
+ Miltiadis Allamanis and Charles Sutton. Mining source code repositories at massive scale using language modeling. In Working Conference on Mining Software Repositories (MSR), 2013.
164
+
165
+ Miltiadis Allamanis, Earl T Barr, Christian Bird, and Charles Sutton. Suggesting accurate method and class names. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, pp. 38–49. ACM, 2015.
166
+
167
+ Miltiadis Allamanis, Earl T. Barr, Premkumar Devanbu, and Charles Sutton. A survey of machine learning for big code and naturalness. ACM Comput. Surv., 51(4):81:1–81:37, July 2018a. ISSN 0360-0300.
168
+
169
+ Miltiadis Allamanis, Marc Brockschmidt, and Mahmoud Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations, 2018b.
170
+
171
+ Uri Alon, Meital Zilberstein, Omer Levy, and Eran Yahav. code2vec: Learning distributed representations of code. CoRR, abs/1803.09473, 2018.
172
+
173
+ Uri Alon, Shaked Brody, Omer Levy, and Eran Yahav. code2seq: Generating sequences from structured representations of code. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019.
174
+
175
+ Avishkar Bhoopchand, Tim Rocktaschel, Earl Barr, and Sebastian Riedel. Learning python code ¨ suggestion with a sparse pointer network. arXiv preprint arXiv:1611.08307, 2016.
176
+
177
+ Xinyun Chen, Chang Liu, and Dawn Song. Tree-to-tree neural networks for program translation. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 2547–2557. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 7521-tree-to-tree-neural-networks-for-program-translation.pdf.
178
+
179
+ Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014.
180
+
181
+ Patrick Fernandes, Miltiadis Allamanis, and Marc Brockschmidt. Structured neural summarization. arXiv preprint arXiv:1811.01824, 2018.
182
+
183
+ Luca Gazzola, Daniela Micucci, and Leonardo Mariani. Automatic software repair: A survey. IEEE Trans. Software Eng., 45(1):34–67, 2019.
184
+
185
+ Vincent J Hellendoorn and Premkumar Devanbu. Are deep neural networks the best choice for modeling source code? In Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, pp. 763–773. ACM, 2017.
186
+
187
+ Vincent J Hellendoorn, Christian Bird, Earl T Barr, and Miltiadis Allamanis. Deep learning type inference. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pp. 152–162. ACM, 2018.
188
+
189
+ Abram Hindle, Earl T. Barr, Zhendong Su, Mark Gabel, and Premkumar Devanbu. On the naturalness of software. In Proceedings of the 34th International Conference on Software Engineering, ICSE ’12, pp. 837–847, 2012.
190
+
191
+ Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks, 2015.
192
+
193
+ Martin Monperrus. Automatic software repair: A bibliography. ACM Comput. Surv., 51(1):17:1– 17:24, January 2018. ISSN 0360-0300.
194
+
195
+ Emilio Parisotto, Abdel-rahman Mohamed, Rishabh Singh, Lihong Li, Dengyong Zhou, and Pushmeet Kohli. Neuro-symbolic program synthesis. CoRR, abs/1611.01855, 2016. URL http: //arxiv.org/abs/1611.01855.
196
+
197
+ Chris Piech, Jonathan Huang, Andy Nguyen, Mike Phulsuksombati, Mehran Sahami, and Leonidas Guibas. Learning program embeddings to propagate feedback on student code. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 1093–1102, 2015.
198
+
199
+ Veselin Raychev, Martin Vechev, and Andreas Krause. Predicting program properties from ”big code”. In Proceedings of the 42Nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’15, pp. 111–124, 2015.
200
+
201
+ Veselin Raychev, Pavol Bielik, and Martin T. Vechev. Probabilistic model for code with decision trees. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2016, part of SPLASH 2016, Amsterdam, The Netherlands, October 30 - November 4, 2016, pp. 731–747, 2016.
202
+
203
+ Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. arXiv preprint arXiv:1803.02155, 2018.
204
+
205
+ Marko Vasic, Aditya Kanade, Petros Maniatis, David Bieber, and Rishabh Singh. Neural program repair by jointly learning to localize and repair. arXiv preprint arXiv:1904.01720, 2019.
206
+
207
+ Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017.
208
+
209
+ Ashish Vaswani, Samy Bengio, Eugene Brevdo, Franc¸ois Chollet, Aidan N. Gomez, Stephan Gouws, Llion Jones, Lukasz Kaiser, Nal Kalchbrenner, Niki Parmar, Ryan Sepassi, Noam Shazeer, and Jakob Uszkoreit. Tensor2tensor for neural machine translation. In Proceedings of the 13th Conference of the Association for Machine Translation in the Americas, AMTA 2018, Boston, MA, USA, March 17-21, 2018 - Volume 1: Research Papers, pp. 193–199, 2018. URL https://www.aclweb.org/anthology/W18-1819/.
210
+
211
+ Ke Wang, Rishabh Singh, and Zhendong Su. Dynamic neural program embeddings for program repair. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018.
212
+
213
+ Martin White, Christopher Vendome, Mario Linares-Vasquez, and Denys Poshyvanyk. Toward ´ deep learning software repositories. In Proceedings of the 12th Working Conference on Mining Software Repositories, pp. 334–345. IEEE Press, 2015.
parse/train/B1lnbRNtwr/B1lnbRNtwr_content_list.json ADDED
@@ -0,0 +1,1203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "GLOBAL RELATIONAL MODELS OF SOURCE CODE ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 176,
8
+ 98,
9
+ 781,
10
+ 122
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Vincent J. Hellendoorn, Petros Maniatis, Rishabh Singh, Charles Sutton, David Bieber Google Research {vhellendoorn,maniatis,rising,charlessutton,dbieber}@google.com ",
17
+ "bbox": [
18
+ 183,
19
+ 143,
20
+ 794,
21
+ 188
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "ABSTRACT ",
28
+ "text_level": 1,
29
+ "bbox": [
30
+ 454,
31
+ 224,
32
+ 544,
33
+ 239
34
+ ],
35
+ "page_idx": 0
36
+ },
37
+ {
38
+ "type": "text",
39
+ "text": "Models of code can learn distributed representations of a program’s syntax and semantics to predict many non-trivial properties of a program. Recent state-ofthe-art models leverage highly structured representations of programs, such as trees, graphs and paths therein (e.g., data-flow relations), which are precise and abundantly available for code. This provides a strong inductive bias towards semantically meaningful relations, yielding more generalizable representations than classical sequence-based models. Unfortunately, these models primarily rely on graph-based message passing to represent relations in code, which makes them de facto local due to the high cost of message-passing steps, quite in contrast to modern, global sequence-based models, such as the Transformer. In this work, we bridge this divide between global and structured models by introducing two new hybrid model families that are both global and incorporate structural bias: Graph Sandwiches, which wrap traditional (gated) graph message-passing layers in sequential message-passing layers; and Graph Relational Embedding Attention Transformers (GREAT for short), which bias traditional Transformers with relational information from graph edge types. By studying a popular, non-trivial program repair task, variable-misuse identification, we explore the relative merits of traditional and hybrid model families for code representation. Starting with a graph-based model that already improves upon the prior state-of-the-art for this task by $20 \\%$ , we show that our proposed hybrid models improve an additional $1 0 { - } 1 5 \\%$ , while training both faster and using fewer parameters. ",
40
+ "bbox": [
41
+ 233,
42
+ 261,
43
+ 764,
44
+ 553
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "1 INTRODUCTION ",
51
+ "text_level": 1,
52
+ "bbox": [
53
+ 176,
54
+ 594,
55
+ 336,
56
+ 609
57
+ ],
58
+ "page_idx": 0
59
+ },
60
+ {
61
+ "type": "text",
62
+ "text": "Well-trained models of source code can learn complex properties of a program, such as its implicit type structure (Hellendoorn et al., 2018), naming conventions (Allamanis et al., 2015), and potential bugs and repairs (Vasic et al., 2019). This requires learning to represent a program’s latent, semantic properties based on its source. Initial representations of source code relied on sequential models from natural-language processing, such as $n$ -gram language models (Hindle et al., 2012; Allamanis & Sutton, 2013; Hellendoorn & Devanbu, 2017) and Recurrent Neural Networks (RNNs) (White et al., 2015), but these models struggle to capture the complexity of source code. ",
63
+ "bbox": [
64
+ 174,
65
+ 631,
66
+ 825,
67
+ 728
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Source code is rich in structured information, such as a program’s abstract syntax tree, data and control flow. Allamanis et al. (2018b) proposed to model some of this structure directly, providing a powerful inductive bias towards semantically meaningful relations in the code. Their Gated Graph Neural Network (GGNN) model for embedding programs was shown to learn better, more generalizable representations faster than classical RNN-based sequence models. ",
74
+ "bbox": [
75
+ 174,
76
+ 736,
77
+ 823,
78
+ 805
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "However, the debate on effective modeling of code is far from settled. Graph neural networks typically rely on synchronous message passing, which makes them inherently local, requiring many iterations of message passing to aggregate information from distant parts of the code. However, state-of-the-art graph neural networks for code often use as few as eight message-passing iterations (Allamanis et al., 2018b; Fernandes et al., 2018), primarily for computational reasons: program graphs can be very large, and training time grows linearly with the number of message passes. This is in contrast to, e.g., Transformer models (Vaswani et al., 2017), which allow program-wide information flow at every step, yet lack the powerful inductive bias from knowing the code’s structure. ",
85
+ "bbox": [
86
+ 174,
87
+ 811,
88
+ 823,
89
+ 924
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "text",
95
+ "text": "This leads us to a basic research question: is there a fundamental dichotomy between global, unstructured and local, structured models? Our answer is an emphatic no. Our starting point is the sequence-to-pointer model of Vasic et al. (2019), which is state-of-the-art for the task of localizing and repairing a particular type of bug. As a sequence model, their architecture can (at least potentially) propagate information globally, but it lacks access to the known semantic structure of code. To this end, we replace the sequence encoder of Vasic et al. (2019) with a GGNN, yielding a new graph-to-mutlihead-pointer model. Remarkably, this model alone yields a $2 0 \\%$ improvement over the state of the art, though at the cost of being significantly larger than the sequence model. ",
96
+ "bbox": [
97
+ 174,
98
+ 103,
99
+ 823,
100
+ 215
101
+ ],
102
+ "page_idx": 1
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "Motivated by this result, we propose two new families of models that efficiently combine longerdistance information, such as the sequence model can represent, with the semantic structural information available to the GGNN. One family, the Graph Sandwich, alternates between message passing and sequential information flow through a chain of nodes within the graph; the other, the Graph Relational Embedding Attention Transformer (GREAT), generalizes the relative position embeddings in Transformers by Shaw et al. (2018) to convey structural relations instead. We show that our proposed model families outperform all prior results, as well as our new, already stronger baseline by an additional $10 \\%$ each, while training both substantially faster and using fewer parameters. ",
107
+ "bbox": [
108
+ 174,
109
+ 222,
110
+ 825,
111
+ 333
112
+ ],
113
+ "page_idx": 1
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "2 RELATED WORK ",
118
+ "text_level": 1,
119
+ "bbox": [
120
+ 176,
121
+ 368,
122
+ 344,
123
+ 385
124
+ ],
125
+ "page_idx": 1
126
+ },
127
+ {
128
+ "type": "text",
129
+ "text": "Distributed Representation of Programs: There has been increasing interest in modeling source code using machine learning (Allamanis et al., 2018a). Hindle et al. (2012) model programs as sequences of tokens and use an $n$ -gram model for predicting code completions. Raychev et al. (2015) use conditional random fields (CRFs) to predict program properties over a set of pairwise program features obtained from the program’s dependency graph. Many approaches use neural language models to embed programs as sequences of tokens (Bhoopchand et al., 2016; White et al., 2015). Some techniques leverage the ASTs of programs in tree-structured recurrent models (Piech et al., 2015; Parisotto et al., 2016; Chen et al., 2018). code2vec (Alon et al., 2018) and code2seq (Alon et al., 2019) model programs as a weighted combination of a set of leaf-to-leaf paths in the abstract syntax tree. Finally, Allamanis et al. (2018b) proposed using GGNNs for embedding program graphs consisting of ASTs together with control-flow and data-flow edges. Some recent models of code embed run-time information of programs, e.g., program traces, besides syntactic information (Wang et al., 2018). In this paper, we explore the space of combining sequence-based and graph-based representations of programs, as well as introduce a Transformer-based model with additional program-edge information to learn program representations. Fernandes et al. (2018) also combine an RNN and a GNN architecture, achieving slight improvements over a GGNN. However, they only consider a single RNN layer inserted at the start; we include larger and more diverse hybrids, as well as entirely different combinations of structural and sequential features. ",
130
+ "bbox": [
131
+ 174,
132
+ 409,
133
+ 825,
134
+ 659
135
+ ],
136
+ "page_idx": 1
137
+ },
138
+ {
139
+ "type": "text",
140
+ "text": "Neural Program Repair: Automatically generating fixes to repair program bugs is an active field of research with many proposed approaches based on genetic programming, program analysis and formal methods, and machine learning (Monperrus, 2018; Gazzola et al., 2019). In this paper, we focus on a specific class of repair task called VarMisuse as proposed by Allamanis et al. (2018b), who use a graph-based embedding of programs to predict the most likely variable at each variable-use location and generate a repair prediction whenever the predicted variable is different from the one present, using an enumerative approach. Vasic et al. (2019) improved this approach by jointly predicting both the bug and repair locations using a two-headed pointer mechanism. Our multi-headed pointer graph, graph-sandwich and GREAT models significantly outperform these approaches. ",
141
+ "bbox": [
142
+ 173,
143
+ 666,
144
+ 825,
145
+ 791
146
+ ],
147
+ "page_idx": 1
148
+ },
149
+ {
150
+ "type": "text",
151
+ "text": "3 SEMI-STRUCTURED MODELS OF SOURCE CODE ",
152
+ "text_level": 1,
153
+ "bbox": [
154
+ 174,
155
+ 827,
156
+ 604,
157
+ 843
158
+ ],
159
+ "page_idx": 1
160
+ },
161
+ {
162
+ "type": "text",
163
+ "text": "Models of code have so far either been structured (GNNs) or unstructured (RNNs, Transformers). Considering the graph-based models’ substantially superior performance compared to RNNs despite their locality limitations, we may ask: to what extent could global information help GNNs, and to what extent could structural features help sequence-based models? ",
164
+ "bbox": [
165
+ 174,
166
+ 867,
167
+ 825,
168
+ 922
169
+ ],
170
+ "page_idx": 1
171
+ },
172
+ {
173
+ "type": "text",
174
+ "text": "3.1 MODELS ",
175
+ "text_level": 1,
176
+ "bbox": [
177
+ 174,
178
+ 103,
179
+ 276,
180
+ 117
181
+ ],
182
+ "page_idx": 2
183
+ },
184
+ {
185
+ "type": "text",
186
+ "text": "We address the questions of combining local and global information with two families of models. ",
187
+ "bbox": [
188
+ 173,
189
+ 131,
190
+ 810,
191
+ 146
192
+ ],
193
+ "page_idx": 2
194
+ },
195
+ {
196
+ "type": "text",
197
+ "text": "Graph-sandwich Models Let $T = \\langle t _ { 1 } , t _ { 2 } , \\cdot \\cdot \\cdot , t _ { n } \\rangle$ denote a program’s token sequence and $\\mathcal { G } =$ $( \\nu , \\mathcal { E } )$ denote the corresponding program graph, where $\\nu$ is the set of node vertices and $\\mathcal { E }$ is the list of edge sets for different edge types. In both graph and sequence based models, the nodes $v$ maintain a state vector $h ^ { ( v ) }$ that is initialized with initial node embedding $\\boldsymbol { x } ^ { ( v ) } \\in \\mathbb { R } ^ { D }$ . ",
198
+ "bbox": [
199
+ 174,
200
+ 152,
201
+ 823,
202
+ 210
203
+ ],
204
+ "page_idx": 2
205
+ },
206
+ {
207
+ "type": "text",
208
+ "text": "In a GGNN layer, messages of type $k$ are sent from each node $v \\in \\mathcal V$ to its neighbors computed as mk $m _ { k } ^ { ( v ) } = \\mathrm { L i n e a r L a y e r } _ { k } ( h ^ { ( v ) } )$ . After the message passing step, the set of messages at each node are aggregated as $\\begin{array} { r } { m ^ { ( v ) } \\ = \\ \\Sigma _ { e _ { k } ( u , v ) \\in \\mathcal { E } } \\ m _ { k } ^ { ( u ) } } \\end{array}$ Finally, the state vector of a node $v$ is updated as $h _ { \\mathrm { n e w } } ^ { ( v ) } = \\mathrm { G R U } ( m ^ { ( v ) } , h ^ { ( v ) } )$ . In aated as e of a node . A Transfo $v$ (correspondmer compute l, $t _ { i }$ $T$ $h _ { \\mathrm { n e w } } ^ { ( v ) } = f ( t _ { v } , h ^ { ( t _ { i - 1 } ) } )$ $t _ { v } \\mathbf { q _ { t } } , \\mathbf { k _ { t } } , \\mathbf { v _ { t } }$ corresponding to a query, key and value for each token.1 Each token then computes its attention to√ all other tokens using $e _ { i j } = ( { \\bf q _ { i } } { \\bf k _ { j } } ^ { \\top } ) / \\sqrt { N } ,$ 2 which can be soft-maxed to yield attention probabilities $a _ { i j } = \\exp ( e _ { i j } ) / \\Sigma \\exp ( \\bar { e } _ { i , : } )$ . ",
209
+ "bbox": [
210
+ 173,
211
+ 217,
212
+ 825,
213
+ 348
214
+ ],
215
+ "page_idx": 2
216
+ },
217
+ {
218
+ "type": "text",
219
+ "text": "Our first class of models follows from the observation that $T \\subseteq V$ ; i.e., the source code tokens used by sequence models, like RNNs, are by definition also nodes in the program graph, so GGNNs update their state with every message pass. We can thus envision a combined model that uses each of these as a building block; for instance, assuming initial node features $\\boldsymbol { x } ^ { ( v ) } \\in \\mathbb { R } ^ { D }$ , the formula [RNN, GGNN(3), RNN] describes a model in which we first run an RNN on all tokens $\\in \\mathcal { T }$ (in lexical ordering), then, using these as initial states for $v \\in T$ while using the default node-type embeddings for all other nodes, run three message passing steps using a GGNN, after which we again gather the nodes corresponding to $T$ and update their state with an additional RNN pass. ",
220
+ "bbox": [
221
+ 173,
222
+ 353,
223
+ 825,
224
+ 467
225
+ ],
226
+ "page_idx": 2
227
+ },
228
+ {
229
+ "type": "text",
230
+ "text": "The resulting family of models alternates GGNN-style message passing operations and layers of sequence-based models. By varying the number and size of sequential layers and blocks of GGNNstyle message passing, this variant particularly provides insight into the first question above (how can global information help GNNs?), by showing the transition in performance potential of models that increasingly incorporate sequential features. We refer to this class of models as sandwich models. ",
231
+ "bbox": [
232
+ 174,
233
+ 473,
234
+ 825,
235
+ 542
236
+ ],
237
+ "page_idx": 2
238
+ },
239
+ {
240
+ "type": "text",
241
+ "text": "Graph Relational Embedding Attention Transformer The above family of models still rely on explicit message passing for their structural bias, thereby only indirectly combining structural and global information to the model. We may wish to instead directly encode structural bias into a sequence-based model, which requires a relaxation of the ‘hard’ inductive bias from the GGNN. For Transformer-based architectures, Shaw et al. (2018) show that relational features can be incorporated directly into the attention function by changing the attention computation to:3√ $e _ { i j } = ( { \\bf q _ { i } } + b _ { i j } ) { { \\bf k _ { j } } ^ { \\top } } / \\sqrt { N }$ where ${ \\bf q _ { i } }$ and $\\mathbf { k _ { j } }$ correspond to the query and key vectors as described above, $b _ { i j }$ is an added bias term for the specific attention weight between tokens $i$ and $j$ , and $N$ is the per-head attention dimension. In our case, we compute $b _ { i j } = W _ { e } ^ { \\top } { \\mathbf e } + b _ { e }$ , where $W _ { e } \\in \\mathbb { R } ^ { N } , b _ { e } \\in \\mathbb { R }$ , and $\\mathbf { e } \\in \\mathbb { R } ^ { N }$ is an embedding of the edge type connecting nodes $i$ and $j$ , if any. If multiple edge types are present between two nodes, the resulting biases are simply added. We name this model GREAT, for Graph Relational Embedding Attention Transformer. ",
242
+ "bbox": [
243
+ 173,
244
+ 549,
245
+ 826,
246
+ 723
247
+ ],
248
+ "page_idx": 2
249
+ },
250
+ {
251
+ "type": "text",
252
+ "text": "3.2 ARCHITECTURAL DETAILS ",
253
+ "text_level": 1,
254
+ "bbox": [
255
+ 176,
256
+ 744,
257
+ 401,
258
+ 758
259
+ ],
260
+ "page_idx": 2
261
+ },
262
+ {
263
+ "type": "text",
264
+ "text": "In this section, we present details of different architectures we compare and their hyperparameters. ",
265
+ "bbox": [
266
+ 169,
267
+ 772,
268
+ 816,
269
+ 787
270
+ ],
271
+ "page_idx": 2
272
+ },
273
+ {
274
+ "type": "text",
275
+ "text": "General: All of our models follow the structure proposed by Vasic et al. (2019), stacking an initial token-embedding layer, a ‘core’ model that computes a distributed representation of the code under inspection (in their case, an LSTM), followed by a projection into two pointers for the localization and repair tasks (see Section 4). This core model is the part varied in our work. We use ",
276
+ "bbox": [
277
+ 174,
278
+ 794,
279
+ 823,
280
+ 851
281
+ ],
282
+ "page_idx": 2
283
+ },
284
+ {
285
+ "type": "text",
286
+ "text": "SubwordTextEncoder from Tensor2Tensor (Vaswani et al., 2018) to generate a 10K sub-token vocabulary from training data and embed each token by averaging embeddings of its sub-token(s). ",
287
+ "bbox": [
288
+ 173,
289
+ 103,
290
+ 823,
291
+ 132
292
+ ],
293
+ "page_idx": 3
294
+ },
295
+ {
296
+ "type": "text",
297
+ "text": "GGNN: Many types of graph-based message-passing neural networks have been proposed for code, mostly differing in how a node’s state is updated based on ‘messages’ sent by nodes it is connected to. Most commonly used is the gated graph neural network (GGNN) (Li et al., 2015), which uses a GRU cell (Cho et al., 2014) to update a node’s state. Although other options sometimes outperform this architecture, the improvements are generally minor, so we rely on this model for our baseline. One hyperparameter of the architecture is whether to use different transformations at each message-passing step, or to reuse one set of transformations for multiple message passes. Following Allamanis et al. (2018b), we use blocks of two message-passing layers, in which the first layer is repeated three times, for four message passes per block. We then sweep over GGNN architectures that repeat these blocks 1 to 4 times (thus yielding 4 to 16 message passes). By default, the message dimension is set to 128, but we include an ablation with 256-dimensional messages as well. ",
298
+ "bbox": [
299
+ 174,
300
+ 138,
301
+ 825,
302
+ 291
303
+ ],
304
+ "page_idx": 3
305
+ },
306
+ {
307
+ "type": "text",
308
+ "text": "RNNs: We experimented with the one-directional entailment-attention-based RNN proposed by Vasic et al. (2019), but found a simpler bi-directional RNN architecture to work even better. We use GRUs as the recurrent cells, vary the number of layers from 1 to 3, and the hidden dimension (of the concatenated forward and backward component) in $\\{ 1 2 8 , 2 5 6 , 5 1 2 \\}$ . ",
309
+ "bbox": [
310
+ 174,
311
+ 299,
312
+ 825,
313
+ 354
314
+ ],
315
+ "page_idx": 3
316
+ },
317
+ {
318
+ "type": "text",
319
+ "text": "Transformers: We base our architecture on the original Transformer (Vaswani et al., 2017), varying the number of layers from 1 to 10 and the attention dimension in $\\{ 1 2 8 , 2 5 6 , 5 1 2 , 1 0 2 4 \\}$ . ",
320
+ "bbox": [
321
+ 173,
322
+ 361,
323
+ 823,
324
+ 390
325
+ ],
326
+ "page_idx": 3
327
+ },
328
+ {
329
+ "type": "text",
330
+ "text": "Sandwich Models: We distinguish between two types of sandwich models: ‘small’ sandwiches, which add a single RNN or Transformer to a GGNN architecture, and ‘large’ sandwiches, which wrap every message-passing block (as defined above) with a 128-dimensional (bi-directional) RNN/Transformer layer. We vary the number of message-passing blocks from 1 to 3 (corresponding to 4 to 12 message passes) to span a similar parameter domain as the GGNNs above (ca. $1 . 5 { \\mathbf { M } } -$ 5M), increasing the number of layers to 2 and their dimension to 512 for a later ablation. ",
331
+ "bbox": [
332
+ 174,
333
+ 397,
334
+ 825,
335
+ 479
336
+ ],
337
+ "page_idx": 3
338
+ },
339
+ {
340
+ "type": "text",
341
+ "text": "GREAT: Uses the same architectural variations as the Transformer family; edge-type embedding dimensions are fixed at the per-head attention dimension, as described above. ",
342
+ "bbox": [
343
+ 173,
344
+ 487,
345
+ 821,
346
+ 515
347
+ ],
348
+ "page_idx": 3
349
+ },
350
+ {
351
+ "type": "text",
352
+ "text": "Global hyper-parameters: We train most of our models with batch sizes of $\\{ 1 2 . 5 \\mathrm { K } , 2 5 \\mathrm { K } , 5 0 \\mathrm { K } \\}$ tokens, with the exception of the Transformer architectures; due to the quadratic nature of the attention computation, 25K tokens was too large for these models, so we additionally trained these with 6.25K-token batches.4 Learning rates were varied in $\\left\\{ 1 \\mathrm { e } { - } 3 , 4 \\mathrm { - } \\mathrm { e } 4 , 1 \\mathrm { e } { - } 4 , 4 \\mathrm { e } { - } 5 , 1 \\mathrm { e } { - } 5 \\right\\}$ using an Adam optimizer, where we omitted the first option for our GGNN models and the last for our RNNs due to poor performance. Sub-tokens were embedded using 128-dimensional embeddings. ",
353
+ "bbox": [
354
+ 174,
355
+ 522,
356
+ 825,
357
+ 606
358
+ ],
359
+ "page_idx": 3
360
+ },
361
+ {
362
+ "type": "text",
363
+ "text": "Hardware: all our models were trained on a single Tesla P100 GPU on 25 million samples, which required between 40 and 250 hours for our various models. However, we emphasize that overall training time is not our main objective; we primarily assess the ultimated converged accuracy of our models and present training behavior over time for reference of our various models’ training behavior. ",
364
+ "bbox": [
365
+ 174,
366
+ 613,
367
+ 825,
368
+ 683
369
+ ],
370
+ "page_idx": 3
371
+ },
372
+ {
373
+ "type": "text",
374
+ "text": "3.3 ABOUT GRAPH REPRESENTATIONS OF CODE ",
375
+ "text_level": 1,
376
+ "bbox": [
377
+ 176,
378
+ 700,
379
+ 524,
380
+ 714
381
+ ],
382
+ "page_idx": 3
383
+ },
384
+ {
385
+ "type": "text",
386
+ "text": "Our program graphs borrow many edge types from Allamanis et al. (2018b), such as data-flow (e.g., read & write), adjacent-token, and syntactic edges, which we further augment with edges between control-flow statements and function calls. When representing programs as graphs, a key decision needs to be made regarding the Abstract Syntax Tree (AST). Typically, one of the edge types in the graphs represents syntactic parent-child relationships in the AST. Additionally, some of the edges representing relations (e.g., control-flow) are naturally represented as edges between internal nodes in this tree, e.g., between two IfStatement nodes. However, ablations often find that the effectiveness of including the AST is limited in graph-based models (Allamanis et al., 2018b). ",
387
+ "bbox": [
388
+ 174,
389
+ 726,
390
+ 825,
391
+ 837
392
+ ],
393
+ "page_idx": 3
394
+ },
395
+ {
396
+ "type": "text",
397
+ "text": "This raises the question of whether it is possible to represent programs as graphs that include sequential and semantic information, but not syntax. To this end, we propose a leaves-only graph representation for code as follows: edges that represent semantic relationships such as control flow and data flow can easily be moved down from internal nodes – which typically represent a span of multiple tokens – to those leaf nodes in the graph that represent the begin token of that span. Thus, an edge that used to connect two IfStatement interior AST nodes is moved down to connect the corresponding if tokens. Now, the AST can be omitted entirely, thereby removing parent-child relations among syntax nodes, producing what we call a leaves-only graph. This latter representation is substantially more compressed than the graphs with ASTs, often using $2 { - } 3 \\mathbf { x }$ fewer nodes (while retaining most of the edges), and additionally aligns better with sequence-based models, because all edges are directly connected to the original code tokens.5 We compare both settings for each graph-based model, but unless otherwise specified, we use the ‘full’ graphs for the regular GGNN model and the ‘leaves-only’ graphs (without ASTs) for the sandwich and GREAT models. ",
398
+ "bbox": [
399
+ 174,
400
+ 844,
401
+ 823,
402
+ 900
403
+ ],
404
+ "page_idx": 3
405
+ },
406
+ {
407
+ "type": "text",
408
+ "text": "",
409
+ "bbox": [
410
+ 174,
411
+ 103,
412
+ 825,
413
+ 229
414
+ ],
415
+ "page_idx": 4
416
+ },
417
+ {
418
+ "type": "text",
419
+ "text": "4 EXPERIMENTAL SETUP ",
420
+ "text_level": 1,
421
+ "bbox": [
422
+ 176,
423
+ 250,
424
+ 398,
425
+ 265
426
+ ],
427
+ "page_idx": 4
428
+ },
429
+ {
430
+ "type": "text",
431
+ "text": "The VarMisuse Task We focus our study on the variable-misuse localization-and-repair task (Vasic et al., 2019): given a function, predict two pointers into the function’s tokens, one pointer for the location of a variable use containing the wrong variable (or a special no-bug location), and one pointer for any occurrence of the correct variable that should be used at the faulty location instead. ",
432
+ "bbox": [
433
+ 174,
434
+ 281,
435
+ 825,
436
+ 337
437
+ ],
438
+ "page_idx": 4
439
+ },
440
+ {
441
+ "type": "text",
442
+ "text": "Synthetic Dataset We used the ETH Py150 dataset (Raychev et al., 2016), which is based on GitHub Python code, and already partitioned into train and test splits (100K and 50K files, respectively). We further split the 100K train files into 90K train and 10K validation examples and applied a deduplication step on that dataset (Allamanis, 2018). We extracted all top-level function definitions from these files; any function that uses multiple variables can be turned into a training example by randomly replacing one variable usage with another. As there may be many candidates for such bugs in a function, we limit our extraction to up to three samples per function to avoid biasing our dataset too strongly towards longer functions. For every synthetically generated buggy example, an unperturbed, bug-free example of the function is included as well, to keep our dataset balanced, yielding ca. 2M total training and 755K test samples. Finally, we train with functions with up to 250 tokens; at test time, we raise this to 1,000 to study our models’ generalization to longer functions. ",
443
+ "bbox": [
444
+ 174,
445
+ 343,
446
+ 825,
447
+ 497
448
+ ],
449
+ "page_idx": 4
450
+ },
451
+ {
452
+ "type": "text",
453
+ "text": "Metrics As we are mainly interested in contrasting the behavior of different models of code, we focus most of our results on the various models’ learning curves by tracking development-set accuracy on 25K held-out samples every 250K samples as the models train. Here, we measure two accuracy metrics: localization accuracy (whether the model correctly identifies the bug’s location for buggy samples); and (independently) repair accuracy (whether the model points to the correct variable to repair the bug). Note that these metrics focus on buggy samples; the models also determine whether a function is buggy, which we discuss below. We group all models by their ‘family’, as categorized in Section 3.2, reporting the maximum held-out performance per family. ",
454
+ "bbox": [
455
+ 174,
456
+ 503,
457
+ 825,
458
+ 614
459
+ ],
460
+ "page_idx": 4
461
+ },
462
+ {
463
+ "type": "text",
464
+ "text": "For deeper insight into the fully trained models’ performance, we also analyze the performance of the best models in each family in more depth on the test portion of our synthetic dataset. Specifically, we assess their bugginess-classification accuracy (whether the model correctly identifies the method as (non-)buggy) and their joint localization and repair accuracy (for buggy samples, how often the model correctly localizes and repairs the bug). Here, we also increase the maximum function size to 1,000 tokens and analyze the impact of longer functions on our models’ performance. ",
465
+ "bbox": [
466
+ 174,
467
+ 622,
468
+ 825,
469
+ 705
470
+ ],
471
+ "page_idx": 4
472
+ },
473
+ {
474
+ "type": "text",
475
+ "text": "4.1 DATA & CODE RELEASE ",
476
+ "text_level": 1,
477
+ "bbox": [
478
+ 176,
479
+ 723,
480
+ 385,
481
+ 737
482
+ ],
483
+ "page_idx": 4
484
+ },
485
+ {
486
+ "type": "text",
487
+ "text": "We release a public implementation of the GREAT model based on Tensorflow, as well as the program graphs for all samples in our training and evaluation datasets whose license permits us to redistribute these at: https://doi.org/10.5281/zenodo.3668323, which tracks the latest release of our Github repository at: https://github.com/VHellendoorn/ ICLR20-Great. ",
488
+ "bbox": [
489
+ 174,
490
+ 750,
491
+ 825,
492
+ 818
493
+ ],
494
+ "page_idx": 4
495
+ },
496
+ {
497
+ "type": "text",
498
+ "text": "5 RESULTS ",
499
+ "text_level": 1,
500
+ "bbox": [
501
+ 174,
502
+ 839,
503
+ 281,
504
+ 854
505
+ ],
506
+ "page_idx": 4
507
+ },
508
+ {
509
+ "type": "text",
510
+ "text": "There are many degrees of freedom in our family of models, so we structure our results around a series of comparisons, which we analyze and discuss in this section. We start with our key result, which compares all our model families (RNNs, Transformers, GGNNs, Sandwich hybrids, and GREAT models) across a comparable parameter domain (ca. 1.4M – 5.5M parameters) in Figure 1. ",
511
+ "bbox": [
512
+ 178,
513
+ 871,
514
+ 823,
515
+ 900
516
+ ],
517
+ "page_idx": 4
518
+ },
519
+ {
520
+ "type": "text",
521
+ "text": "",
522
+ "bbox": [
523
+ 173,
524
+ 103,
525
+ 825,
526
+ 132
527
+ ],
528
+ "page_idx": 5
529
+ },
530
+ {
531
+ "type": "image",
532
+ "img_path": "images/96061ba572ebf13a72a349a63a2a4c26ec4970bd22d2b93d03adfbc9020773de.jpg",
533
+ "image_caption": [
534
+ "Figure 1: Comparison of top-performing models from all model families across a comparable parameter domain of $1 . 5 \\mathrm { M } - 5 \\mathrm { M }$ parameters. Performance visualized using the localization (left) and repair (right) accuracy Pareto fronts w.r.t. both training time (top) and number of training samples seen (bottom), both log-scaled, where an epoch is ca. 2M samples. In all cases, our proposed models substantially outperform GGNNs from early in the training process. "
535
+ ],
536
+ "image_footnote": [],
537
+ "bbox": [
538
+ 236,
539
+ 161,
540
+ 756,
541
+ 550
542
+ ],
543
+ "page_idx": 5
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "Although there are subtle differences between the models’ behavior on localization and repair accuracy, the overall picture is consistent: whereas our newly proposed graph-to-multihead-pointer models already substantially outperform RNN-based models (the previous state-of-the-art), and sometimes Transformers, the hybrid global & structured models achieve significantly better results faster. ",
548
+ "bbox": [
549
+ 174,
550
+ 651,
551
+ 823,
552
+ 707
553
+ ],
554
+ "page_idx": 5
555
+ },
556
+ {
557
+ "type": "text",
558
+ "text": "Time-wise (the top two figures), the GGNN models take the longest to converge, continuing to improve slightly even after a week of training mainly because their largest (16-layer) architecture starts to dominate the 12-layer version’s performance after ca. 170h. The Sandwich models follow its training curve, but are more accurate and faster to converge, achieving especially good results for limited training budgets, partly because they succeeded with just 4 – 8 layers of message passing by relying on their global components. ",
559
+ "bbox": [
560
+ 174,
561
+ 713,
562
+ 825,
563
+ 797
564
+ ],
565
+ "page_idx": 5
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "The Transformer architecture, although slower at first, widely outperforms the RNN as a baseline model. The GREAT model tracks its learning curve, starting out slower than the models with explicit message passing, but gradually overtaking them after ca. 10h, as the underlying Transformer becomes increasingly effective. We note that this model achieves state-of-the-art results despite having, at the time of this writing, received less training time (ca. 64h compared to up to 240h). ",
570
+ "bbox": [
571
+ 174,
572
+ 805,
573
+ 825,
574
+ 875
575
+ ],
576
+ "page_idx": 5
577
+ },
578
+ {
579
+ "type": "text",
580
+ "text": "The bottom half of Figure 1 abstracts away the potentially confounding issue of implementation speed of our models by tracking performance w.r.t the number of training samples. Naturally, the end-points of the curves (the converged accuracy) are identical, but importantly the various models’ training curves are quite similar; even here, the GGNN is only able to outperform some of our proposed models briefly, yielding inferior performance to all within just one epoch. ",
581
+ "bbox": [
582
+ 176,
583
+ 882,
584
+ 823,
585
+ 924
586
+ ],
587
+ "page_idx": 5
588
+ },
589
+ {
590
+ "type": "text",
591
+ "text": "",
592
+ "bbox": [
593
+ 173,
594
+ 103,
595
+ 821,
596
+ 132
597
+ ],
598
+ "page_idx": 6
599
+ },
600
+ {
601
+ "type": "text",
602
+ "text": "The RNN and GGNN models appear to be particularly complementary; even though the RNN’s localization accuracy is very poor compared to the GGNN, the combined model still sustains a ${ \\sim } 5 \\%$ improvement on the latter.6 However, the Transformer Sandwich does not seem to benefit similarly, showing virtually no difference in performance with the RNN Sandwich model. This strongly suggests that the Transformer’s ability to access long-distance information overlaps in large part (though not entirely, given GREAT’s performance) with the GGNNs’ ability to do so using message passing. We conjecture that the Transformer learns to infer many of the same connections (e.g., data-flow, control-flow) that are encoded explicitly in the graph’s message passing. ",
603
+ "bbox": [
604
+ 174,
605
+ 138,
606
+ 825,
607
+ 251
608
+ ],
609
+ "page_idx": 6
610
+ },
611
+ {
612
+ "type": "text",
613
+ "text": "To understand the behavior of the many models and combinations that may be used for code, we now explore the variations on our choices of parameters, models, and metrics. ",
614
+ "bbox": [
615
+ 176,
616
+ 257,
617
+ 823,
618
+ 285
619
+ ],
620
+ "page_idx": 6
621
+ },
622
+ {
623
+ "type": "text",
624
+ "text": "5.1 LARGER MODELS ",
625
+ "text_level": 1,
626
+ "bbox": [
627
+ 176,
628
+ 303,
629
+ 338,
630
+ 318
631
+ ],
632
+ "page_idx": 6
633
+ },
634
+ {
635
+ "type": "text",
636
+ "text": "Model capacity is a potential threat to any comparison between models of different families. We aimed to ensure a fair comparison in the previous section by selecting a range of hyper-parameters (which includes the number of stacked layers) for these architectures that span a similar parameter count range. For instance, a 6-layer Transformer with 512-dimensional attention is comparable to a 2-layer 512-dimensional bi-directional RNN and an 8-layer GGNN. However, all these architectures are relatively modest, having at most ${ \\sim } 5 \\mathbf { M }$ parameters. By increasing the number, and dimensionality of their layers, we can evaluate a second family of models with ca. 5–20M parameters. ",
637
+ "bbox": [
638
+ 173,
639
+ 329,
640
+ 825,
641
+ 428
642
+ ],
643
+ "page_idx": 6
644
+ },
645
+ {
646
+ "type": "text",
647
+ "text": "Figure 2 shows the performance for the low- and high-parameter variations for each of our bestperforming model families. Overall, while providing more parameters to the GGNNs made virtually no difference, all our hybrid models increase $2 - 3 \\%$ in both localization and repair accuracy, providing further support for combining global, structured models. The best-performing instances of each model family were consistently the larger architectures, 15M parameters for the GGNN, 12.5M & 10M for the RNN and Transformer Sandwiches respectively and 7.9M for GREAT.7 ",
648
+ "bbox": [
649
+ 174,
650
+ 434,
651
+ 823,
652
+ 517
653
+ ],
654
+ "page_idx": 6
655
+ },
656
+ {
657
+ "type": "image",
658
+ "img_path": "images/891bb76b8b22cc3f22d8d35865dbfce9b0f0a82d9df045cca8830b19b5be6265.jpg",
659
+ "image_caption": [
660
+ "Figure 2: Comparison of smaller (1.5–5M parameter) and larger (5–20M parameter, identified with $\\cdot _ { + + } ,$ variants of each model family. Localization and repair accuracy Pareto-front w.r.t. time. "
661
+ ],
662
+ "image_footnote": [],
663
+ "bbox": [
664
+ 238,
665
+ 544,
666
+ 756,
667
+ 728
668
+ ],
669
+ "page_idx": 6
670
+ },
671
+ {
672
+ "type": "text",
673
+ "text": "5.2 ON SYNTACTIC INFORMATION ",
674
+ "text_level": 1,
675
+ "bbox": [
676
+ 176,
677
+ 803,
678
+ 424,
679
+ 816
680
+ ],
681
+ "page_idx": 6
682
+ },
683
+ {
684
+ "type": "text",
685
+ "text": "In the previous results, the GGNN models were trained on ‘full’ graphs (as described in Section 3.3), that use the code’s AST structure, and the sandwich models on ‘leaves-only’ graphs, with only source token nodes, and edges moved to connect these directly. These settings are arguably each appropriate to the underlying model, but both models can also use the alternative setting. ",
686
+ "bbox": [
687
+ 176,
688
+ 828,
689
+ 823,
690
+ 885
691
+ ],
692
+ "page_idx": 6
693
+ },
694
+ {
695
+ "type": "image",
696
+ "img_path": "images/a820488f09223f97e60319c333a9fc46ccb028312e07b0032199bdaa49aa909f.jpg",
697
+ "image_caption": [
698
+ "Figure 3: Comparing impact of graph representation on GGNNs and RNN Sandwich models. Localization and repair accuracy Pareto-front w.r.t time. Note: y-axis cropped to simplify comparison. "
699
+ ],
700
+ "image_footnote": [],
701
+ "bbox": [
702
+ 238,
703
+ 113,
704
+ 756,
705
+ 296
706
+ ],
707
+ "page_idx": 7
708
+ },
709
+ {
710
+ "type": "text",
711
+ "text": "Figure 3 shows the training curves for the alternative settings. In all cases, the models that do not use syntax train substantially faster because each sample’s graph representation is more than twice as small, so these models naturally lead in accuracy early on in training. However, whereas the GGNN equipped with syntax overtakes its counter-part within ca. 48h, the sandwich models display a much longer lag, with no cross-over observed at all on localization accuracy in this time window.8 ",
712
+ "bbox": [
713
+ 174,
714
+ 381,
715
+ 823,
716
+ 450
717
+ ],
718
+ "page_idx": 7
719
+ },
720
+ {
721
+ "type": "text",
722
+ "text": "The sandwich model on full graphs still compares favorably with the GGNN baseline, though its early training behavior is not as effective. It is also interesting to note that the best-performing Sandwich models in this setting were consistently architectures with more message-passing steps. This may be due to the additional distance between information propagated along the tokens and along semantic edges, which in this setting are almost universally connected to AST-internal nodes. ",
723
+ "bbox": [
724
+ 174,
725
+ 458,
726
+ 825,
727
+ 529
728
+ ],
729
+ "page_idx": 7
730
+ },
731
+ {
732
+ "type": "text",
733
+ "text": "5.3 RNNS IN SANDWICHES: SINGLE VS. MANY",
734
+ "text_level": 1,
735
+ "bbox": [
736
+ 174,
737
+ 556,
738
+ 517,
739
+ 570
740
+ ],
741
+ "page_idx": 7
742
+ },
743
+ {
744
+ "type": "text",
745
+ "text": "Recent work on neural summarization also mixed RNNs and GGNNs (Fernandes et al., 2018), but did so by inserting a single RNN layer into a GNN architecture, before any message passing. We compare this architecture to a full Sandwich model in Figure 4. Although a single RNN certainly helps compared to the GGNN, interleaving RNNs and GGNN-style message passes performed substantially better. In fact, the best performing full Sandwiches used fewer parameters than the Single models because they used 8 message passes instead of 12, relying more heavily on the RNNs.9 ",
746
+ "bbox": [
747
+ 174,
748
+ 585,
749
+ 825,
750
+ 670
751
+ ],
752
+ "page_idx": 7
753
+ },
754
+ {
755
+ "type": "text",
756
+ "text": "5.4 TEST-SET ANALYSIS ",
757
+ "text_level": 1,
758
+ "bbox": [
759
+ 176,
760
+ 698,
761
+ 356,
762
+ 712
763
+ ],
764
+ "page_idx": 7
765
+ },
766
+ {
767
+ "type": "text",
768
+ "text": "Having identified our best-performing models in each family, we now study their performance on the test data, specifically using the metrics used in Vasic et al. (2019) (see Section 4) in Table 1. In general, the two metrics correlated well; models that accurately determined whether a function contained a bug also accurately identified the bug (and repair), as may be expected. The baseline RNN model achieves a modest $44 \\%$ accuracy at the latter task; this is slightly lower than reported in prior work (Vasic et al., 2019), which is likely due in part to our dataset de-duplication. Transformers and GGNNs perform substantially better (and comparably, though the latter trained 6x longer for this performance), but still fall well short of our hybrid models’ performance, which are especially much more accurate on long functions. The GREAT model shows most promise on the repair task, already outperforming the sandwich models despite having so far had limited training time. ",
769
+ "bbox": [
770
+ 174,
771
+ 728,
772
+ 825,
773
+ 867
774
+ ],
775
+ "page_idx": 7
776
+ },
777
+ {
778
+ "type": "image",
779
+ "img_path": "images/4e04d6ea7dd5bfb2ef01a6dfd6d452ab0dbf57732e286b392cbf2337a905571b.jpg",
780
+ "image_caption": [
781
+ "Figure 4: Comparison of RNN sandwiches with a single RNN vs. those with RNNs around every message-passing block (‘Multi’). Localization and repair accuracy Pareto-front w.r.t. time. "
782
+ ],
783
+ "image_footnote": [],
784
+ "bbox": [
785
+ 236,
786
+ 113,
787
+ 756,
788
+ 295
789
+ ],
790
+ "page_idx": 8
791
+ },
792
+ {
793
+ "type": "table",
794
+ "img_path": "images/4e7aea86a35c3a5154dd03b345cf8c91955b43f8821d291f304467e0d6db27fa.jpg",
795
+ "table_caption": [
796
+ "Table 1: Test-set results of best-performing models by family, on metrics of Vasic et al. (2019). Grouped by maximum length; $6 . 5 \\%$ of test set samples exceeded 250 tokens (the training limit). "
797
+ ],
798
+ "table_footnote": [
799
+ "1: a stronger version of the model proposed in Vasic et al. (2019) (previous SOTA). "
800
+ ],
801
+ "table_body": "<table><tr><td rowspan=1 colspan=4>Model Family</td><td rowspan=1 colspan=1>Class. Accuracy≤ 250 ≤1000</td><td rowspan=1 colspan=1>Loc &amp; Rep Accuracy≤ 250 ≤1000</td><td rowspan=1 colspan=1>Parameters</td><td rowspan=1 colspan=1>TrainingTime</td></tr><tr><td rowspan=1 colspan=4>RNN1</td><td rowspan=1 colspan=1>71.8% 70.6%</td><td rowspan=1 colspan=1>44.4% 42.5%</td><td rowspan=1 colspan=1>4.3M</td><td rowspan=1 colspan=1>31.3h</td></tr><tr><td rowspan=3 colspan=4>TransformerGGNN</td><td rowspan=1 colspan=1>75.9% 73.2%</td><td rowspan=1 colspan=1>67.7% 63.0%</td><td rowspan=1 colspan=1>3.7M</td><td rowspan=1 colspan=1>41.5h</td></tr><tr><td rowspan=1 colspan=2></td><td rowspan=1 colspan=2>GGNN</td><td rowspan=1 colspan=1>81.4% 79.2%</td><td rowspan=1 colspan=1>64.0% 60.9%</td><td rowspan=1 colspan=1>5.5M</td><td rowspan=1 colspan=1>241h</td></tr><tr><td rowspan=2 colspan=4>RNN Sandwich</td><td></td><td></td><td></td><td></td></tr><tr><td rowspan=1 colspan=1>82.5% 81.9%</td><td rowspan=1 colspan=1>75.8% 73.8%</td><td rowspan=1 colspan=1>12.6M</td><td rowspan=1 colspan=1>109h</td></tr><tr><td rowspan=1 colspan=4>Transformer Sandwich</td><td rowspan=1 colspan=1>81.1% 78.1%</td><td rowspan=1 colspan=1>74.5% 71.4%</td><td rowspan=1 colspan=1>10M</td><td rowspan=1 colspan=1>161h</td></tr><tr><td rowspan=1 colspan=4>GREAT</td><td rowspan=1 colspan=1>80.1% 76.9%</td><td rowspan=1 colspan=1>76.4% 73.1%</td><td rowspan=1 colspan=1>7.9M</td><td rowspan=1 colspan=1>120h</td></tr></table>",
802
+ "bbox": [
803
+ 184,
804
+ 410,
805
+ 813,
806
+ 537
807
+ ],
808
+ "page_idx": 8
809
+ },
810
+ {
811
+ "type": "text",
812
+ "text": "5.5 REAL BUGS ANALYSIS ",
813
+ "text_level": 1,
814
+ "bbox": [
815
+ 176,
816
+ 588,
817
+ 374,
818
+ 603
819
+ ],
820
+ "page_idx": 8
821
+ },
822
+ {
823
+ "type": "text",
824
+ "text": "We want to ensure that our models can be useful for real bugs and do not simply overfit to the synthetic data generation that we used. This risk exists because we did not filter our introduced bugs based on whether they would be difficult to detect, for instance because they conflate variables with similar names, usage, or data types; presumably, such bugs are more likely to escape a developer’s notice and find their way into real code bases. It is therefore expected that performance on realworld bugs will be lower for all our models, but we must assert that our proposed models do not just outperform GGNNs on synthetic data, e.g. by memorizing characteristics of synthetic bugs. ",
825
+ "bbox": [
826
+ 174,
827
+ 617,
828
+ 825,
829
+ 715
830
+ ],
831
+ "page_idx": 8
832
+ },
833
+ {
834
+ "type": "text",
835
+ "text": "To mitigate this threat, we collect real variable misuse bugs from code on Github. Specifically, we collect ca. 1 million commits that modify Python files from Github. We extracted all changes to functions from these commits, filtering these according to the same criteria that we used to introduce variable-misuse bugs: we looked for commits that exclusively changed a single variable usage in a function body from one variable in scope to another. We focus on functions with up to 250 tokens, since all our models performed substantially better on these in Table 1. We identified 170 such changes, in which we assumed that the version before the change was buggy and the updated version correct. We removed any functions that had occurred in our training data, of which we found 9 and paired the remaining functions up (correct and buggy) to create a real-world evaluation set with 322 functions, which we presented to our models. ",
836
+ "bbox": [
837
+ 174,
838
+ 722,
839
+ 825,
840
+ 861
841
+ ],
842
+ "page_idx": 8
843
+ },
844
+ {
845
+ "type": "text",
846
+ "text": "Table 2 shows the results of running our various models on these bugs. In general, these were clearly substantially more difficult for all our models than the synthetic samples we generated. However, we see a clear difference in performance with all our proposed models performing substantially better than previous baselines, and showing favorable precision/recall trade-offs. ",
847
+ "bbox": [
848
+ 174,
849
+ 867,
850
+ 823,
851
+ 924
852
+ ],
853
+ "page_idx": 8
854
+ },
855
+ {
856
+ "type": "table",
857
+ "img_path": "images/a2588d44c5222e93ce00d4984202080de0bba24d5330bb29927852b42faca985.jpg",
858
+ "table_caption": [
859
+ "Table 2: Results on 322 paired buggy and non-buggy samples from 161 real variable misuse bugs mined from Github commits. ‘Class.’ measures accuracy at identifying non-buggy samples; ‘Prec.’ and ‘Rec.’ capture the precision and recall at identifying the correct localization and repair on the buggy samples. "
860
+ ],
861
+ "table_footnote": [],
862
+ "table_body": "<table><tr><td>Model Family</td><td colspan=\"2\"> All Samples</td><td>Precision at Recall = 5%</td><td>Precision at Recall = 10%</td></tr><tr><td>RNN</td><td>Class. Prec. 52.8% 13.3%</td><td>Rec. 46.6%</td><td>44.4%</td><td>23.5%</td></tr><tr><td>Transformer</td><td>62.1% 15.8%</td><td>47.2%</td><td>33.3%</td><td>17.6%</td></tr><tr><td>GGNN</td><td>65.8% 17.7%</td><td>42.2%</td><td>44.4%</td><td>23.5%</td></tr><tr><td>RNN Sandwich</td><td>69.6% 28.6%</td><td>43.5%</td><td>77.8%</td><td>64.7%</td></tr><tr><td>Trans.Sandwich</td><td>75.2% 21.5%</td><td>40.4%</td><td>33.3%</td><td>35.3%</td></tr><tr><td>GREAT</td><td>70.2% 23.7%</td><td>36.7%</td><td>44.4%</td><td>29.4%</td></tr></table>",
863
+ "bbox": [
864
+ 228,
865
+ 174,
866
+ 769,
867
+ 301
868
+ ],
869
+ "page_idx": 9
870
+ },
871
+ {
872
+ "type": "text",
873
+ "text": "6 CONCLUSION ",
874
+ "text_level": 1,
875
+ "bbox": [
876
+ 174,
877
+ 330,
878
+ 318,
879
+ 347
880
+ ],
881
+ "page_idx": 9
882
+ },
883
+ {
884
+ "type": "text",
885
+ "text": "We demonstrate that models leveraging richly structured representations of source code do not have to be confined to local contexts. Instead, models that leverage only limited message passing in combination with global models learn much more powerful representations faster. We proposed two different architectures for combining local and global information: sandwich models that combine two different message-passing schedules and achieve highly competitive models quickly, and the GREAT model which adds information from a sparse graph to a Transformer to achieve stateof-the-art results. In the process, we raise the state-of-the-art performance on the VarMisuse bug localization and repair task by over $30 \\%$ . ",
886
+ "bbox": [
887
+ 173,
888
+ 361,
889
+ 825,
890
+ 473
891
+ ],
892
+ "page_idx": 9
893
+ },
894
+ {
895
+ "type": "text",
896
+ "text": "REFERENCES ",
897
+ "text_level": 1,
898
+ "bbox": [
899
+ 174,
900
+ 493,
901
+ 285,
902
+ 508
903
+ ],
904
+ "page_idx": 9
905
+ },
906
+ {
907
+ "type": "text",
908
+ "text": "Miltiadis Allamanis. The adverse effects of code duplication in machine learning models of code. CoRR, abs/1812.06469, 2018. URL http://arxiv.org/abs/1812.06469. ",
909
+ "bbox": [
910
+ 176,
911
+ 516,
912
+ 823,
913
+ 545
914
+ ],
915
+ "page_idx": 9
916
+ },
917
+ {
918
+ "type": "text",
919
+ "text": "Miltiadis Allamanis and Charles Sutton. Mining source code repositories at massive scale using language modeling. In Working Conference on Mining Software Repositories (MSR), 2013. ",
920
+ "bbox": [
921
+ 173,
922
+ 553,
923
+ 823,
924
+ 583
925
+ ],
926
+ "page_idx": 9
927
+ },
928
+ {
929
+ "type": "text",
930
+ "text": "Miltiadis Allamanis, Earl T Barr, Christian Bird, and Charles Sutton. Suggesting accurate method and class names. In Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, pp. 38–49. ACM, 2015. ",
931
+ "bbox": [
932
+ 174,
933
+ 589,
934
+ 823,
935
+ 633
936
+ ],
937
+ "page_idx": 9
938
+ },
939
+ {
940
+ "type": "text",
941
+ "text": "Miltiadis Allamanis, Earl T. Barr, Premkumar Devanbu, and Charles Sutton. A survey of machine learning for big code and naturalness. ACM Comput. Surv., 51(4):81:1–81:37, July 2018a. ISSN 0360-0300. ",
942
+ "bbox": [
943
+ 173,
944
+ 640,
945
+ 823,
946
+ 683
947
+ ],
948
+ "page_idx": 9
949
+ },
950
+ {
951
+ "type": "text",
952
+ "text": "Miltiadis Allamanis, Marc Brockschmidt, and Mahmoud Khademi. Learning to represent programs with graphs. In International Conference on Learning Representations, 2018b. ",
953
+ "bbox": [
954
+ 169,
955
+ 691,
956
+ 823,
957
+ 720
958
+ ],
959
+ "page_idx": 9
960
+ },
961
+ {
962
+ "type": "text",
963
+ "text": "Uri Alon, Meital Zilberstein, Omer Levy, and Eran Yahav. code2vec: Learning distributed representations of code. CoRR, abs/1803.09473, 2018. ",
964
+ "bbox": [
965
+ 171,
966
+ 728,
967
+ 821,
968
+ 757
969
+ ],
970
+ "page_idx": 9
971
+ },
972
+ {
973
+ "type": "text",
974
+ "text": "Uri Alon, Shaked Brody, Omer Levy, and Eran Yahav. code2seq: Generating sequences from structured representations of code. In 7th International Conference on Learning Representations, ICLR 2019, New Orleans, LA, USA, May 6-9, 2019, 2019. ",
975
+ "bbox": [
976
+ 176,
977
+ 765,
978
+ 823,
979
+ 809
980
+ ],
981
+ "page_idx": 9
982
+ },
983
+ {
984
+ "type": "text",
985
+ "text": "Avishkar Bhoopchand, Tim Rocktaschel, Earl Barr, and Sebastian Riedel. Learning python code ¨ suggestion with a sparse pointer network. arXiv preprint arXiv:1611.08307, 2016. ",
986
+ "bbox": [
987
+ 171,
988
+ 816,
989
+ 823,
990
+ 845
991
+ ],
992
+ "page_idx": 9
993
+ },
994
+ {
995
+ "type": "text",
996
+ "text": "Xinyun Chen, Chang Liu, and Dawn Song. Tree-to-tree neural networks for program translation. In S. Bengio, H. Wallach, H. Larochelle, K. Grauman, N. Cesa-Bianchi, and R. Garnett (eds.), Advances in Neural Information Processing Systems 31, pp. 2547–2557. Curran Associates, Inc., 2018. URL http://papers.nips.cc/paper/ 7521-tree-to-tree-neural-networks-for-program-translation.pdf. ",
997
+ "bbox": [
998
+ 176,
999
+ 854,
1000
+ 825,
1001
+ 922
1002
+ ],
1003
+ "page_idx": 9
1004
+ },
1005
+ {
1006
+ "type": "text",
1007
+ "text": "Kyunghyun Cho, Bart Van Merrienboer, Caglar Gulcehre, Dzmitry Bahdanau, Fethi Bougares, Hol- ¨ ger Schwenk, and Yoshua Bengio. Learning phrase representations using rnn encoder-decoder for statistical machine translation. arXiv preprint arXiv:1406.1078, 2014. ",
1008
+ "bbox": [
1009
+ 176,
1010
+ 103,
1011
+ 821,
1012
+ 146
1013
+ ],
1014
+ "page_idx": 10
1015
+ },
1016
+ {
1017
+ "type": "text",
1018
+ "text": "Patrick Fernandes, Miltiadis Allamanis, and Marc Brockschmidt. Structured neural summarization. arXiv preprint arXiv:1811.01824, 2018. ",
1019
+ "bbox": [
1020
+ 171,
1021
+ 155,
1022
+ 823,
1023
+ 184
1024
+ ],
1025
+ "page_idx": 10
1026
+ },
1027
+ {
1028
+ "type": "text",
1029
+ "text": "Luca Gazzola, Daniela Micucci, and Leonardo Mariani. Automatic software repair: A survey. IEEE Trans. Software Eng., 45(1):34–67, 2019. ",
1030
+ "bbox": [
1031
+ 171,
1032
+ 193,
1033
+ 823,
1034
+ 222
1035
+ ],
1036
+ "page_idx": 10
1037
+ },
1038
+ {
1039
+ "type": "text",
1040
+ "text": "Vincent J Hellendoorn and Premkumar Devanbu. Are deep neural networks the best choice for modeling source code? In Proceedings of the 2017 11th Joint Meeting on Foundations of Software Engineering, pp. 763–773. ACM, 2017. ",
1041
+ "bbox": [
1042
+ 176,
1043
+ 231,
1044
+ 825,
1045
+ 273
1046
+ ],
1047
+ "page_idx": 10
1048
+ },
1049
+ {
1050
+ "type": "text",
1051
+ "text": "Vincent J Hellendoorn, Christian Bird, Earl T Barr, and Miltiadis Allamanis. Deep learning type inference. In Proceedings of the 2018 26th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pp. 152–162. ACM, 2018. ",
1052
+ "bbox": [
1053
+ 174,
1054
+ 282,
1055
+ 825,
1056
+ 339
1057
+ ],
1058
+ "page_idx": 10
1059
+ },
1060
+ {
1061
+ "type": "text",
1062
+ "text": "Abram Hindle, Earl T. Barr, Zhendong Su, Mark Gabel, and Premkumar Devanbu. On the naturalness of software. In Proceedings of the 34th International Conference on Software Engineering, ICSE ’12, pp. 837–847, 2012. ",
1063
+ "bbox": [
1064
+ 174,
1065
+ 348,
1066
+ 825,
1067
+ 392
1068
+ ],
1069
+ "page_idx": 10
1070
+ },
1071
+ {
1072
+ "type": "text",
1073
+ "text": "Yujia Li, Daniel Tarlow, Marc Brockschmidt, and Richard Zemel. Gated graph sequence neural networks, 2015. ",
1074
+ "bbox": [
1075
+ 173,
1076
+ 400,
1077
+ 823,
1078
+ 429
1079
+ ],
1080
+ "page_idx": 10
1081
+ },
1082
+ {
1083
+ "type": "text",
1084
+ "text": "Martin Monperrus. Automatic software repair: A bibliography. ACM Comput. Surv., 51(1):17:1– 17:24, January 2018. ISSN 0360-0300. ",
1085
+ "bbox": [
1086
+ 169,
1087
+ 438,
1088
+ 825,
1089
+ 467
1090
+ ],
1091
+ "page_idx": 10
1092
+ },
1093
+ {
1094
+ "type": "text",
1095
+ "text": "Emilio Parisotto, Abdel-rahman Mohamed, Rishabh Singh, Lihong Li, Dengyong Zhou, and Pushmeet Kohli. Neuro-symbolic program synthesis. CoRR, abs/1611.01855, 2016. URL http: //arxiv.org/abs/1611.01855. ",
1096
+ "bbox": [
1097
+ 174,
1098
+ 477,
1099
+ 821,
1100
+ 518
1101
+ ],
1102
+ "page_idx": 10
1103
+ },
1104
+ {
1105
+ "type": "text",
1106
+ "text": "Chris Piech, Jonathan Huang, Andy Nguyen, Mike Phulsuksombati, Mehran Sahami, and Leonidas Guibas. Learning program embeddings to propagate feedback on student code. In Proceedings of the 32Nd International Conference on International Conference on Machine Learning - Volume 37, ICML’15, pp. 1093–1102, 2015. ",
1107
+ "bbox": [
1108
+ 174,
1109
+ 529,
1110
+ 826,
1111
+ 585
1112
+ ],
1113
+ "page_idx": 10
1114
+ },
1115
+ {
1116
+ "type": "text",
1117
+ "text": "Veselin Raychev, Martin Vechev, and Andreas Krause. Predicting program properties from ”big code”. In Proceedings of the 42Nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’15, pp. 111–124, 2015. ",
1118
+ "bbox": [
1119
+ 174,
1120
+ 594,
1121
+ 826,
1122
+ 637
1123
+ ],
1124
+ "page_idx": 10
1125
+ },
1126
+ {
1127
+ "type": "text",
1128
+ "text": "Veselin Raychev, Pavol Bielik, and Martin T. Vechev. Probabilistic model for code with decision trees. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2016, part of SPLASH 2016, Amsterdam, The Netherlands, October 30 - November 4, 2016, pp. 731–747, 2016. ",
1129
+ "bbox": [
1130
+ 173,
1131
+ 645,
1132
+ 825,
1133
+ 703
1134
+ ],
1135
+ "page_idx": 10
1136
+ },
1137
+ {
1138
+ "type": "text",
1139
+ "text": "Peter Shaw, Jakob Uszkoreit, and Ashish Vaswani. Self-attention with relative position representations. arXiv preprint arXiv:1803.02155, 2018. ",
1140
+ "bbox": [
1141
+ 173,
1142
+ 712,
1143
+ 823,
1144
+ 741
1145
+ ],
1146
+ "page_idx": 10
1147
+ },
1148
+ {
1149
+ "type": "text",
1150
+ "text": "Marko Vasic, Aditya Kanade, Petros Maniatis, David Bieber, and Rishabh Singh. Neural program repair by jointly learning to localize and repair. arXiv preprint arXiv:1904.01720, 2019. ",
1151
+ "bbox": [
1152
+ 171,
1153
+ 750,
1154
+ 823,
1155
+ 780
1156
+ ],
1157
+ "page_idx": 10
1158
+ },
1159
+ {
1160
+ "type": "text",
1161
+ "text": "Ashish Vaswani, Noam Shazeer, Niki Parmar, Jakob Uszkoreit, Llion Jones, Aidan N Gomez, Łukasz Kaiser, and Illia Polosukhin. Attention is all you need. In Advances in neural information processing systems, pp. 5998–6008, 2017. ",
1162
+ "bbox": [
1163
+ 174,
1164
+ 787,
1165
+ 825,
1166
+ 830
1167
+ ],
1168
+ "page_idx": 10
1169
+ },
1170
+ {
1171
+ "type": "text",
1172
+ "text": "Ashish Vaswani, Samy Bengio, Eugene Brevdo, Franc¸ois Chollet, Aidan N. Gomez, Stephan Gouws, Llion Jones, Lukasz Kaiser, Nal Kalchbrenner, Niki Parmar, Ryan Sepassi, Noam Shazeer, and Jakob Uszkoreit. Tensor2tensor for neural machine translation. In Proceedings of the 13th Conference of the Association for Machine Translation in the Americas, AMTA 2018, Boston, MA, USA, March 17-21, 2018 - Volume 1: Research Papers, pp. 193–199, 2018. URL https://www.aclweb.org/anthology/W18-1819/. ",
1173
+ "bbox": [
1174
+ 174,
1175
+ 840,
1176
+ 825,
1177
+ 924
1178
+ ],
1179
+ "page_idx": 10
1180
+ },
1181
+ {
1182
+ "type": "text",
1183
+ "text": "Ke Wang, Rishabh Singh, and Zhendong Su. Dynamic neural program embeddings for program repair. In 6th International Conference on Learning Representations, ICLR 2018, Vancouver, BC, Canada, April 30 - May 3, 2018, Conference Track Proceedings, 2018. ",
1184
+ "bbox": [
1185
+ 178,
1186
+ 103,
1187
+ 823,
1188
+ 146
1189
+ ],
1190
+ "page_idx": 11
1191
+ },
1192
+ {
1193
+ "type": "text",
1194
+ "text": "Martin White, Christopher Vendome, Mario Linares-Vasquez, and Denys Poshyvanyk. Toward ´ deep learning software repositories. In Proceedings of the 12th Working Conference on Mining Software Repositories, pp. 334–345. IEEE Press, 2015. ",
1195
+ "bbox": [
1196
+ 176,
1197
+ 155,
1198
+ 821,
1199
+ 196
1200
+ ],
1201
+ "page_idx": 11
1202
+ }
1203
+ ]
parse/train/B1lnbRNtwr/B1lnbRNtwr_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/B1lnbRNtwr/B1lnbRNtwr_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/EI2KOXKdnP/EI2KOXKdnP.md ADDED
@@ -0,0 +1,215 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # MLP-Mixer: An all-MLP Architecture for Vision
2
+
3
+ Ilya Tolstikhin∗, Neil Houlsby∗, Alexander Kolesnikov∗, Lucas Beyer∗,
4
+
5
+ Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner,
6
+
7
+ Daniel Keysers, Jakob Uszkoreit, Mario Lucic, Alexey Dosovitskiy
8
+
9
+ ∗equal contribution
10
+
11
+ Google Research, Brain Team
12
+
13
+ {tolstikhin, neilhoulsby, akolesnikov, lbeyer, xzhai, unterthiner, jessicayung†, andstein, keysers, usz, lucic, adosovitskiy}@google.com
14
+
15
+ †work done during Google AI Residency
16
+
17
+ # Abstract
18
+
19
+ Convolutional Neural Networks (CNNs) are the go-to model for computer vision. Recently, attention-based networks, such as the Vision Transformer, have also become popular. In this paper we show that while convolutions and attention are both sufficient for good performance, neither of them are necessary. We present MLP-Mixer, an architecture based exclusively on multi-layer perceptrons (MLPs). MLP-Mixer contains two types of layers: one with MLPs applied independently to image patches (i.e. “mixing” the per-location features), and one with MLPs applied across patches (i.e. “mixing” spatial information). When trained on large datasets, or with modern regularization schemes, MLP-Mixer attains competitive scores on image classification benchmarks, with pre-training and inference cost comparable to state-of-the-art models. We hope that these results spark further research beyond the realms of well established CNNs and Transformers.1
20
+
21
+ # 1 Introduction
22
+
23
+ As the history of computer vision demonstrates, the availability of larger datasets coupled with increased computational capacity often leads to a paradigm shift. While Convolutional Neural Networks (CNNs) have been the de-facto standard for computer vision, recently Vision Transformers [14] (ViT), an alternative based on self-attention layers, attained state-of-the-art performance. ViT continues the long-lasting trend of removing hand-crafted visual features and inductive biases from models and relies further on learning from raw data.
24
+
25
+ We propose the MLP-Mixer architecture (or “Mixer” for short), a competitive but conceptually and technically simple alternative, that does not use convolutions or self-attention. Instead, Mixer’s architecture is based entirely on multi-layer perceptrons (MLPs) that are repeatedly applied across either spatial locations or feature channels. Mixer relies only on basic matrix multiplication routines, changes to data layout (reshapes and transpositions), and scalar nonlinearities.
26
+
27
+ Figure 1 depicts the macro-structure of Mixer. It accepts a sequence of linearly projected image patches (also referred to as tokens) shaped as a “patches $\times$ channels” table as an input, and maintains this dimensionality. Mixer makes use of two types of MLP layers: channel-mixing MLPs and token-mixing MLPs. The channel-mixing MLPs allow communication between different channels;
28
+
29
+ ![](images/759c8bb1b0f4ebf46f621f72824e0a25d409516ac63197eee33154d2126e49cb.jpg)
30
+ Figure 1: MLP-Mixer consists of per-patch linear embeddings, Mixer layers, and a classifier head. Mixer layers contain one token-mixing MLP and one channel-mixing MLP, each consisting of two fully-connected layers and a GELU nonlinearity. Other components include: skip-connections, dropout, and layer norm on the channels.
31
+
32
+ they operate on each token independently and take individual rows of the table as inputs. The token-mixing MLPs allow communication between different spatial locations (tokens); they operate on each channel independently and take individual columns of the table as inputs. These two types of layers are interleaved to enable interaction of both input dimensions.
33
+
34
+ In the extreme case, our architecture can be seen as a very special CNN, which uses $1 \times 1$ convolutions for channel mixing, and single-channel depth-wise convolutions of a full receptive field and parameter sharing for token mixing. However, the converse is not true as typical CNNs are not special cases of Mixer. Furthermore, a convolution is more complex than the plain matrix multiplication in MLPs as it requires an additional costly reduction to matrix multiplication and/or specialized implementation.
35
+
36
+ Despite its simplicity, Mixer attains competitive results. When pre-trained on large datasets (i.e., ${ \sim } 1 0 0 \mathbf { M }$ images), it reaches near state-of-the-art performance, previously claimed by CNNs and Transformers, in terms of the accuracy/cost trade-off. This includes $8 7 . 9 4 \%$ top-1 validation accuracy on ILSVRC2012 “ImageNet” [13]. When pre-trained on data of more modest scale (i.e., ${ \sim } 1 -$ 10M images), coupled with modern regularization techniques [49, 54], Mixer also achieves strong performance. However, similar to ViT, it falls slightly short of specialized CNN architectures.
37
+
38
+ # 2 Mixer Architecture
39
+
40
+ Modern deep vision architectures consist of layers that mix features (i) at a given spatial location, (ii) between different spatial locations, or both at once. In CNNs, (ii) is implemented with $N \times N$ convolutions (for $N > 1$ ) and pooling. Neurons in deeper layers have a larger receptive field [1, 29]. At the same time, $1 \times 1$ convolutions also perform (i), and larger kernels perform both (i) and (ii). In Vision Transformers and other attention-based architectures, self-attention layers allow both (i) and (ii) and the MLP-blocks perform (i). The idea behind the Mixer architecture is to clearly separate the per-location (channel-mixing) operations (i) and cross-location (token-mixing) operations (ii). Both operations are implemented with MLPs. Figure 1 summarizes the architecture.
41
+
42
+ Mixer takes as input a sequence of $S$ non-overlapping image patches, each one projected to a desired hidden dimension $C$ . This results in a two-dimensional real-valued input table, $\mathbf { \bar { X } } \in \mathbb { R } ^ { S \times C }$ . If the original input image has resolution $( H , W )$ , and each patch has resolution $( P , P )$ , then the number of patches is $\bar { S } = \bar { H W } / P ^ { 2 }$ . All patches are linearly projected with the same projection matrix. Mixer consists of multiple layers of identical size, and each layer consists of two MLP blocks. The first one is the token-mixing MLP: it acts on columns of $\mathbf { X }$ (i.e. it is applied to a transposed input table $\mathbf { X } ^ { \top }$ ), maps $\mathbb { R } ^ { S } \mapsto \mathbb { R } ^ { S }$ , and is shared across all columns. The second one is the channel-mixing MLP: it acts on rows of $\mathbf { X }$ , maps $\mathbb { R } ^ { C } \mapsto \mathbb { R } ^ { C }$ , and is shared across all rows. Each MLP block contains two fully-connected layers and a nonlinearity applied independently to each row of its input data tensor. Mixer layers can be written as follows (omitting layer indices):
43
+
44
+ $$
45
+ \begin{array} { r } { \mathbf { U } _ { * , i } = \mathbf { X } _ { * , i } + \mathbf { W } _ { 2 } \sigma \big ( \mathbf { W } _ { 1 } \mathrm { L a y e r N o r m } ( \mathbf { X } ) _ { * , i } \big ) , \quad \mathrm { f o r } i = 1 \ldots C , } \\ { \mathbf { Y } _ { j , * } = \mathbf { U } _ { j , * } + \mathbf { W } _ { 4 } \sigma \big ( \mathbf { W } _ { 3 } \mathrm { L a y e r N o r m } ( \mathbf { U } ) _ { j , * } \big ) , \quad \mathrm { f o r } j = 1 \ldots S . } \end{array}
46
+ $$
47
+
48
+ Here $\sigma$ is an element-wise nonlinearity (GELU [16]). $D _ { S }$ and $D _ { C }$ are tunable hidden widths in the token-mixing and channel-mixing MLPs, respectively. Note that $D _ { S }$ is selected independently of the number of input patches. Therefore, the computational complexity of the network is linear in the number of input patches, unlike ViT whose complexity is quadratic. Since $D _ { C }$ is independent of the patch size, the overall complexity is linear in the number of pixels in the image, as for a typical CNN.
49
+
50
+ As mentioned above, the same channel-mixing MLP (token-mixing MLP) is applied to every row (column) of $\mathbf { X }$ . Tying the parameters of the channel-mixing MLPs (within each layer) is a natural choice—it provides positional invariance, a prominent feature of convolutions. However, tying parameters across channels is much less common. For example, separable convolutions [9, 40], used in some CNNs, apply convolutions to each channel independently of the other channels. However, in separable convolutions, a different convolutional kernel is applied to each channel unlike the token-mixing MLPs in Mixer that share the same kernel (of full receptive field) for all of the channels. The parameter tying prevents the architecture from growing too fast when increasing the hidden dimension $C$ or the sequence length $S$ and leads to significant memory savings. Surprisingly, this choice does not affect the empirical performance, see Supplementary A.1.
51
+
52
+ Each layer in Mixer (except for the initial patch projection layer) takes an input of the same size. This “isotropic” design is most similar to Transformers, or deep RNNs in other domains, that also use a fixed width. This is unlike most CNNs, which have a pyramidal structure: deeper layers have a lower resolution input, but more channels. Note that while these are the typical designs, other combinations exist, such as isotropic ResNets [38] and pyramidal ViTs [52].
53
+
54
+ Aside from the MLP layers, Mixer uses other standard architectural components: skip-connections [15] and layer normalization [2]. Unlike ViTs, Mixer does not use position embeddings because the token-mixing MLPs are sensitive to the order of the input tokens. Finally, Mixer uses a standard classification head with the global average pooling layer followed by a linear classifier. Overall, the architecture can be written compactly in JAX/Flax, the code is given in Supplementary F.
55
+
56
+ # 3 Experiments
57
+
58
+ We evaluate the performance of MLP-Mixer models, pre-trained with medium- to large-scale datasets, on a range of small and mid-sized downstream classification tasks. We are interested in three primary quantities: (1) Accuracy on the downstream task; (2) Total computational cost of pre-training, which is important when training the model from scratch on the upstream dataset; (3) Test-time throughput, which is important to the practitioner. Our goal is not to demonstrate state-of-the-art results, but to show that, remarkably, a simple MLP-based model is competitive with today’s best convolutional and attention-based models.
59
+
60
+ Downstream tasks We use popular downstream tasks such as ILSVRC2012 “ImageNet” (1.3M training examples, 1k classes) with the original validation labels [13] and cleaned-up ReaL labels [5], CIFAR-10/100 (50k examples, 10/100 classes) [23], Oxford-IIIT Pets (3.7k examples, 36 classes) [33], and Oxford Flowers-102 (2k examples, 102 classes) [32]. We also use the Visual Task Adaptation Benchmark (VTAB-1k), which consists of 19 diverse datasets, each with 1k training examples [58].
61
+
62
+ Pre-training We follow the standard transfer learning setup: pre-training followed by fine-tuning on the downstream tasks. We pre-train our models on two public datasets: ILSVRC2021 ImageNet, and ImageNet-21k, a superset of ILSVRC2012 that contains 21k classes and 14M images [13]. To assess performance at larger scale, we also train on JFT-300M, a proprietary dataset with 300M examples and 18k classes [44]. We de-duplicate all pre-training datasets with respect to the test sets of the downstream tasks as done in Dosovitskiy et al. [14], Kolesnikov et al. [22]. We pre-train all models at resolution 224 using Adam with $\beta _ { 1 } = 0 . 9$ , $\beta _ { 2 } = 0 . 9 9 9$ , linear learning rate warmup of 10k steps and linear decay, batch size 4 096, weight decay, and gradient clipping at global norm 1. For JFT-300M, we pre-process images by applying the cropping technique from Szegedy et al. [45] in addition to random horizontal flipping. For ImageNet and ImageNet-21k, we employ additional data augmentation and regularization techniques. In particular, we use RandAugment [12], mixup [60], dropout [43], and stochastic depth [19]. This set of techniques was inspired by the timm library [54] and Touvron et al. [48]. More details on these hyperparameters are provided in Supplementary B.
63
+
64
+ Table 1: Specifications of the Mixer architectures. The “B”, “L”, and “H” (base, large, and huge) model scales follow Dosovitskiy et al. [14]. A brief notation $\mathbf { \ddot { B } } / 1 6 ^ { \mathbf { \ ' } }$ means the model of base scale with patches of resolution $1 6 \times 1 6$ . The number of parameters is reported for an input resolution of 224 and does not include the weights of the classifier head.
65
+
66
+ <table><tr><td>Specification</td><td>S/32</td><td>S/16</td><td>B/32</td><td>B/16</td><td>L/32</td><td>L/16</td><td>H/14</td></tr><tr><td>Number of layers</td><td>8</td><td>8</td><td>12</td><td>12</td><td>24</td><td>24</td><td>32</td></tr><tr><td>Patch resolution P×P</td><td>32×32</td><td>16×16</td><td>32×32</td><td>16×16</td><td>32×32</td><td>16×16</td><td>14×14</td></tr><tr><td>Hidden size C</td><td>512</td><td>512</td><td>768</td><td>768</td><td>1024</td><td>1024</td><td>1280</td></tr><tr><td>Sequence length S</td><td>49</td><td>196</td><td>49</td><td>196</td><td>49</td><td>196</td><td>256</td></tr><tr><td>MLP dimension Dc</td><td>2048</td><td>2048</td><td>3072</td><td>3072</td><td>4096</td><td>4096</td><td>5120</td></tr><tr><td>MLP dimension Ds</td><td>256</td><td>256</td><td>384</td><td>384</td><td>512</td><td>512</td><td>640</td></tr><tr><td>Parameters (M)</td><td>19</td><td>18</td><td>60</td><td>59</td><td>206</td><td>207</td><td>431</td></tr></table>
67
+
68
+ Fine-tuning We fine-tune using momentum SGD, batch size 512, gradient clipping at global norm 1, and a cosine learning rate schedule with a linear warmup. We do not use weight decay when finetuning. Following common practice [22, 48], we also fine-tune at higher resolutions with respect to those used during pre-training. Since we keep the patch resolution fixed, this increases the number of input patches (say from $S$ to $S ^ { \prime }$ ) and thus requires modifying the shape of Mixer’s token-mixing MLP blocks. Formally, the input in Eq. (1) is left-multiplied by a weight matrix $\mathbf { W } _ { 1 } \in \mathbb { R } ^ { D _ { S } \times S }$ and this operation has to be adjusted when changing the input dimension $S$ . For this, we increase the hidden layer width from $D _ { S }$ to $D _ { S ^ { \prime } }$ in proportion to the number of patches and initialize the (now larger) weight matrix $\mathbf { W } _ { 2 } ^ { \prime } \in \mathbb { R } ^ { D _ { S ^ { \prime } } \times S ^ { \prime } }$ with a block-diagonal matrix containing copies of $\mathbf { W } _ { 2 }$ on its diagonal. This particular scheme only allows for $S ^ { \prime } = \breve { K } ^ { 2 } S$ with $K \in \mathbb N$ . See Supplementary C for further details. On the VTAB-1k benchmark we follow the BiT-HyperRule [22] and fine-tune Mixer models at resolution 224 and 448 on the datasets with small and large input images respectively.
69
+
70
+ Metrics We evaluate the trade-off between the model’s computational cost and quality. For the former we compute two metrics: (1) Total pre-training time on TPU-v3 accelerators, which combines three relevant factors: the theoretical FLOPs for each training setup, the computational efficiency on the relevant training hardware, and the data efficiency. (2) Throughput in images/sec/core on TPU-v3. Since models of different sizes may benefit from different batch sizes, we sweep the batch sizes and report the highest throughput for each model. For model quality, we focus on top-1 downstream accuracy after fine-tuning. On two occasions (Figure 3, right and Figure 4), where fine-tuning all of the models is too costly, we report the few-shot accuracies obtained by solving the $\ell _ { 2 }$ -regularized linear regression problem between the frozen learned representations of images and the labels.
71
+
72
+ Models We compare various configurations of Mixer, summarized in Table 1, to the most recent, state-of-the-art, CNNs and attention-based models. In all the figures and tables, the MLP-based Mixer models are marked with pink ( ), convolution-based models with yellow $( \circ )$ , and attention-based models with blue ( ). The Vision Transformers (ViTs) have model scales and patch resolutions similar to Mixer. HaloNets are attention-based models that use a ResNet-like structure with local selfattention layers instead of $3 \times 3$ convolutions [51]. We focus on the particularly efficient “HaloNet-H4 (base 128, Conv-12)” model, which is a hybrid variant of the wider HaloNet-H4 architecture with some of the self-attention layers replaced by convolutions. Note, we mark HaloNets with both attention and convolutions with blue ( ). Big Transfer (BiT) [22] models are ResNets optimized for transfer learning. NFNets [7] are normalizer-free ResNets with several optimizations for ImageNet classification. We consider the NFNet- $\cdot \mathrm { F 4 + }$ model variant. We consider MPL [35] and ALIGN [21] for EfficientNet architectures. MPL is pre-trained at very large-scale on JFT-300M images, using meta-pseudo labelling from ImageNet instead of the original labels. We compare to the EfficientNetB6-Wide model variant. ALIGN pre-train image encoder and language encoder on noisy web image text pairs in a contrastive way. We compare to their best EfficientNet-L2 image encoder.
73
+
74
+ # 3.1 Main results
75
+
76
+ Table 2 presents comparison of the largest Mixer models to state-of-the-art models from the literature. “ImNet” and “ReaL” columns refer to the original ImageNet validation [13] and cleaned-up ReaL [5] labels. “Avg. $5 ^ { \circ }$ stands for the average performance across all five downstream tasks (ImageNet, CIFAR-10, CIFAR-100, Pets, Flowers). Figure 2 (left) visualizes the accuracy-compute frontier. When pre-trained on ImageNet-21k with additional regularization, Mixer achieves an overall strong performance $8 4 . 1 5 \%$ top-1 on ImageNet), although slightly inferior to other models2. Regularization in this scenario is necessary and Mixer overfits without it, which is consistent with similar observations for ViT [14]. The same conclusion holds when training Mixer from random initialization on ImageNet (see Section 3.2): Mixer-B/16 attains a reasonable score of $7 6 . 4 \%$ at resolution 224, but tends to overfit. This score is similar to a vanilla ResNet50, but behind state-of-the-art CNNs/hybrids for the ImageNet “from scratch” setting, e.g. $8 4 . 7 \%$ BotNet [42] and $8 6 . 5 \%$ NFNet [7].
77
+
78
+ Table 2: Transfer performance, inference throughput, and training cost. The rows are sorted by inference throughput (fifth column). Mixer has comparable transfer accuracy to state-of-the-art models with similar cost. The Mixer models are fine-tuned at resolution 448. Mixer performance numbers are averaged over three fine-tuning runs and standard deviations are smaller than 0.1.
79
+
80
+ <table><tr><td></td><td>ImNet top-1</td><td>ReaL top-1</td><td>Avg 5 top-1</td><td>VTAB-1k 19 tasks</td><td>Throughput img/sec/core</td><td>TPUv3 core-days</td></tr><tr><td colspan="7">Pre-trained on ImageNet-21k (public)</td></tr><tr><td>HaloNet [51]</td><td>85.8</td><td></td><td></td><td></td><td>120</td><td>0.10k</td></tr><tr><td>Mixer-L/16</td><td>84.15</td><td>87.86</td><td>93.91</td><td>74.95</td><td>105</td><td>0.41k</td></tr><tr><td>ViT-L/16 [14]</td><td>85.30</td><td>88.62</td><td>94.39</td><td>72.72</td><td>32</td><td>0.18k</td></tr><tr><td>BiT-R152x4 [22] .</td><td>85.39</td><td></td><td>94.04</td><td>70.64</td><td>26</td><td>0.94k</td></tr><tr><td colspan="7">Pre-trained on JFT-30OM (proprietary)</td></tr><tr><td>NFNet-F4+ [7]</td><td>89.2</td><td></td><td></td><td></td><td>46</td><td>1.86k</td></tr><tr><td>· Mixer-H/14</td><td>87.94</td><td>90.18</td><td>95.71</td><td>75.33</td><td>40</td><td>1.01k</td></tr><tr><td>·BiT-R152x4 [22]</td><td>87.54</td><td>90.54</td><td>95.33</td><td>76.29</td><td>26</td><td>9.90k</td></tr><tr><td>ViT-H/14 [14]</td><td>88.55</td><td>90.72</td><td>95.97</td><td>77.63</td><td>15</td><td>2.30k</td></tr><tr><td colspan="7">Pre-trained on unlabelled or weakly labelled data (proprietary)</td></tr><tr><td>·MPL [35]</td><td>90.0</td><td>91.12</td><td></td><td></td><td>一</td><td>20.48k</td></tr><tr><td>ALIGN[21] T</td><td>88.64</td><td>一</td><td></td><td>79.99</td><td>15</td><td>14.82k</td></tr></table>
81
+
82
+ When the size of the upstream dataset increases, Mixer’s performance improves significantly. In particular, Mixer-H/14 achieves $8 7 . 9 4 \%$ top-1 accuracy on ImageNet, which is $0 . 5 \%$ better than BiTResNet $1 5 2 \mathrm { x } 4$ and only $0 . 5 \%$ lower than ViT-H/14. Remarkably, Mixer-H/14 runs 2.5 times faster than ViT-H/14 and almost twice as fast as BiT. Overall, Figure 2 (left) supports our main claim that in terms of the accuracy-compute trade-off Mixer is competitive with more conventional neural network architectures. The figure also demonstrates a clear correlation between the total pre-training cost and the downstream accuracy, even across architecture classes.
83
+
84
+ BiT-ResNet1 $5 2 \mathrm { x } 4$ in the table are pre-trained using SGD with momentum and a long schedule. Since Adam tends to converge faster, we complete the picture in Figure 2 (left) with the BiT-R200x3 model from Dosovitskiy et al. [14] pre-trained on JFT-300M using Adam. This ResNet has a slightly lower accuracy, but considerably lower pre-training compute. Finally, the results of smaller ViT-L/16 and Mixer-L/16 models are also reported in this figure.
85
+
86
+ # 3.2 The role of the model scale
87
+
88
+ The results outlined in the previous section focus on (large) models at the upper end of the compute spectrum. We now turn our attention to smaller Mixer models.
89
+
90
+ We may scale the model in two independent ways: (1) Increasing the model size (number of layers, hidden dimension, MLP widths) when pre-training; (2) Increasing the input image resolution when fine-tuning. While the former affects both pre-training compute and test-time throughput, the latter only affects the throughput. Unless stated otherwise, we fine-tune at resolution 224.
91
+
92
+ ![](images/e888ec18a5f1ffc5126a75c42bc7c88e5c7569217134a6f3ca6be02f3064c9b2.jpg)
93
+ Figure 2: Left: ImageNet accuracy/training cost Pareto frontier (dashed line) for the SOTA models in Table 2. Models are pre-trained on ImageNet-21k, or JFT (labelled, or pseudo-labelled for MPL), or web image text pairs. Mixer is as good as these extremely performant ResNets, ViTs, and hybrid models, and sits on frontier with HaloNet, ViT, NFNet, and MPL. Right: Mixer (solid) catches or exceeds BiT (dotted) and ViT (dashed) as the data size grows. Every point on a curve uses the same pre-training compute; they correspond to pre-training on $3 \%$ , $10 \%$ , $30 \%$ , and $100 \%$ of JFT-300M for 233, 70, 23, and 7 epochs, respectively. Additional points at ${ \sim } 3 \mathbf { B }$ correspond to pre-training on an even larger JFT-3B dataset for the same number of total steps. Mixer improves more rapidly with data than ResNets, or even ViT. The gap between large Mixer and ViT models shrinks.
94
+
95
+ ![](images/dcb60c2290be7785a89bed98d1d0cadb3b9e81795e4b5a5cc118b0fb971d4aa5.jpg)
96
+ Figure 3: The role of the model scale. ImageNet validation top-1 accuracy vs. total pre-training compute (left) and throughput (right) of ViT, BiT, and Mixer models at various scales. All models are pre-trained on JFT-300M and fine-tuned at resolution 224, which is lower than in Figure 2 (left).
97
+
98
+ We compare various configurations of Mixer (see Table 1) to ViT models of similar scales and BiT models pre-trained with Adam. The results are summarized in Table 3 and Figure 3. When trained from scratch on ImageNet, Mixer-B/16 achieves a reasonable top-1 accuracy of $7 6 . 4 4 \%$ . This is $3 \%$ behind the ViT-B/16 model. The training curves (not reported) reveal that both models achieve very similar values of the training loss. In other words, Mixer-B/16 overfits more than ViT-B/16. For the Mixer-L/16 and ViT-L/16 models this difference is even more pronounced.
99
+
100
+ As the pre-training dataset grows, Mixer’s performance steadily improves. Remarkably, Mixer-H/14 pre-trained on JFT-300M and fine-tuned at 224 resolution is only $0 . 3 \%$ behind ViT-H/14 on ImageNet whilst running 2.2 times faster. Figure 3 clearly demonstrates that although Mixer is slightly below the frontier on the lower end of model scales, it sits confidently on the frontier at the high end.
101
+
102
+ # 3.3 The role of the pre-training dataset size
103
+
104
+ The results presented thus far demonstrate that pre-training on larger datasets significantly improves Mixer’s performance. Here, we study this effect in more detail.
105
+
106
+ To study Mixer’s ability to make use of the growing number of training examples we pre-train Mixer-B/32, Mixer-L/32, and Mixer-L/16 models on random subsets of JFT-300M containing $3 \%$ , $10 \%$ , $30 \%$ and $100 \%$ of all the training examples for 233, 70, 23, and 7 epochs. Thus, every model is pre-trained for the same number of total steps. We also pre-train Mixer-L/16 model on an even larger JFT-3B dataset [59] containing roughly 3B images with 30k classes for the same number of total steps.
107
+
108
+ Table 3: Performance of Mixer and other models from the literature across various model and pre-training dataset scales. “Avg. 5” denotes the average performance across five downstream tasks. Mixer and ViT models are averaged over three fine-tuning runs, standard deviations are smaller than 0.15. $( \ddagger )$ Extrapolated from the numbers reported for the same models pre-trained on JFT-300M without extra regularization. $\mathbf { \Pi } ( \widehat { \mathbf { a } } )$ Numbers provided by authors of Dosovitskiy et al. [14] through personal communication. Rows are sorted by throughput.
109
+
110
+ <table><tr><td></td><td>Image size</td><td>Pre-Train Epochs</td><td>ImNet top-1</td><td>ReaL top-1</td><td></td><td>Avg.5Throughput top-1 (img/sec/core) core-days</td><td>TPUv3</td></tr><tr><td colspan="8">Pre-trained on ImageNet (with extra regularization)</td></tr><tr><td>Mixer-B/16</td><td>224</td><td>300</td><td>76.44</td><td>82.36</td><td>88.33</td><td>1384</td><td>0.01k(t)</td></tr><tr><td>ViT-B/16 ()</td><td>224</td><td>300</td><td>79.67</td><td>84.97</td><td>90.79</td><td>861</td><td>0.02k(±)</td></tr><tr><td>Mixer-L/16 .</td><td>224</td><td>300</td><td>71.76</td><td>77.08</td><td>87.25</td><td>419</td><td>0.04k(t)</td></tr><tr><td>ViT-L/16 ()</td><td>224</td><td>300</td><td>76.11</td><td>80.93</td><td>89.66</td><td>280</td><td>0.05k($)</td></tr><tr><td colspan="8">Pre-trained on ImageNet-21k (with extra regularization)</td></tr><tr><td>·Mixer-B/16</td><td>224</td><td>300</td><td>80.64</td><td>85.80</td><td>92.50</td><td>1384</td><td>0.15k(t)</td></tr><tr><td>ViT-B/16 ()</td><td>224</td><td>300</td><td>84.59</td><td>88.93</td><td>94.16</td><td>861</td><td>0.18k(t)</td></tr><tr><td>Mixer-L/16</td><td>224</td><td>300</td><td>82.89</td><td>87.54</td><td>93.63</td><td>419</td><td>0.41k($)</td></tr><tr><td>ViT-L/16 (a)</td><td>224</td><td>300</td><td>84.46</td><td>88.35</td><td>94.49</td><td>280</td><td>0.55k(t)</td></tr><tr><td>·Mixer-L/16</td><td>448</td><td>300</td><td>83.91</td><td>87.75</td><td>93.86</td><td>105</td><td>0.41k($)</td></tr><tr><td colspan="8">Pre-trained on JFT-300M</td></tr><tr><td>·Mixer-S/32</td><td>224</td><td>5</td><td>68.70</td><td>75.83</td><td>87.13</td><td>11489</td><td>0.01k</td></tr><tr><td>Mixer-B/32</td><td>224</td><td>7</td><td>75.53</td><td>81.94</td><td>90.99</td><td>4208</td><td>0.05k</td></tr><tr><td>Mixer-S/16</td><td>224</td><td>5</td><td>73.83</td><td>80.60</td><td>89.50</td><td>3994</td><td>0.03k</td></tr><tr><td>BiT-R50x1</td><td>224</td><td>7</td><td>73.69</td><td>81.92</td><td>一</td><td>2159</td><td>0.08k</td></tr><tr><td>Mixer-B/16</td><td>224</td><td>7</td><td>80.00</td><td>85.56</td><td>92.60</td><td>1384</td><td>0.08k</td></tr><tr><td>·Mixer-L/32</td><td>224</td><td>7</td><td>80.67</td><td>85.62</td><td>93.24</td><td>1314</td><td>0.12k</td></tr><tr><td>BiT-R152x1</td><td>224</td><td>7</td><td>79.12</td><td>86.12</td><td></td><td>932</td><td>0.14k</td></tr><tr><td>BiT-R50x2</td><td>224</td><td>7</td><td>78.92</td><td>86.06</td><td></td><td>890</td><td>0.14k</td></tr><tr><td>BiT-R152x2</td><td>224</td><td>14</td><td>83.34</td><td>88.90</td><td></td><td>356</td><td>0.58k</td></tr><tr><td>Mixer-L/16</td><td>224</td><td>7</td><td>84.05</td><td>88.14</td><td>94.51</td><td>419</td><td>0.23k</td></tr><tr><td>·Mixer-L/16</td><td>224</td><td>14</td><td>84.82</td><td>88.48</td><td>94.77</td><td>419</td><td>0.45k</td></tr><tr><td>ViT-L/16</td><td>224</td><td>14</td><td>85.63</td><td>89.16</td><td>95.21</td><td>280</td><td>0.65k</td></tr><tr><td>Mixer-H/14</td><td>224</td><td>14</td><td>86.32</td><td>89.14</td><td>95.49</td><td>194</td><td>1.01k</td></tr><tr><td>. BiT-R200x3</td><td>224</td><td>14</td><td>84.73</td><td>89.58</td><td></td><td>141</td><td>1.78k</td></tr><tr><td>Mixer-L/16</td><td>448</td><td>14</td><td>86.78</td><td>89.72</td><td>95.13</td><td>105</td><td>0.45k</td></tr><tr><td>ViT-H/14</td><td>224</td><td>14</td><td>86.65</td><td>89.56</td><td>95.57</td><td>87</td><td>2.30k</td></tr><tr><td>ViT-L/16 [14]</td><td>512</td><td>14</td><td>87.76</td><td>90.54</td><td>95.63</td><td>32</td><td>0.65k</td></tr></table>
111
+
112
+ While not strictly comparable, this allows us to further extrapolate the effect of scale. We use the linear 5-shot top-1 accuracy on ImageNet as a proxy for transfer quality. For every pre-training run we perform early stopping based on the best upstream validation performance. Results are reported in Figure 2 (right), where we also include ViT-B/32, ViT-L/32, ViT-L/16, and BiT- $\mathbf { R } 1 5 2 \mathbf { x } 2$ models.
113
+
114
+ When pre-trained on the smallest subset of JFT-300M, all Mixer models strongly overfit. BiT models also overfit, but to a lesser extent, possibly due to the strong inductive biases associated with the convolutions. As the dataset increases, the performance of both Mixer-L/32 and Mixer-L/16 grows faster than BiT; Mixer-L/16 keeps improving, while the BiT model plateaus.
115
+
116
+ The same conclusions hold for ViT, consistent with Dosovitskiy et al. [14]. However, the relative improvement of larger Mixer models are even more pronounced. The performance gap between Mixer-L/16 and ViT-L/16 shrinks with data scale. It appears that Mixer benefits from the growing dataset size even more than ViT. One could speculate and explain it again with the difference in inductive biases: self-attention layers in ViT lead to certain properties of the learned functions that are less compatible with the true underlying distribution than those discovered with Mixer architecture.
117
+
118
+ # 3.4 Invariance to input permutations
119
+
120
+ In this section, we study the difference between inductive biases of Mixer and CNN architectures. Specifically, we train Mixer-B/16 and ResNet50x1 models on JFT-300M following the pre-training setup described in Section 3 and using one of two different input transformations: (1) Shuffle the order of $1 6 \times 1 6$ patches and permute pixels within each patch with a shared permutation; (2) Permute the pixels globally in the entire image. Same permutation is used across all images. We report the linear 5-shot top-1 accuracy of the trained models on ImageNet in Figure 4 (bottom). Some original images along with their two transformed versions appear in Figure 4 (top). As could be expected, Mixer is invariant to the order of patches and pixels within the patches (the blue and green curves match perfectly). On the other hand, ResNet’s strong inductive bias relies on a particular order of pixels within an image and its performance drops significantly when the patches are permuted. Remarkably, when globally permuting the pixels, Mixer’s performance drops much less ( ${ \sim } 4 5 \%$ drop) compared to the ResNet $\sim 7 5 \%$ drop).
121
+
122
+ ![](images/4d73edba72e7ee7ea5c72a0d41ac9476e577939a71c5c92b54605615df0e5d5c.jpg)
123
+ Figure 4: Top: Input examples from ImageNet before permuting the contents (left); after shuffling the $1 6 \times 1 6$ patches and pixels within the patches (center); after shuffling pixels globally (right). Bottom: Mixer-B/16 (left) and ResNet50x1 (right) trained with three corresponding input pipelines.
124
+
125
+ ![](images/6580eadc8dc26ea6d1683a42b8533e69114404d978ae2cc5853f9e28e8fb58f1.jpg)
126
+ Figure 5: Hidden units in the first (left), second (center), and third (right) token-mixing MLPs of a Mixer-B/16 model trained on JFT-300M. Each unit has 196 weights, one for each of the $1 4 \times 1 4$ incoming patches. We pair the units to highlight the emergence of kernels of opposing phase. Pairs are sorted by filter frequency. In contrast to the kernels of convolutional filters, where each weight corresponds to one pixel in the input image, one weight in any plot from the left column corresponds to a particular $1 6 \times 1 6$ patch of the input image. Complete plots in Supplementary D.
127
+
128
+ # 3.5 Visualization
129
+
130
+ It is commonly observed that the first layers of CNNs tend to learn Gabor-like detectors that act on pixels in local regions of the image. In contrast, Mixer allows for global information exchange in the token-mixing MLPs, which begs the question whether it processes information in a similar fashion. Figure 5 shows hidden units of the first three token-mixing MLPs of Mixer trained on JFT-300M. Recall that the token-mixing MLPs allow global communication between different spatial locations. Some of the learned features operate on the entire image, while others operate on smaller regions. Deeper layers appear to have no clearly identifiable structure. Similar to CNNs, we observe many pairs of feature detectors with opposite phases [39]. The structure of learned units depends on the hyperparameters. Plots for the first embedding layer appear in Figure 2 of Supplementary D.
131
+
132
+ # 4 Related work
133
+
134
+ MLP-Mixer is a new architecture for computer vision that differs from previous successful architectures because it uses neither convolutional nor self-attention layers. Nevertheless, the design choices can be traced back to ideas from the literature on CNNs [24, 25] and Transformers [50].
135
+
136
+ CNNs have been the de-facto standard in computer vision since the AlexNet model [24] surpassed prevailing approaches based on hand-crafted image features [36]. Many works focused on improving the design of CNNs. Simonyan and Zisserman [41] demonstrated that one can train state-of-the-art models using only convolutions with small $3 \times 3$ kernels. He et al. [15] introduced skip-connections together with the batch normalization [20], which enabled training of very deep neural networks and further improved performance. A prominent line of research has investigated the benefits of using sparse convolutions, such as grouped [57] or depth-wise [9, 17] variants. In a similar spirit to our token-mixing MLPs, Wu et al. [55] share parameters in the depth-wise convolutions for natural language processing. Hu et al. [18] and Wang et al. [53] propose to augment convolutional networks with non-local operations to partially alleviate the constraint of local processing from CNNs. Mixer takes the idea of using convolutions with small kernels to the extreme: by reducing the kernel size to $1 \times 1$ it turns convolutions into standard dense matrix multiplications applied independently to each spatial location (channel-mixing MLPs). This alone does not allow aggregation of spatial information and to compensate we apply dense matrix multiplications that are applied to every feature across all spatial locations (token-mixing MLPs). In Mixer, matrix multiplications are applied row-wise or column-wise on the “patches $\times$ features” input table, which is also closely related to the work on sparse convolutions. Mixer uses skip-connections [15] and normalization layers [2, 20].
137
+
138
+ In computer vision, self-attention based Transformer architectures were initially applied for generative modeling [8, 34]. Their value for image recognition was demonstrated later, albeit in combination with a convolution-like locality bias [37], or on low-resolution images [10]. Dosovitskiy et al. [14] introduced ViT, a pure transformer model that has fewer locality biases, but scales well to large data. ViT achieves state-of-the-art performance on popular vision benchmarks while retaining the robustness of CNNs [6]. Touvron et al. [49] trained ViT effectively on smaller datasets using extensive regularization. Mixer borrows design choices from recent transformer-based architectures. The design of Mixer’s MLP-blocks originates in [27, 50]. Converting images to a sequence of patches and directly processing embeddings of these patches originates in Dosovitskiy et al. [14].
139
+
140
+ Many recent works strive to design more effective architectures for vision. Srinivas et al. [42] replace $3 \times 3$ convolutions in ResNets by self-attention layers. Ramachandran et al. [37], Tay et al. [47], Li et al. [26], and Bello [3] design networks with new attention-like mechanisms. Mixer can be seen as a step in an orthogonal direction, without reliance on locality bias and attention mechanisms.
141
+
142
+ The work of Lin et al. [28] is closely related. It attains reasonable performance on CIFAR-10 using fully connected networks, heavy data augmentation, and pre-training with an auto-encoder. Neyshabur [31] devises custom regularization and optimization algorithms and trains a fully-connected network, attaining impressive performance on small-scale tasks. Instead we rely on token and channel-mixing MLPs, use standard regularization and optimization techniques, and scale to large data effectively.
143
+
144
+ Traditionally, networks evaluated on ImageNet [13] are trained from random initialization using Inception-style pre-processing [46]. For smaller datasets, transfer of ImageNet models is popular. However, modern state-of-the-art models typically use either weights pre-trained on larger datasets, or more recent data-augmentation and training strategies. For example, Dosovitskiy et al. [14], Kolesnikov et al. [22], Mahajan et al. [30], Pham et al. [35], Xie et al. [56] all advance state-of-the-art in image classification using large-scale pre-training. Examples of improvements due to augmentation or regularization changes include Cubuk et al. [11], who attain excellent classification performance with learned data augmentation, and Bello et al. [4], who show that canonical ResNets are still near state-of-the-art, if one uses recent training and augmentation strategies.
145
+
146
+ # 5 Conclusions
147
+
148
+ We describe a very simple architecture for vision. Our experiments demonstrate that it is as good as existing state-of-the-art methods in terms of the trade-off between accuracy and computational resources required for training and inference. We believe these results open many questions. On the practical side, it may be useful to study the features learned by the model and identify the main differences (if any) from those learned by CNNs and Transformers. On the theoretical side, we would like to understand the inductive biases hidden in these various features and eventually their role in generalization. Most of all, we hope that our results spark further research, beyond the realms of established models based on convolutions and self-attention. It would be particularly interesting to see whether such a design works in NLP or other domains.
149
+
150
+ # Acknowledgments and Disclosure of Funding
151
+
152
+ The work was performed in the Brain teams in Berlin and Zürich. We thank Josip Djolonga for feedback on the initial version of the paper; Preetum Nakkiran for proposing to train MLP-Mixer on input images with shuffled pixels; Olivier Bousquet, Yann Dauphin, and Dirk Weissenborn for useful discussions.
153
+
154
+ # References
155
+
156
+ [1] A. Araujo, W. Norris, and J. Sim. Computing receptive fields of convolutional neural networks. Distill, 2019. doi: 10.23915/distill.00021. URL https://distill.pub/2019/ computing-receptive-fields.
157
+ [2] J. L. Ba, J. R. Kiros, and G. E. Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016.
158
+ [3] I. Bello. LambdaNetworks: Modeling long-range interactions without attention. arXiv preprint arXiv:2102.08602, 2021.
159
+ [4] I. Bello, W. Fedus, X. Du, E. D. Cubuk, A. Srinivas, T.-Y. Lin, J. Shlens, and B. Zoph. Revisiting ResNets: Improved training and scaling strategies. arXiv preprint arXiv:2103.07579, 2021.
160
+ [5] L. Beyer, O. J. Hénaff, A. Kolesnikov, X. Zhai, and A. van den Oord. Are we done with ImageNet? arXiv preprint arXiv:2006.07159, 2020.
161
+ [6] S. Bhojanapalli, A. Chakrabarti, D. Glasner, D. Li, T. Unterthiner, and A. Veit. Understanding robustness of transformers for image classification. arXiv preprint arXiv:2103.14586, 2021.
162
+ [7] A. Brock, S. De, S. L. Smith, and K. Simonyan. High-performance large-scale image recognition without normalization. arXiv preprint arXiv:2102.06171, 2021.
163
+ [8] R. Child, S. Gray, A. Radford, and I. Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019.
164
+ [9] F. Chollet. Xception: Deep learning with depthwise separable convolutions. In CVPR, 2017.
165
+ [10] J.-B. Cordonnier, A. Loukas, and M. Jaggi. On the relationship between self-attention and convolutional layers. In ICLR, 2020.
166
+ [11] E. D. Cubuk, B. Zoph, D. Mane, V. Vasudevan, and Q. V. Le. AutoAugment: Learning augmentation policies from data. In CVPR, 2019.
167
+ [12] E. D. Cubuk, B. Zoph, J. Shlens, and Q. V. Le. RandAugment: Practical automated data augmentation with a reduced search space. In CVPR Workshops, 2020.
168
+ [13] J. Deng, W. Dong, R. Socher, L. Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In CVPR, 2009.
169
+ [14] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021.
170
+ [15] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, 2016.
171
+ [16] D. Hendrycks and K. Gimpel. Gaussian error linear units (GELUs). arXiv preprint arXiv:1606.08415, 2016.
172
+ [17] A. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017.
173
+ [18] J. Hu, L. Shen, and G. Sun. Squeeze-and-excitation networks. In CVPR, 2018.
174
+ [19] G. Huang, Y. Sun, Z. Liu, D. Sedra, and K. Q. Weinberger. Deep networks with stochastic depth. In ECCV, 2016.
175
+ [20] S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015.
176
+ [21] C. Jia, Y. Yang, Y. Xia, Y.-T. Chen, Z. Parekh, H. Pham, Q. V. Le, Y. Sung, Z. Li, and T. Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. arXiv preprint arXiv:2102.05918, 2021.
177
+ [22] A. Kolesnikov, L. Beyer, X. Zhai, J. Puigcerver, J. Yung, S. Gelly, and N. Houlsby. Big transfer (BiT): General visual representation learning. In ECCV, 2020.
178
+ [23] A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009.
179
+ [24] A. Krizhevsky, I. Sutskever, and G. E. Hinton. ImageNet classification with deep convolutional neural networks. In NeurIPS, 2012.
180
+ [25] Y. LeCun, B. Boser, J. Denker, D. Henderson, R. Howard, W. Hubbard, and L. Jackel. Backpropagation applied to handwritten zip code recognition. Neural Computation, 1:541–551, 1989.
181
+ [26] D. Li, J. Hu, C. Wang, X. Li, Q. She, L. Zhu, T. Zhang, and Q. Chen. Involution: Inverting the inherence of convolution for visual recognition. CVPR, 2021.
182
+ [27] M. Lin, Q. Chen, and S. Yan. Network in network. In ICLR, 2014.
183
+ [28] Z. Lin, R. Memisevic, and K. Konda. How far can we go without convolution: Improving fullyconnected networks. In ICLR, Workshop Track, 2016.
184
+ [29] W. Luo, Y. Li, R. Urtasun, and R. Zemel. Understanding the effective receptive field in deep convolutional neural networks. In NeurIPS, 2016.
185
+ [30] D. Mahajan, R. Girshick, V. Ramanathan, K. He, M. Paluri, Y. Li, A. Bharambe, and L. van der Maaten. Exploring the limits of weakly supervised pretraining. In ECCV, 2018.
186
+ [31] B. Neyshabur. Towards learning convolutions from scratch. In NeurIPS, 2020.
187
+ [32] M. Nilsback and A. Zisserman. Automated flower classification over a large number of classes. In ICVGIP, 2008.
188
+ [33] O. M. Parkhi, A. Vedaldi, A. Zisserman, and C. V. Jawahar. Cats and dogs. In CVPR, 2012.
189
+ [34] N. Parmar, A. Vaswani, J. Uszkoreit, L. Kaiser, N. Shazeer, A. Ku, and D. Tran. Image transformer. In ICML, 2018.
190
+ [35] H. Pham, Z. Dai, Q. Xie, M.-T. Luong, and Q. V. Le. Meta pseudo labels. In CVPR, 2021.
191
+ [36] A. Pinz. Object categorization. Foundations and Trends in Computer Graphics and Vision, 1(4), 2006.
192
+ [37] P. Ramachandran, N. Parmar, A. Vaswani, I. Bello, A. Levskaya, and J. Shlens. Stand-alone self-attention in vision models. In NeurIPS, 2019.
193
+ [38] M. Sandler, J. Baccash, A. Zhmoginov, and Howard. Non-discriminative data or weak model? On the relative importance of data and model resolution. In ICCV Workshop on Real-World Recognition from Low-Quality Images and Videos, 2019.
194
+ [39] W. Shang, K. Sohn, D. Almeida, and H. Lee. Understanding and improving convolutional neural networks via concatenated rectified linear units. In ICML, 2016.
195
+ [40] L. Sifre. Rigid-Motion Scattering For Image Classification. PhD thesis, Ecole Polytechnique, 2014.
196
+ [41] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015.
197
+ [42] A. Srinivas, T.-Y. Lin, N. Parmar, J. Shlens, P. Abbeel, and A. Vaswani. Bottleneck transformers for visual recognition. arXiv preprint arXiv:2101.11605, 2021.
198
+ [43] N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. JMLR, 15(56), 2014.
199
+ [44] C. Sun, A. Shrivastava, S. Singh, and A. Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, 2017.
200
+ [45] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In CVPR, 2015.
201
+ [46] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016.
202
+ [47] Y. Tay, D. Bahri, D. Metzler, D.-C. Juan, Z. Zhao, and C. Zheng. Synthesizer: Rethinking self-attention in transformer models. arXiv, 2020.
203
+ [48] H. Touvron, A. Vedaldi, M. Douze, and H. Jegou. Fixing the train-test resolution discrepancy. In NeurIPS, 2019.
204
+ [49] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020.
205
+ [50] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, 2017.
206
+ [51] A. Vaswani, P. Ramachandran, A. Srinivas, N. Parmar, B. Hechtman, and J. Shlens. Scaling local self-attention for parameter efficient visual backbones. arXiv preprint arXiv:2103.12731, 2021.
207
+ [52] 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. arXiv preprint arXiv:2102.12122, 2021.
208
+ [53] X. Wang, R. Girshick, A. Gupta, and K. He. Non-local neural networks. In CVPR, 2018.
209
+ [54] R. Wightman. Pytorch image models. https://github.com/rwightman/ pytorch-image-models, 2019.
210
+ [55] F. Wu, A. Fan, A. Baevski, Y. Dauphin, and M. Auli. Pay less attention with lightweight and dynamic convolutions. In ICLR, 2019.
211
+ [56] Q. Xie, M.-T. Luong, E. Hovy, and Q. V. Le. Self-training with noisy student improves imagenet classification. In CVPR, 2020.
212
+ [57] S. Xie, R. Girshick, P. Dollár, Z. Tu, and K. He. Aggregated residual transformations for deep neural networks. arXiv preprint arXiv:1611.05431, 2016.
213
+ [58] X. Zhai, J. Puigcerver, A. Kolesnikov, P. Ruyssen, C. Riquelme, M. Lucic, J. Djolonga, A. S. Pinto, M. Neumann, A. Dosovitskiy, et al. A large-scale study of representation learning with the visual task adaptation benchmark. arXiv preprint arXiv:1910.04867, 2019.
214
+ [59] X. Zhai, A. Kolesnikov, N. Houlsby, and L. Beyer. Scaling vision transformers. arXiv preprint arXiv:2106.04560, 2021.
215
+ [60] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR, 2018.
parse/train/EI2KOXKdnP/EI2KOXKdnP_content_list.json ADDED
@@ -0,0 +1,933 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "MLP-Mixer: An all-MLP Architecture for Vision ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 197,
8
+ 122,
9
+ 799,
10
+ 147
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Ilya Tolstikhin∗, Neil Houlsby∗, Alexander Kolesnikov∗, Lucas Beyer∗, ",
17
+ "bbox": [
18
+ 264,
19
+ 195,
20
+ 754,
21
+ 212
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Xiaohua Zhai, Thomas Unterthiner, Jessica Yung, Andreas Steiner, ",
28
+ "bbox": [
29
+ 274,
30
+ 217,
31
+ 745,
32
+ 232
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Daniel Keysers, Jakob Uszkoreit, Mario Lucic, Alexey Dosovitskiy ",
39
+ "bbox": [
40
+ 276,
41
+ 238,
42
+ 743,
43
+ 252
44
+ ],
45
+ "page_idx": 0
46
+ },
47
+ {
48
+ "type": "text",
49
+ "text": "∗equal contribution ",
50
+ "bbox": [
51
+ 446,
52
+ 258,
53
+ 573,
54
+ 272
55
+ ],
56
+ "page_idx": 0
57
+ },
58
+ {
59
+ "type": "text",
60
+ "text": "Google Research, Brain Team ",
61
+ "bbox": [
62
+ 410,
63
+ 277,
64
+ 607,
65
+ 290
66
+ ],
67
+ "page_idx": 0
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "{tolstikhin, neilhoulsby, akolesnikov, lbeyer, xzhai, unterthiner, jessicayung†, andstein, keysers, usz, lucic, adosovitskiy}@google.com ",
72
+ "bbox": [
73
+ 312,
74
+ 296,
75
+ 705,
76
+ 338
77
+ ],
78
+ "page_idx": 0
79
+ },
80
+ {
81
+ "type": "text",
82
+ "text": "†work done during Google AI Residency ",
83
+ "bbox": [
84
+ 375,
85
+ 344,
86
+ 642,
87
+ 359
88
+ ],
89
+ "page_idx": 0
90
+ },
91
+ {
92
+ "type": "text",
93
+ "text": "Abstract ",
94
+ "text_level": 1,
95
+ "bbox": [
96
+ 462,
97
+ 400,
98
+ 535,
99
+ 416
100
+ ],
101
+ "page_idx": 0
102
+ },
103
+ {
104
+ "type": "text",
105
+ "text": "Convolutional Neural Networks (CNNs) are the go-to model for computer vision. Recently, attention-based networks, such as the Vision Transformer, have also become popular. In this paper we show that while convolutions and attention are both sufficient for good performance, neither of them are necessary. We present MLP-Mixer, an architecture based exclusively on multi-layer perceptrons (MLPs). MLP-Mixer contains two types of layers: one with MLPs applied independently to image patches (i.e. “mixing” the per-location features), and one with MLPs applied across patches (i.e. “mixing” spatial information). When trained on large datasets, or with modern regularization schemes, MLP-Mixer attains competitive scores on image classification benchmarks, with pre-training and inference cost comparable to state-of-the-art models. We hope that these results spark further research beyond the realms of well established CNNs and Transformers.1 ",
106
+ "bbox": [
107
+ 233,
108
+ 431,
109
+ 766,
110
+ 597
111
+ ],
112
+ "page_idx": 0
113
+ },
114
+ {
115
+ "type": "text",
116
+ "text": "1 Introduction ",
117
+ "text_level": 1,
118
+ "bbox": [
119
+ 174,
120
+ 623,
121
+ 310,
122
+ 640
123
+ ],
124
+ "page_idx": 0
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "As the history of computer vision demonstrates, the availability of larger datasets coupled with increased computational capacity often leads to a paradigm shift. While Convolutional Neural Networks (CNNs) have been the de-facto standard for computer vision, recently Vision Transformers [14] (ViT), an alternative based on self-attention layers, attained state-of-the-art performance. ViT continues the long-lasting trend of removing hand-crafted visual features and inductive biases from models and relies further on learning from raw data. ",
129
+ "bbox": [
130
+ 174,
131
+ 654,
132
+ 825,
133
+ 738
134
+ ],
135
+ "page_idx": 0
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "We propose the MLP-Mixer architecture (or “Mixer” for short), a competitive but conceptually and technically simple alternative, that does not use convolutions or self-attention. Instead, Mixer’s architecture is based entirely on multi-layer perceptrons (MLPs) that are repeatedly applied across either spatial locations or feature channels. Mixer relies only on basic matrix multiplication routines, changes to data layout (reshapes and transpositions), and scalar nonlinearities. ",
140
+ "bbox": [
141
+ 174,
142
+ 744,
143
+ 825,
144
+ 814
145
+ ],
146
+ "page_idx": 0
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "Figure 1 depicts the macro-structure of Mixer. It accepts a sequence of linearly projected image patches (also referred to as tokens) shaped as a “patches $\\times$ channels” table as an input, and maintains this dimensionality. Mixer makes use of two types of MLP layers: channel-mixing MLPs and token-mixing MLPs. The channel-mixing MLPs allow communication between different channels; ",
151
+ "bbox": [
152
+ 174,
153
+ 820,
154
+ 823,
155
+ 876
156
+ ],
157
+ "page_idx": 0
158
+ },
159
+ {
160
+ "type": "image",
161
+ "img_path": "images/759c8bb1b0f4ebf46f621f72824e0a25d409516ac63197eee33154d2126e49cb.jpg",
162
+ "image_caption": [
163
+ "Figure 1: MLP-Mixer consists of per-patch linear embeddings, Mixer layers, and a classifier head. Mixer layers contain one token-mixing MLP and one channel-mixing MLP, each consisting of two fully-connected layers and a GELU nonlinearity. Other components include: skip-connections, dropout, and layer norm on the channels. "
164
+ ],
165
+ "image_footnote": [],
166
+ "bbox": [
167
+ 225,
168
+ 93,
169
+ 772,
170
+ 313
171
+ ],
172
+ "page_idx": 1
173
+ },
174
+ {
175
+ "type": "text",
176
+ "text": "they operate on each token independently and take individual rows of the table as inputs. The token-mixing MLPs allow communication between different spatial locations (tokens); they operate on each channel independently and take individual columns of the table as inputs. These two types of layers are interleaved to enable interaction of both input dimensions. ",
177
+ "bbox": [
178
+ 174,
179
+ 405,
180
+ 825,
181
+ 460
182
+ ],
183
+ "page_idx": 1
184
+ },
185
+ {
186
+ "type": "text",
187
+ "text": "In the extreme case, our architecture can be seen as a very special CNN, which uses $1 \\times 1$ convolutions for channel mixing, and single-channel depth-wise convolutions of a full receptive field and parameter sharing for token mixing. However, the converse is not true as typical CNNs are not special cases of Mixer. Furthermore, a convolution is more complex than the plain matrix multiplication in MLPs as it requires an additional costly reduction to matrix multiplication and/or specialized implementation. ",
188
+ "bbox": [
189
+ 174,
190
+ 467,
191
+ 825,
192
+ 537
193
+ ],
194
+ "page_idx": 1
195
+ },
196
+ {
197
+ "type": "text",
198
+ "text": "Despite its simplicity, Mixer attains competitive results. When pre-trained on large datasets (i.e., ${ \\sim } 1 0 0 \\mathbf { M }$ images), it reaches near state-of-the-art performance, previously claimed by CNNs and Transformers, in terms of the accuracy/cost trade-off. This includes $8 7 . 9 4 \\%$ top-1 validation accuracy on ILSVRC2012 “ImageNet” [13]. When pre-trained on data of more modest scale (i.e., ${ \\sim } 1 -$ 10M images), coupled with modern regularization techniques [49, 54], Mixer also achieves strong performance. However, similar to ViT, it falls slightly short of specialized CNN architectures. ",
199
+ "bbox": [
200
+ 174,
201
+ 542,
202
+ 826,
203
+ 627
204
+ ],
205
+ "page_idx": 1
206
+ },
207
+ {
208
+ "type": "text",
209
+ "text": "2 Mixer Architecture ",
210
+ "text_level": 1,
211
+ "bbox": [
212
+ 176,
213
+ 650,
214
+ 367,
215
+ 666
216
+ ],
217
+ "page_idx": 1
218
+ },
219
+ {
220
+ "type": "text",
221
+ "text": "Modern deep vision architectures consist of layers that mix features (i) at a given spatial location, (ii) between different spatial locations, or both at once. In CNNs, (ii) is implemented with $N \\times N$ convolutions (for $N > 1$ ) and pooling. Neurons in deeper layers have a larger receptive field [1, 29]. At the same time, $1 \\times 1$ convolutions also perform (i), and larger kernels perform both (i) and (ii). In Vision Transformers and other attention-based architectures, self-attention layers allow both (i) and (ii) and the MLP-blocks perform (i). The idea behind the Mixer architecture is to clearly separate the per-location (channel-mixing) operations (i) and cross-location (token-mixing) operations (ii). Both operations are implemented with MLPs. Figure 1 summarizes the architecture. ",
222
+ "bbox": [
223
+ 174,
224
+ 683,
225
+ 825,
226
+ 795
227
+ ],
228
+ "page_idx": 1
229
+ },
230
+ {
231
+ "type": "text",
232
+ "text": "Mixer takes as input a sequence of $S$ non-overlapping image patches, each one projected to a desired hidden dimension $C$ . This results in a two-dimensional real-valued input table, $\\mathbf { \\bar { X } } \\in \\mathbb { R } ^ { S \\times C }$ . If the original input image has resolution $( H , W )$ , and each patch has resolution $( P , P )$ , then the number of patches is $\\bar { S } = \\bar { H W } / P ^ { 2 }$ . All patches are linearly projected with the same projection matrix. Mixer consists of multiple layers of identical size, and each layer consists of two MLP blocks. The first one is the token-mixing MLP: it acts on columns of $\\mathbf { X }$ (i.e. it is applied to a transposed input table $\\mathbf { X } ^ { \\top }$ ), maps $\\mathbb { R } ^ { S } \\mapsto \\mathbb { R } ^ { S }$ , and is shared across all columns. The second one is the channel-mixing MLP: it acts on rows of $\\mathbf { X }$ , maps $\\mathbb { R } ^ { C } \\mapsto \\mathbb { R } ^ { C }$ , and is shared across all rows. Each MLP block contains two fully-connected layers and a nonlinearity applied independently to each row of its input data tensor. Mixer layers can be written as follows (omitting layer indices): ",
233
+ "bbox": [
234
+ 174,
235
+ 800,
236
+ 825,
237
+ 911
238
+ ],
239
+ "page_idx": 1
240
+ },
241
+ {
242
+ "type": "text",
243
+ "text": "",
244
+ "bbox": [
245
+ 173,
246
+ 90,
247
+ 823,
248
+ 119
249
+ ],
250
+ "page_idx": 2
251
+ },
252
+ {
253
+ "type": "equation",
254
+ "img_path": "images/2c8c6654efa6c7166ff291d40e60d324d625c8579bcf986e46cbc1e3cf546ea9.jpg",
255
+ "text": "$$\n\\begin{array} { r } { \\mathbf { U } _ { * , i } = \\mathbf { X } _ { * , i } + \\mathbf { W } _ { 2 } \\sigma \\big ( \\mathbf { W } _ { 1 } \\mathrm { L a y e r N o r m } ( \\mathbf { X } ) _ { * , i } \\big ) , \\quad \\mathrm { f o r } i = 1 \\ldots C , } \\\\ { \\mathbf { Y } _ { j , * } = \\mathbf { U } _ { j , * } + \\mathbf { W } _ { 4 } \\sigma \\big ( \\mathbf { W } _ { 3 } \\mathrm { L a y e r N o r m } ( \\mathbf { U } ) _ { j , * } \\big ) , \\quad \\mathrm { f o r } j = 1 \\ldots S . } \\end{array}\n$$",
256
+ "text_format": "latex",
257
+ "bbox": [
258
+ 279,
259
+ 122,
260
+ 718,
261
+ 162
262
+ ],
263
+ "page_idx": 2
264
+ },
265
+ {
266
+ "type": "text",
267
+ "text": "Here $\\sigma$ is an element-wise nonlinearity (GELU [16]). $D _ { S }$ and $D _ { C }$ are tunable hidden widths in the token-mixing and channel-mixing MLPs, respectively. Note that $D _ { S }$ is selected independently of the number of input patches. Therefore, the computational complexity of the network is linear in the number of input patches, unlike ViT whose complexity is quadratic. Since $D _ { C }$ is independent of the patch size, the overall complexity is linear in the number of pixels in the image, as for a typical CNN. ",
268
+ "bbox": [
269
+ 174,
270
+ 165,
271
+ 825,
272
+ 234
273
+ ],
274
+ "page_idx": 2
275
+ },
276
+ {
277
+ "type": "text",
278
+ "text": "As mentioned above, the same channel-mixing MLP (token-mixing MLP) is applied to every row (column) of $\\mathbf { X }$ . Tying the parameters of the channel-mixing MLPs (within each layer) is a natural choice—it provides positional invariance, a prominent feature of convolutions. However, tying parameters across channels is much less common. For example, separable convolutions [9, 40], used in some CNNs, apply convolutions to each channel independently of the other channels. However, in separable convolutions, a different convolutional kernel is applied to each channel unlike the token-mixing MLPs in Mixer that share the same kernel (of full receptive field) for all of the channels. The parameter tying prevents the architecture from growing too fast when increasing the hidden dimension $C$ or the sequence length $S$ and leads to significant memory savings. Surprisingly, this choice does not affect the empirical performance, see Supplementary A.1. ",
279
+ "bbox": [
280
+ 173,
281
+ 239,
282
+ 825,
283
+ 378
284
+ ],
285
+ "page_idx": 2
286
+ },
287
+ {
288
+ "type": "text",
289
+ "text": "Each layer in Mixer (except for the initial patch projection layer) takes an input of the same size. This “isotropic” design is most similar to Transformers, or deep RNNs in other domains, that also use a fixed width. This is unlike most CNNs, which have a pyramidal structure: deeper layers have a lower resolution input, but more channels. Note that while these are the typical designs, other combinations exist, such as isotropic ResNets [38] and pyramidal ViTs [52]. ",
290
+ "bbox": [
291
+ 173,
292
+ 385,
293
+ 825,
294
+ 455
295
+ ],
296
+ "page_idx": 2
297
+ },
298
+ {
299
+ "type": "text",
300
+ "text": "Aside from the MLP layers, Mixer uses other standard architectural components: skip-connections [15] and layer normalization [2]. Unlike ViTs, Mixer does not use position embeddings because the token-mixing MLPs are sensitive to the order of the input tokens. Finally, Mixer uses a standard classification head with the global average pooling layer followed by a linear classifier. Overall, the architecture can be written compactly in JAX/Flax, the code is given in Supplementary F. ",
301
+ "bbox": [
302
+ 174,
303
+ 460,
304
+ 825,
305
+ 531
306
+ ],
307
+ "page_idx": 2
308
+ },
309
+ {
310
+ "type": "text",
311
+ "text": "3 Experiments ",
312
+ "text_level": 1,
313
+ "bbox": [
314
+ 174,
315
+ 549,
316
+ 312,
317
+ 566
318
+ ],
319
+ "page_idx": 2
320
+ },
321
+ {
322
+ "type": "text",
323
+ "text": "We evaluate the performance of MLP-Mixer models, pre-trained with medium- to large-scale datasets, on a range of small and mid-sized downstream classification tasks. We are interested in three primary quantities: (1) Accuracy on the downstream task; (2) Total computational cost of pre-training, which is important when training the model from scratch on the upstream dataset; (3) Test-time throughput, which is important to the practitioner. Our goal is not to demonstrate state-of-the-art results, but to show that, remarkably, a simple MLP-based model is competitive with today’s best convolutional and attention-based models. ",
324
+ "bbox": [
325
+ 173,
326
+ 579,
327
+ 825,
328
+ 676
329
+ ],
330
+ "page_idx": 2
331
+ },
332
+ {
333
+ "type": "text",
334
+ "text": "Downstream tasks We use popular downstream tasks such as ILSVRC2012 “ImageNet” (1.3M training examples, 1k classes) with the original validation labels [13] and cleaned-up ReaL labels [5], CIFAR-10/100 (50k examples, 10/100 classes) [23], Oxford-IIIT Pets (3.7k examples, 36 classes) [33], and Oxford Flowers-102 (2k examples, 102 classes) [32]. We also use the Visual Task Adaptation Benchmark (VTAB-1k), which consists of 19 diverse datasets, each with 1k training examples [58]. ",
335
+ "bbox": [
336
+ 174,
337
+ 683,
338
+ 825,
339
+ 752
340
+ ],
341
+ "page_idx": 2
342
+ },
343
+ {
344
+ "type": "text",
345
+ "text": "Pre-training We follow the standard transfer learning setup: pre-training followed by fine-tuning on the downstream tasks. We pre-train our models on two public datasets: ILSVRC2021 ImageNet, and ImageNet-21k, a superset of ILSVRC2012 that contains 21k classes and 14M images [13]. To assess performance at larger scale, we also train on JFT-300M, a proprietary dataset with 300M examples and 18k classes [44]. We de-duplicate all pre-training datasets with respect to the test sets of the downstream tasks as done in Dosovitskiy et al. [14], Kolesnikov et al. [22]. We pre-train all models at resolution 224 using Adam with $\\beta _ { 1 } = 0 . 9$ , $\\beta _ { 2 } = 0 . 9 9 9$ , linear learning rate warmup of 10k steps and linear decay, batch size 4 096, weight decay, and gradient clipping at global norm 1. For JFT-300M, we pre-process images by applying the cropping technique from Szegedy et al. [45] in addition to random horizontal flipping. For ImageNet and ImageNet-21k, we employ additional data augmentation and regularization techniques. In particular, we use RandAugment [12], mixup [60], dropout [43], and stochastic depth [19]. This set of techniques was inspired by the timm library [54] and Touvron et al. [48]. More details on these hyperparameters are provided in Supplementary B. ",
346
+ "bbox": [
347
+ 174,
348
+ 758,
349
+ 825,
350
+ 911
351
+ ],
352
+ "page_idx": 2
353
+ },
354
+ {
355
+ "type": "table",
356
+ "img_path": "images/7e26b274eefa2449ead43edb17625410832b76d92162f3866cc372fdf2f626a0.jpg",
357
+ "table_caption": [
358
+ "Table 1: Specifications of the Mixer architectures. The “B”, “L”, and “H” (base, large, and huge) model scales follow Dosovitskiy et al. [14]. A brief notation $\\mathbf { \\ddot { B } } / 1 6 ^ { \\mathbf { \\ ' } }$ means the model of base scale with patches of resolution $1 6 \\times 1 6$ . The number of parameters is reported for an input resolution of 224 and does not include the weights of the classifier head. "
359
+ ],
360
+ "table_footnote": [],
361
+ "table_body": "<table><tr><td>Specification</td><td>S/32</td><td>S/16</td><td>B/32</td><td>B/16</td><td>L/32</td><td>L/16</td><td>H/14</td></tr><tr><td>Number of layers</td><td>8</td><td>8</td><td>12</td><td>12</td><td>24</td><td>24</td><td>32</td></tr><tr><td>Patch resolution P×P</td><td>32×32</td><td>16×16</td><td>32×32</td><td>16×16</td><td>32×32</td><td>16×16</td><td>14×14</td></tr><tr><td>Hidden size C</td><td>512</td><td>512</td><td>768</td><td>768</td><td>1024</td><td>1024</td><td>1280</td></tr><tr><td>Sequence length S</td><td>49</td><td>196</td><td>49</td><td>196</td><td>49</td><td>196</td><td>256</td></tr><tr><td>MLP dimension Dc</td><td>2048</td><td>2048</td><td>3072</td><td>3072</td><td>4096</td><td>4096</td><td>5120</td></tr><tr><td>MLP dimension Ds</td><td>256</td><td>256</td><td>384</td><td>384</td><td>512</td><td>512</td><td>640</td></tr><tr><td>Parameters (M)</td><td>19</td><td>18</td><td>60</td><td>59</td><td>206</td><td>207</td><td>431</td></tr></table>",
362
+ "bbox": [
363
+ 215,
364
+ 160,
365
+ 779,
366
+ 276
367
+ ],
368
+ "page_idx": 3
369
+ },
370
+ {
371
+ "type": "text",
372
+ "text": "",
373
+ "bbox": [
374
+ 174,
375
+ 295,
376
+ 823,
377
+ 323
378
+ ],
379
+ "page_idx": 3
380
+ },
381
+ {
382
+ "type": "text",
383
+ "text": "Fine-tuning We fine-tune using momentum SGD, batch size 512, gradient clipping at global norm 1, and a cosine learning rate schedule with a linear warmup. We do not use weight decay when finetuning. Following common practice [22, 48], we also fine-tune at higher resolutions with respect to those used during pre-training. Since we keep the patch resolution fixed, this increases the number of input patches (say from $S$ to $S ^ { \\prime }$ ) and thus requires modifying the shape of Mixer’s token-mixing MLP blocks. Formally, the input in Eq. (1) is left-multiplied by a weight matrix $\\mathbf { W } _ { 1 } \\in \\mathbb { R } ^ { D _ { S } \\times S }$ and this operation has to be adjusted when changing the input dimension $S$ . For this, we increase the hidden layer width from $D _ { S }$ to $D _ { S ^ { \\prime } }$ in proportion to the number of patches and initialize the (now larger) weight matrix $\\mathbf { W } _ { 2 } ^ { \\prime } \\in \\mathbb { R } ^ { D _ { S ^ { \\prime } } \\times S ^ { \\prime } }$ with a block-diagonal matrix containing copies of $\\mathbf { W } _ { 2 }$ on its diagonal. This particular scheme only allows for $S ^ { \\prime } = \\breve { K } ^ { 2 } S$ with $K \\in \\mathbb N$ . See Supplementary C for further details. On the VTAB-1k benchmark we follow the BiT-HyperRule [22] and fine-tune Mixer models at resolution 224 and 448 on the datasets with small and large input images respectively. ",
384
+ "bbox": [
385
+ 173,
386
+ 329,
387
+ 825,
388
+ 497
389
+ ],
390
+ "page_idx": 3
391
+ },
392
+ {
393
+ "type": "text",
394
+ "text": "Metrics We evaluate the trade-off between the model’s computational cost and quality. For the former we compute two metrics: (1) Total pre-training time on TPU-v3 accelerators, which combines three relevant factors: the theoretical FLOPs for each training setup, the computational efficiency on the relevant training hardware, and the data efficiency. (2) Throughput in images/sec/core on TPU-v3. Since models of different sizes may benefit from different batch sizes, we sweep the batch sizes and report the highest throughput for each model. For model quality, we focus on top-1 downstream accuracy after fine-tuning. On two occasions (Figure 3, right and Figure 4), where fine-tuning all of the models is too costly, we report the few-shot accuracies obtained by solving the $\\ell _ { 2 }$ -regularized linear regression problem between the frozen learned representations of images and the labels. ",
395
+ "bbox": [
396
+ 174,
397
+ 503,
398
+ 825,
399
+ 628
400
+ ],
401
+ "page_idx": 3
402
+ },
403
+ {
404
+ "type": "text",
405
+ "text": "Models We compare various configurations of Mixer, summarized in Table 1, to the most recent, state-of-the-art, CNNs and attention-based models. In all the figures and tables, the MLP-based Mixer models are marked with pink ( ), convolution-based models with yellow $( \\circ )$ , and attention-based models with blue ( ). The Vision Transformers (ViTs) have model scales and patch resolutions similar to Mixer. HaloNets are attention-based models that use a ResNet-like structure with local selfattention layers instead of $3 \\times 3$ convolutions [51]. We focus on the particularly efficient “HaloNet-H4 (base 128, Conv-12)” model, which is a hybrid variant of the wider HaloNet-H4 architecture with some of the self-attention layers replaced by convolutions. Note, we mark HaloNets with both attention and convolutions with blue ( ). Big Transfer (BiT) [22] models are ResNets optimized for transfer learning. NFNets [7] are normalizer-free ResNets with several optimizations for ImageNet classification. We consider the NFNet- $\\cdot \\mathrm { F 4 + }$ model variant. We consider MPL [35] and ALIGN [21] for EfficientNet architectures. MPL is pre-trained at very large-scale on JFT-300M images, using meta-pseudo labelling from ImageNet instead of the original labels. We compare to the EfficientNetB6-Wide model variant. ALIGN pre-train image encoder and language encoder on noisy web image text pairs in a contrastive way. We compare to their best EfficientNet-L2 image encoder. ",
406
+ "bbox": [
407
+ 174,
408
+ 633,
409
+ 825,
410
+ 842
411
+ ],
412
+ "page_idx": 3
413
+ },
414
+ {
415
+ "type": "text",
416
+ "text": "3.1 Main results ",
417
+ "text_level": 1,
418
+ "bbox": [
419
+ 174,
420
+ 857,
421
+ 300,
422
+ 872
423
+ ],
424
+ "page_idx": 3
425
+ },
426
+ {
427
+ "type": "text",
428
+ "text": "Table 2 presents comparison of the largest Mixer models to state-of-the-art models from the literature. “ImNet” and “ReaL” columns refer to the original ImageNet validation [13] and cleaned-up ReaL [5] labels. “Avg. $5 ^ { \\circ }$ stands for the average performance across all five downstream tasks (ImageNet, CIFAR-10, CIFAR-100, Pets, Flowers). Figure 2 (left) visualizes the accuracy-compute frontier. When pre-trained on ImageNet-21k with additional regularization, Mixer achieves an overall strong performance $8 4 . 1 5 \\%$ top-1 on ImageNet), although slightly inferior to other models2. Regularization in this scenario is necessary and Mixer overfits without it, which is consistent with similar observations for ViT [14]. The same conclusion holds when training Mixer from random initialization on ImageNet (see Section 3.2): Mixer-B/16 attains a reasonable score of $7 6 . 4 \\%$ at resolution 224, but tends to overfit. This score is similar to a vanilla ResNet50, but behind state-of-the-art CNNs/hybrids for the ImageNet “from scratch” setting, e.g. $8 4 . 7 \\%$ BotNet [42] and $8 6 . 5 \\%$ NFNet [7]. ",
429
+ "bbox": [
430
+ 174,
431
+ 883,
432
+ 821,
433
+ 911
434
+ ],
435
+ "page_idx": 3
436
+ },
437
+ {
438
+ "type": "table",
439
+ "img_path": "images/520a8ab358be53d9597d292a724c5d33b52cd7a6c61bc1526554b9469dd172b6.jpg",
440
+ "table_caption": [
441
+ "Table 2: Transfer performance, inference throughput, and training cost. The rows are sorted by inference throughput (fifth column). Mixer has comparable transfer accuracy to state-of-the-art models with similar cost. The Mixer models are fine-tuned at resolution 448. Mixer performance numbers are averaged over three fine-tuning runs and standard deviations are smaller than 0.1. "
442
+ ],
443
+ "table_footnote": [],
444
+ "table_body": "<table><tr><td></td><td>ImNet top-1</td><td>ReaL top-1</td><td>Avg 5 top-1</td><td>VTAB-1k 19 tasks</td><td>Throughput img/sec/core</td><td>TPUv3 core-days</td></tr><tr><td colspan=\"7\">Pre-trained on ImageNet-21k (public)</td></tr><tr><td>HaloNet [51]</td><td>85.8</td><td></td><td></td><td></td><td>120</td><td>0.10k</td></tr><tr><td>Mixer-L/16</td><td>84.15</td><td>87.86</td><td>93.91</td><td>74.95</td><td>105</td><td>0.41k</td></tr><tr><td>ViT-L/16 [14]</td><td>85.30</td><td>88.62</td><td>94.39</td><td>72.72</td><td>32</td><td>0.18k</td></tr><tr><td>BiT-R152x4 [22] .</td><td>85.39</td><td></td><td>94.04</td><td>70.64</td><td>26</td><td>0.94k</td></tr><tr><td colspan=\"7\">Pre-trained on JFT-30OM (proprietary)</td></tr><tr><td>NFNet-F4+ [7]</td><td>89.2</td><td></td><td></td><td></td><td>46</td><td>1.86k</td></tr><tr><td>· Mixer-H/14</td><td>87.94</td><td>90.18</td><td>95.71</td><td>75.33</td><td>40</td><td>1.01k</td></tr><tr><td>·BiT-R152x4 [22]</td><td>87.54</td><td>90.54</td><td>95.33</td><td>76.29</td><td>26</td><td>9.90k</td></tr><tr><td>ViT-H/14 [14]</td><td>88.55</td><td>90.72</td><td>95.97</td><td>77.63</td><td>15</td><td>2.30k</td></tr><tr><td colspan=\"7\">Pre-trained on unlabelled or weakly labelled data (proprietary)</td></tr><tr><td>·MPL [35]</td><td>90.0</td><td>91.12</td><td></td><td></td><td>一</td><td>20.48k</td></tr><tr><td>ALIGN[21] T</td><td>88.64</td><td>一</td><td></td><td>79.99</td><td>15</td><td>14.82k</td></tr></table>",
445
+ "bbox": [
446
+ 238,
447
+ 160,
448
+ 759,
449
+ 387
450
+ ],
451
+ "page_idx": 4
452
+ },
453
+ {
454
+ "type": "text",
455
+ "text": "",
456
+ "bbox": [
457
+ 173,
458
+ 407,
459
+ 825,
460
+ 534
461
+ ],
462
+ "page_idx": 4
463
+ },
464
+ {
465
+ "type": "text",
466
+ "text": "When the size of the upstream dataset increases, Mixer’s performance improves significantly. In particular, Mixer-H/14 achieves $8 7 . 9 4 \\%$ top-1 accuracy on ImageNet, which is $0 . 5 \\%$ better than BiTResNet $1 5 2 \\mathrm { x } 4$ and only $0 . 5 \\%$ lower than ViT-H/14. Remarkably, Mixer-H/14 runs 2.5 times faster than ViT-H/14 and almost twice as fast as BiT. Overall, Figure 2 (left) supports our main claim that in terms of the accuracy-compute trade-off Mixer is competitive with more conventional neural network architectures. The figure also demonstrates a clear correlation between the total pre-training cost and the downstream accuracy, even across architecture classes. ",
467
+ "bbox": [
468
+ 174,
469
+ 539,
470
+ 825,
471
+ 636
472
+ ],
473
+ "page_idx": 4
474
+ },
475
+ {
476
+ "type": "text",
477
+ "text": "BiT-ResNet1 $5 2 \\mathrm { x } 4$ in the table are pre-trained using SGD with momentum and a long schedule. Since Adam tends to converge faster, we complete the picture in Figure 2 (left) with the BiT-R200x3 model from Dosovitskiy et al. [14] pre-trained on JFT-300M using Adam. This ResNet has a slightly lower accuracy, but considerably lower pre-training compute. Finally, the results of smaller ViT-L/16 and Mixer-L/16 models are also reported in this figure. ",
478
+ "bbox": [
479
+ 174,
480
+ 642,
481
+ 825,
482
+ 712
483
+ ],
484
+ "page_idx": 4
485
+ },
486
+ {
487
+ "type": "text",
488
+ "text": "3.2 The role of the model scale ",
489
+ "text_level": 1,
490
+ "bbox": [
491
+ 174,
492
+ 731,
493
+ 398,
494
+ 746
495
+ ],
496
+ "page_idx": 4
497
+ },
498
+ {
499
+ "type": "text",
500
+ "text": "The results outlined in the previous section focus on (large) models at the upper end of the compute spectrum. We now turn our attention to smaller Mixer models. ",
501
+ "bbox": [
502
+ 173,
503
+ 757,
504
+ 823,
505
+ 785
506
+ ],
507
+ "page_idx": 4
508
+ },
509
+ {
510
+ "type": "text",
511
+ "text": "We may scale the model in two independent ways: (1) Increasing the model size (number of layers, hidden dimension, MLP widths) when pre-training; (2) Increasing the input image resolution when fine-tuning. While the former affects both pre-training compute and test-time throughput, the latter only affects the throughput. Unless stated otherwise, we fine-tune at resolution 224. ",
512
+ "bbox": [
513
+ 176,
514
+ 791,
515
+ 823,
516
+ 820
517
+ ],
518
+ "page_idx": 4
519
+ },
520
+ {
521
+ "type": "image",
522
+ "img_path": "images/e888ec18a5f1ffc5126a75c42bc7c88e5c7569217134a6f3ca6be02f3064c9b2.jpg",
523
+ "image_caption": [
524
+ "Figure 2: Left: ImageNet accuracy/training cost Pareto frontier (dashed line) for the SOTA models in Table 2. Models are pre-trained on ImageNet-21k, or JFT (labelled, or pseudo-labelled for MPL), or web image text pairs. Mixer is as good as these extremely performant ResNets, ViTs, and hybrid models, and sits on frontier with HaloNet, ViT, NFNet, and MPL. Right: Mixer (solid) catches or exceeds BiT (dotted) and ViT (dashed) as the data size grows. Every point on a curve uses the same pre-training compute; they correspond to pre-training on $3 \\%$ , $10 \\%$ , $30 \\%$ , and $100 \\%$ of JFT-300M for 233, 70, 23, and 7 epochs, respectively. Additional points at ${ \\sim } 3 \\mathbf { B }$ correspond to pre-training on an even larger JFT-3B dataset for the same number of total steps. Mixer improves more rapidly with data than ResNets, or even ViT. The gap between large Mixer and ViT models shrinks. "
525
+ ],
526
+ "image_footnote": [],
527
+ "bbox": [
528
+ 232,
529
+ 92,
530
+ 767,
531
+ 247
532
+ ],
533
+ "page_idx": 5
534
+ },
535
+ {
536
+ "type": "image",
537
+ "img_path": "images/dcb60c2290be7785a89bed98d1d0cadb3b9e81795e4b5a5cc118b0fb971d4aa5.jpg",
538
+ "image_caption": [
539
+ "Figure 3: The role of the model scale. ImageNet validation top-1 accuracy vs. total pre-training compute (left) and throughput (right) of ViT, BiT, and Mixer models at various scales. All models are pre-trained on JFT-300M and fine-tuned at resolution 224, which is lower than in Figure 2 (left). "
540
+ ],
541
+ "image_footnote": [],
542
+ "bbox": [
543
+ 210,
544
+ 398,
545
+ 787,
546
+ 515
547
+ ],
548
+ "page_idx": 5
549
+ },
550
+ {
551
+ "type": "text",
552
+ "text": "",
553
+ "bbox": [
554
+ 174,
555
+ 583,
556
+ 821,
557
+ 611
558
+ ],
559
+ "page_idx": 5
560
+ },
561
+ {
562
+ "type": "text",
563
+ "text": "We compare various configurations of Mixer (see Table 1) to ViT models of similar scales and BiT models pre-trained with Adam. The results are summarized in Table 3 and Figure 3. When trained from scratch on ImageNet, Mixer-B/16 achieves a reasonable top-1 accuracy of $7 6 . 4 4 \\%$ . This is $3 \\%$ behind the ViT-B/16 model. The training curves (not reported) reveal that both models achieve very similar values of the training loss. In other words, Mixer-B/16 overfits more than ViT-B/16. For the Mixer-L/16 and ViT-L/16 models this difference is even more pronounced. ",
564
+ "bbox": [
565
+ 174,
566
+ 617,
567
+ 825,
568
+ 700
569
+ ],
570
+ "page_idx": 5
571
+ },
572
+ {
573
+ "type": "text",
574
+ "text": "As the pre-training dataset grows, Mixer’s performance steadily improves. Remarkably, Mixer-H/14 pre-trained on JFT-300M and fine-tuned at 224 resolution is only $0 . 3 \\%$ behind ViT-H/14 on ImageNet whilst running 2.2 times faster. Figure 3 clearly demonstrates that although Mixer is slightly below the frontier on the lower end of model scales, it sits confidently on the frontier at the high end. ",
575
+ "bbox": [
576
+ 174,
577
+ 707,
578
+ 825,
579
+ 762
580
+ ],
581
+ "page_idx": 5
582
+ },
583
+ {
584
+ "type": "text",
585
+ "text": "3.3 The role of the pre-training dataset size ",
586
+ "text_level": 1,
587
+ "bbox": [
588
+ 176,
589
+ 781,
590
+ 486,
591
+ 796
592
+ ],
593
+ "page_idx": 5
594
+ },
595
+ {
596
+ "type": "text",
597
+ "text": "The results presented thus far demonstrate that pre-training on larger datasets significantly improves Mixer’s performance. Here, we study this effect in more detail. ",
598
+ "bbox": [
599
+ 176,
600
+ 808,
601
+ 823,
602
+ 835
603
+ ],
604
+ "page_idx": 5
605
+ },
606
+ {
607
+ "type": "text",
608
+ "text": "To study Mixer’s ability to make use of the growing number of training examples we pre-train Mixer-B/32, Mixer-L/32, and Mixer-L/16 models on random subsets of JFT-300M containing $3 \\%$ , $10 \\%$ , $30 \\%$ and $100 \\%$ of all the training examples for 233, 70, 23, and 7 epochs. Thus, every model is pre-trained for the same number of total steps. We also pre-train Mixer-L/16 model on an even larger JFT-3B dataset [59] containing roughly 3B images with 30k classes for the same number of total steps. ",
609
+ "bbox": [
610
+ 176,
611
+ 842,
612
+ 825,
613
+ 911
614
+ ],
615
+ "page_idx": 5
616
+ },
617
+ {
618
+ "type": "table",
619
+ "img_path": "images/7fb179a35692e5d7af2ac5139b1c7d513db42916c8578b35a36b1c4ad70aff29.jpg",
620
+ "table_caption": [
621
+ "Table 3: Performance of Mixer and other models from the literature across various model and pre-training dataset scales. “Avg. 5” denotes the average performance across five downstream tasks. Mixer and ViT models are averaged over three fine-tuning runs, standard deviations are smaller than 0.15. $( \\ddagger )$ Extrapolated from the numbers reported for the same models pre-trained on JFT-300M without extra regularization. $\\mathbf { \\Pi } ( \\widehat { \\mathbf { a } } )$ Numbers provided by authors of Dosovitskiy et al. [14] through personal communication. Rows are sorted by throughput. "
622
+ ],
623
+ "table_footnote": [],
624
+ "table_body": "<table><tr><td></td><td>Image size</td><td>Pre-Train Epochs</td><td>ImNet top-1</td><td>ReaL top-1</td><td></td><td>Avg.5Throughput top-1 (img/sec/core) core-days</td><td>TPUv3</td></tr><tr><td colspan=\"8\">Pre-trained on ImageNet (with extra regularization)</td></tr><tr><td>Mixer-B/16</td><td>224</td><td>300</td><td>76.44</td><td>82.36</td><td>88.33</td><td>1384</td><td>0.01k(t)</td></tr><tr><td>ViT-B/16 ()</td><td>224</td><td>300</td><td>79.67</td><td>84.97</td><td>90.79</td><td>861</td><td>0.02k(±)</td></tr><tr><td>Mixer-L/16 .</td><td>224</td><td>300</td><td>71.76</td><td>77.08</td><td>87.25</td><td>419</td><td>0.04k(t)</td></tr><tr><td>ViT-L/16 ()</td><td>224</td><td>300</td><td>76.11</td><td>80.93</td><td>89.66</td><td>280</td><td>0.05k($)</td></tr><tr><td colspan=\"8\">Pre-trained on ImageNet-21k (with extra regularization)</td></tr><tr><td>·Mixer-B/16</td><td>224</td><td>300</td><td>80.64</td><td>85.80</td><td>92.50</td><td>1384</td><td>0.15k(t)</td></tr><tr><td>ViT-B/16 ()</td><td>224</td><td>300</td><td>84.59</td><td>88.93</td><td>94.16</td><td>861</td><td>0.18k(t)</td></tr><tr><td>Mixer-L/16</td><td>224</td><td>300</td><td>82.89</td><td>87.54</td><td>93.63</td><td>419</td><td>0.41k($)</td></tr><tr><td>ViT-L/16 (a)</td><td>224</td><td>300</td><td>84.46</td><td>88.35</td><td>94.49</td><td>280</td><td>0.55k(t)</td></tr><tr><td>·Mixer-L/16</td><td>448</td><td>300</td><td>83.91</td><td>87.75</td><td>93.86</td><td>105</td><td>0.41k($)</td></tr><tr><td colspan=\"8\">Pre-trained on JFT-300M</td></tr><tr><td>·Mixer-S/32</td><td>224</td><td>5</td><td>68.70</td><td>75.83</td><td>87.13</td><td>11489</td><td>0.01k</td></tr><tr><td>Mixer-B/32</td><td>224</td><td>7</td><td>75.53</td><td>81.94</td><td>90.99</td><td>4208</td><td>0.05k</td></tr><tr><td>Mixer-S/16</td><td>224</td><td>5</td><td>73.83</td><td>80.60</td><td>89.50</td><td>3994</td><td>0.03k</td></tr><tr><td>BiT-R50x1</td><td>224</td><td>7</td><td>73.69</td><td>81.92</td><td>一</td><td>2159</td><td>0.08k</td></tr><tr><td>Mixer-B/16</td><td>224</td><td>7</td><td>80.00</td><td>85.56</td><td>92.60</td><td>1384</td><td>0.08k</td></tr><tr><td>·Mixer-L/32</td><td>224</td><td>7</td><td>80.67</td><td>85.62</td><td>93.24</td><td>1314</td><td>0.12k</td></tr><tr><td>BiT-R152x1</td><td>224</td><td>7</td><td>79.12</td><td>86.12</td><td></td><td>932</td><td>0.14k</td></tr><tr><td>BiT-R50x2</td><td>224</td><td>7</td><td>78.92</td><td>86.06</td><td></td><td>890</td><td>0.14k</td></tr><tr><td>BiT-R152x2</td><td>224</td><td>14</td><td>83.34</td><td>88.90</td><td></td><td>356</td><td>0.58k</td></tr><tr><td>Mixer-L/16</td><td>224</td><td>7</td><td>84.05</td><td>88.14</td><td>94.51</td><td>419</td><td>0.23k</td></tr><tr><td>·Mixer-L/16</td><td>224</td><td>14</td><td>84.82</td><td>88.48</td><td>94.77</td><td>419</td><td>0.45k</td></tr><tr><td>ViT-L/16</td><td>224</td><td>14</td><td>85.63</td><td>89.16</td><td>95.21</td><td>280</td><td>0.65k</td></tr><tr><td>Mixer-H/14</td><td>224</td><td>14</td><td>86.32</td><td>89.14</td><td>95.49</td><td>194</td><td>1.01k</td></tr><tr><td>. BiT-R200x3</td><td>224</td><td>14</td><td>84.73</td><td>89.58</td><td></td><td>141</td><td>1.78k</td></tr><tr><td>Mixer-L/16</td><td>448</td><td>14</td><td>86.78</td><td>89.72</td><td>95.13</td><td>105</td><td>0.45k</td></tr><tr><td>ViT-H/14</td><td>224</td><td>14</td><td>86.65</td><td>89.56</td><td>95.57</td><td>87</td><td>2.30k</td></tr><tr><td>ViT-L/16 [14]</td><td>512</td><td>14</td><td>87.76</td><td>90.54</td><td>95.63</td><td>32</td><td>0.65k</td></tr></table>",
625
+ "bbox": [
626
+ 238,
627
+ 186,
628
+ 758,
629
+ 612
630
+ ],
631
+ "page_idx": 6
632
+ },
633
+ {
634
+ "type": "text",
635
+ "text": "While not strictly comparable, this allows us to further extrapolate the effect of scale. We use the linear 5-shot top-1 accuracy on ImageNet as a proxy for transfer quality. For every pre-training run we perform early stopping based on the best upstream validation performance. Results are reported in Figure 2 (right), where we also include ViT-B/32, ViT-L/32, ViT-L/16, and BiT- $\\mathbf { R } 1 5 2 \\mathbf { x } 2$ models. ",
636
+ "bbox": [
637
+ 174,
638
+ 627,
639
+ 823,
640
+ 684
641
+ ],
642
+ "page_idx": 6
643
+ },
644
+ {
645
+ "type": "text",
646
+ "text": "When pre-trained on the smallest subset of JFT-300M, all Mixer models strongly overfit. BiT models also overfit, but to a lesser extent, possibly due to the strong inductive biases associated with the convolutions. As the dataset increases, the performance of both Mixer-L/32 and Mixer-L/16 grows faster than BiT; Mixer-L/16 keeps improving, while the BiT model plateaus. ",
647
+ "bbox": [
648
+ 174,
649
+ 689,
650
+ 825,
651
+ 746
652
+ ],
653
+ "page_idx": 6
654
+ },
655
+ {
656
+ "type": "text",
657
+ "text": "The same conclusions hold for ViT, consistent with Dosovitskiy et al. [14]. However, the relative improvement of larger Mixer models are even more pronounced. The performance gap between Mixer-L/16 and ViT-L/16 shrinks with data scale. It appears that Mixer benefits from the growing dataset size even more than ViT. One could speculate and explain it again with the difference in inductive biases: self-attention layers in ViT lead to certain properties of the learned functions that are less compatible with the true underlying distribution than those discovered with Mixer architecture. ",
658
+ "bbox": [
659
+ 174,
660
+ 751,
661
+ 825,
662
+ 835
663
+ ],
664
+ "page_idx": 6
665
+ },
666
+ {
667
+ "type": "text",
668
+ "text": "3.4 Invariance to input permutations ",
669
+ "text_level": 1,
670
+ "bbox": [
671
+ 176,
672
+ 856,
673
+ 442,
674
+ 871
675
+ ],
676
+ "page_idx": 6
677
+ },
678
+ {
679
+ "type": "text",
680
+ "text": "In this section, we study the difference between inductive biases of Mixer and CNN architectures. Specifically, we train Mixer-B/16 and ResNet50x1 models on JFT-300M following the pre-training setup described in Section 3 and using one of two different input transformations: (1) Shuffle the order of $1 6 \\times 1 6$ patches and permute pixels within each patch with a shared permutation; (2) Permute the pixels globally in the entire image. Same permutation is used across all images. We report the linear 5-shot top-1 accuracy of the trained models on ImageNet in Figure 4 (bottom). Some original images along with their two transformed versions appear in Figure 4 (top). As could be expected, Mixer is invariant to the order of patches and pixels within the patches (the blue and green curves match perfectly). On the other hand, ResNet’s strong inductive bias relies on a particular order of pixels within an image and its performance drops significantly when the patches are permuted. Remarkably, when globally permuting the pixels, Mixer’s performance drops much less ( ${ \\sim } 4 5 \\%$ drop) compared to the ResNet $\\sim 7 5 \\%$ drop). ",
681
+ "bbox": [
682
+ 174,
683
+ 882,
684
+ 823,
685
+ 911
686
+ ],
687
+ "page_idx": 6
688
+ },
689
+ {
690
+ "type": "image",
691
+ "img_path": "images/4d73edba72e7ee7ea5c72a0d41ac9476e577939a71c5c92b54605615df0e5d5c.jpg",
692
+ "image_caption": [
693
+ "Figure 4: Top: Input examples from ImageNet before permuting the contents (left); after shuffling the $1 6 \\times 1 6$ patches and pixels within the patches (center); after shuffling pixels globally (right). Bottom: Mixer-B/16 (left) and ResNet50x1 (right) trained with three corresponding input pipelines. "
694
+ ],
695
+ "image_footnote": [],
696
+ "bbox": [
697
+ 236,
698
+ 88,
699
+ 761,
700
+ 258
701
+ ],
702
+ "page_idx": 7
703
+ },
704
+ {
705
+ "type": "image",
706
+ "img_path": "images/6580eadc8dc26ea6d1683a42b8533e69114404d978ae2cc5853f9e28e8fb58f1.jpg",
707
+ "image_caption": [
708
+ "Figure 5: Hidden units in the first (left), second (center), and third (right) token-mixing MLPs of a Mixer-B/16 model trained on JFT-300M. Each unit has 196 weights, one for each of the $1 4 \\times 1 4$ incoming patches. We pair the units to highlight the emergence of kernels of opposing phase. Pairs are sorted by filter frequency. In contrast to the kernels of convolutional filters, where each weight corresponds to one pixel in the input image, one weight in any plot from the left column corresponds to a particular $1 6 \\times 1 6$ patch of the input image. Complete plots in Supplementary D. "
709
+ ],
710
+ "image_footnote": [],
711
+ "bbox": [
712
+ 194,
713
+ 328,
714
+ 805,
715
+ 479
716
+ ],
717
+ "page_idx": 7
718
+ },
719
+ {
720
+ "type": "text",
721
+ "text": "",
722
+ "bbox": [
723
+ 174,
724
+ 592,
725
+ 825,
726
+ 729
727
+ ],
728
+ "page_idx": 7
729
+ },
730
+ {
731
+ "type": "text",
732
+ "text": "3.5 Visualization ",
733
+ "text_level": 1,
734
+ "bbox": [
735
+ 174,
736
+ 757,
737
+ 303,
738
+ 771
739
+ ],
740
+ "page_idx": 7
741
+ },
742
+ {
743
+ "type": "text",
744
+ "text": "It is commonly observed that the first layers of CNNs tend to learn Gabor-like detectors that act on pixels in local regions of the image. In contrast, Mixer allows for global information exchange in the token-mixing MLPs, which begs the question whether it processes information in a similar fashion. Figure 5 shows hidden units of the first three token-mixing MLPs of Mixer trained on JFT-300M. Recall that the token-mixing MLPs allow global communication between different spatial locations. Some of the learned features operate on the entire image, while others operate on smaller regions. Deeper layers appear to have no clearly identifiable structure. Similar to CNNs, we observe many pairs of feature detectors with opposite phases [39]. The structure of learned units depends on the hyperparameters. Plots for the first embedding layer appear in Figure 2 of Supplementary D. ",
745
+ "bbox": [
746
+ 174,
747
+ 786,
748
+ 826,
749
+ 911
750
+ ],
751
+ "page_idx": 7
752
+ },
753
+ {
754
+ "type": "text",
755
+ "text": "4 Related work ",
756
+ "text_level": 1,
757
+ "bbox": [
758
+ 174,
759
+ 89,
760
+ 316,
761
+ 106
762
+ ],
763
+ "page_idx": 8
764
+ },
765
+ {
766
+ "type": "text",
767
+ "text": "MLP-Mixer is a new architecture for computer vision that differs from previous successful architectures because it uses neither convolutional nor self-attention layers. Nevertheless, the design choices can be traced back to ideas from the literature on CNNs [24, 25] and Transformers [50]. ",
768
+ "bbox": [
769
+ 176,
770
+ 121,
771
+ 825,
772
+ 162
773
+ ],
774
+ "page_idx": 8
775
+ },
776
+ {
777
+ "type": "text",
778
+ "text": "CNNs have been the de-facto standard in computer vision since the AlexNet model [24] surpassed prevailing approaches based on hand-crafted image features [36]. Many works focused on improving the design of CNNs. Simonyan and Zisserman [41] demonstrated that one can train state-of-the-art models using only convolutions with small $3 \\times 3$ kernels. He et al. [15] introduced skip-connections together with the batch normalization [20], which enabled training of very deep neural networks and further improved performance. A prominent line of research has investigated the benefits of using sparse convolutions, such as grouped [57] or depth-wise [9, 17] variants. In a similar spirit to our token-mixing MLPs, Wu et al. [55] share parameters in the depth-wise convolutions for natural language processing. Hu et al. [18] and Wang et al. [53] propose to augment convolutional networks with non-local operations to partially alleviate the constraint of local processing from CNNs. Mixer takes the idea of using convolutions with small kernels to the extreme: by reducing the kernel size to $1 \\times 1$ it turns convolutions into standard dense matrix multiplications applied independently to each spatial location (channel-mixing MLPs). This alone does not allow aggregation of spatial information and to compensate we apply dense matrix multiplications that are applied to every feature across all spatial locations (token-mixing MLPs). In Mixer, matrix multiplications are applied row-wise or column-wise on the “patches $\\times$ features” input table, which is also closely related to the work on sparse convolutions. Mixer uses skip-connections [15] and normalization layers [2, 20]. ",
779
+ "bbox": [
780
+ 174,
781
+ 169,
782
+ 825,
783
+ 404
784
+ ],
785
+ "page_idx": 8
786
+ },
787
+ {
788
+ "type": "text",
789
+ "text": "In computer vision, self-attention based Transformer architectures were initially applied for generative modeling [8, 34]. Their value for image recognition was demonstrated later, albeit in combination with a convolution-like locality bias [37], or on low-resolution images [10]. Dosovitskiy et al. [14] introduced ViT, a pure transformer model that has fewer locality biases, but scales well to large data. ViT achieves state-of-the-art performance on popular vision benchmarks while retaining the robustness of CNNs [6]. Touvron et al. [49] trained ViT effectively on smaller datasets using extensive regularization. Mixer borrows design choices from recent transformer-based architectures. The design of Mixer’s MLP-blocks originates in [27, 50]. Converting images to a sequence of patches and directly processing embeddings of these patches originates in Dosovitskiy et al. [14]. ",
790
+ "bbox": [
791
+ 174,
792
+ 410,
793
+ 825,
794
+ 535
795
+ ],
796
+ "page_idx": 8
797
+ },
798
+ {
799
+ "type": "text",
800
+ "text": "Many recent works strive to design more effective architectures for vision. Srinivas et al. [42] replace $3 \\times 3$ convolutions in ResNets by self-attention layers. Ramachandran et al. [37], Tay et al. [47], Li et al. [26], and Bello [3] design networks with new attention-like mechanisms. Mixer can be seen as a step in an orthogonal direction, without reliance on locality bias and attention mechanisms. ",
801
+ "bbox": [
802
+ 174,
803
+ 541,
804
+ 825,
805
+ 597
806
+ ],
807
+ "page_idx": 8
808
+ },
809
+ {
810
+ "type": "text",
811
+ "text": "The work of Lin et al. [28] is closely related. It attains reasonable performance on CIFAR-10 using fully connected networks, heavy data augmentation, and pre-training with an auto-encoder. Neyshabur [31] devises custom regularization and optimization algorithms and trains a fully-connected network, attaining impressive performance on small-scale tasks. Instead we rely on token and channel-mixing MLPs, use standard regularization and optimization techniques, and scale to large data effectively. ",
812
+ "bbox": [
813
+ 174,
814
+ 603,
815
+ 825,
816
+ 672
817
+ ],
818
+ "page_idx": 8
819
+ },
820
+ {
821
+ "type": "text",
822
+ "text": "Traditionally, networks evaluated on ImageNet [13] are trained from random initialization using Inception-style pre-processing [46]. For smaller datasets, transfer of ImageNet models is popular. However, modern state-of-the-art models typically use either weights pre-trained on larger datasets, or more recent data-augmentation and training strategies. For example, Dosovitskiy et al. [14], Kolesnikov et al. [22], Mahajan et al. [30], Pham et al. [35], Xie et al. [56] all advance state-of-the-art in image classification using large-scale pre-training. Examples of improvements due to augmentation or regularization changes include Cubuk et al. [11], who attain excellent classification performance with learned data augmentation, and Bello et al. [4], who show that canonical ResNets are still near state-of-the-art, if one uses recent training and augmentation strategies. ",
823
+ "bbox": [
824
+ 174,
825
+ 679,
826
+ 825,
827
+ 804
828
+ ],
829
+ "page_idx": 8
830
+ },
831
+ {
832
+ "type": "text",
833
+ "text": "5 Conclusions ",
834
+ "text_level": 1,
835
+ "bbox": [
836
+ 174,
837
+ 823,
838
+ 305,
839
+ 840
840
+ ],
841
+ "page_idx": 8
842
+ },
843
+ {
844
+ "type": "text",
845
+ "text": "We describe a very simple architecture for vision. Our experiments demonstrate that it is as good as existing state-of-the-art methods in terms of the trade-off between accuracy and computational resources required for training and inference. We believe these results open many questions. On the practical side, it may be useful to study the features learned by the model and identify the main differences (if any) from those learned by CNNs and Transformers. On the theoretical side, we would like to understand the inductive biases hidden in these various features and eventually their role in generalization. Most of all, we hope that our results spark further research, beyond the realms of established models based on convolutions and self-attention. It would be particularly interesting to see whether such a design works in NLP or other domains. ",
846
+ "bbox": [
847
+ 174,
848
+ 856,
849
+ 823,
850
+ 911
851
+ ],
852
+ "page_idx": 8
853
+ },
854
+ {
855
+ "type": "text",
856
+ "text": "",
857
+ "bbox": [
858
+ 174,
859
+ 92,
860
+ 825,
861
+ 160
862
+ ],
863
+ "page_idx": 9
864
+ },
865
+ {
866
+ "type": "text",
867
+ "text": "Acknowledgments and Disclosure of Funding ",
868
+ "text_level": 1,
869
+ "bbox": [
870
+ 174,
871
+ 180,
872
+ 553,
873
+ 198
874
+ ],
875
+ "page_idx": 9
876
+ },
877
+ {
878
+ "type": "text",
879
+ "text": "The work was performed in the Brain teams in Berlin and Zürich. We thank Josip Djolonga for feedback on the initial version of the paper; Preetum Nakkiran for proposing to train MLP-Mixer on input images with shuffled pixels; Olivier Bousquet, Yann Dauphin, and Dirk Weissenborn for useful discussions. ",
880
+ "bbox": [
881
+ 174,
882
+ 212,
883
+ 825,
884
+ 267
885
+ ],
886
+ "page_idx": 9
887
+ },
888
+ {
889
+ "type": "text",
890
+ "text": "References ",
891
+ "text_level": 1,
892
+ "bbox": [
893
+ 174,
894
+ 287,
895
+ 266,
896
+ 304
897
+ ],
898
+ "page_idx": 9
899
+ },
900
+ {
901
+ "type": "text",
902
+ "text": "[1] A. Araujo, W. Norris, and J. Sim. Computing receptive fields of convolutional neural networks. Distill, 2019. doi: 10.23915/distill.00021. URL https://distill.pub/2019/ computing-receptive-fields. \n[2] J. L. Ba, J. R. Kiros, and G. E. Hinton. Layer normalization. arXiv preprint arXiv:1607.06450, 2016. \n[3] I. Bello. LambdaNetworks: Modeling long-range interactions without attention. arXiv preprint arXiv:2102.08602, 2021. \n[4] I. Bello, W. Fedus, X. Du, E. D. Cubuk, A. Srinivas, T.-Y. Lin, J. Shlens, and B. Zoph. Revisiting ResNets: Improved training and scaling strategies. arXiv preprint arXiv:2103.07579, 2021. \n[5] L. Beyer, O. J. Hénaff, A. Kolesnikov, X. Zhai, and A. van den Oord. Are we done with ImageNet? arXiv preprint arXiv:2006.07159, 2020. \n[6] S. Bhojanapalli, A. Chakrabarti, D. Glasner, D. Li, T. Unterthiner, and A. Veit. Understanding robustness of transformers for image classification. arXiv preprint arXiv:2103.14586, 2021. \n[7] A. Brock, S. De, S. L. Smith, and K. Simonyan. High-performance large-scale image recognition without normalization. arXiv preprint arXiv:2102.06171, 2021. \n[8] R. Child, S. Gray, A. Radford, and I. Sutskever. Generating long sequences with sparse transformers. arXiv preprint arXiv:1904.10509, 2019. \n[9] F. Chollet. Xception: Deep learning with depthwise separable convolutions. In CVPR, 2017. \n[10] J.-B. Cordonnier, A. Loukas, and M. Jaggi. On the relationship between self-attention and convolutional layers. In ICLR, 2020. \n[11] E. D. Cubuk, B. Zoph, D. Mane, V. Vasudevan, and Q. V. Le. AutoAugment: Learning augmentation policies from data. In CVPR, 2019. \n[12] E. D. Cubuk, B. Zoph, J. Shlens, and Q. V. Le. RandAugment: Practical automated data augmentation with a reduced search space. In CVPR Workshops, 2020. \n[13] J. Deng, W. Dong, R. Socher, L. Li, Kai Li, and Li Fei-Fei. ImageNet: A large-scale hierarchical image database. In CVPR, 2009. \n[14] A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly, J. Uszkoreit, and N. Houlsby. An image is worth 16x16 words: Transformers for image recognition at scale. In ICLR, 2021. \n[15] K. He, X. Zhang, S. Ren, and J. Sun. Deep residual learning for image recognition. In CVPR, 2016. \n[16] D. Hendrycks and K. Gimpel. Gaussian error linear units (GELUs). arXiv preprint arXiv:1606.08415, 2016. \n[17] A. G. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto, and H. Adam. Mobilenets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861, 2017. \n[18] J. Hu, L. Shen, and G. Sun. Squeeze-and-excitation networks. In CVPR, 2018. \n[19] G. Huang, Y. Sun, Z. Liu, D. Sedra, and K. Q. Weinberger. Deep networks with stochastic depth. In ECCV, 2016. \n[20] S. Ioffe and C. Szegedy. Batch normalization: Accelerating deep network training by reducing internal covariate shift. In ICML, 2015. \n[21] C. Jia, Y. Yang, Y. Xia, Y.-T. Chen, Z. Parekh, H. Pham, Q. V. Le, Y. Sung, Z. Li, and T. Duerig. Scaling up visual and vision-language representation learning with noisy text supervision. arXiv preprint arXiv:2102.05918, 2021. \n[22] A. Kolesnikov, L. Beyer, X. Zhai, J. Puigcerver, J. Yung, S. Gelly, and N. Houlsby. Big transfer (BiT): General visual representation learning. In ECCV, 2020. \n[23] A. Krizhevsky. Learning multiple layers of features from tiny images. Technical report, University of Toronto, 2009. \n[24] A. Krizhevsky, I. Sutskever, and G. E. Hinton. ImageNet classification with deep convolutional neural networks. In NeurIPS, 2012. \n[25] Y. LeCun, B. Boser, J. Denker, D. Henderson, R. Howard, W. Hubbard, and L. Jackel. Backpropagation applied to handwritten zip code recognition. Neural Computation, 1:541–551, 1989. \n[26] D. Li, J. Hu, C. Wang, X. Li, Q. She, L. Zhu, T. Zhang, and Q. Chen. Involution: Inverting the inherence of convolution for visual recognition. CVPR, 2021. \n[27] M. Lin, Q. Chen, and S. Yan. Network in network. In ICLR, 2014. \n[28] Z. Lin, R. Memisevic, and K. Konda. How far can we go without convolution: Improving fullyconnected networks. In ICLR, Workshop Track, 2016. \n[29] W. Luo, Y. Li, R. Urtasun, and R. Zemel. Understanding the effective receptive field in deep convolutional neural networks. In NeurIPS, 2016. \n[30] D. Mahajan, R. Girshick, V. Ramanathan, K. He, M. Paluri, Y. Li, A. Bharambe, and L. van der Maaten. Exploring the limits of weakly supervised pretraining. In ECCV, 2018. \n[31] B. Neyshabur. Towards learning convolutions from scratch. In NeurIPS, 2020. \n[32] M. Nilsback and A. Zisserman. Automated flower classification over a large number of classes. In ICVGIP, 2008. \n[33] O. M. Parkhi, A. Vedaldi, A. Zisserman, and C. V. Jawahar. Cats and dogs. In CVPR, 2012. \n[34] N. Parmar, A. Vaswani, J. Uszkoreit, L. Kaiser, N. Shazeer, A. Ku, and D. Tran. Image transformer. In ICML, 2018. \n[35] H. Pham, Z. Dai, Q. Xie, M.-T. Luong, and Q. V. Le. Meta pseudo labels. In CVPR, 2021. \n[36] A. Pinz. Object categorization. Foundations and Trends in Computer Graphics and Vision, 1(4), 2006. \n[37] P. Ramachandran, N. Parmar, A. Vaswani, I. Bello, A. Levskaya, and J. Shlens. Stand-alone self-attention in vision models. In NeurIPS, 2019. \n[38] M. Sandler, J. Baccash, A. Zhmoginov, and Howard. Non-discriminative data or weak model? On the relative importance of data and model resolution. In ICCV Workshop on Real-World Recognition from Low-Quality Images and Videos, 2019. \n[39] W. Shang, K. Sohn, D. Almeida, and H. Lee. Understanding and improving convolutional neural networks via concatenated rectified linear units. In ICML, 2016. \n[40] L. Sifre. Rigid-Motion Scattering For Image Classification. PhD thesis, Ecole Polytechnique, 2014. \n[41] K. Simonyan and A. Zisserman. Very deep convolutional networks for large-scale image recognition. In ICLR, 2015. \n[42] A. Srinivas, T.-Y. Lin, N. Parmar, J. Shlens, P. Abbeel, and A. Vaswani. Bottleneck transformers for visual recognition. arXiv preprint arXiv:2101.11605, 2021. \n[43] N. Srivastava, G. Hinton, A. Krizhevsky, I. Sutskever, and R. Salakhutdinov. Dropout: A simple way to prevent neural networks from overfitting. JMLR, 15(56), 2014. \n[44] C. Sun, A. Shrivastava, S. Singh, and A. Gupta. Revisiting unreasonable effectiveness of data in deep learning era. In ICCV, 2017. \n[45] C. Szegedy, W. Liu, Y. Jia, P. Sermanet, S. Reed, D. Anguelov, D. Erhan, V. Vanhoucke, and A. Rabinovich. Going deeper with convolutions. In CVPR, 2015. \n[46] C. Szegedy, V. Vanhoucke, S. Ioffe, J. Shlens, and Z. Wojna. Rethinking the inception architecture for computer vision. In CVPR, 2016. \n[47] Y. Tay, D. Bahri, D. Metzler, D.-C. Juan, Z. Zhao, and C. Zheng. Synthesizer: Rethinking self-attention in transformer models. arXiv, 2020. \n[48] H. Touvron, A. Vedaldi, M. Douze, and H. Jegou. Fixing the train-test resolution discrepancy. In NeurIPS, 2019. \n[49] H. Touvron, M. Cord, M. Douze, F. Massa, A. Sablayrolles, and H. Jégou. Training data-efficient image transformers & distillation through attention. arXiv preprint arXiv:2012.12877, 2020. \n[50] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin. Attention is all you need. In NeurIPS, 2017. \n[51] A. Vaswani, P. Ramachandran, A. Srinivas, N. Parmar, B. Hechtman, and J. Shlens. Scaling local self-attention for parameter efficient visual backbones. arXiv preprint arXiv:2103.12731, 2021. \n[52] 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. arXiv preprint arXiv:2102.12122, 2021. \n[53] X. Wang, R. Girshick, A. Gupta, and K. He. Non-local neural networks. In CVPR, 2018. \n[54] R. Wightman. Pytorch image models. https://github.com/rwightman/ pytorch-image-models, 2019. \n[55] F. Wu, A. Fan, A. Baevski, Y. Dauphin, and M. Auli. Pay less attention with lightweight and dynamic convolutions. In ICLR, 2019. \n[56] Q. Xie, M.-T. Luong, E. Hovy, and Q. V. Le. Self-training with noisy student improves imagenet classification. In CVPR, 2020. \n[57] S. Xie, R. Girshick, P. Dollár, Z. Tu, and K. He. Aggregated residual transformations for deep neural networks. arXiv preprint arXiv:1611.05431, 2016. \n[58] X. Zhai, J. Puigcerver, A. Kolesnikov, P. Ruyssen, C. Riquelme, M. Lucic, J. Djolonga, A. S. Pinto, M. Neumann, A. Dosovitskiy, et al. A large-scale study of representation learning with the visual task adaptation benchmark. arXiv preprint arXiv:1910.04867, 2019. \n[59] X. Zhai, A. Kolesnikov, N. Houlsby, and L. Beyer. Scaling vision transformers. arXiv preprint arXiv:2106.04560, 2021. \n[60] H. Zhang, M. Cisse, Y. N. Dauphin, and D. Lopez-Paz. mixup: Beyond empirical risk minimization. In ICLR, 2018. ",
903
+ "bbox": [
904
+ 173,
905
+ 306,
906
+ 826,
907
+ 916
908
+ ],
909
+ "page_idx": 9
910
+ },
911
+ {
912
+ "type": "text",
913
+ "text": "",
914
+ "bbox": [
915
+ 171,
916
+ 95,
917
+ 828,
918
+ 912
919
+ ],
920
+ "page_idx": 10
921
+ },
922
+ {
923
+ "type": "text",
924
+ "text": "",
925
+ "bbox": [
926
+ 171,
927
+ 89,
928
+ 828,
929
+ 645
930
+ ],
931
+ "page_idx": 11
932
+ }
933
+ ]
parse/train/EI2KOXKdnP/EI2KOXKdnP_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/EI2KOXKdnP/EI2KOXKdnP_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HJepXaVYDr/HJepXaVYDr.md ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HJepXaVYDr/HJepXaVYDr_content_list.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HJepXaVYDr/HJepXaVYDr_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/HJepXaVYDr/HJepXaVYDr_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/djbC2A4uTHP/djbC2A4uTHP.md ADDED
@@ -0,0 +1,269 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Consistency Regularization for Variational Auto-Encoders
2
+
3
+ Samarth Sinha Vector Institute University of Toronto
4
+
5
+ Adji B. Dieng
6
+ Google Brain
7
+ Princeton University
8
+
9
+ # Abstract
10
+
11
+ Variational auto-encoders (vaes) are a powerful approach to unsupervised learning. They enable scalable approximate posterior inference in latent-variable models using variational inference (vi). A vae posits a variational family parameterized by a deep neural network—called an encoder—that takes data as input. This encoder is shared across all the observations, which amortizes the cost of inference. However the encoder of a vae has the undesirable property that it maps a given observation and a semantics-preserving transformation of it to different latent representations. This “inconsistency" of the encoder lowers the quality of the learned representations, especially for downstream tasks, and also negatively affects generalization. In this paper, we propose a regularization method to enforce consistency in vaes. The idea is to minimize the Kullback-Leibler (kl) divergence between the variational distribution when conditioning on the observation and the variational distribution when conditioning on a random semantic-preserving transformation of this observation. This regularization is applicable to any vae. In our experiments we apply it to four different vae variants on several benchmark datasets and found it always improves the quality of the learned representations but also leads to better generalization. In particular, when applied to the nouveau variational auto-encoder (nvae), our regularization method yields state-of-the-art performance on mnist, cifar-10, and celeba. We also applied our method to 3D data and found it learns representations of superior quality as measured by accuracy on a downstream classification task. Finally, we show our method can even outperform the triplet loss, an advanced and popular contrastive learning-based method for representation learning.
12
+
13
+ # 1 Introduction
14
+
15
+ Variational auto-encoders (vaes) have significantly impacted research on unsupervised learning. They have been used in several areas, including density estimation (Kingma & Welling, 2013; Rezende et al., 2014), image generation (Gregor et al., 2015), text generation (Bowman et al., 2015; Fang et al., 2019), music generation (Roberts et al., 2018), topic modeling (Miao et al., 2016; Dieng et al., 2019), and recommendation systems (Liang et al., 2018). Vaes have also been used for different representation learning problems such as semi-supervised learning (Kingma et al., 2014), anomaly detection (An & Cho, 2015; Zimmerer et al., 2018), language modeling Bowman et al. (2015), active learning (Sinha et al., 2019), continual learning (Achille et al., 2018), and motion prediction of agents (Walker et al., 2016). This widespread application of vae representations makes it critical that we focus on improving them.
16
+
17
+ vaes extend deterministic auto-encoders to probabilistic generative modeling. The encoder of a vae parameterizes an approximate posterior distribution over latent variables of a generative model. The encoder is shared between all observations, which amortizes the cost of posterior inference. Once fitted, the encoder of a vae can be used to obtain low-dimensional representations of data, (e.g. for downstream tasks.) The quality of these representations is therefore very important to a successful application of vaes.
18
+
19
+ ![](images/87da93feb9101d9471f5468dd3ffeb7e8e2ecfe35807360b6f865d0e977509dc.jpg)
20
+ Figure 1: Illustration of the inconsistency problem in vaes and how cr-vaes address this problem. The red dots correspond to the representations of few images from mnist. The blue dots correspond to the representations of the transformed images. The transformations used here are rotations, translations, and scaling; they are semantics-preserving. The arrows connect the representations of any two pairs of an image and its transformation. The shorter the arrow, the better. (a): The vae maps the two sets of images to different areas in the latent space. (b): Even when trained with the original dataset augmented with the transformed images, the vae still maps the two sets of images to different parts in the latent space. (c): The cr-vae maps an image and its transformation to nearby areas in the latent space.
21
+
22
+ Researchers have looked at ways to improve the quality of the latent representations of vaes, often tackling the so-called latent variable collapse problem—in which the approximate posterior distribution induced by the encoder collapses to the prior over the latent variables (Bowman et al., 2015; Kim et al., 2018; Dieng et al., 2018; He et al., 2019; Fu et al., 2019).
23
+
24
+ In this paper, we focus on a different problem pertaining to the latent representations of vaes for image data. Indeed, the encoder of a fitted vae tends to map an image and a semantics-preserving transformation of that image to different parts in the latent space. This “inconsistency" of the encoder affects the quality of the learned representations and generalization. We propose a method to enforce consistency in vaes. The idea is simple and consists in maximizing the likelihood of the images while minimizing the Kullback-Leibler $\mathbf { \Pi } ( \kappa \mathbf { L } )$ divergence between the approximate posterior distribution induced by the encoder when conditioning on the image, on one hand, and its transformation, on the other hand. This regularization technique can be applied to any vae variant to improve the quality of the learned representations and boost generalization performance. We call a vae with this form of regularization, a consistency-regularized variational auto-encoder (cr-vae).
25
+
26
+ Figure 1 illustrates the inconsistency problem of vaes and how cr-vaes address this problem on mnist. The red dots are representations of a few images and the blue dots are the representations of their transformations. We applied semantics-preserving transformations: rotation, translation, and scaling. The vae maps each image and its transformation to different parts in the latent space as evidenced by the long arrows connecting each pair (a). Even when we include the transformed images to the data and fit the vae the inconsistency problem still occurs (b). The cr-vae does not suffer from the inconsistency problem; it maps each image and its transformation to nearby areas in the latent space, as evidenced by the short arrows connecting each pair (c).
27
+
28
+ In our experiments (see Section 4), we apply the proposed technique to four vae variants, the original vae (Kingma & Welling, 2013), the importance-weighted auto-encoder (iwae) (Burda et al., 2015), the $\beta$ -vae (Higgins et al., 2017), and the nouveau variational auto-encoder (nvae) (Vahdat & Kautz, 2020). We found, on four different benchmark datasets, that cr-vaes always yield better representations and generalize better than their base vaes. In particular, consistency-regularized nouveau variational auto-encoders (cr-nvaes) yield state-of-the-art performance on mnist and cifar-10. We also applied cr-vaes to 3D data where these conclusions still hold.
29
+
30
+ # 2 Method
31
+
32
+ We consider a latent-variable model $p _ { \boldsymbol { \theta } } ( \mathbf { x } , \mathbf { z } ) = p _ { \boldsymbol { \theta } } ( \mathbf { x } | \mathbf { z } ) \cdot p ( \mathbf { z } )$ , where $\mathbf { x }$ denotes an observation and $\mathbf { z }$ is its associated latent variable. The marginal $p ( \mathbf { z } )$ is a prior over the latent variable and $p _ { \boldsymbol { \theta } } ( \mathbf { x } | \mathbf { z } )$
33
+
34
+ is an exponential family distribution whose natural parameter is a function of $\mathbf { z }$ parameterized by $\theta$ , e.g. through a neural network. Our goal is to learn the parameters $\theta$ and a posterior distribution over the latent variables. The approach of vaes is to maximize the evidence lower bound (elbo), a lower bound on the log marginal likelihood of the data,
35
+
36
+ $$
37
+ \mathcal { L } _ { \mathrm { v A E } } = \mathtt { E L B O } = \mathbb { E } _ { q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } \left[ \log \left( \frac { p _ { \theta } ( \mathbf { x } , \mathbf { z } ) } { q _ { \phi } ( \mathbf { z } | \mathbf { x } ) } \right) \right]
38
+ $$
39
+
40
+ where $q _ { \phi } ( \mathbf { z } | \mathbf { x } )$ is an approximate posterior distribution over the latent variables. The idea of a vae is to let the parameters of the distribution $q _ { \phi } ( { \bf z } | { \bf x } )$ be given by the output of a neural network, with parameters $\phi$ , that takes $\mathbf { x }$ as input. The parameters $\theta$ and $\phi$ are then jointly optimized by maximizing a Monte Carlo approximation of the elbo using the reparameterization trick (Kingma & Welling, 2013).
41
+
42
+ Consider a semantics-preserving transformation $t ( \tilde { \mathbf { x } } | \mathbf { x } )$ of data $\mathbf { x }$ (e.g. rotation or translation for images.) A good representation learning algorithm should provide similar latent representations for $\mathbf { x }$ and $\tilde { \mathbf { x } }$ . This is not the case for the vae that maximizes Equation 1 and its variants. Once fit to data, the encoder of a vae is unable to yield similar latent representations for a data $\mathbf { x }$ and its tranformation x˜ (see Figure 1). This is because there is nothing in Equation 1 that forces this desideratum.
43
+
44
+ We now propose a regularization method that ensures consistency of the encoder of a vae. We call a vae with such a regularization a cr-vae. The regularization proposed is applicable to many variants of the vae such as the iwae (Burda et al., 2015), the $\beta$ -vae (Higgins et al., 2017), and the nvae (Vahdat & Kautz, 2020). In what follows, we use the standard vae, the one that maximizes Equation 1, as the base vae to regularize to illustrate the method.
45
+
46
+ Consider an image $\mathbf { x }$ . Denote by $t ( \tilde { \mathbf { x } } | \mathbf { x } )$ the random process by which we generate $\tilde { \mathbf { x } }$ , a semanticspreserving transformation of $\mathbf { x }$ . We draw $\tilde { \mathbf { x } }$ from $t ( \tilde { \mathbf { x } } | \mathbf { x } )$ as follows:
47
+
48
+ $$
49
+ \begin{array} { r } { \tilde { { \mathbf { x } } } \sim t ( \tilde { { \mathbf { x } } } | { \mathbf { x } } ) \iff \epsilon \sim p ( \epsilon ) \mathrm { a n d } \tilde { { \mathbf { x } } } = g ( { \mathbf { x } } , \epsilon ) . } \end{array}
50
+ $$
51
+
52
+ Here $g ( \mathbf { x } , \epsilon )$ is a semantics-preserving transformation of the image $\mathbf { x }$ , e.g. translation with random length $\epsilon$ drawn from $\boldsymbol { p } ( \boldsymbol { \epsilon } ) = \mathbf { \bar { \mathcal { U } } } [ - \delta , \delta ]$ for some threshold $\delta$ . A cr-vae then maximizes
53
+
54
+ $$
55
+ \mathcal { L } _ { \mathtt { C R - V A E } } ( \mathbf { x } ) = \mathcal { L } _ { \mathtt { V A E } } ( \mathbf { x } ) + \mathbb { E } _ { t ( \tilde { \mathbf { x } } | \mathbf { x } ) } \left[ \mathcal { L } _ { \mathtt { V A E } } ( \tilde { \mathbf { x } } ) \right] - \lambda \cdot \mathcal { R } ( \mathbf { x } , \phi )
56
+ $$
57
+
58
+ where the regularization term $\mathcal { R } ( \mathbf { x } , \phi )$ is
59
+
60
+ $$
61
+ \begin{array} { r } { \mathcal { R } ( \mathbf { x } , \phi ) = \mathbb { E } _ { t ( \tilde { \mathbf { x } } | \mathbf { x } ) } \left[ \mathrm { K L } \left( q _ { \phi } ( \mathbf { z } | \tilde { \mathbf { x } } ) | | q _ { \phi } ( \mathbf { z } | \mathbf { x } ) \right) \right] . } \end{array}
62
+ $$
63
+
64
+ Maximizing the objective in Equation 3 maximizes the likelihood of the data and their augmentations while enforcing consistency through $\mathcal { R } ( \mathbf { x } , \phi )$ . Minimizing $\mathcal { R } ( \mathbf { x } , \phi )$ , which only affects the encoder (with parameters $\phi$ ), forces each observation and the corresponding augmentations to lie close to each other in the latent space. The hyperparameter $\lambda \geq 0$ controls the strength of this constraint.
65
+
66
+ The objective in Equation 3 is intractable but we can easily approximate it using Monte Carlo with the reparameterization trick. In particular, we approximate the regularization term with one sample from $t ( \tilde { \mathbf { x } } | \mathbf { x } )$ and make the dependence to this sample explicit using the notation $\mathcal { R } ( \mathbf { x } , \tilde { \mathbf { x } } , \phi )$ . Algorithm 1 illustrates this in greater detail. Although we show the application of consistency regularization using the vae that maximizes the elbo, $\mathcal { L } _ { \mathrm { v _ { A E } } } ( \cdot )$ in Equation 3 can be replaced with any vae objective.
67
+
68
+ # 3 Related Work
69
+
70
+ Applying consistency regularization to vaes, as we do in this paper, has not been previously explored. Consistency regularization is a widely used technique for semi-supervised learning (Bachman et al., 2014; Sajjadi et al., 2016; Laine & Aila, 2016; Miyato et al., 2018; Xie et al., 2019). The core idea behind consistency regularization for semi-supervised learning is to force classifiers to learn representations that are insensitive to semantics-preserving changes to images, so as to improve classification of unlabeled images. Examples of semantics-preserving changes used in the literature include rotation, zoom, translation, crop, or adversarial attacks. Consistency is often enforced by minimizing the $\mathbb { L } _ { 2 }$ distance between a classifier’s logit output for an image and the logit output for its semantics-preserving transformation (Sajjadi et al., 2016; Laine & Aila, 2016), or by minimizing the kl divergence between the classifier’s label distribution induced by the image and that of its tranformation (Miyato et al., 2018; Xie et al., 2019).
71
+
72
+ <table><tr><td>input :Data X,consistency regularization strength 入,latent space dimensionality K Initialize parameters 0,$ foriterationt=1,2,...do for n=1,...,Bdo Transform the data: ∈n ~ p(∈n) and xn = T(xn,∈n) Get variational mean and variance for the data: μn = WTNN(xn; Φ) + a and σn = softplus(QTNN(xn; Φ) + b) Get S samples from the variational distribution when conditioning on Xn: η(s) ~ N(0,I) and Z) )= μn+n(s).σn for s=1,...,S Get variational mean and variance for the transformed data:</td></tr></table>
73
+
74
+ More recently, consistency regularization has been applied to generative adversarial networks (gans) (Goodfellow et al., 2014). Indeed Wei et al. (2018) and Zhang et al. (2020) show that applying consistency regularization on the discriminator of a gan—also a classifier—can substantially improve its performance.
75
+
76
+ The idea we develop in this paper differs from the works above in two ways. First, it applies consistency regularization to vaes for image data. Second, it leverages consistency regularization, not in the label or logit space, as done in the works mentioned above, but in the latent space.
77
+
78
+ Although different, consistency regularization for vaes relates to works that study ways to constrain the sensitivity of encoders to various perturbations. For example, denoising auto-encoders (daes) and their variants (Vincent et al., 2008, 2010) corrupt an image $\mathbf { x }$ into $\mathbf { x } ^ { \prime }$ , typically using Gaussian noise, and then minimize the distance between the reconstruction of $\mathbf { x } ^ { \prime }$ and the un-corrupted image x. The motivation is to learn representations that are insensitive to the added noise. Our work differs in that we do not constrain the decoder to recover the original image from the corrupted image but, rather, to constrain the encoder to recover the latent representation of the original image from the corrupted image via a kl divergence minimization constraint.
79
+
80
+ Contractive auto-encoders (caes) (Rifai et al., 2011) share a similar goal with cr-vaes. A cae is an auto-encoder whose encoder is constrained by minimizing the norm of the Jacobian of the output of the encoder with respect to the input image. This norm constraint on the Jacobian forces the representations learned by the encoder to be insensitive to changes in the input. Our work differs in several main ways. First, cr-vaes are not deterministic auto-encoders, contrary to caes. We can easily sample from a cr-vae, as for any vae, which is not the case for a cae. Second, a cae does not apply transformations to the input image, which limits the sensitivities it can learn to limit to those exhibited in the training set. Finally, caes use the Jacobian to impose a consistency constraint, which are not as easy to compute as the kl divergence we use on the variational distribution induced by the encoder.
81
+
82
+ Table 1: cr-vaes learn better representations than their base vaes on all three benchmark datasets. Although fitting the base vae with augmentations does improve the representations, adding the consistency regularization further improves the quality of these learned representations. The value of $\beta$ for the $\beta$ -vae is inside the parentheses.
83
+
84
+ <table><tr><td rowspan="2">Method</td><td colspan="2">MNIST</td><td colspan="2">OMNIGLOT</td><td colspan="2">CELEBA</td></tr><tr><td>MI</td><td>AU</td><td>MI</td><td>AU</td><td>MI</td><td>AU</td></tr><tr><td>VAE</td><td>124.5 ±1.1</td><td>36±0.8</td><td>105.4±1.2</td><td>50±0.0</td><td>33.8±0.2</td><td>32±0.9</td></tr><tr><td>VAE + Aug</td><td>125.9 ± 0.2</td><td>42 ± 0.5</td><td>105.9 ± 0.7</td><td>50 ±0.0</td><td>34.1± 0.8</td><td>33 ± 0.9</td></tr><tr><td>CR-VAE</td><td>126.3 ± 0.9</td><td>47 ± 0.5</td><td>107.8 ± 1.1</td><td>50±0.0</td><td>34.9 ± 0.5</td><td>33 ±1.2</td></tr><tr><td>IWAE</td><td>127.1 ± 0.7</td><td>39±0.5</td><td>110.3±1.1</td><td>50±0.0</td><td>36.9± 0.5</td><td>36 ±1.6</td></tr><tr><td>IWAE+Aug</td><td>129.0 ± 0.9</td><td>45±0.8</td><td>112.9 ± 0.7</td><td>50 ±0.0</td><td>37.0± 0.2</td><td>36 ± 1.2</td></tr><tr><td>CR-IWAE</td><td>129.7 ± 1.0</td><td>50 ± 0.0</td><td>115.3 ± 0.8</td><td>50±0.0</td><td>38.4 ± 0.5</td><td>36 ± 1.9</td></tr><tr><td>β-VAE (0.5)</td><td>284.3± 1.1</td><td>50±0.0</td><td>143.4 ± 1.0</td><td>50±0.0</td><td>75.8 ± 0.5</td><td>49± 0.5</td></tr><tr><td>β-VAE (0.5) + Aug</td><td>289.3 ± 1.0</td><td>50±0.0</td><td>159.6 ± 1.3</td><td>50±0.0</td><td>75.7 ± 0.3</td><td>49±0.0</td></tr><tr><td>β-CR-VAE (0.5)</td><td>291.9 ± 0.7</td><td>50±0.0</td><td>169.5 ± 0.5</td><td>50±0.0</td><td>77.1 ± 0.1</td><td>50 ± 0.0</td></tr><tr><td>β-VAE (10)</td><td>6.3± 0.6</td><td>8±1.7</td><td>1.4 ± 0.2</td><td>4±0.9</td><td>3.6± 0.3</td><td>7±0.8</td></tr><tr><td>β-VAE (10) + Aug</td><td>6.5 ± 0.5</td><td>9±1.1</td><td>1.6 ± 0.2</td><td>4±0.5</td><td>3.7 ± 0.1</td><td>7±0.0</td></tr><tr><td>β-CR-VAE (10)</td><td>6.9 ± 0.6</td><td>10 ± 0.5</td><td>1.6 ± 0.1</td><td>4± 0.5</td><td>3.7 ± 0.4</td><td>9 ± 0.9</td></tr></table>
85
+
86
+ # 4 Empirical Study
87
+
88
+ In this section we show that a cr-vae improves the learned representations of its base vae and positively affects generalization performance We also show that the proposed regularization method is amenable to different vae variants by applying it not only to the original vae but also to the iwae, the $\beta$ -vae, and the nvae. We showcase the importance of the KL regularization term by conducting an ablation study. We found that only regularizing with data augmentation improves performance but that accounting for the kl term $\lambda > 0$ ) further improves the quality of the learned representations and generalization.
89
+
90
+ We will conduct three sets of experiments. In the first experiment, we will apply the regularization method proposed in this paper to standard vaes such as the original vae, the iwae, and the $\beta$ -vae. We use mnist, omniglot, and celeba as datasets for this experiment. For celeba, we choose the $3 2 \mathrm { x 3 2 }$ resolution for this experiment. Our results show that adding consistency regularization always improves upon the base vae, both in terms of the quality of the learned representations and generalization. We conduct an ablation study and also report performance of the different vae variants above when they are fitted with the original data and their augmentations. The results from this ablation highlight the importance of setting $\lambda > 0$ .
91
+
92
+ In the second set of experiments we apply our method to a large-scale vae, the latest nvae (Vahdat & Kautz, 2020). We use mnist, cifar-10, and celeba as datasets for this experiment. We increased the resolution for the celeba dataset for this experiment to $6 4 \mathrm { x 6 4 }$ . We reach the same conclusions as for the first sets of experiments; cr-vaes improve the learned representations and generalization of their base vaes. In this particular setting, the cr-nvae achieves state-of-the-art generalization performance on both mnist and cifar-10. This state-of-the-art performance couldn’t be reach simply by training the nvae with augmentations, as our results show.
93
+
94
+ Finally, in a third set of experiments, we apply our regularization technique to a 3D point-cloud dataset called ShapeNet (Chang et al., 2015). We adapt a high-performing auto-encoding method called FoldingNet (Yang et al., 2018) to its vae counterpart and apply the method we described in this paper to that vae variant on the ShapeNet dataset. We found that adding consistency regularization yields better learned representations.
95
+
96
+ We next describe in great detail the set up for each of these experiments and the results showcasing the usefulness of the regularization method we propose in this paper.
97
+
98
+ Table 2: cr-vaes learn representations that yield higher accuracy on downstream classification than their base vaes. These results correspond to the accuracy from a linear classifier that was fitted on the training. We fed this classifier with the representations learned by each method. On both mnist and cifar-10, cr-vaes yield higher accuracy.
99
+
100
+ <table><tr><td>Method</td><td>MNIST</td><td>CIFAR-10</td></tr><tr><td>VAE</td><td>98.5</td><td>32.6</td></tr><tr><td>VAE+Aug</td><td>98.9</td><td>40.1</td></tr><tr><td>CR-VAE</td><td>99.4</td><td>44.7</td></tr><tr><td>IWAE</td><td>98.6</td><td>35.8</td></tr><tr><td>IWAE+Aug</td><td>99.9</td><td>37.1</td></tr><tr><td>CR-IWAE</td><td>99.9</td><td>44.8</td></tr><tr><td>β- VAE (0.5)</td><td>97.6</td><td>27.0</td></tr><tr><td>β- VAE (0.5)+Aug</td><td>98.7</td><td>27.6</td></tr><tr><td>β- CR-VAE (0.5)</td><td>98.9</td><td>30.0</td></tr><tr><td>β- VAE (10)</td><td>99.4</td><td>36.5</td></tr><tr><td>β- VAE (10)+Aug</td><td>99.6</td><td>42.1</td></tr><tr><td>β- CR-VAE (10)</td><td>99.6</td><td>46.1</td></tr></table>
101
+
102
+ Table 3: cr-vaes generalize better than their base vaes on almost all cases; they achieve lower negative log-likelihoods. Although training the base vaes with the augmented data improves generalization, adding the consistency regularization term further improves generalization performance.
103
+
104
+ <table><tr><td>Method</td><td>MNIST</td><td>OMNIGLOT</td><td>CELEBA</td></tr><tr><td>VAE</td><td>83.7 ± 0.3</td><td>128.2± 0.8</td><td>66.1±0.2</td></tr><tr><td>VAE + Aug</td><td>82.8 ±0.4</td><td>125.7 ± 0.2</td><td>66.0± 0.2</td></tr><tr><td>CR-VAE</td><td>81.2 ± 0.2</td><td>124.1 ± 0.1</td><td>65.9 ± 0.2</td></tr><tr><td>IWAE</td><td>81.7± 0.3</td><td>127.5 ± 0.5</td><td>65.3 ± 0.1</td></tr><tr><td>IWAE+Aug</td><td>80.4± 0.2</td><td>125.0 ± 0.6</td><td>65.3 ± 0.1</td></tr><tr><td>CR-IWAE</td><td>79.7 ± 0.3</td><td>123.6 ± 0.5</td><td>65.0 ± 0.2</td></tr><tr><td>β-VAE (0.5)</td><td>92.6±0.3</td><td>137.1 ± 0.2</td><td>68.7±0.2</td></tr><tr><td>β-VAE (0.5) + Aug</td><td>90.0 ± 0.5</td><td>134.6 ± 0.5</td><td>68.8 ± 0.2</td></tr><tr><td>β-CR-VAE (0.5)</td><td>85.7 ± 0.6</td><td>132.5 ± 0.3</td><td>68.2 ± 0.1</td></tr><tr><td>β-VAE (10)</td><td>126.1 ± 1.8</td><td>157.5 ± 1.1</td><td>92.7± 0.5</td></tr><tr><td>β-VAE (10) + Aug</td><td>127.1 ± 1.0</td><td>157.3 ± 0.5</td><td>92.7 ± 0.3</td></tr><tr><td>β-CR-VAE (10)</td><td>126.2 ± 0.5</td><td>157.6 ± 0.6</td><td>92.6 ± 0.1</td></tr></table>
105
+
106
+ # 4.1 Application to standard vaes on benchmark datasets
107
+
108
+ We apply consistency regularization, as described in this paper, to the original vae, the iwae, and the $\beta$ -vae. We now describe the set up and results for this experiment.
109
+
110
+ Datasets. We study three benchmark datasets that we briefly describe below. We first consider mnist. mnist is a handwritten digit recognition dataset with 60, 000 images in the training set and 10, 000 images in the test set (LeCun, 1998). We form a validation set of 10, 000 images randomly sampled from the training set.
111
+
112
+ We also consider omniglot, a handwritten alphabet recognition dataset (Lake et al., 2011). This dataset is composed of 19, 280 images. We use 16, 280 randomly sampled images for training and 1, 000 for validation and the remaining 2, 000 samples for testing.
113
+
114
+ Finally we consider celeba. It is a dataset of faces, consisting of 162, 770 images for training, 19, 867 images for validation, and 19, 962 images for testing (Liu et al., 2018). We set the resolution to $3 2 \mathrm { x 3 2 }$ for this experiment.
115
+
116
+ Transformations $t ( \tilde { \mathbf { x } } | \mathbf { x } )$ . We consider three transformations variants for image data $t ( \tilde { \mathbf { x } } | \mathbf { x } )$ . The first randomly translates an image $[ - 2 , 2 ]$ pixels in any direction. The second transformation randomly rotates an image uniformly in $[ - 1 5 , 1 5 ]$ degrees clockwise. Finally the third transformation randomly scales an image by a factor uniformly sampled from [0.9, 1.1].
117
+
118
+ Table 4: The regularization term $\lambda$ affects both generalization performance and the quality of the learned representations. Many values of $\lambda$ perform better than the base vae. However a large enough value of $\lambda$ , e.g. $\lambda = 1$ , can lead to worse performance than the base vae because for large values of $\lambda$ the regularization term takes over the data-term in the objective function.
119
+
120
+ <table><tr><td></td><td>入</td><td>MI</td><td>AU</td><td>NLL</td></tr><tr><td>VAE</td><td>11</td><td>124.5</td><td>36</td><td>83.7</td></tr><tr><td>CR-VAE</td><td>0.001</td><td>125.0</td><td>38</td><td>83.5</td></tr><tr><td>CR-VAE</td><td>0.01</td><td>125.9</td><td>41</td><td>82.4</td></tr><tr><td>CR-VAE</td><td>0.1</td><td>126.3</td><td>47</td><td>81.2</td></tr><tr><td>CR-VAE</td><td>1</td><td>124.3</td><td>47</td><td>83.9</td></tr></table>
121
+
122
+ Table 5: The choice of augmentation affects both generalization performance and the quality of the learned representations. Jointly using all augmentations works best.
123
+
124
+ <table><tr><td>Augmentation</td><td>MI</td><td>AU</td><td>NLL</td></tr><tr><td>Rotations only</td><td>125.8</td><td>45</td><td>82.1</td></tr><tr><td>Translations only</td><td>126.1</td><td>45</td><td>81.9</td></tr><tr><td>Scaling only</td><td>125.1</td><td>42</td><td>82.7</td></tr><tr><td>All</td><td>126.3</td><td>47</td><td>81.2</td></tr></table>
125
+
126
+ Evaluation metrics. The regularization method we propose in this paper is mainly aimed at improving the learned representations of vaes. To assess these representations we use three metrics: mutual information, number of active latent units, and accuracy on a downstream classification task. We also evaluate the effect of the proposed method on generalization to unseen data. For that we also report negative log-likelihood. We define each of these metrics next.
127
+
128
+ Mutual information $( M I )$ . The first quality metric is the mutual information $I ( \mathbf { z } ; \mathbf { x } )$ between the observations and the latents under the joint distribution induced by the encoder,
129
+
130
+ $$
131
+ I ( \mathbf { z } ; \mathbf { x } ) = \mathbb { E } _ { p _ { d } ( \mathbf { x } ) } \left[ K L ( q _ { \phi } ( \mathbf { z } | \mathbf { x } ) | | p ( \mathbf { z } ) ) - \kappa \mathbf { L } ( q _ { \phi } ( \mathbf { z } ) | | p ( \mathbf { z } ) ) \right]
132
+ $$
133
+
134
+ where $p _ { d } ( \mathbf { x } )$ is the empirical data distribution and $q _ { \phi } ( \mathbf { z } )$ is the aggregated posterior, the marginal over $\mathbf { z }$ induced by the joint distribution defined by $p _ { d } ( \mathbf { x } )$ and $q _ { \phi } ( { \bf z } | { \bf x } )$ . The mutual information is intractable but we can approximate it with Monte Carlo. Higher mutual information corresponds to more interpretable latent variables.
135
+
136
+ Number of active latent units $( A U )$ . The second quality metrics we consider is the number of active latent units (AU). It is defined in Burda et al. (2015) and measures the “activity" of a dimension of the latent variables $\mathbf { z }$ . A latent dimension is “active" if
137
+
138
+ $$
139
+ C o v _ { \mathbf { x } } ( \mathbb { E } _ { \mathbf { u } \sim q _ { \phi } ( \mathbf { u } | \mathbf { x } ) } ) > \delta
140
+ $$
141
+
142
+ where $\delta$ is a threshold defined by the user. For our experiments we set $\delta = 0 . 0 1$ . The higher the number of latent active units, the better the learned representations.
143
+
144
+ Accuracy on downstream classification. This metric is calculated by fitting a given vae, taking the learned representations for each data in the test set and computing the accuracy from the prediction of the labels of the images in that same test set by a classifier fitted on the training set. This metric is only applicable to labelled datasets.
145
+
146
+ Negative log-likelihood. We use negative held-out log-likelihood to assess generalization. Consider an unseen data $\mathbf { x } ^ { * }$ , its negative held-out log-likelihood under the fitted model is
147
+
148
+ $$
149
+ \log p _ { \boldsymbol \theta } ( \mathbf { x } ^ { * } ) = - \log \left( \mathbb { E } _ { q _ { \boldsymbol \phi } ( \mathbf { z } | \mathbf { x } ^ { * } ) } \left[ \frac { p _ { \boldsymbol \theta } ( \mathbf { x } ^ { * } , \mathbf { z } ) } { q _ { \boldsymbol \phi } ( \mathbf { z } | \mathbf { x } ^ { * } ) } \right] \right) .
150
+ $$
151
+
152
+ Table 6: The cr-vae outperforms a popular and advanced contrastive learning technique called triplet loss on both generalization performance and quality of learned representations.
153
+
154
+ <table><tr><td>Method</td><td>MI</td><td>AU</td><td>NLL</td></tr><tr><td>VAE</td><td>124.5</td><td>36</td><td>83.7</td></tr><tr><td>VAE + augmentations</td><td>125.9</td><td>42</td><td>82.8</td></tr><tr><td>VAE + triplet loss</td><td>124.9</td><td>39</td><td>83.1</td></tr><tr><td>CR-VAE</td><td>126.3</td><td>47</td><td>81.2</td></tr></table>
155
+
156
+ This is intractable and we approximate it using Monte Carlo,
157
+
158
+ $$
159
+ \log p _ { \theta } ( \mathbf { x } ^ { * } ) \approx - \log \frac { 1 } { S } \sum _ { s = 1 } ^ { S } \frac { p _ { \theta } ( \mathbf { x } ^ { * } , \mathbf { z } ^ { ( s ) } ) } { q _ { \phi } ( \mathbf { z } ^ { ( s ) } | \mathbf { x } ^ { * } ) }
160
+ $$
161
+
162
+ where $\mathbf { z } ^ { ( 1 ) } , \ldots , \mathbf { z } ^ { ( S ) } \sim q _ { \phi } ( \mathbf { z } | \mathbf { x } ^ { * } )$
163
+
164
+ Settings. The vaes are built on the same architecture as Tolstikhin et al. (2017). The networks are trained with the Adam optimizer with a learning rate of $1 0 ^ { - 4 }$ (Kingma & Ba, 2014) and trained for 100 epochs with a batch size of 64. We set the dimensionality of the latent variables to 50, therefore the maximum number of active latent units in the latent space is 50. We found $\lambda = 0 . 1$ to be best according to cross-validation using held-out log-likelihood and exploring the range $[ 1 e ^ { - 4 } , 1 . 0 ]$ datasets. In an ablation study we explore $\lambda = 0$ . For the $\beta$ -vae we set $\lambda = 0 . 1 \cdot \beta$ and study both $\beta = 0 . 1$ and $\beta = 1 0$ , two regimes under which the $\beta$ -vae performs qualitatively very differently (Higgins et al., 2017). All experiments were done on a GPU cluster consisting of Nvidia P100 and RTX. The training took approximately 1 day for most experiments.
165
+
166
+ Results. Table 1 shows that on all the three benchmark datasets all the different vae variants we studied, consistency regularization as developed in this paper always improves the quality of the learned representations as measured by mutual information and the number of active latent units. These results are confirmed by the numbers shown in Table 2 where cr-vaes always lead to better accuracy on downstream classification.
167
+
168
+ We proposed consistency regularization as a way to improve the quality of the learned representations. Incidentally, Table 3 also shows that it can improve generalization as measured by negative loglikelihood.
169
+
170
+ Ablation Study. We now look at the impact of each factor that goes into the regularization method we introduced in this paper using mnist. We test the impact of the regularization term $\lambda$ and the impact of the choice of augmentation on all metrics. Table 4 and Table 5 show the results.
171
+
172
+ Table 4 shows that even small consistency regularization (a small $\lambda$ value) results in improvement over the base vae but that a large enough $\lambda$ value can hurt performance.
173
+
174
+ Table 5 shows that rotations and translations are more important than scaling, but the combination of all three augmentations works best for cr-vaes.
175
+
176
+ Comparison to Contrastive Learning. We look at how cr-vaes compare against a popular and advanced contrastive-learning-based technique, the triplet loss (Schroff et al., 2015) using mnist. Table 6 shows that the cr-vae outperforms the triplet loss on both generalization performance and quality of learned representations. Table 6 also confirms existing literature showing simply applying augmentations can outperform complex contrastive learning-based methods such as the triplet loss (Kostrikov et al., 2020; Sinha & Garg, 2021).
177
+
178
+ # 4.2 Application to the large-scale nvae on benchmark datasets
179
+
180
+ Along with standard VAE variants, we also experiment with a large scale state-of-the-art vae, the nvae(Vahdat & Kautz, 2020). Similar to before, we simply add consistency regularization using the image-based augmentations techniques to the NVAE model and experiment on benchmark datasets: mnist (LeCun, 1998), cifar-10 (Krizhevsky et al., 2009) and celeba (Liu et al., 2018).
181
+
182
+ The results for large scale generative modeling are tabulated in Table 8 and Table 7, where we see that using cr-nvae we are able to learn representations that yield better accuracy on downstream classification and set new state-of-the-art values on each of the datasets, improving upon the baseline log-likelihood values. This shows the ability of consistency regularization to work at scale on challenging generative modeling tasks.
183
+
184
+ Table 7: The cr-nvaes learns better representations than the base nvae as measured by accuracy on a downstream classification on both mnist and cifar-10. We get to this same conclusion when looking at the number of active units as an indicator for the quality of the learned latent representations; cr-nvae recovers 226 units whereas nvae recovers 211 units.
185
+
186
+ <table><tr><td>Method</td><td>MNIST</td><td>CIFAR-10</td></tr><tr><td>NVAE</td><td>99.9</td><td>57.9</td></tr><tr><td>NVAE+Aug</td><td>99.9</td><td>66.4</td></tr><tr><td>CR-NVAE</td><td>99.9</td><td>71.4</td></tr></table>
187
+
188
+ Table 8: Large-scale experiments with nvaes with and without consistency-regularization on 3 benchmark datasets: dynamically binarized mnist, cifar-10 and celeba. We report generalization using negative log-likelihood on mnist and bits per dim on cifar-10 and celeba. On all datasets consistency regularization improves generalization performance. In particular cr-nvae achieves state-of-the-art performance on mnist and cifar-10.
189
+
190
+ <table><tr><td></td><td>MNIST (28 × 28)</td><td>CIFAR-10 (32 × 32)</td><td>CELEBA (64 × 64)</td></tr><tr><td>NVAE</td><td>78.19</td><td>2.91</td><td>2.03</td></tr><tr><td>NVAE+Aug</td><td>77.53</td><td>2.70</td><td>1.96</td></tr><tr><td>CR-NVAE</td><td>76.93</td><td>2.51</td><td>1.86</td></tr></table>
191
+
192
+ ![](images/013be7f0e1e75e1072aef4213dc3071a40eed8f53d36cb5a52a75b32e6cdd895.jpg)
193
+ Figure 2: Interpolation between two samples of a lamp, airplane and table using a trained CRFoldingNet trained on the ShapeNet dataset. The CR-FoldingNet is able to learn an interpretable latent space.
194
+
195
+ # 4.3 Application to the FoldingNet on 3D point-cloud data
196
+
197
+ Along with working with image data, we additionally experiment with 3D point cloud data using a FoldingNet Yang et al. (2018) and the ShapeNet dataset Chang et al. (2015) which consists of 55 distinct object classes. FoldingNet learns a deep AutoEncoder to learn unsupervised representations from the point cloud data. To add consistency regularization, we first substitute the AutoEncoder to a vae by adding the KL term from the ELBO to the baseline FoldingNet. We then add the additional consistency regularization KL term to the latent space of FoldingNet.
198
+
199
+ Table 9: The FoldingNet yields higher accuracy when paired with consistency regularization on the ShapeNet dataset. The results shown here correspond to a FoldingNet that was trained with augmented data, the same used to apply consistency regularization. As can be seen from these results, enforcing consistency through KL as we do in this paper leads to representations that perform well on a downstream classification. Here the classifier used is a linear SVM. We also report mean reconstruction error through Chamfer distance where the same conclusion holds.
200
+
201
+ <table><tr><td>Method</td><td>Accuracy</td><td>Reconstruction Loss</td></tr><tr><td>Folding Net (Aug)</td><td>82.5%</td><td>0.0355</td></tr><tr><td>CR-Folding Net</td><td>84.6%</td><td>0.0327</td></tr></table>
202
+
203
+ For the ShapeNet point cloud data, we perform data augmentation using a similar scheme to what we did for the previous experiments, we randomly translate, rotate and add jitter to the $( x , y , z )$ coordinates of the point cloud data. We follow the same scheme detailed in FoldingNet (Yang et al., 2018).
204
+
205
+ We train both the FoldingNet turned in a vae and the CR-FoldingNet with these augmentations. To train CR-FoldingNet, we additionally apply the consistency regularization term as proposed in Equation 3. The results on the validation set for reconstruction (as measured by Chamfer distance) and accuracy are shown in Table 9.
206
+
207
+ We also visualize the point clouds reconstructions and interpolations between 3 different object classes using a CR-FoldingNet in Figure 2. We perform 4 interpolation steps for each of the objects, to highlight the interpretable learned latent space. Additionally, we perform the same interpolation on the baseline FoldingNet model. We show these interpolations in the appendix.
208
+
209
+ # 5 Conclusion
210
+
211
+ We proposed a simple regularization technique to constrain encoders of vaes to learn similar latent representations for an image and a semantics-preserving transformation of the image. The idea consists in maximizing the likelihood of the pair of images while minimizing the kl divergence between the variational distribution induced by the encoder when conditioning on the image on one hand, and its transformation, on the other hand. We applied this technique to several vae variants on several datasets, including a 3D dataset. We found it always leads to better learned representations and also better generalization to unseen data. In particular, when applied to the nvae, the regularization technique we developed in this paper yields state-of-the-art results on mnist and cifar-10.
212
+
213
+ # Broader Impact
214
+
215
+ In this paper, we propose a simple method that performs a KL-based consistency regularization scheme using data augmentation for vaes. The broader impact of the study includes practical applications such as graphics and computer vision applications. The method we propose improves the learned representations of vaes, and as an artifact, also improves their generalization to unseen data. In this regard, any implications of vaes also apply to this work. For example, the generative model fit by a vae may be used to generate artificial data such as images, text, and 3D objects. Biases may arise as a result of poor data selection. Furthermore, text generated from generative systems may amplify harmful speech contained in the data. However, the method we propose can also improve the performance of vaes when used in certain practical domains as we discussed in the introduction of the paper.
216
+
217
+ # 6 Acknowledgements
218
+
219
+ We thank Kevin Murphy, Ben Poole, and Augustus Odena for their comments on this work.
220
+
221
+ # References
222
+
223
+ Achille, A., Eccles, T., Matthey, L., Burgess, C. P., Watters, N., Lerchner, A., and Higgins, I. Life-long disentangled representation learning with cross-domain latent homologies. arXiv preprint arXiv:1808.06508, 2018.
224
+ An, J. and Cho, S. Variational autoencoder based anomaly detection using reconstruction probability. Special Lecture on IE, 2(1), 2015.
225
+ Bachman, P., Alsharif, O., and Precup, D. Learning with pseudo-ensembles. In Advances in neural information processing systems, pp. 3365–3373, 2014.
226
+ Bowman, S. R., Vilnis, L., Vinyals, O., Dai, A. M., Jozefowicz, R., and Bengio, S. Generating sentences from a continuous space. arXiv preprint arXiv:1511.06349, 2015.
227
+ Burda, Y., Grosse, R., and Salakhutdinov, R. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015.
228
+ Chang, A. X., Funkhouser, T., Guibas, L., Hanrahan, P., Huang, Q., Li, Z., Savarese, S., Savva, M., Song, S., Su, H., et al. Shapenet: An information-rich 3d model repository. arXiv preprint arXiv:1512.03012, 2015.
229
+ Dieng, A. B., Kim, Y., Rush, A. M., and Blei, D. M. Avoiding latent variable collapse with generative skip models. arXiv preprint arXiv:1807.04863, 2018.
230
+ Dieng, A. B., Ruiz, F. J., and Blei, D. M. Topic modeling in embedding spaces. arXiv preprint arXiv:1907.04907, 2019.
231
+ Fang, L., Li, C., Gao, J., Dong, W., and Chen, C. Implicit deep latent variable models for text generation. arXiv preprint arXiv:1908.11527, 2019.
232
+ Fu, H., Li, C., Liu, X., Gao, J., Celikyilmaz, A., and Carin, L. Cyclical annealing schedule: A simple approach to mitigating kl vanishing. arXiv preprint arXiv:1903.10145, 2019.
233
+ Goodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680, 2014.
234
+ Gregor, K., Danihelka, I., Graves, A., Rezende, D. J., and Wierstra, D. Draw: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015.
235
+ Hadjeres, G., Nielsen, F., and Pachet, F. Glsr-vae: Geodesic latent space regularization for variational autoencoder architectures. In 2017 IEEE Symposium Series on Computational Intelligence (SSCI), pp. 1–7. IEEE, 2017.
236
+ He, J., Spokoyny, D., Neubig, G., and Berg-Kirkpatrick, T. Lagging inference networks and posterior collapse in variational autoencoders. arXiv preprint arXiv:1901.05534, 2019.
237
+ Higgins, I., Matthey, L., Pal, A., Burgess, C., Glorot, X., Botvinick, M., Mohamed, S., and Lerchner, A. beta-vae: Learning basic visual concepts with a constrained variational framework. Iclr, 2(5):6, 2017.
238
+ Jun, H., Child, R., Chen, M., Schulman, J., Ramesh, A., Radford, A., and Sutskever, I. Distribution augmentation for generative modeling. In International Conference on Machine Learning, pp. 5006–5019. PMLR, 2020.
239
+ Kim, Y., Wiseman, S., Miller, A. C., Sontag, D., and Rush, A. M. Semi-amortized variational autoencoders. arXiv preprint arXiv:1802.02550, 2018.
240
+ Kingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014.
241
+ Kingma, D. P. and Welling, M. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013.
242
+ Kingma, D. P., Rezende, D. J., Mohamed, S., and Welling, M. Semi-supervised learning with deep generative models. arXiv preprint arXiv:1406.5298, 2014.
243
+ Kostrikov, I., Yarats, D., and Fergus, R. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. arXiv preprint arXiv:2004.13649, 2020.
244
+ Krizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009.
245
+ Laine, S. and Aila, T. Temporal ensembling for semi-supervised learning. arXiv preprint arXiv:1610.02242, 2016.
246
+ Lake, B., Salakhutdinov, R., Gross, J., and Tenenbaum, J. One shot learning of simple visual concepts. In Proceedings of the annual meeting of the cognitive science society, volume 33, 2011.
247
+ LeCun, Y. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998.
248
+ Liang, D., Krishnan, R. G., Hoffman, M. D., and Jebara, T. Variational autoencoders for collaborative filtering. In Proceedings of the 2018 World Wide Web Conference, pp. 689–698, 2018.
249
+ Liu, Z., Luo, P., Wang, X., and Tang, X. Large-scale celebfaces attributes (celeba) dataset. Retrieved August, 15: 2018, 2018.
250
+ Miao, Y., Yu, L., and Blunsom, P. Neural variational inference for text processing. In International conference on machine learning, pp. 1727–1736, 2016.
251
+ Miyato, T., Maeda, S.-i., Ishii, S., and Koyama, M. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 2018.
252
+ Osada, G., Ahsan, B., Bora, R. P., and Nishide, T. Regularization with latent space virtual adversarial training. In European Conference on Computer Vision, pp. 565–581. Springer, 2020.
253
+ Rezende, D. J., Mohamed, S., and Wierstra, D. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014.
254
+ Rifai, S., Vincent, P., Muller, X., Glorot, X., and Bengio, Y. Contractive auto-encoders: Explicit invariance during feature extraction. 2011.
255
+ Roberts, A., Engel, J., Raffel, C., Hawthorne, C., and Eck, D. A hierarchical latent vector model for learning long-term structure in music. arXiv preprint arXiv:1803.05428, 2018.
256
+ Sajjadi, M., Javanmardi, M., and Tasdizen, T. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. In NeurIPS, 2016.
257
+ Schroff, F., Kalenichenko, D., and Philbin, J. Facenet: A unified embedding for face recognition and clustering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 815–823, 2015.
258
+ Sinha, S. and Garg, A. S4rl: Surprisingly simple self-supervision for offline reinforcement learning. arXiv preprint arXiv:2103.06326, 2021.
259
+ Sinha, S., Ebrahimi, S., and Darrell, T. Variational adversarial active learning. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5972–5981, 2019.
260
+ Tolstikhin, I., Bousquet, O., Gelly, S., and Schoelkopf, B. Wasserstein auto-encoders. arXiv preprint arXiv:1711.01558, 2017.
261
+ Vahdat, A. and Kautz, J. Nvae: A deep hierarchical variational autoencoder. arXiv preprint arXiv:2007.03898, 2020.
262
+ Vincent, P., Larochelle, H., Bengio, Y., and Manzagol, P.-A. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th international conference on Machine learning, pp. 1096–1103, 2008.
263
+ Vincent, P., Larochelle, H., Lajoie, I., Bengio, Y., and Manzagol, P.-A. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of machine learning research, 11(Dec):3371–3408, 2010.
264
+ Walker, J., Doersch, C., Gupta, A., and Hebert, M. An uncertain future: Forecasting from static images using variational autoencoders. In European Conference on Computer Vision, pp. 835–851. Springer, 2016.
265
+ Wei, X., Gong, B., Liu, Z., Lu, W., and Wang, L. Improving the improved training of wasserstein gans: A consistency term and its dual effect. arXiv preprint arXiv:1803.01541, 2018.
266
+ Xie, Q., Dai, Z., Hovy, E., Luong, M.-T., and Le, Q. V. Unsupervised data augmentation for consistency training. arXiv preprint arXiv:1904.12848, 2019.
267
+ Yang, Y., Feng, C., Shen, Y., and Tian, D. Foldingnet: Point cloud auto-encoder via deep grid deformation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 206–215, 2018.
268
+ Zhang, H., Zhang, Z., Odena, A., and Lee, H. Consistency regularization for generative adversarial networks. 2020.
269
+ Zimmerer, D., Kohl, S. A., Petersen, J., Isensee, F., and Maier-Hein, K. H. Context-encoding variational autoencoder for unsupervised anomaly detection. arXiv preprint arXiv:1812.05941, 2018.
parse/train/djbC2A4uTHP/djbC2A4uTHP_content_list.json ADDED
@@ -0,0 +1,1187 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "Consistency Regularization for Variational Auto-Encoders ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 312,
8
+ 123,
9
+ 683,
10
+ 171
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Samarth Sinha Vector Institute University of Toronto ",
17
+ "bbox": [
18
+ 295,
19
+ 222,
20
+ 437,
21
+ 263
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Adji B. Dieng \nGoogle Brain \nPrinceton University ",
28
+ "bbox": [
29
+ 565,
30
+ 222,
31
+ 702,
32
+ 263
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Abstract ",
39
+ "text_level": 1,
40
+ "bbox": [
41
+ 462,
42
+ 299,
43
+ 535,
44
+ 315
45
+ ],
46
+ "page_idx": 0
47
+ },
48
+ {
49
+ "type": "text",
50
+ "text": "Variational auto-encoders (vaes) are a powerful approach to unsupervised learning. They enable scalable approximate posterior inference in latent-variable models using variational inference (vi). A vae posits a variational family parameterized by a deep neural network—called an encoder—that takes data as input. This encoder is shared across all the observations, which amortizes the cost of inference. However the encoder of a vae has the undesirable property that it maps a given observation and a semantics-preserving transformation of it to different latent representations. This “inconsistency\" of the encoder lowers the quality of the learned representations, especially for downstream tasks, and also negatively affects generalization. In this paper, we propose a regularization method to enforce consistency in vaes. The idea is to minimize the Kullback-Leibler (kl) divergence between the variational distribution when conditioning on the observation and the variational distribution when conditioning on a random semantic-preserving transformation of this observation. This regularization is applicable to any vae. In our experiments we apply it to four different vae variants on several benchmark datasets and found it always improves the quality of the learned representations but also leads to better generalization. In particular, when applied to the nouveau variational auto-encoder (nvae), our regularization method yields state-of-the-art performance on mnist, cifar-10, and celeba. We also applied our method to 3D data and found it learns representations of superior quality as measured by accuracy on a downstream classification task. Finally, we show our method can even outperform the triplet loss, an advanced and popular contrastive learning-based method for representation learning. ",
51
+ "bbox": [
52
+ 232,
53
+ 325,
54
+ 766,
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
+ 645,
66
+ 312,
67
+ 661
68
+ ],
69
+ "page_idx": 0
70
+ },
71
+ {
72
+ "type": "text",
73
+ "text": "Variational auto-encoders (vaes) have significantly impacted research on unsupervised learning. They have been used in several areas, including density estimation (Kingma & Welling, 2013; Rezende et al., 2014), image generation (Gregor et al., 2015), text generation (Bowman et al., 2015; Fang et al., 2019), music generation (Roberts et al., 2018), topic modeling (Miao et al., 2016; Dieng et al., 2019), and recommendation systems (Liang et al., 2018). Vaes have also been used for different representation learning problems such as semi-supervised learning (Kingma et al., 2014), anomaly detection (An & Cho, 2015; Zimmerer et al., 2018), language modeling Bowman et al. (2015), active learning (Sinha et al., 2019), continual learning (Achille et al., 2018), and motion prediction of agents (Walker et al., 2016). This widespread application of vae representations makes it critical that we focus on improving them. ",
74
+ "bbox": [
75
+ 174,
76
+ 670,
77
+ 825,
78
+ 808
79
+ ],
80
+ "page_idx": 0
81
+ },
82
+ {
83
+ "type": "text",
84
+ "text": "vaes extend deterministic auto-encoders to probabilistic generative modeling. The encoder of a vae parameterizes an approximate posterior distribution over latent variables of a generative model. The encoder is shared between all observations, which amortizes the cost of posterior inference. Once fitted, the encoder of a vae can be used to obtain low-dimensional representations of data, (e.g. for downstream tasks.) The quality of these representations is therefore very important to a successful application of vaes. ",
85
+ "bbox": [
86
+ 174,
87
+ 816,
88
+ 825,
89
+ 871
90
+ ],
91
+ "page_idx": 0
92
+ },
93
+ {
94
+ "type": "image",
95
+ "img_path": "images/87da93feb9101d9471f5468dd3ffeb7e8e2ecfe35807360b6f865d0e977509dc.jpg",
96
+ "image_caption": [
97
+ "Figure 1: Illustration of the inconsistency problem in vaes and how cr-vaes address this problem. The red dots correspond to the representations of few images from mnist. The blue dots correspond to the representations of the transformed images. The transformations used here are rotations, translations, and scaling; they are semantics-preserving. The arrows connect the representations of any two pairs of an image and its transformation. The shorter the arrow, the better. (a): The vae maps the two sets of images to different areas in the latent space. (b): Even when trained with the original dataset augmented with the transformed images, the vae still maps the two sets of images to different parts in the latent space. (c): The cr-vae maps an image and its transformation to nearby areas in the latent space. "
98
+ ],
99
+ "image_footnote": [],
100
+ "bbox": [
101
+ 210,
102
+ 0,
103
+ 794,
104
+ 219
105
+ ],
106
+ "page_idx": 1
107
+ },
108
+ {
109
+ "type": "text",
110
+ "text": "",
111
+ "bbox": [
112
+ 176,
113
+ 385,
114
+ 821,
115
+ 412
116
+ ],
117
+ "page_idx": 1
118
+ },
119
+ {
120
+ "type": "text",
121
+ "text": "Researchers have looked at ways to improve the quality of the latent representations of vaes, often tackling the so-called latent variable collapse problem—in which the approximate posterior distribution induced by the encoder collapses to the prior over the latent variables (Bowman et al., 2015; Kim et al., 2018; Dieng et al., 2018; He et al., 2019; Fu et al., 2019). ",
122
+ "bbox": [
123
+ 174,
124
+ 420,
125
+ 825,
126
+ 476
127
+ ],
128
+ "page_idx": 1
129
+ },
130
+ {
131
+ "type": "text",
132
+ "text": "In this paper, we focus on a different problem pertaining to the latent representations of vaes for image data. Indeed, the encoder of a fitted vae tends to map an image and a semantics-preserving transformation of that image to different parts in the latent space. This “inconsistency\" of the encoder affects the quality of the learned representations and generalization. We propose a method to enforce consistency in vaes. The idea is simple and consists in maximizing the likelihood of the images while minimizing the Kullback-Leibler $\\mathbf { \\Pi } ( \\kappa \\mathbf { L } )$ divergence between the approximate posterior distribution induced by the encoder when conditioning on the image, on one hand, and its transformation, on the other hand. This regularization technique can be applied to any vae variant to improve the quality of the learned representations and boost generalization performance. We call a vae with this form of regularization, a consistency-regularized variational auto-encoder (cr-vae). ",
133
+ "bbox": [
134
+ 174,
135
+ 483,
136
+ 825,
137
+ 622
138
+ ],
139
+ "page_idx": 1
140
+ },
141
+ {
142
+ "type": "text",
143
+ "text": "Figure 1 illustrates the inconsistency problem of vaes and how cr-vaes address this problem on mnist. The red dots are representations of a few images and the blue dots are the representations of their transformations. We applied semantics-preserving transformations: rotation, translation, and scaling. The vae maps each image and its transformation to different parts in the latent space as evidenced by the long arrows connecting each pair (a). Even when we include the transformed images to the data and fit the vae the inconsistency problem still occurs (b). The cr-vae does not suffer from the inconsistency problem; it maps each image and its transformation to nearby areas in the latent space, as evidenced by the short arrows connecting each pair (c). ",
144
+ "bbox": [
145
+ 173,
146
+ 628,
147
+ 825,
148
+ 741
149
+ ],
150
+ "page_idx": 1
151
+ },
152
+ {
153
+ "type": "text",
154
+ "text": "In our experiments (see Section 4), we apply the proposed technique to four vae variants, the original vae (Kingma & Welling, 2013), the importance-weighted auto-encoder (iwae) (Burda et al., 2015), the $\\beta$ -vae (Higgins et al., 2017), and the nouveau variational auto-encoder (nvae) (Vahdat & Kautz, 2020). We found, on four different benchmark datasets, that cr-vaes always yield better representations and generalize better than their base vaes. In particular, consistency-regularized nouveau variational auto-encoders (cr-nvaes) yield state-of-the-art performance on mnist and cifar-10. We also applied cr-vaes to 3D data where these conclusions still hold. ",
155
+ "bbox": [
156
+ 174,
157
+ 747,
158
+ 825,
159
+ 844
160
+ ],
161
+ "page_idx": 1
162
+ },
163
+ {
164
+ "type": "text",
165
+ "text": "2 Method ",
166
+ "text_level": 1,
167
+ "bbox": [
168
+ 174,
169
+ 858,
170
+ 271,
171
+ 875
172
+ ],
173
+ "page_idx": 1
174
+ },
175
+ {
176
+ "type": "text",
177
+ "text": "We consider a latent-variable model $p _ { \\boldsymbol { \\theta } } ( \\mathbf { x } , \\mathbf { z } ) = p _ { \\boldsymbol { \\theta } } ( \\mathbf { x } | \\mathbf { z } ) \\cdot p ( \\mathbf { z } )$ , where $\\mathbf { x }$ denotes an observation and $\\mathbf { z }$ is its associated latent variable. The marginal $p ( \\mathbf { z } )$ is a prior over the latent variable and $p _ { \\boldsymbol { \\theta } } ( \\mathbf { x } | \\mathbf { z } )$ ",
178
+ "bbox": [
179
+ 174,
180
+ 882,
181
+ 823,
182
+ 911
183
+ ],
184
+ "page_idx": 1
185
+ },
186
+ {
187
+ "type": "text",
188
+ "text": "is an exponential family distribution whose natural parameter is a function of $\\mathbf { z }$ parameterized by $\\theta$ , e.g. through a neural network. Our goal is to learn the parameters $\\theta$ and a posterior distribution over the latent variables. The approach of vaes is to maximize the evidence lower bound (elbo), a lower bound on the log marginal likelihood of the data, ",
189
+ "bbox": [
190
+ 173,
191
+ 90,
192
+ 826,
193
+ 147
194
+ ],
195
+ "page_idx": 2
196
+ },
197
+ {
198
+ "type": "equation",
199
+ "img_path": "images/5d271458eb06f054cd1c9f6f42d7f9c933f577600e9497a10a7ddf4e3e3b6ade.jpg",
200
+ "text": "$$\n\\mathcal { L } _ { \\mathrm { v A E } } = \\mathtt { E L B O } = \\mathbb { E } _ { q _ { \\phi } ( \\mathbf { z } | \\mathbf { x } ) } \\left[ \\log \\left( \\frac { p _ { \\theta } ( \\mathbf { x } , \\mathbf { z } ) } { q _ { \\phi } ( \\mathbf { z } | \\mathbf { x } ) } \\right) \\right]\n$$",
201
+ "text_format": "latex",
202
+ "bbox": [
203
+ 352,
204
+ 154,
205
+ 645,
206
+ 189
207
+ ],
208
+ "page_idx": 2
209
+ },
210
+ {
211
+ "type": "text",
212
+ "text": "where $q _ { \\phi } ( \\mathbf { z } | \\mathbf { x } )$ is an approximate posterior distribution over the latent variables. The idea of a vae is to let the parameters of the distribution $q _ { \\phi } ( { \\bf z } | { \\bf x } )$ be given by the output of a neural network, with parameters $\\phi$ , that takes $\\mathbf { x }$ as input. The parameters $\\theta$ and $\\phi$ are then jointly optimized by maximizing a Monte Carlo approximation of the elbo using the reparameterization trick (Kingma & Welling, 2013). ",
213
+ "bbox": [
214
+ 174,
215
+ 195,
216
+ 825,
217
+ 266
218
+ ],
219
+ "page_idx": 2
220
+ },
221
+ {
222
+ "type": "text",
223
+ "text": "Consider a semantics-preserving transformation $t ( \\tilde { \\mathbf { x } } | \\mathbf { x } )$ of data $\\mathbf { x }$ (e.g. rotation or translation for images.) A good representation learning algorithm should provide similar latent representations for $\\mathbf { x }$ and $\\tilde { \\mathbf { x } }$ . This is not the case for the vae that maximizes Equation 1 and its variants. Once fit to data, the encoder of a vae is unable to yield similar latent representations for a data $\\mathbf { x }$ and its tranformation x˜ (see Figure 1). This is because there is nothing in Equation 1 that forces this desideratum. ",
224
+ "bbox": [
225
+ 173,
226
+ 272,
227
+ 825,
228
+ 343
229
+ ],
230
+ "page_idx": 2
231
+ },
232
+ {
233
+ "type": "text",
234
+ "text": "We now propose a regularization method that ensures consistency of the encoder of a vae. We call a vae with such a regularization a cr-vae. The regularization proposed is applicable to many variants of the vae such as the iwae (Burda et al., 2015), the $\\beta$ -vae (Higgins et al., 2017), and the nvae (Vahdat & Kautz, 2020). In what follows, we use the standard vae, the one that maximizes Equation 1, as the base vae to regularize to illustrate the method. ",
235
+ "bbox": [
236
+ 173,
237
+ 348,
238
+ 825,
239
+ 419
240
+ ],
241
+ "page_idx": 2
242
+ },
243
+ {
244
+ "type": "text",
245
+ "text": "Consider an image $\\mathbf { x }$ . Denote by $t ( \\tilde { \\mathbf { x } } | \\mathbf { x } )$ the random process by which we generate $\\tilde { \\mathbf { x } }$ , a semanticspreserving transformation of $\\mathbf { x }$ . We draw $\\tilde { \\mathbf { x } }$ from $t ( \\tilde { \\mathbf { x } } | \\mathbf { x } )$ as follows: ",
246
+ "bbox": [
247
+ 174,
248
+ 425,
249
+ 825,
250
+ 454
251
+ ],
252
+ "page_idx": 2
253
+ },
254
+ {
255
+ "type": "equation",
256
+ "img_path": "images/f03c44e8274f6944635a3eaf220484b2dffc981faaf10c88764078d41e3aee5f.jpg",
257
+ "text": "$$\n\\begin{array} { r } { \\tilde { { \\mathbf { x } } } \\sim t ( \\tilde { { \\mathbf { x } } } | { \\mathbf { x } } ) \\iff \\epsilon \\sim p ( \\epsilon ) \\mathrm { a n d } \\tilde { { \\mathbf { x } } } = g ( { \\mathbf { x } } , \\epsilon ) . } \\end{array}\n$$",
258
+ "text_format": "latex",
259
+ "bbox": [
260
+ 349,
261
+ 460,
262
+ 647,
263
+ 478
264
+ ],
265
+ "page_idx": 2
266
+ },
267
+ {
268
+ "type": "text",
269
+ "text": "Here $g ( \\mathbf { x } , \\epsilon )$ is a semantics-preserving transformation of the image $\\mathbf { x }$ , e.g. translation with random length $\\epsilon$ drawn from $\\boldsymbol { p } ( \\boldsymbol { \\epsilon } ) = \\mathbf { \\bar { \\mathcal { U } } } [ - \\delta , \\delta ]$ for some threshold $\\delta$ . A cr-vae then maximizes ",
270
+ "bbox": [
271
+ 173,
272
+ 486,
273
+ 825,
274
+ 513
275
+ ],
276
+ "page_idx": 2
277
+ },
278
+ {
279
+ "type": "equation",
280
+ "img_path": "images/232a0cf438bd8162ffcb009760e5764148e0ddb2944864d1ba174eb053dc3ab2.jpg",
281
+ "text": "$$\n\\mathcal { L } _ { \\mathtt { C R - V A E } } ( \\mathbf { x } ) = \\mathcal { L } _ { \\mathtt { V A E } } ( \\mathbf { x } ) + \\mathbb { E } _ { t ( \\tilde { \\mathbf { x } } | \\mathbf { x } ) } \\left[ \\mathcal { L } _ { \\mathtt { V A E } } ( \\tilde { \\mathbf { x } } ) \\right] - \\lambda \\cdot \\mathcal { R } ( \\mathbf { x } , \\phi )\n$$",
282
+ "text_format": "latex",
283
+ "bbox": [
284
+ 310,
285
+ 522,
286
+ 686,
287
+ 541
288
+ ],
289
+ "page_idx": 2
290
+ },
291
+ {
292
+ "type": "text",
293
+ "text": "where the regularization term $\\mathcal { R } ( \\mathbf { x } , \\phi )$ is ",
294
+ "bbox": [
295
+ 176,
296
+ 549,
297
+ 441,
298
+ 564
299
+ ],
300
+ "page_idx": 2
301
+ },
302
+ {
303
+ "type": "equation",
304
+ "img_path": "images/c74383d34e75780205a7859f62fd761513688c87abc06ef16c17185ee13fd7a4.jpg",
305
+ "text": "$$\n\\begin{array} { r } { \\mathcal { R } ( \\mathbf { x } , \\phi ) = \\mathbb { E } _ { t ( \\tilde { \\mathbf { x } } | \\mathbf { x } ) } \\left[ \\mathrm { K L } \\left( q _ { \\phi } ( \\mathbf { z } | \\tilde { \\mathbf { x } } ) | | q _ { \\phi } ( \\mathbf { z } | \\mathbf { x } ) \\right) \\right] . } \\end{array}\n$$",
306
+ "text_format": "latex",
307
+ "bbox": [
308
+ 354,
309
+ 570,
310
+ 643,
311
+ 589
312
+ ],
313
+ "page_idx": 2
314
+ },
315
+ {
316
+ "type": "text",
317
+ "text": "Maximizing the objective in Equation 3 maximizes the likelihood of the data and their augmentations while enforcing consistency through $\\mathcal { R } ( \\mathbf { x } , \\phi )$ . Minimizing $\\mathcal { R } ( \\mathbf { x } , \\phi )$ , which only affects the encoder (with parameters $\\phi$ ), forces each observation and the corresponding augmentations to lie close to each other in the latent space. The hyperparameter $\\lambda \\geq 0$ controls the strength of this constraint. ",
318
+ "bbox": [
319
+ 173,
320
+ 602,
321
+ 823,
322
+ 660
323
+ ],
324
+ "page_idx": 2
325
+ },
326
+ {
327
+ "type": "text",
328
+ "text": "The objective in Equation 3 is intractable but we can easily approximate it using Monte Carlo with the reparameterization trick. In particular, we approximate the regularization term with one sample from $t ( \\tilde { \\mathbf { x } } | \\mathbf { x } )$ and make the dependence to this sample explicit using the notation $\\mathcal { R } ( \\mathbf { x } , \\tilde { \\mathbf { x } } , \\phi )$ . Algorithm 1 illustrates this in greater detail. Although we show the application of consistency regularization using the vae that maximizes the elbo, $\\mathcal { L } _ { \\mathrm { v _ { A E } } } ( \\cdot )$ in Equation 3 can be replaced with any vae objective. ",
329
+ "bbox": [
330
+ 173,
331
+ 665,
332
+ 825,
333
+ 750
334
+ ],
335
+ "page_idx": 2
336
+ },
337
+ {
338
+ "type": "text",
339
+ "text": "3 Related Work ",
340
+ "text_level": 1,
341
+ "bbox": [
342
+ 174,
343
+ 762,
344
+ 321,
345
+ 779
346
+ ],
347
+ "page_idx": 2
348
+ },
349
+ {
350
+ "type": "text",
351
+ "text": "Applying consistency regularization to vaes, as we do in this paper, has not been previously explored. Consistency regularization is a widely used technique for semi-supervised learning (Bachman et al., 2014; Sajjadi et al., 2016; Laine & Aila, 2016; Miyato et al., 2018; Xie et al., 2019). The core idea behind consistency regularization for semi-supervised learning is to force classifiers to learn representations that are insensitive to semantics-preserving changes to images, so as to improve classification of unlabeled images. Examples of semantics-preserving changes used in the literature include rotation, zoom, translation, crop, or adversarial attacks. Consistency is often enforced by minimizing the $\\mathbb { L } _ { 2 }$ distance between a classifier’s logit output for an image and the logit output for its semantics-preserving transformation (Sajjadi et al., 2016; Laine & Aila, 2016), or by minimizing the kl divergence between the classifier’s label distribution induced by the image and that of its tranformation (Miyato et al., 2018; Xie et al., 2019). ",
352
+ "bbox": [
353
+ 174,
354
+ 786,
355
+ 825,
356
+ 911
357
+ ],
358
+ "page_idx": 2
359
+ },
360
+ {
361
+ "type": "table",
362
+ "img_path": "images/d590410ae5320acbe610c74382f7978aeec1c5aa980fb2c6b19f816af2109735.jpg",
363
+ "table_caption": [],
364
+ "table_footnote": [],
365
+ "table_body": "<table><tr><td>input :Data X,consistency regularization strength 入,latent space dimensionality K Initialize parameters 0,$ foriterationt=1,2,...do for n=1,...,Bdo Transform the data: ∈n ~ p(∈n) and xn = T(xn,∈n) Get variational mean and variance for the data: μn = WTNN(xn; Φ) + a and σn = softplus(QTNN(xn; Φ) + b) Get S samples from the variational distribution when conditioning on Xn: η(s) ~ N(0,I) and Z) )= μn+n(s).σn for s=1,...,S Get variational mean and variance for the transformed data:</td></tr></table>",
366
+ "bbox": [
367
+ 171,
368
+ 127,
369
+ 781,
370
+ 529
371
+ ],
372
+ "page_idx": 3
373
+ },
374
+ {
375
+ "type": "text",
376
+ "text": "",
377
+ "bbox": [
378
+ 174,
379
+ 560,
380
+ 821,
381
+ 588
382
+ ],
383
+ "page_idx": 3
384
+ },
385
+ {
386
+ "type": "text",
387
+ "text": "More recently, consistency regularization has been applied to generative adversarial networks (gans) (Goodfellow et al., 2014). Indeed Wei et al. (2018) and Zhang et al. (2020) show that applying consistency regularization on the discriminator of a gan—also a classifier—can substantially improve its performance. ",
388
+ "bbox": [
389
+ 174,
390
+ 597,
391
+ 825,
392
+ 652
393
+ ],
394
+ "page_idx": 3
395
+ },
396
+ {
397
+ "type": "text",
398
+ "text": "The idea we develop in this paper differs from the works above in two ways. First, it applies consistency regularization to vaes for image data. Second, it leverages consistency regularization, not in the label or logit space, as done in the works mentioned above, but in the latent space. ",
399
+ "bbox": [
400
+ 174,
401
+ 660,
402
+ 825,
403
+ 702
404
+ ],
405
+ "page_idx": 3
406
+ },
407
+ {
408
+ "type": "text",
409
+ "text": "Although different, consistency regularization for vaes relates to works that study ways to constrain the sensitivity of encoders to various perturbations. For example, denoising auto-encoders (daes) and their variants (Vincent et al., 2008, 2010) corrupt an image $\\mathbf { x }$ into $\\mathbf { x } ^ { \\prime }$ , typically using Gaussian noise, and then minimize the distance between the reconstruction of $\\mathbf { x } ^ { \\prime }$ and the un-corrupted image x. The motivation is to learn representations that are insensitive to the added noise. Our work differs in that we do not constrain the decoder to recover the original image from the corrupted image but, rather, to constrain the encoder to recover the latent representation of the original image from the corrupted image via a kl divergence minimization constraint. ",
410
+ "bbox": [
411
+ 174,
412
+ 709,
413
+ 825,
414
+ 820
415
+ ],
416
+ "page_idx": 3
417
+ },
418
+ {
419
+ "type": "text",
420
+ "text": "Contractive auto-encoders (caes) (Rifai et al., 2011) share a similar goal with cr-vaes. A cae is an auto-encoder whose encoder is constrained by minimizing the norm of the Jacobian of the output of the encoder with respect to the input image. This norm constraint on the Jacobian forces the representations learned by the encoder to be insensitive to changes in the input. Our work differs in several main ways. First, cr-vaes are not deterministic auto-encoders, contrary to caes. We can easily sample from a cr-vae, as for any vae, which is not the case for a cae. Second, a cae does not apply transformations to the input image, which limits the sensitivities it can learn to limit to those exhibited in the training set. Finally, caes use the Jacobian to impose a consistency constraint, which are not as easy to compute as the kl divergence we use on the variational distribution induced by the encoder. ",
421
+ "bbox": [
422
+ 174,
423
+ 827,
424
+ 823,
425
+ 911
426
+ ],
427
+ "page_idx": 3
428
+ },
429
+ {
430
+ "type": "table",
431
+ "img_path": "images/01f62b4aea9bb82dffcddb89fa9a85c9f395e99eb8cc15ec176ece76074b337b.jpg",
432
+ "table_caption": [
433
+ "Table 1: cr-vaes learn better representations than their base vaes on all three benchmark datasets. Although fitting the base vae with augmentations does improve the representations, adding the consistency regularization further improves the quality of these learned representations. The value of $\\beta$ for the $\\beta$ -vae is inside the parentheses. "
434
+ ],
435
+ "table_footnote": [],
436
+ "table_body": "<table><tr><td rowspan=\"2\">Method</td><td colspan=\"2\">MNIST</td><td colspan=\"2\">OMNIGLOT</td><td colspan=\"2\">CELEBA</td></tr><tr><td>MI</td><td>AU</td><td>MI</td><td>AU</td><td>MI</td><td>AU</td></tr><tr><td>VAE</td><td>124.5 ±1.1</td><td>36±0.8</td><td>105.4±1.2</td><td>50±0.0</td><td>33.8±0.2</td><td>32±0.9</td></tr><tr><td>VAE + Aug</td><td>125.9 ± 0.2</td><td>42 ± 0.5</td><td>105.9 ± 0.7</td><td>50 ±0.0</td><td>34.1± 0.8</td><td>33 ± 0.9</td></tr><tr><td>CR-VAE</td><td>126.3 ± 0.9</td><td>47 ± 0.5</td><td>107.8 ± 1.1</td><td>50±0.0</td><td>34.9 ± 0.5</td><td>33 ±1.2</td></tr><tr><td>IWAE</td><td>127.1 ± 0.7</td><td>39±0.5</td><td>110.3±1.1</td><td>50±0.0</td><td>36.9± 0.5</td><td>36 ±1.6</td></tr><tr><td>IWAE+Aug</td><td>129.0 ± 0.9</td><td>45±0.8</td><td>112.9 ± 0.7</td><td>50 ±0.0</td><td>37.0± 0.2</td><td>36 ± 1.2</td></tr><tr><td>CR-IWAE</td><td>129.7 ± 1.0</td><td>50 ± 0.0</td><td>115.3 ± 0.8</td><td>50±0.0</td><td>38.4 ± 0.5</td><td>36 ± 1.9</td></tr><tr><td>β-VAE (0.5)</td><td>284.3± 1.1</td><td>50±0.0</td><td>143.4 ± 1.0</td><td>50±0.0</td><td>75.8 ± 0.5</td><td>49± 0.5</td></tr><tr><td>β-VAE (0.5) + Aug</td><td>289.3 ± 1.0</td><td>50±0.0</td><td>159.6 ± 1.3</td><td>50±0.0</td><td>75.7 ± 0.3</td><td>49±0.0</td></tr><tr><td>β-CR-VAE (0.5)</td><td>291.9 ± 0.7</td><td>50±0.0</td><td>169.5 ± 0.5</td><td>50±0.0</td><td>77.1 ± 0.1</td><td>50 ± 0.0</td></tr><tr><td>β-VAE (10)</td><td>6.3± 0.6</td><td>8±1.7</td><td>1.4 ± 0.2</td><td>4±0.9</td><td>3.6± 0.3</td><td>7±0.8</td></tr><tr><td>β-VAE (10) + Aug</td><td>6.5 ± 0.5</td><td>9±1.1</td><td>1.6 ± 0.2</td><td>4±0.5</td><td>3.7 ± 0.1</td><td>7±0.0</td></tr><tr><td>β-CR-VAE (10)</td><td>6.9 ± 0.6</td><td>10 ± 0.5</td><td>1.6 ± 0.1</td><td>4± 0.5</td><td>3.7 ± 0.4</td><td>9 ± 0.9</td></tr></table>",
437
+ "bbox": [
438
+ 173,
439
+ 165,
440
+ 834,
441
+ 363
442
+ ],
443
+ "page_idx": 4
444
+ },
445
+ {
446
+ "type": "text",
447
+ "text": "",
448
+ "bbox": [
449
+ 174,
450
+ 388,
451
+ 825,
452
+ 444
453
+ ],
454
+ "page_idx": 4
455
+ },
456
+ {
457
+ "type": "text",
458
+ "text": "4 Empirical Study ",
459
+ "text_level": 1,
460
+ "bbox": [
461
+ 174,
462
+ 457,
463
+ 343,
464
+ 474
465
+ ],
466
+ "page_idx": 4
467
+ },
468
+ {
469
+ "type": "text",
470
+ "text": "In this section we show that a cr-vae improves the learned representations of its base vae and positively affects generalization performance We also show that the proposed regularization method is amenable to different vae variants by applying it not only to the original vae but also to the iwae, the $\\beta$ -vae, and the nvae. We showcase the importance of the KL regularization term by conducting an ablation study. We found that only regularizing with data augmentation improves performance but that accounting for the kl term $\\lambda > 0$ ) further improves the quality of the learned representations and generalization. ",
471
+ "bbox": [
472
+ 173,
473
+ 482,
474
+ 825,
475
+ 579
476
+ ],
477
+ "page_idx": 4
478
+ },
479
+ {
480
+ "type": "text",
481
+ "text": "We will conduct three sets of experiments. In the first experiment, we will apply the regularization method proposed in this paper to standard vaes such as the original vae, the iwae, and the $\\beta$ -vae. We use mnist, omniglot, and celeba as datasets for this experiment. For celeba, we choose the $3 2 \\mathrm { x 3 2 }$ resolution for this experiment. Our results show that adding consistency regularization always improves upon the base vae, both in terms of the quality of the learned representations and generalization. We conduct an ablation study and also report performance of the different vae variants above when they are fitted with the original data and their augmentations. The results from this ablation highlight the importance of setting $\\lambda > 0$ . ",
482
+ "bbox": [
483
+ 173,
484
+ 585,
485
+ 825,
486
+ 696
487
+ ],
488
+ "page_idx": 4
489
+ },
490
+ {
491
+ "type": "text",
492
+ "text": "In the second set of experiments we apply our method to a large-scale vae, the latest nvae (Vahdat & Kautz, 2020). We use mnist, cifar-10, and celeba as datasets for this experiment. We increased the resolution for the celeba dataset for this experiment to $6 4 \\mathrm { x 6 4 }$ . We reach the same conclusions as for the first sets of experiments; cr-vaes improve the learned representations and generalization of their base vaes. In this particular setting, the cr-nvae achieves state-of-the-art generalization performance on both mnist and cifar-10. This state-of-the-art performance couldn’t be reach simply by training the nvae with augmentations, as our results show. ",
493
+ "bbox": [
494
+ 173,
495
+ 703,
496
+ 825,
497
+ 800
498
+ ],
499
+ "page_idx": 4
500
+ },
501
+ {
502
+ "type": "text",
503
+ "text": "Finally, in a third set of experiments, we apply our regularization technique to a 3D point-cloud dataset called ShapeNet (Chang et al., 2015). We adapt a high-performing auto-encoding method called FoldingNet (Yang et al., 2018) to its vae counterpart and apply the method we described in this paper to that vae variant on the ShapeNet dataset. We found that adding consistency regularization yields better learned representations. ",
504
+ "bbox": [
505
+ 174,
506
+ 806,
507
+ 825,
508
+ 876
509
+ ],
510
+ "page_idx": 4
511
+ },
512
+ {
513
+ "type": "text",
514
+ "text": "We next describe in great detail the set up for each of these experiments and the results showcasing the usefulness of the regularization method we propose in this paper. ",
515
+ "bbox": [
516
+ 173,
517
+ 883,
518
+ 821,
519
+ 911
520
+ ],
521
+ "page_idx": 4
522
+ },
523
+ {
524
+ "type": "table",
525
+ "img_path": "images/ca2e472d072fc4f4263a91a933a1bbd1bd818c34ad3086fbc683078ed7560075.jpg",
526
+ "table_caption": [
527
+ "Table 2: cr-vaes learn representations that yield higher accuracy on downstream classification than their base vaes. These results correspond to the accuracy from a linear classifier that was fitted on the training. We fed this classifier with the representations learned by each method. On both mnist and cifar-10, cr-vaes yield higher accuracy. "
528
+ ],
529
+ "table_footnote": [],
530
+ "table_body": "<table><tr><td>Method</td><td>MNIST</td><td>CIFAR-10</td></tr><tr><td>VAE</td><td>98.5</td><td>32.6</td></tr><tr><td>VAE+Aug</td><td>98.9</td><td>40.1</td></tr><tr><td>CR-VAE</td><td>99.4</td><td>44.7</td></tr><tr><td>IWAE</td><td>98.6</td><td>35.8</td></tr><tr><td>IWAE+Aug</td><td>99.9</td><td>37.1</td></tr><tr><td>CR-IWAE</td><td>99.9</td><td>44.8</td></tr><tr><td>β- VAE (0.5)</td><td>97.6</td><td>27.0</td></tr><tr><td>β- VAE (0.5)+Aug</td><td>98.7</td><td>27.6</td></tr><tr><td>β- CR-VAE (0.5)</td><td>98.9</td><td>30.0</td></tr><tr><td>β- VAE (10)</td><td>99.4</td><td>36.5</td></tr><tr><td>β- VAE (10)+Aug</td><td>99.6</td><td>42.1</td></tr><tr><td>β- CR-VAE (10)</td><td>99.6</td><td>46.1</td></tr></table>",
531
+ "bbox": [
532
+ 352,
533
+ 164,
534
+ 640,
535
+ 381
536
+ ],
537
+ "page_idx": 5
538
+ },
539
+ {
540
+ "type": "table",
541
+ "img_path": "images/8b9b3f68fca58fe2e42e1a8482298efe7f6b2f24634f547d5b7a3e397bf38b80.jpg",
542
+ "table_caption": [
543
+ "Table 3: cr-vaes generalize better than their base vaes on almost all cases; they achieve lower negative log-likelihoods. Although training the base vaes with the augmented data improves generalization, adding the consistency regularization term further improves generalization performance. "
544
+ ],
545
+ "table_footnote": [],
546
+ "table_body": "<table><tr><td>Method</td><td>MNIST</td><td>OMNIGLOT</td><td>CELEBA</td></tr><tr><td>VAE</td><td>83.7 ± 0.3</td><td>128.2± 0.8</td><td>66.1±0.2</td></tr><tr><td>VAE + Aug</td><td>82.8 ±0.4</td><td>125.7 ± 0.2</td><td>66.0± 0.2</td></tr><tr><td>CR-VAE</td><td>81.2 ± 0.2</td><td>124.1 ± 0.1</td><td>65.9 ± 0.2</td></tr><tr><td>IWAE</td><td>81.7± 0.3</td><td>127.5 ± 0.5</td><td>65.3 ± 0.1</td></tr><tr><td>IWAE+Aug</td><td>80.4± 0.2</td><td>125.0 ± 0.6</td><td>65.3 ± 0.1</td></tr><tr><td>CR-IWAE</td><td>79.7 ± 0.3</td><td>123.6 ± 0.5</td><td>65.0 ± 0.2</td></tr><tr><td>β-VAE (0.5)</td><td>92.6±0.3</td><td>137.1 ± 0.2</td><td>68.7±0.2</td></tr><tr><td>β-VAE (0.5) + Aug</td><td>90.0 ± 0.5</td><td>134.6 ± 0.5</td><td>68.8 ± 0.2</td></tr><tr><td>β-CR-VAE (0.5)</td><td>85.7 ± 0.6</td><td>132.5 ± 0.3</td><td>68.2 ± 0.1</td></tr><tr><td>β-VAE (10)</td><td>126.1 ± 1.8</td><td>157.5 ± 1.1</td><td>92.7± 0.5</td></tr><tr><td>β-VAE (10) + Aug</td><td>127.1 ± 1.0</td><td>157.3 ± 0.5</td><td>92.7 ± 0.3</td></tr><tr><td>β-CR-VAE (10)</td><td>126.2 ± 0.5</td><td>157.6 ± 0.6</td><td>92.6 ± 0.1</td></tr></table>",
547
+ "bbox": [
548
+ 282,
549
+ 457,
550
+ 715,
551
+ 641
552
+ ],
553
+ "page_idx": 5
554
+ },
555
+ {
556
+ "type": "text",
557
+ "text": "4.1 Application to standard vaes on benchmark datasets ",
558
+ "text_level": 1,
559
+ "bbox": [
560
+ 174,
561
+ 667,
562
+ 584,
563
+ 683
564
+ ],
565
+ "page_idx": 5
566
+ },
567
+ {
568
+ "type": "text",
569
+ "text": "We apply consistency regularization, as described in this paper, to the original vae, the iwae, and the $\\beta$ -vae. We now describe the set up and results for this experiment. ",
570
+ "bbox": [
571
+ 174,
572
+ 686,
573
+ 823,
574
+ 715
575
+ ],
576
+ "page_idx": 5
577
+ },
578
+ {
579
+ "type": "text",
580
+ "text": "Datasets. We study three benchmark datasets that we briefly describe below. We first consider mnist. mnist is a handwritten digit recognition dataset with 60, 000 images in the training set and 10, 000 images in the test set (LeCun, 1998). We form a validation set of 10, 000 images randomly sampled from the training set. ",
581
+ "bbox": [
582
+ 173,
583
+ 722,
584
+ 825,
585
+ 779
586
+ ],
587
+ "page_idx": 5
588
+ },
589
+ {
590
+ "type": "text",
591
+ "text": "We also consider omniglot, a handwritten alphabet recognition dataset (Lake et al., 2011). This dataset is composed of 19, 280 images. We use 16, 280 randomly sampled images for training and 1, 000 for validation and the remaining 2, 000 samples for testing. ",
592
+ "bbox": [
593
+ 174,
594
+ 785,
595
+ 825,
596
+ 827
597
+ ],
598
+ "page_idx": 5
599
+ },
600
+ {
601
+ "type": "text",
602
+ "text": "Finally we consider celeba. It is a dataset of faces, consisting of 162, 770 images for training, 19, 867 images for validation, and 19, 962 images for testing (Liu et al., 2018). We set the resolution to $3 2 \\mathrm { x 3 2 }$ for this experiment. ",
603
+ "bbox": [
604
+ 174,
605
+ 834,
606
+ 825,
607
+ 876
608
+ ],
609
+ "page_idx": 5
610
+ },
611
+ {
612
+ "type": "text",
613
+ "text": "Transformations $t ( \\tilde { \\mathbf { x } } | \\mathbf { x } )$ . We consider three transformations variants for image data $t ( \\tilde { \\mathbf { x } } | \\mathbf { x } )$ . The first randomly translates an image $[ - 2 , 2 ]$ pixels in any direction. The second transformation randomly rotates an image uniformly in $[ - 1 5 , 1 5 ]$ degrees clockwise. Finally the third transformation randomly scales an image by a factor uniformly sampled from [0.9, 1.1]. ",
614
+ "bbox": [
615
+ 173,
616
+ 882,
617
+ 821,
618
+ 912
619
+ ],
620
+ "page_idx": 5
621
+ },
622
+ {
623
+ "type": "table",
624
+ "img_path": "images/9049cac26096d5e7579e063d4751364e984a103026cb53014919ca12ce878707.jpg",
625
+ "table_caption": [
626
+ "Table 4: The regularization term $\\lambda$ affects both generalization performance and the quality of the learned representations. Many values of $\\lambda$ perform better than the base vae. However a large enough value of $\\lambda$ , e.g. $\\lambda = 1$ , can lead to worse performance than the base vae because for large values of $\\lambda$ the regularization term takes over the data-term in the objective function. "
627
+ ],
628
+ "table_footnote": [],
629
+ "table_body": "<table><tr><td></td><td>入</td><td>MI</td><td>AU</td><td>NLL</td></tr><tr><td>VAE</td><td>11</td><td>124.5</td><td>36</td><td>83.7</td></tr><tr><td>CR-VAE</td><td>0.001</td><td>125.0</td><td>38</td><td>83.5</td></tr><tr><td>CR-VAE</td><td>0.01</td><td>125.9</td><td>41</td><td>82.4</td></tr><tr><td>CR-VAE</td><td>0.1</td><td>126.3</td><td>47</td><td>81.2</td></tr><tr><td>CR-VAE</td><td>1</td><td>124.3</td><td>47</td><td>83.9</td></tr></table>",
630
+ "bbox": [
631
+ 354,
632
+ 165,
633
+ 640,
634
+ 265
635
+ ],
636
+ "page_idx": 6
637
+ },
638
+ {
639
+ "type": "table",
640
+ "img_path": "images/ac39e3c789e3adf899bf3dc4d7aa0cb25c62b933db2b17bafbd2bb47123459fc.jpg",
641
+ "table_caption": [
642
+ "Table 5: The choice of augmentation affects both generalization performance and the quality of the learned representations. Jointly using all augmentations works best. "
643
+ ],
644
+ "table_footnote": [],
645
+ "table_body": "<table><tr><td>Augmentation</td><td>MI</td><td>AU</td><td>NLL</td></tr><tr><td>Rotations only</td><td>125.8</td><td>45</td><td>82.1</td></tr><tr><td>Translations only</td><td>126.1</td><td>45</td><td>81.9</td></tr><tr><td>Scaling only</td><td>125.1</td><td>42</td><td>82.7</td></tr><tr><td>All</td><td>126.3</td><td>47</td><td>81.2</td></tr></table>",
646
+ "bbox": [
647
+ 351,
648
+ 325,
649
+ 642,
650
+ 412
651
+ ],
652
+ "page_idx": 6
653
+ },
654
+ {
655
+ "type": "text",
656
+ "text": "",
657
+ "bbox": [
658
+ 174,
659
+ 438,
660
+ 823,
661
+ 467
662
+ ],
663
+ "page_idx": 6
664
+ },
665
+ {
666
+ "type": "text",
667
+ "text": "Evaluation metrics. The regularization method we propose in this paper is mainly aimed at improving the learned representations of vaes. To assess these representations we use three metrics: mutual information, number of active latent units, and accuracy on a downstream classification task. We also evaluate the effect of the proposed method on generalization to unseen data. For that we also report negative log-likelihood. We define each of these metrics next. ",
668
+ "bbox": [
669
+ 173,
670
+ 472,
671
+ 825,
672
+ 541
673
+ ],
674
+ "page_idx": 6
675
+ },
676
+ {
677
+ "type": "text",
678
+ "text": "Mutual information $( M I )$ . The first quality metric is the mutual information $I ( \\mathbf { z } ; \\mathbf { x } )$ between the observations and the latents under the joint distribution induced by the encoder, ",
679
+ "bbox": [
680
+ 173,
681
+ 547,
682
+ 823,
683
+ 577
684
+ ],
685
+ "page_idx": 6
686
+ },
687
+ {
688
+ "type": "equation",
689
+ "img_path": "images/20429e2704dad1c0dc1720cb8df1c75463dee281517f045ffd9fcd6d220eec7b.jpg",
690
+ "text": "$$\nI ( \\mathbf { z } ; \\mathbf { x } ) = \\mathbb { E } _ { p _ { d } ( \\mathbf { x } ) } \\left[ K L ( q _ { \\phi } ( \\mathbf { z } | \\mathbf { x } ) | | p ( \\mathbf { z } ) ) - \\kappa \\mathbf { L } ( q _ { \\phi } ( \\mathbf { z } ) | | p ( \\mathbf { z } ) ) \\right]\n$$",
691
+ "text_format": "latex",
692
+ "bbox": [
693
+ 307,
694
+ 583,
695
+ 691,
696
+ 602
697
+ ],
698
+ "page_idx": 6
699
+ },
700
+ {
701
+ "type": "text",
702
+ "text": "where $p _ { d } ( \\mathbf { x } )$ is the empirical data distribution and $q _ { \\phi } ( \\mathbf { z } )$ is the aggregated posterior, the marginal over $\\mathbf { z }$ induced by the joint distribution defined by $p _ { d } ( \\mathbf { x } )$ and $q _ { \\phi } ( { \\bf z } | { \\bf x } )$ . The mutual information is intractable but we can approximate it with Monte Carlo. Higher mutual information corresponds to more interpretable latent variables. ",
703
+ "bbox": [
704
+ 173,
705
+ 608,
706
+ 825,
707
+ 664
708
+ ],
709
+ "page_idx": 6
710
+ },
711
+ {
712
+ "type": "text",
713
+ "text": "Number of active latent units $( A U )$ . The second quality metrics we consider is the number of active latent units (AU). It is defined in Burda et al. (2015) and measures the “activity\" of a dimension of the latent variables $\\mathbf { z }$ . A latent dimension is “active\" if ",
714
+ "bbox": [
715
+ 173,
716
+ 670,
717
+ 825,
718
+ 712
719
+ ],
720
+ "page_idx": 6
721
+ },
722
+ {
723
+ "type": "equation",
724
+ "img_path": "images/807f0b6a2f18d592a13c2f76527dd67d65704ecf0bc4f5ce156fe8502705139e.jpg",
725
+ "text": "$$\nC o v _ { \\mathbf { x } } ( \\mathbb { E } _ { \\mathbf { u } \\sim q _ { \\phi } ( \\mathbf { u } | \\mathbf { x } ) } ) > \\delta\n$$",
726
+ "text_format": "latex",
727
+ "bbox": [
728
+ 421,
729
+ 719,
730
+ 578,
731
+ 738
732
+ ],
733
+ "page_idx": 6
734
+ },
735
+ {
736
+ "type": "text",
737
+ "text": "where $\\delta$ is a threshold defined by the user. For our experiments we set $\\delta = 0 . 0 1$ . The higher the number of latent active units, the better the learned representations. ",
738
+ "bbox": [
739
+ 171,
740
+ 743,
741
+ 825,
742
+ 772
743
+ ],
744
+ "page_idx": 6
745
+ },
746
+ {
747
+ "type": "text",
748
+ "text": "Accuracy on downstream classification. This metric is calculated by fitting a given vae, taking the learned representations for each data in the test set and computing the accuracy from the prediction of the labels of the images in that same test set by a classifier fitted on the training set. This metric is only applicable to labelled datasets. ",
749
+ "bbox": [
750
+ 173,
751
+ 777,
752
+ 825,
753
+ 833
754
+ ],
755
+ "page_idx": 6
756
+ },
757
+ {
758
+ "type": "text",
759
+ "text": "Negative log-likelihood. We use negative held-out log-likelihood to assess generalization. Consider an unseen data $\\mathbf { x } ^ { * }$ , its negative held-out log-likelihood under the fitted model is ",
760
+ "bbox": [
761
+ 173,
762
+ 839,
763
+ 823,
764
+ 868
765
+ ],
766
+ "page_idx": 6
767
+ },
768
+ {
769
+ "type": "equation",
770
+ "img_path": "images/49142c6f3e517ea78a7cf6503ab86315a9fab4eae97e9da18bb18134b4423853.jpg",
771
+ "text": "$$\n\\log p _ { \\boldsymbol \\theta } ( \\mathbf { x } ^ { * } ) = - \\log \\left( \\mathbb { E } _ { q _ { \\boldsymbol \\phi } ( \\mathbf { z } | \\mathbf { x } ^ { * } ) } \\left[ \\frac { p _ { \\boldsymbol \\theta } ( \\mathbf { x } ^ { * } , \\mathbf { z } ) } { q _ { \\boldsymbol \\phi } ( \\mathbf { z } | \\mathbf { x } ^ { * } ) } \\right] \\right) .\n$$",
772
+ "text_format": "latex",
773
+ "bbox": [
774
+ 343,
775
+ 875,
776
+ 653,
777
+ 910
778
+ ],
779
+ "page_idx": 6
780
+ },
781
+ {
782
+ "type": "table",
783
+ "img_path": "images/4b2324520025efa58830e21a6115ffa750dd98795319a96faee2d2d6ca2a0112.jpg",
784
+ "table_caption": [
785
+ "Table 6: The cr-vae outperforms a popular and advanced contrastive learning technique called triplet loss on both generalization performance and quality of learned representations. "
786
+ ],
787
+ "table_footnote": [],
788
+ "table_body": "<table><tr><td>Method</td><td>MI</td><td>AU</td><td>NLL</td></tr><tr><td>VAE</td><td>124.5</td><td>36</td><td>83.7</td></tr><tr><td>VAE + augmentations</td><td>125.9</td><td>42</td><td>82.8</td></tr><tr><td>VAE + triplet loss</td><td>124.9</td><td>39</td><td>83.1</td></tr><tr><td>CR-VAE</td><td>126.3</td><td>47</td><td>81.2</td></tr></table>",
789
+ "bbox": [
790
+ 336,
791
+ 137,
792
+ 655,
793
+ 223
794
+ ],
795
+ "page_idx": 7
796
+ },
797
+ {
798
+ "type": "text",
799
+ "text": "This is intractable and we approximate it using Monte Carlo, ",
800
+ "bbox": [
801
+ 173,
802
+ 247,
803
+ 570,
804
+ 262
805
+ ],
806
+ "page_idx": 7
807
+ },
808
+ {
809
+ "type": "equation",
810
+ "img_path": "images/7dda144bd40410a81a940ae50d5e67f85669cc267a11ca25ba90d8da35a5eb88.jpg",
811
+ "text": "$$\n\\log p _ { \\theta } ( \\mathbf { x } ^ { * } ) \\approx - \\log \\frac { 1 } { S } \\sum _ { s = 1 } ^ { S } \\frac { p _ { \\theta } ( \\mathbf { x } ^ { * } , \\mathbf { z } ^ { ( s ) } ) } { q _ { \\phi } ( \\mathbf { z } ^ { ( s ) } | \\mathbf { x } ^ { * } ) }\n$$",
812
+ "text_format": "latex",
813
+ "bbox": [
814
+ 367,
815
+ 267,
816
+ 629,
817
+ 310
818
+ ],
819
+ "page_idx": 7
820
+ },
821
+ {
822
+ "type": "text",
823
+ "text": "where $\\mathbf { z } ^ { ( 1 ) } , \\ldots , \\mathbf { z } ^ { ( S ) } \\sim q _ { \\phi } ( \\mathbf { z } | \\mathbf { x } ^ { * } )$ ",
824
+ "bbox": [
825
+ 174,
826
+ 315,
827
+ 393,
828
+ 333
829
+ ],
830
+ "page_idx": 7
831
+ },
832
+ {
833
+ "type": "text",
834
+ "text": "Settings. The vaes are built on the same architecture as Tolstikhin et al. (2017). The networks are trained with the Adam optimizer with a learning rate of $1 0 ^ { - 4 }$ (Kingma & Ba, 2014) and trained for 100 epochs with a batch size of 64. We set the dimensionality of the latent variables to 50, therefore the maximum number of active latent units in the latent space is 50. We found $\\lambda = 0 . 1$ to be best according to cross-validation using held-out log-likelihood and exploring the range $[ 1 e ^ { - 4 } , 1 . 0 ]$ datasets. In an ablation study we explore $\\lambda = 0$ . For the $\\beta$ -vae we set $\\lambda = 0 . 1 \\cdot \\beta$ and study both $\\beta = 0 . 1$ and $\\beta = 1 0$ , two regimes under which the $\\beta$ -vae performs qualitatively very differently (Higgins et al., 2017). All experiments were done on a GPU cluster consisting of Nvidia P100 and RTX. The training took approximately 1 day for most experiments. ",
835
+ "bbox": [
836
+ 173,
837
+ 338,
838
+ 825,
839
+ 463
840
+ ],
841
+ "page_idx": 7
842
+ },
843
+ {
844
+ "type": "text",
845
+ "text": "Results. Table 1 shows that on all the three benchmark datasets all the different vae variants we studied, consistency regularization as developed in this paper always improves the quality of the learned representations as measured by mutual information and the number of active latent units. These results are confirmed by the numbers shown in Table 2 where cr-vaes always lead to better accuracy on downstream classification. ",
846
+ "bbox": [
847
+ 174,
848
+ 469,
849
+ 825,
850
+ 539
851
+ ],
852
+ "page_idx": 7
853
+ },
854
+ {
855
+ "type": "text",
856
+ "text": "We proposed consistency regularization as a way to improve the quality of the learned representations. Incidentally, Table 3 also shows that it can improve generalization as measured by negative loglikelihood. ",
857
+ "bbox": [
858
+ 174,
859
+ 545,
860
+ 825,
861
+ 587
862
+ ],
863
+ "page_idx": 7
864
+ },
865
+ {
866
+ "type": "text",
867
+ "text": "Ablation Study. We now look at the impact of each factor that goes into the regularization method we introduced in this paper using mnist. We test the impact of the regularization term $\\lambda$ and the impact of the choice of augmentation on all metrics. Table 4 and Table 5 show the results. ",
868
+ "bbox": [
869
+ 176,
870
+ 593,
871
+ 823,
872
+ 635
873
+ ],
874
+ "page_idx": 7
875
+ },
876
+ {
877
+ "type": "text",
878
+ "text": "Table 4 shows that even small consistency regularization (a small $\\lambda$ value) results in improvement over the base vae but that a large enough $\\lambda$ value can hurt performance. ",
879
+ "bbox": [
880
+ 173,
881
+ 641,
882
+ 823,
883
+ 670
884
+ ],
885
+ "page_idx": 7
886
+ },
887
+ {
888
+ "type": "text",
889
+ "text": "Table 5 shows that rotations and translations are more important than scaling, but the combination of all three augmentations works best for cr-vaes. ",
890
+ "bbox": [
891
+ 171,
892
+ 676,
893
+ 823,
894
+ 704
895
+ ],
896
+ "page_idx": 7
897
+ },
898
+ {
899
+ "type": "text",
900
+ "text": "Comparison to Contrastive Learning. We look at how cr-vaes compare against a popular and advanced contrastive-learning-based technique, the triplet loss (Schroff et al., 2015) using mnist. Table 6 shows that the cr-vae outperforms the triplet loss on both generalization performance and quality of learned representations. Table 6 also confirms existing literature showing simply applying augmentations can outperform complex contrastive learning-based methods such as the triplet loss (Kostrikov et al., 2020; Sinha & Garg, 2021). ",
901
+ "bbox": [
902
+ 174,
903
+ 709,
904
+ 825,
905
+ 794
906
+ ],
907
+ "page_idx": 7
908
+ },
909
+ {
910
+ "type": "text",
911
+ "text": "4.2 Application to the large-scale nvae on benchmark datasets ",
912
+ "text_level": 1,
913
+ "bbox": [
914
+ 173,
915
+ 803,
916
+ 622,
917
+ 818
918
+ ],
919
+ "page_idx": 7
920
+ },
921
+ {
922
+ "type": "text",
923
+ "text": "Along with standard VAE variants, we also experiment with a large scale state-of-the-art vae, the nvae(Vahdat & Kautz, 2020). Similar to before, we simply add consistency regularization using the image-based augmentations techniques to the NVAE model and experiment on benchmark datasets: mnist (LeCun, 1998), cifar-10 (Krizhevsky et al., 2009) and celeba (Liu et al., 2018). ",
924
+ "bbox": [
925
+ 174,
926
+ 821,
927
+ 825,
928
+ 877
929
+ ],
930
+ "page_idx": 7
931
+ },
932
+ {
933
+ "type": "text",
934
+ "text": "The results for large scale generative modeling are tabulated in Table 8 and Table 7, where we see that using cr-nvae we are able to learn representations that yield better accuracy on downstream classification and set new state-of-the-art values on each of the datasets, improving upon the baseline log-likelihood values. This shows the ability of consistency regularization to work at scale on challenging generative modeling tasks. ",
935
+ "bbox": [
936
+ 174,
937
+ 883,
938
+ 820,
939
+ 911
940
+ ],
941
+ "page_idx": 7
942
+ },
943
+ {
944
+ "type": "table",
945
+ "img_path": "images/0f2716d399a4da7efa579f44270d8b63f236485b38e4adc90d9c678c3b3a2ee1.jpg",
946
+ "table_caption": [
947
+ "Table 7: The cr-nvaes learns better representations than the base nvae as measured by accuracy on a downstream classification on both mnist and cifar-10. We get to this same conclusion when looking at the number of active units as an indicator for the quality of the learned latent representations; cr-nvae recovers 226 units whereas nvae recovers 211 units. "
948
+ ],
949
+ "table_footnote": [],
950
+ "table_body": "<table><tr><td>Method</td><td>MNIST</td><td>CIFAR-10</td></tr><tr><td>NVAE</td><td>99.9</td><td>57.9</td></tr><tr><td>NVAE+Aug</td><td>99.9</td><td>66.4</td></tr><tr><td>CR-NVAE</td><td>99.9</td><td>71.4</td></tr></table>",
951
+ "bbox": [
952
+ 375,
953
+ 165,
954
+ 617,
955
+ 237
956
+ ],
957
+ "page_idx": 8
958
+ },
959
+ {
960
+ "type": "table",
961
+ "img_path": "images/6a278a274b29255ea80874edce5c640ac9b6abc9a186c108a470f5a2d42a756f.jpg",
962
+ "table_caption": [
963
+ "Table 8: Large-scale experiments with nvaes with and without consistency-regularization on 3 benchmark datasets: dynamically binarized mnist, cifar-10 and celeba. We report generalization using negative log-likelihood on mnist and bits per dim on cifar-10 and celeba. On all datasets consistency regularization improves generalization performance. In particular cr-nvae achieves state-of-the-art performance on mnist and cifar-10. "
964
+ ],
965
+ "table_footnote": [],
966
+ "table_body": "<table><tr><td></td><td>MNIST (28 × 28)</td><td>CIFAR-10 (32 × 32)</td><td>CELEBA (64 × 64)</td></tr><tr><td>NVAE</td><td>78.19</td><td>2.91</td><td>2.03</td></tr><tr><td>NVAE+Aug</td><td>77.53</td><td>2.70</td><td>1.96</td></tr><tr><td>CR-NVAE</td><td>76.93</td><td>2.51</td><td>1.86</td></tr></table>",
967
+ "bbox": [
968
+ 236,
969
+ 342,
970
+ 754,
971
+ 415
972
+ ],
973
+ "page_idx": 8
974
+ },
975
+ {
976
+ "type": "image",
977
+ "img_path": "images/013be7f0e1e75e1072aef4213dc3071a40eed8f53d36cb5a52a75b32e6cdd895.jpg",
978
+ "image_caption": [
979
+ "Figure 2: Interpolation between two samples of a lamp, airplane and table using a trained CRFoldingNet trained on the ShapeNet dataset. The CR-FoldingNet is able to learn an interpretable latent space. "
980
+ ],
981
+ "image_footnote": [],
982
+ "bbox": [
983
+ 197,
984
+ 441,
985
+ 794,
986
+ 696
987
+ ],
988
+ "page_idx": 8
989
+ },
990
+ {
991
+ "type": "text",
992
+ "text": "",
993
+ "bbox": [
994
+ 174,
995
+ 781,
996
+ 825,
997
+ 823
998
+ ],
999
+ "page_idx": 8
1000
+ },
1001
+ {
1002
+ "type": "text",
1003
+ "text": "4.3 Application to the FoldingNet on 3D point-cloud data ",
1004
+ "text_level": 1,
1005
+ "bbox": [
1006
+ 173,
1007
+ 835,
1008
+ 583,
1009
+ 851
1010
+ ],
1011
+ "page_idx": 8
1012
+ },
1013
+ {
1014
+ "type": "text",
1015
+ "text": "Along with working with image data, we additionally experiment with 3D point cloud data using a FoldingNet Yang et al. (2018) and the ShapeNet dataset Chang et al. (2015) which consists of 55 distinct object classes. FoldingNet learns a deep AutoEncoder to learn unsupervised representations from the point cloud data. To add consistency regularization, we first substitute the AutoEncoder to a vae by adding the KL term from the ELBO to the baseline FoldingNet. We then add the additional consistency regularization KL term to the latent space of FoldingNet. ",
1016
+ "bbox": [
1017
+ 174,
1018
+ 856,
1019
+ 825,
1020
+ 911
1021
+ ],
1022
+ "page_idx": 8
1023
+ },
1024
+ {
1025
+ "type": "table",
1026
+ "img_path": "images/3415f282ed82b433ed836f811f5ab0ae836d4bcb25e77dd339ab61af4daf5a9e.jpg",
1027
+ "table_caption": [
1028
+ "Table 9: The FoldingNet yields higher accuracy when paired with consistency regularization on the ShapeNet dataset. The results shown here correspond to a FoldingNet that was trained with augmented data, the same used to apply consistency regularization. As can be seen from these results, enforcing consistency through KL as we do in this paper leads to representations that perform well on a downstream classification. Here the classifier used is a linear SVM. We also report mean reconstruction error through Chamfer distance where the same conclusion holds. "
1029
+ ],
1030
+ "table_footnote": [],
1031
+ "table_body": "<table><tr><td>Method</td><td>Accuracy</td><td>Reconstruction Loss</td></tr><tr><td>Folding Net (Aug)</td><td>82.5%</td><td>0.0355</td></tr><tr><td>CR-Folding Net</td><td>84.6%</td><td>0.0327</td></tr></table>",
1032
+ "bbox": [
1033
+ 307,
1034
+ 193,
1035
+ 684,
1036
+ 251
1037
+ ],
1038
+ "page_idx": 9
1039
+ },
1040
+ {
1041
+ "type": "text",
1042
+ "text": "",
1043
+ "bbox": [
1044
+ 171,
1045
+ 281,
1046
+ 823,
1047
+ 309
1048
+ ],
1049
+ "page_idx": 9
1050
+ },
1051
+ {
1052
+ "type": "text",
1053
+ "text": "For the ShapeNet point cloud data, we perform data augmentation using a similar scheme to what we did for the previous experiments, we randomly translate, rotate and add jitter to the $( x , y , z )$ coordinates of the point cloud data. We follow the same scheme detailed in FoldingNet (Yang et al., 2018). ",
1054
+ "bbox": [
1055
+ 174,
1056
+ 320,
1057
+ 825,
1058
+ 376
1059
+ ],
1060
+ "page_idx": 9
1061
+ },
1062
+ {
1063
+ "type": "text",
1064
+ "text": "We train both the FoldingNet turned in a vae and the CR-FoldingNet with these augmentations. To train CR-FoldingNet, we additionally apply the consistency regularization term as proposed in Equation 3. The results on the validation set for reconstruction (as measured by Chamfer distance) and accuracy are shown in Table 9. ",
1065
+ "bbox": [
1066
+ 174,
1067
+ 387,
1068
+ 825,
1069
+ 443
1070
+ ],
1071
+ "page_idx": 9
1072
+ },
1073
+ {
1074
+ "type": "text",
1075
+ "text": "We also visualize the point clouds reconstructions and interpolations between 3 different object classes using a CR-FoldingNet in Figure 2. We perform 4 interpolation steps for each of the objects, to highlight the interpretable learned latent space. Additionally, we perform the same interpolation on the baseline FoldingNet model. We show these interpolations in the appendix. ",
1076
+ "bbox": [
1077
+ 174,
1078
+ 455,
1079
+ 825,
1080
+ 510
1081
+ ],
1082
+ "page_idx": 9
1083
+ },
1084
+ {
1085
+ "type": "text",
1086
+ "text": "5 Conclusion ",
1087
+ "text_level": 1,
1088
+ "bbox": [
1089
+ 174,
1090
+ 529,
1091
+ 299,
1092
+ 545
1093
+ ],
1094
+ "page_idx": 9
1095
+ },
1096
+ {
1097
+ "type": "text",
1098
+ "text": "We proposed a simple regularization technique to constrain encoders of vaes to learn similar latent representations for an image and a semantics-preserving transformation of the image. The idea consists in maximizing the likelihood of the pair of images while minimizing the kl divergence between the variational distribution induced by the encoder when conditioning on the image on one hand, and its transformation, on the other hand. We applied this technique to several vae variants on several datasets, including a 3D dataset. We found it always leads to better learned representations and also better generalization to unseen data. In particular, when applied to the nvae, the regularization technique we developed in this paper yields state-of-the-art results on mnist and cifar-10. ",
1099
+ "bbox": [
1100
+ 174,
1101
+ 556,
1102
+ 825,
1103
+ 667
1104
+ ],
1105
+ "page_idx": 9
1106
+ },
1107
+ {
1108
+ "type": "text",
1109
+ "text": "Broader Impact ",
1110
+ "text_level": 1,
1111
+ "bbox": [
1112
+ 174,
1113
+ 685,
1114
+ 310,
1115
+ 702
1116
+ ],
1117
+ "page_idx": 9
1118
+ },
1119
+ {
1120
+ "type": "text",
1121
+ "text": "In this paper, we propose a simple method that performs a KL-based consistency regularization scheme using data augmentation for vaes. The broader impact of the study includes practical applications such as graphics and computer vision applications. The method we propose improves the learned representations of vaes, and as an artifact, also improves their generalization to unseen data. In this regard, any implications of vaes also apply to this work. For example, the generative model fit by a vae may be used to generate artificial data such as images, text, and 3D objects. Biases may arise as a result of poor data selection. Furthermore, text generated from generative systems may amplify harmful speech contained in the data. However, the method we propose can also improve the performance of vaes when used in certain practical domains as we discussed in the introduction of the paper. ",
1122
+ "bbox": [
1123
+ 174,
1124
+ 712,
1125
+ 825,
1126
+ 852
1127
+ ],
1128
+ "page_idx": 9
1129
+ },
1130
+ {
1131
+ "type": "text",
1132
+ "text": "6 Acknowledgements ",
1133
+ "text_level": 1,
1134
+ "bbox": [
1135
+ 176,
1136
+ 869,
1137
+ 364,
1138
+ 886
1139
+ ],
1140
+ "page_idx": 9
1141
+ },
1142
+ {
1143
+ "type": "text",
1144
+ "text": "We thank Kevin Murphy, Ben Poole, and Augustus Odena for their comments on this work. ",
1145
+ "bbox": [
1146
+ 169,
1147
+ 897,
1148
+ 769,
1149
+ 911
1150
+ ],
1151
+ "page_idx": 9
1152
+ },
1153
+ {
1154
+ "type": "text",
1155
+ "text": "References ",
1156
+ "text_level": 1,
1157
+ "bbox": [
1158
+ 174,
1159
+ 90,
1160
+ 266,
1161
+ 106
1162
+ ],
1163
+ "page_idx": 10
1164
+ },
1165
+ {
1166
+ "type": "text",
1167
+ "text": "Achille, A., Eccles, T., Matthey, L., Burgess, C. P., Watters, N., Lerchner, A., and Higgins, I. Life-long disentangled representation learning with cross-domain latent homologies. arXiv preprint arXiv:1808.06508, 2018. \nAn, J. and Cho, S. Variational autoencoder based anomaly detection using reconstruction probability. Special Lecture on IE, 2(1), 2015. \nBachman, P., Alsharif, O., and Precup, D. Learning with pseudo-ensembles. In Advances in neural information processing systems, pp. 3365–3373, 2014. \nBowman, S. R., Vilnis, L., Vinyals, O., Dai, A. M., Jozefowicz, R., and Bengio, S. Generating sentences from a continuous space. arXiv preprint arXiv:1511.06349, 2015. \nBurda, Y., Grosse, R., and Salakhutdinov, R. Importance weighted autoencoders. arXiv preprint arXiv:1509.00519, 2015. \nChang, A. X., Funkhouser, T., Guibas, L., Hanrahan, P., Huang, Q., Li, Z., Savarese, S., Savva, M., Song, S., Su, H., et al. Shapenet: An information-rich 3d model repository. arXiv preprint arXiv:1512.03012, 2015. \nDieng, A. B., Kim, Y., Rush, A. M., and Blei, D. M. Avoiding latent variable collapse with generative skip models. arXiv preprint arXiv:1807.04863, 2018. \nDieng, A. B., Ruiz, F. J., and Blei, D. M. Topic modeling in embedding spaces. arXiv preprint arXiv:1907.04907, 2019. \nFang, L., Li, C., Gao, J., Dong, W., and Chen, C. Implicit deep latent variable models for text generation. arXiv preprint arXiv:1908.11527, 2019. \nFu, H., Li, C., Liu, X., Gao, J., Celikyilmaz, A., and Carin, L. Cyclical annealing schedule: A simple approach to mitigating kl vanishing. arXiv preprint arXiv:1903.10145, 2019. \nGoodfellow, I., Pouget-Abadie, J., Mirza, M., Xu, B., Warde-Farley, D., Ozair, S., Courville, A., and Bengio, Y. Generative adversarial nets. In Advances in neural information processing systems, pp. 2672–2680, 2014. \nGregor, K., Danihelka, I., Graves, A., Rezende, D. J., and Wierstra, D. Draw: A recurrent neural network for image generation. arXiv preprint arXiv:1502.04623, 2015. \nHadjeres, G., Nielsen, F., and Pachet, F. Glsr-vae: Geodesic latent space regularization for variational autoencoder architectures. In 2017 IEEE Symposium Series on Computational Intelligence (SSCI), pp. 1–7. IEEE, 2017. \nHe, J., Spokoyny, D., Neubig, G., and Berg-Kirkpatrick, T. Lagging inference networks and posterior collapse in variational autoencoders. arXiv preprint arXiv:1901.05534, 2019. \nHiggins, I., Matthey, L., Pal, A., Burgess, C., Glorot, X., Botvinick, M., Mohamed, S., and Lerchner, A. beta-vae: Learning basic visual concepts with a constrained variational framework. Iclr, 2(5):6, 2017. \nJun, H., Child, R., Chen, M., Schulman, J., Ramesh, A., Radford, A., and Sutskever, I. Distribution augmentation for generative modeling. In International Conference on Machine Learning, pp. 5006–5019. PMLR, 2020. \nKim, Y., Wiseman, S., Miller, A. C., Sontag, D., and Rush, A. M. Semi-amortized variational autoencoders. arXiv preprint arXiv:1802.02550, 2018. \nKingma, D. P. and Ba, J. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980, 2014. \nKingma, D. P. and Welling, M. Auto-encoding variational bayes. arXiv preprint arXiv:1312.6114, 2013. \nKingma, D. P., Rezende, D. J., Mohamed, S., and Welling, M. Semi-supervised learning with deep generative models. arXiv preprint arXiv:1406.5298, 2014. \nKostrikov, I., Yarats, D., and Fergus, R. Image augmentation is all you need: Regularizing deep reinforcement learning from pixels. arXiv preprint arXiv:2004.13649, 2020. \nKrizhevsky, A., Hinton, G., et al. Learning multiple layers of features from tiny images. 2009. \nLaine, S. and Aila, T. Temporal ensembling for semi-supervised learning. arXiv preprint arXiv:1610.02242, 2016. \nLake, B., Salakhutdinov, R., Gross, J., and Tenenbaum, J. One shot learning of simple visual concepts. In Proceedings of the annual meeting of the cognitive science society, volume 33, 2011. \nLeCun, Y. The mnist database of handwritten digits. http://yann. lecun. com/exdb/mnist/, 1998. \nLiang, D., Krishnan, R. G., Hoffman, M. D., and Jebara, T. Variational autoencoders for collaborative filtering. In Proceedings of the 2018 World Wide Web Conference, pp. 689–698, 2018. \nLiu, Z., Luo, P., Wang, X., and Tang, X. Large-scale celebfaces attributes (celeba) dataset. Retrieved August, 15: 2018, 2018. \nMiao, Y., Yu, L., and Blunsom, P. Neural variational inference for text processing. In International conference on machine learning, pp. 1727–1736, 2016. \nMiyato, T., Maeda, S.-i., Ishii, S., and Koyama, M. Virtual adversarial training: a regularization method for supervised and semi-supervised learning. IEEE transactions on pattern analysis and machine intelligence, 2018. \nOsada, G., Ahsan, B., Bora, R. P., and Nishide, T. Regularization with latent space virtual adversarial training. In European Conference on Computer Vision, pp. 565–581. Springer, 2020. \nRezende, D. J., Mohamed, S., and Wierstra, D. Stochastic backpropagation and approximate inference in deep generative models. arXiv preprint arXiv:1401.4082, 2014. \nRifai, S., Vincent, P., Muller, X., Glorot, X., and Bengio, Y. Contractive auto-encoders: Explicit invariance during feature extraction. 2011. \nRoberts, A., Engel, J., Raffel, C., Hawthorne, C., and Eck, D. A hierarchical latent vector model for learning long-term structure in music. arXiv preprint arXiv:1803.05428, 2018. \nSajjadi, M., Javanmardi, M., and Tasdizen, T. Regularization with stochastic transformations and perturbations for deep semi-supervised learning. In NeurIPS, 2016. \nSchroff, F., Kalenichenko, D., and Philbin, J. Facenet: A unified embedding for face recognition and clustering. In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 815–823, 2015. \nSinha, S. and Garg, A. S4rl: Surprisingly simple self-supervision for offline reinforcement learning. arXiv preprint arXiv:2103.06326, 2021. \nSinha, S., Ebrahimi, S., and Darrell, T. Variational adversarial active learning. In Proceedings of the IEEE International Conference on Computer Vision, pp. 5972–5981, 2019. \nTolstikhin, I., Bousquet, O., Gelly, S., and Schoelkopf, B. Wasserstein auto-encoders. arXiv preprint arXiv:1711.01558, 2017. \nVahdat, A. and Kautz, J. Nvae: A deep hierarchical variational autoencoder. arXiv preprint arXiv:2007.03898, 2020. \nVincent, P., Larochelle, H., Bengio, Y., and Manzagol, P.-A. Extracting and composing robust features with denoising autoencoders. In Proceedings of the 25th international conference on Machine learning, pp. 1096–1103, 2008. \nVincent, P., Larochelle, H., Lajoie, I., Bengio, Y., and Manzagol, P.-A. Stacked denoising autoencoders: Learning useful representations in a deep network with a local denoising criterion. Journal of machine learning research, 11(Dec):3371–3408, 2010. \nWalker, J., Doersch, C., Gupta, A., and Hebert, M. An uncertain future: Forecasting from static images using variational autoencoders. In European Conference on Computer Vision, pp. 835–851. Springer, 2016. \nWei, X., Gong, B., Liu, Z., Lu, W., and Wang, L. Improving the improved training of wasserstein gans: A consistency term and its dual effect. arXiv preprint arXiv:1803.01541, 2018. \nXie, Q., Dai, Z., Hovy, E., Luong, M.-T., and Le, Q. V. Unsupervised data augmentation for consistency training. arXiv preprint arXiv:1904.12848, 2019. \nYang, Y., Feng, C., Shen, Y., and Tian, D. Foldingnet: Point cloud auto-encoder via deep grid deformation. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition, pp. 206–215, 2018. \nZhang, H., Zhang, Z., Odena, A., and Lee, H. Consistency regularization for generative adversarial networks. 2020. \nZimmerer, D., Kohl, S. A., Petersen, J., Isensee, F., and Maier-Hein, K. H. Context-encoding variational autoencoder for unsupervised anomaly detection. arXiv preprint arXiv:1812.05941, 2018. ",
1168
+ "bbox": [
1169
+ 171,
1170
+ 109,
1171
+ 828,
1172
+ 914
1173
+ ],
1174
+ "page_idx": 10
1175
+ },
1176
+ {
1177
+ "type": "text",
1178
+ "text": "",
1179
+ "bbox": [
1180
+ 171,
1181
+ 60,
1182
+ 828,
1183
+ 914
1184
+ ],
1185
+ "page_idx": 11
1186
+ }
1187
+ ]
parse/train/djbC2A4uTHP/djbC2A4uTHP_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/djbC2A4uTHP/djbC2A4uTHP_model.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/ryghZJBKPS/ryghZJBKPS.md ADDED
@@ -0,0 +1,422 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # DEEP BATCH ACTIVE LEARNING BY DIVERSE, UNCERTAIN GRADIENT LOWER BOUNDS
2
+
3
+ Jordan T. Ash Princeton University
4
+
5
+ Chicheng Zhang University of Arizona
6
+
7
+ Akshay Krishnamurthy Microsoft Research NYC
8
+
9
+ John Langford Microsoft Research NYC
10
+
11
+ Alekh Agarwal Microsoft Research Redmond
12
+
13
+ # ABSTRACT
14
+
15
+ We design a new algorithm for batch active learning with deep neural network models. Our algorithm, Batch Active learning by Diverse Gradient Embeddings (BADGE), samples groups of points that are disparate and high magnitude when represented in a hallucinated gradient space, a strategy designed to incorporate both predictive uncertainty and sample diversity into every selected batch. Crucially, BADGE trades off between uncertainty and diversity without requiring any hand-tuned hyperparameters. While other approaches sometimes succeed for particular batch sizes or architectures, BADGE consistently performs as well or better, making it a useful option for real world active learning problems.
16
+
17
+ # 1 INTRODUCTION
18
+
19
+ In recent years, deep neural networks have produced state-of-the-art results on a variety of important supervised learning tasks. However, many of these successes have been limited to domains where large amounts of labeled data are available. A promising approach for minimizing labeling effort is active learning, a learning protocol where labels can be requested by the algorithm in a sequential, feedback-driven fashion. Active learning algorithms aim to identify and label only maximally-informative samples, so that a high-performing classifier can be trained with minimal labeling effort. As such, a robust active learning algorithm for deep neural networks may considerably expand the domains in which these models are applicable.
20
+
21
+ How should we design a practical, general-purpose, label-efficient active learning algorithm for deep neural networks? Theory for active learning suggests a version-space-based approach (Cohn et al., 1994; Balcan et al., 2006), which explicitly or implicitly maintains a set of plausible models, and queries examples for which these models make different predictions. But when using highly expressive models like neural networks, these algorithms degenerate to querying every example. Further, the computational overhead of training deep neural networks precludes approaches that update the model to best fit data after each label query, as is often done (exactly or approximately) for linear methods (Beygelzimer et al., 2010; Cesa-Bianchi et al., 2009). Unfortunately, the theory provides little guidance for these models.
22
+
23
+ One option is to use the network’s uncertainty to inform a query strategy, for example by labeling samples for which the model is least confident. In a batch setting, however, this creates a pathological scenario where data in the batch are nearly identical, a clear inefficiency. Remedying this issue, we could select samples to maximize batch diversity, but this might choose points that provide little new information to the model.
24
+
25
+ For these reasons, methods that exploit just uncertainty or diversity do not consistently work well across model architectures, batch sizes, or datasets. An algorithm that performs well when using a ResNet, for example, might perform poorly when using a multilayer perceptron. A diversity-based approach might work well when the batch size is very large, but poorly when the batch size is small. Further, what even constitutes a “large” or “small” batch size is largely a function of the statistical properties of the data in question. These weaknesses pose a major problem for real, practical batch active learning situations, where data are unfamiliar and potentially unstructured. There is no way to know which active learning algorithm is best to use.
26
+
27
+ Moreover, in a real active learning scenario, every change of hyperparameters typically causes the algorithm to label examples not chosen under other hyperparameters, provoking substantial labeling inefficiency. That is, hyperparameter sweeps in active learning can be label expensive. As a result, active learning algorithms need to “just work”, given fixed hyperparameters, to a greater extent than is typical for supervised learning.
28
+
29
+ Based on these observations, we design an approach which creates diverse batches of examples about which the current model is uncertain. We measure uncertainty as the gradient magnitude with respect to parameters in the final (output) layer, which is computed using the most likely label according to the model. To capture diversity, we collect a batch of examples where these gradients span a diverse set of directions. More specifically, we build up the batch of query points based on these hallucinated gradients using the $k { \mathrm { - M E A N S + + } }$ initialization (Arthur and Vassilvitskii, 2007), which simultaneously captures both the magnitude of a candidate gradient and its distance from previously included points in the batch. We name the resulting approach Batch Active learning by Diverse Gradient Embeddings (BADGE).
30
+
31
+ We show that BADGE is robust to architecture choice, batch size, and dataset, generally performing as well as or better than the best baseline across our experiments, which vary all of the aforementioned environmental conditions. We begin by introducing our notation and setting, followed by a description of the BADGE algorithm in Section 3 and experiments in Section 4. We defer our discussion of related work to Section 5.
32
+
33
+ # 2 NOTATION AND SETTING
34
+
35
+ Define $[ K ] : = \{ 1 , 2 , \dots , K \}$ . Denote by $\mathcal { X }$ the instance space and by $\mathcal { V }$ the label space. In this work we consider multiclass classification, so $\mathcal { V } = [ K ]$ . Denote by $D$ the distribution from which examples are drawn, by $D _ { \mathcal { X } }$ the unlabeled data distribution, and by $D _ { \mathcal { V } | \mathcal { X } }$ the conditional distribution over labels given examples. We consider the pool-based active learning setup, where the learner receives an unlabeled dataset $U$ sampled according to $D _ { \mathcal { X } }$ and can request labels sampled according to $D _ { \mathcal { Y } | \mathcal { X } }$ for any $x \in$ $U$ . We use $\mathbb { E } _ { D }$ to denote expectation under the data distribution $D$ . Given a classifier $h \ : \ \mathcal { X } \ \mathcal { Y }$ , which maps examples to labels, and a labeled example $( x , y )$ , we denote the $0 / 1$ error of $h$ on $( x , y )$ as $\ell _ { 0 1 } ( h ( x ) , \bar { y } ) = I ( \bar { h } ( x ) \neq y )$ . The performance of a classifier $h$ is measured by its expected $0 / 1$ error, i.e. $\begin{array} { r } { \mathbb { E } _ { D } [ \ell _ { 0 1 } ( h ( x ) , y ) ] = \operatorname* { P r } _ { ( x , y ) \sim D } ( h ( x ) \neq y ) } \end{array}$ . The goal of pool-based active learning is to find a classifier with a small expected $0 / 1$ error using as few label queries as possible. Given a set $S$ of labeled examples $( x , y )$ , where each $x \in S$ is picked from $U$ , followed by a label query, we use $\mathbb { E } _ { S }$ as the sample averages over $S$ .
36
+
37
+ In this paper, we consider classifiers $h$ parameterized by underlying neural networks $f$ of fixed architecture, with the weights in the network denoted by $\theta$ . We abbreviate the classifier with parameters $\theta$ as $h _ { \theta }$ since the architectures are fixed in any given context, and our classifiers take the form $h _ { \theta } ( x ) = \operatorname { a r g m a x } _ { y \in [ K ] } f ( x ; \theta ) _ { y }$ , where $f ( x ; \theta ) \in \mathbb { R } ^ { K }$ is a probability vector of scores assigned to candidate labels, given the example $x$ and parameters $\theta$ . We optimize the parameters by minimizing the cross-entropy loss $\mathbb { E } _ { S } [ \ell _ { \mathrm { C E } } ( f ( x ; \theta ) , y ) ]$ over the labeled examples, where $\begin{array} { r } { \ell _ { \mathrm { C E } } ( p , y ) = \sum _ { i = 1 } ^ { K } I ( y = i ) \ln 1 / p _ { i } = \ln { 1 / p _ { y } } } \end{array}$ .
38
+
39
+ Algorithm 1 BADGE: Batch Active learning by Diverse Gradient Embeddings
40
+
41
+ Require: Neural network $f ( x ; \theta )$ , unlabeled pool of examples $U$ , initial number of examples $M$ , number of iterations $T$ , number of examples in a batch $B$ .
42
+
43
+ 1: Labeled dataset $S \gets M$ examples drawn uniformly at random from $U$ together with queried labels.
44
+
45
+ Train an initial model $\theta _ { 1 }$ on $S$ by minimizing $\mathbb { E } _ { S } [ \dot { \ell _ { \mathrm { C E } } } ( f ( x ; \theta ) , y ) ]$ .
46
+
47
+ 4: For all examples $x$ in $U \backslash S$
48
+
49
+ 1. Compute its hypothetical label $\hat { y } ( x ) = h _ { \theta _ { t } } ( x )$ .
50
+ 2. Compute gradient embedding $\begin{array} { r } { g _ { x } = \frac { \partial } { \partial \theta _ { \mathrm { o u t } } } \ell _ { \mathrm { C E } } ( f ( x ; \theta ) , \hat { y } ( x ) ) | _ { \theta = \theta _ { t } } } \end{array}$ , where $\theta _ { \mathrm { o u t } }$ refers to parameters of the final (output) layer.
51
+ 5: Compute $S _ { t }$ , a random subset of $U \backslash S$ , using the $k { \mathrm { - M E A N S + + } }$ seeding algorithm on $\{ g _ { x } : x \in U \setminus S \}$ and query for their labels.
52
+ 6: $S \gets S \cup S _ { t }$ .
53
+ 7: Train a model $\theta _ { t + 1 }$ on $S$ by minimizing $\mathbb { E } _ { S } [ \ell _ { \mathrm { C E } } ( f ( x ; \theta ) , y ) ]$ .
54
+
55
+ 8: end for
56
+ 9: return Final model $\theta _ { T + 1 }$
57
+
58
+ # 3 ALGORITHM
59
+
60
+ BADGE, described in Algorithm 1, starts by drawing an initial set of $M$ examples uniformly at random from $U$ and asking for their labels. It then proceeds iteratively, performing two main computations at each step $t$ : a gradient embedding computation and a sampling computation. Specifically, at each step $t$ , for every $x$ in the pool $U$ , we compute the label ${ \hat { y } } ( x )$ preferred by the current model, and the gradient $g _ { x }$ of the loss on $( x , { \hat { y } } ( x ) )$ with respect to the parameters of the last layer of the network. Given these gradient embedding vectors $\{ g _ { x } : x \in U \}$ , BADGE selects a set of points by sampling via the $k$ -MEAN ${ \hphantom { 0 } } _ { \mathrm { S } + + }$ initialization scheme (Arthur and Vassilvitskii, 2007). The algorithm queries the labels of these examples, retrains the model, and repeats.
61
+
62
+ We now describe the main computations — the embedding and sampling steps — in more detail.
63
+
64
+ The gradient embedding. Since deep neural networks are optimized using gradient-based methods, we capture uncertainty about an example through the lens of gradients. In particular, we consider the model uncertain about an example if knowing the label induces a large gradient of the loss with respect to the model parameters and hence a large update to the model. A difficulty with this reasoning is that we need to know the label to compute the gradient. As a proxy, we compute the gradient as if the model’s current prediction on the example is the true label. We show in Proposition 1 that, assuming a common structure satisfied by most natural neural networks, the gradient norm with respect to the last layer using this label provides a lower bound on the gradient norm induced by any other label. In addition, under that assumption, the length of this hypothetical gradient vector captures the uncertainty of the model on the example: if the model is highly certain about the example’s label, then the example’s gradient embedding will have a small norm, and vice versa for samples where the model is uncertain (see example below). Thus, the gradient embedding conveys information both about the model’s uncertainty and potential update direction upon receiving a label at an example.
65
+
66
+ The sampling step. We want the newly-acquired labeled samples to induce large and diverse changes to the model. To this end, we want the selection procedure to favor both sample magnitude and batch diversity. Specifically, we want to avoid the pathology of, for example, selecting a batch of $k$ similar samples where even just a single label could alleviate our uncertainty on all remaining $\left( k - 1 \right)$ samples.
67
+
68
+ A natural way of making this selection without introducing additional hyperparameters is to sample from a $k$ -Determinantal Point Process ( $k$ -DPP; (Kulesza and Taskar, 2011)). That is, to select a batch of $k$ points with probability proportional to the determinant of their Gram matrix. Recently, Derezinski and Warmuth´ (2018) showed that in experimental design for least square linear regression settings, learning from samples drawn from a $k$ -DPP can have much smaller mean square prediction error than learning from iid samples. In this process, when the batch size is very low, the selection will naturally favor points with a large length, which corresponds to uncertainty in our space. When the batch size is large, the sampler focuses more on diversity because linear independence, which is more difficult to achieve for large $k$ , is required to make the Gram determinant non-zero.
69
+
70
+ ![](images/3fe9bade8f08ff05364a6d8e2a7baee936a987903dffc50b0cac6374c5710223.jpg)
71
+ Figure 1: Left and center: Learning curves for $k { \mathrm { - M E A N S + + } }$ and $k$ -DPP sampling with gradient embeddings for different scenarios. The performance of the two sampling approaches nearly perfectly overlaps. Right: A run time comparison (seconds) corresponding to the middle scenario. Each line is the average over five independent experiments. Standard errors are shown by shaded regions.
72
+
73
+ Unfortunately, sampling from a $k$ -DPP is not trivial. Many sampling algorithms (Kang, 2013; Anari et al., 2016) rely on MCMC, where mixing time poses a significant computational hurdle. The state-of-the-art algorithm of Derezinski (2018) has a high-order polynomial running time in the batch size and the embedding ´ dimension. To overcome this computational hurdle, we suggest instead sampling using the $k { \mathrm { - M E A N S + + } }$ seeding algorithm (Arthur and Vassilvitskii, 2007), originally made to produce a good initialization for $k$ -means clustering. $k { \mathrm { - M E A N S + + } }$ seeding selects centroids by iteratively sampling points in proportion to their squared distances from the nearest centroid that has already been chosen, which, like a $k$ -DPP, tends to select a diverse batch of high-magnitude samples. For completeness, we give a formal description of the $k$ -MEA $\mathrm { J } S + +$ seeding algorithm in Appendix A.
74
+
75
+ Example: multiclass classification with softmax activations. Consider a neural network $f$ where the last nonlinearity is a softmax, i.e. $\sigma ( z ) _ { i } = e ^ { z _ { i } } / { \sum _ { j = 1 } ^ { K } e ^ { z _ { j } } }$ . Specifically, $f$ is parametrized by $\theta = ( W , V )$ , where $\theta _ { \mathrm { o u t } } = W = ( W _ { 1 } , \ldots , W _ { K } ) ^ { \top } \in \mathbb { R } ^ { K \times d }$ are the weights of the last layer, and $V$ consists of weights of all previous layers. This means that $f ( x ; \theta ) = \sigma ( W \cdot \bar { z } ( x ; V ) )$ , where $z$ is the nonlinear function that maps an input $x$ to the output of the network’s penultimate layer. Let us fix an unlabeled sample $x$ and define $p _ { i } = f ( x ; \theta ) _ { i }$ . With this notation, we have
76
+
77
+ $$
78
+ \ell _ { \mathrm { { C E } } } ( f ( x ; \theta ) , y ) = \ln \left( \sum _ { j = 1 } ^ { K } e ^ { W _ { j } \cdot z ( x ; V ) } \right) - W _ { y } \cdot z ( x ; V ) .
79
+ $$
80
+
81
+ Define $\begin{array} { r } { g _ { x } ^ { y } = \frac { \partial } { \partial W } \ell _ { \mathrm { C E } } ( f ( x ; \theta ) , y ) } \end{array}$ for a label $y$ and $g _ { x } = g _ { x } ^ { \hat { y } }$ as the gradient embedding in our algorithm, where ${ \hat { y } } = \operatorname { a r g m a x } _ { i \in [ K ] } p _ { i }$ . Then the $i$ -th block of $g _ { x }$ (i.e. the gradients corresponding to label $i$ ) is
82
+
83
+ $$
84
+ ( g _ { x } ) _ { i } = \frac { \partial } { \partial W _ { i } } \ell _ { \mathrm { C E } } ( f ( x ; \theta ) , \hat { y } ) = ( p _ { i } - I ( \hat { y } = i ) ) z ( x ; V ) .
85
+ $$
86
+
87
+ Based on this expression, we can make the following observations:
88
+
89
+ 1. Each block of $g _ { x }$ is a scaling of $z ( x ; V )$ , which is the output of the penultimate layer of the network. In this respect, $g _ { x }$ captures $x$ ’s representation information similar to that of Sener and Savarese (2018).
90
+
91
+ 2. Proposition 1 below shows that the norm of $g _ { x }$ is a lower bound on the norm of the loss gradient induced by the example with true label $y$ with respect to the weights in the last layer, that is $\| g _ { x } \| \leq \| \dot { g } _ { x } ^ { y } \|$ . This suggests that the norm of $g _ { x }$ conservatively estimates the example’s influence on the current model.
92
+
93
+ 3. If the current model $\theta$ is highly confident about $x$ , i.e. vector $p$ is skewed towards a standard basis vector $e _ { j }$ , then $\hat { y } = j$ , and vector $( p _ { i } - I ( \hat { y } = i ) ) _ { i = 1 } ^ { K }$ has a small length. Therefore, $g _ { x }$ has a small length as well. Such high-confidence examples tend to have gradient embeddings of small magnitude, which are unlikely to be repeatedly selected by $k { \mathrm { - M E A N S + + } }$ at iteration $t$ .
94
+
95
+ Proposition 1. For all $y \in \{ 1 , \ldots , K \}$ , let $\begin{array} { r } { g _ { x } ^ { y } = \frac { \partial } { \partial W } \ell _ { \mathrm { C E } } ( f ( x ; \theta ) , y ) } \end{array}$ . Then
96
+
97
+ $$
98
+ \| g _ { x } ^ { y } \| ^ { 2 } = \Big ( \sum _ { i = 1 } ^ { K } p _ { i } ^ { 2 } + 1 - 2 p _ { y } \Big ) \| z ( x ; V ) \| ^ { 2 } .
99
+ $$
100
+
101
+ Consequently, ${ \hat { y } } = \operatorname { a r g m i n } _ { y \in [ K ] } \left\| g _ { x } ^ { y } \right\|$ .
102
+
103
+ Proof. Observe that by Equation (1),
104
+
105
+ $$
106
+ \| g _ { x } ^ { y } \| ^ { 2 } = \sum _ { i = 1 } ^ { K } \left( p _ { i } - I ( y = i ) \right) ^ { 2 } \| z ( x ; V ) \| ^ { 2 } = \Big ( \sum _ { i = 1 } ^ { K } p _ { i } ^ { 2 } + 1 - 2 p _ { y } \Big ) \| z ( x ; V ) \| ^ { 2 } .
107
+ $$
108
+
109
+ The second claim follows from the fact that yˆ = argmaxy∈[K] py.
110
+
111
+ This simple sampler tends to produce diverse batches similar to a $k$ -DPP. As shown in Figure 1, switching between the two samplers does not affect the active learner’s statistical performance but greatly improves its computational performance. Appendix G compares run time and test accuracy for both $k$ -MEANS $^ { + + }$ and $k$ -DPP based sampling based on the gradient embeddings of the unlabeled examples.
112
+
113
+ Figure 2 illustrates the batch diversity and average gradient magnitude per selected batch for a variety of sampling strategies. As expected, both $k$ -DPPs and $k { \mathrm { - M E A N S + + } }$ tend to select samples that are diverse (as measured by the magnitude of their Gram determinant) and high magnitude. Other samplers, such as furthest-first traversal for $k$ -Center clustering (FF- $k$ -CENTER), do not seem to have this property. The FF- $k$ -CENTER algorithm is the sampling choice of the CORESET approach to active learning, which we describe in the proceeding section (Sener and Savarese, 2018). Appendix F discusses diversity with respect to uncertainty-based approaches.
114
+
115
+ Appendix B provides further justification for why BADGE yields better updates than vanilla uncertainty sampling in the special case of binary logistic regression $K = 2$ and $z ( x ; V ) = x $ ).
116
+
117
+ # 4 EXPERIMENTS
118
+
119
+ We evaluate the performance of BADGE against several algorithms from the literature. In our experiments, we seek to answer the following question: How robust are the learning algorithms to choices of neural network architecture, batch size, and dataset?
120
+
121
+ To ensure a comprehensive comparison among all algorithms, we evaluate them in a batch-mode active learning setup with $M = 1 0 0$ being the number of initial random labeled examples and batch size $B$ varying from $\{ 1 0 0 , 1 0 0 0 , 1 0 0 0 0 \}$ . The following is a list of the baseline algorithms evaluated; the first performs representative sampling, the next three are uncertainty based, the fifth is a hybrid of representative and uncertainty-based approaches, and the last is traditional supervised learning.
122
+
123
+ ![](images/e9edd9bc4085eb347e0355361c980da855565eadfb3c1c4c32469cc726e95c60.jpg)
124
+ Figure 2: A comparison of batch selection algorithms using our gradient embedding. Left and center: Plots showing the log determinant of the Gram matrix of the selected batch of gradient embeddings as learning progresses. Right: The average embedding magnitude (a measurement of predictive uncertainty) in the selected batch. The FF- $k$ -CENTER sampler finds points that are not as diverse or high-magnitude as other samplers. Notice also that $k { \mathrm { - M E A N S + + } }$ tends to actually select samples that are both more diverse and higher-magnitude than a $k$ -DPP, a potential pathology of the $k$ -DPP’s degree of stochastisity. Standard errors are shown by shaded regions.
125
+
126
+ 1. CORESET: A diversity-based approach using coreset selection. The embedding of each example is computed by the network’s penultimate layer and the samples at each round are selected using a greedy furthest-first traversal conditioned on all labeled examples (Sener and Savarese, 2018).
127
+ 2. CONF (Confidence Sampling): An uncertainty-based active learning algorithm that selects $B$ examples with smallest predicted class probability, $\operatorname* { m a x } _ { i = 1 } ^ { K } f ( x ; \theta ) _ { i }$ (e.g. Wang and Shang, 2014).
128
+ 3. MARG (Margin Sampling): An uncertainty-based active learning algorithm that selects the bottom $B$ examples sorted according to the example’s multiclass margin, defined as $f ( x ; \theta ) _ { \hat { y } } - f ( x ; \theta ) _ { y ^ { \prime } }$ , where $\hat { y }$ and $y ^ { \prime }$ are the indices of the largest and second largest entries of $f ( x ; \theta )$ (Roth and Small, 2006).
129
+ 4. ENTROPY: An uncertainty-based active learning algorithm that selects the top $B$ examples according to the entropy of the example’s predictive class probability distribution, defined as $H ( ( f ( x ; \theta ) _ { y } ) _ { y = 1 } ^ { K } )$ , where $\begin{array} { r } { H ( p ) = \sum _ { i = 1 } ^ { K ^ { - } } p _ { i } \ln ^ { - } \Bigr / p _ { i } } \end{array}$ (Wang and Shang, 2014).
130
+ 5. ALBL (Active Learning by Learning): A bandit-style meta-active learning algorithm that selects between CORESET and CONF at every round (Hsu and Lin, 2015).
131
+ 6. RAND: The naive baseline of randomly selecting $k$ examples to query at each round.
132
+
133
+ We consider three neural network architectures: a two-layer Perceptron with ReLU activations (MLP), an 18-layer convolutional ResNet (He et al., 2016), and an 11-layer VGG network (Simonyan and Zisserman, 2014). We evaluate our algorithms using three image datasets, SVHN (Netzer et al., 2011), CIFAR10 (Krizhevsky, 2009) and MNIST (LeCun et al., 1998) 1, and four non-image datasets from the OpenML repository (#6, #155, #156, and #184). 2 We study each situation with 7 active learning algorithms, including BADGE, making for 231 total experiments.
134
+
135
+ For the image datasets, the embedding dimensionality in the MLP is 256. For the OpenML datasets, the embedding dimensionality of the MLP is 1024, as more capacity helps the model fit training data. We fit models using cross-entropy loss and the Adam variant of SGD until training accuracy exceeds $9 9 \%$ . We use a learning rate of 0.001 for image data and of 0.0001 for non-image data. We avoid warm starting and retrain models from scratch every time new samples are queried (Ash and Adams, 2019). All experiments are repeated five times. No learning rate schedules or data augmentation are used. Baselines use implementations from the libact library (Yang et al., 2017). All models are trained in PyTorch (Paszke et al., 2017).
136
+
137
+ ![](images/862b919b13024e0ae4ccf8ea1350510ffaca7bdbca2409f37db62423dba2128a.jpg)
138
+ Figure 3: Active learning test accuracy versus the number of total labeled samples for a range of conditions. Standard errors are shown by shaded regions.
139
+
140
+ Learning curves. Here we show examples of learning curves that highlight some of the phenomena we observe related to the fragility of active learning algorithms with respect to batch size, architecture, and dataset.
141
+
142
+ Often, we see that in early rounds of training, it is better to do diversity sampling, and later in training, it is better to do uncertainty sampling. This kind of event is demonstrated in Figure 3a, which shows CORESET outperforming confidence-based methods at first, but then doing worse than these methods later on.
143
+
144
+ In this figure, BADGE performs as well as diversity sampling when that strategy does best, and as well as uncertainty sampling once those methods start outpacing CORESET. This suggests that BADGE is a good choice regardless of labeling budget.
145
+
146
+ Separately, we notice that diversity sampling only seems to work well when either the model has good architectural priors (inductive biases) built in, or when the data are easy to learn. Otherwise, penultimate layer representations are not meaningful, and diverse sampling can be deleterious. For this reason, CORESET often performs worse than random on sufficiently complex data when not using a convolutional network (Figure 3b). That is, the diversity induced by unconditional random sampling can often yield a batch that better represents the data. Even when batch size is large and the model has helpful inductive biases, the uncertainty information in BADGE can give it an advantage over pure diversity approaches (Figure 3c). Comprehensive plots of this kind, spanning architecture, dataset, and batch size are in Appendix C.
147
+
148
+ ![](images/b6198f1f5a9453b9546972ece2536fc119869120e54d54025af727432c2cd297.jpg)
149
+ Figure 4: A pairwise penalty matrix over all experiments. Element $P _ { i , j }$ corresponds roughly to the number of times algorithm $_ { i }$ outperforms algorithm $j$ . Column-wise averages at the bottom show overall performance (lower is better).
150
+
151
+ Pairwise comparisons. We next show a comprehensive pairwise comparison of algorithms over all datasets $( D )$ , batch sizes $( B )$ , model architectures $( A )$ , and label budgets $( L )$ . From the learning curves, it can be observed that when label budgets are large enough, all algorithms eventually reach similar performance, making the comparison between them uninteresting in the large sample limit. For this reason, for each combination of $( D , B , { \bar { A } } )$ , we select a set of labeling budgets $L$ where learning is still progressing. We experimented with three different batch sizes and eleven dataset-architecture pairs, making the total number of $( D , B , A )$ combinations $3 \times 1 1 = 3 3$ . Specifically, we compute $n _ { 0 }$ , the smallest number of labels where RAND’s accuracy reaches $9 9 \%$ of its final accuracy, and choose label budget $L$ from $\big \{ M + 2 ^ { m - 1 } B : m \in [ \lfloor \log ( ( n _ { 0 } - \dot { M } ) / B ) \rfloor ] \big \} .$ . The calculation of scores in the penalty matrix $P$ follows the following protocol: For each $( D , B , A , L )$ combination and each pair of algorithms $( i , j )$ , we have 5 test errors (one for each repeated run), $\big \{ e _ { i } ^ { 1 } , \ldots , e _ { i } ^ { 5 } \big \}$ and $\big \{ e _ { j } ^ { 1 } , \ldots , e _ { j } ^ { 5 } \big \}$ respectively. We compute the $t$ -score as $\begin{array} { c c l } { t } & { = } & { \sqrt { 5 } \hat { \mu } / \hat { \sigma } } \end{array}$ , where
152
+
153
+ $$
154
+ \hat { \mu } = \frac { 1 } { 5 } \sum _ { l = 1 } ^ { 5 } ( e _ { i } ^ { l } - e _ { j } ^ { l } ) , ~ \hat { \sigma } = \sqrt { \frac { 1 } { 4 } \sum _ { l = 1 } ^ { 5 } ( e _ { i } ^ { l } - e _ { j } ^ { l } - \hat { \mu } ) ^ { 2 } } .
155
+ $$
156
+
157
+ We use the two-sided $t$ -test to compare pairs of algorithms: algorithm $i$ is said to beat algorithm $j$ in this setting if $t ~ > ~ 2 . 7 7 6$ (the critical point of $p$ -value being 0.05), and similarly algorithm $j$ beats algorithm $i$ if $t < - 2 . 7 7 6$ . For each $( D , B , A )$ combination, suppose there are ${ } ^ { n } D , B , A$ different values of $L$ . Then, for each $L$ , if algorithm $i$ beats algorithm $j$ , we accumulate a penalty of $1 / n _ { D , B , A }$ to $P _ { i , j }$ ; otherwise, if algorithm $j$ beats algorithm $i$ , we accumulate a penalty of $1 / n _ { D , B , A }$ to $P _ { j , i }$ The choice of the penalty value $1 / n _ { D , B , A }$ is to ensure that every $( D , B , A )$ combination is assigned equal influence in the aggregated matrix. Therefore, the largest entry of $P$ is at most 33, the total number of $( D , B , A )$ combinations.
158
+
159
+ ![](images/8aea56706be71d726b40aab86de0168f6950ac1a8c1af6affb837d9b574a0b9b.jpg)
160
+ Figure 5: The cumulative distribution function of normalized errors for all acquisition functions.
161
+
162
+ Intuitively, each row $i$ indicates the number of settings in which algorithm $i$ beats other algorithms and each column $j$ indicates the number of settings in which algorithm $j$ is beaten by another algorithm.
163
+
164
+ The penalty matrix in Figure 4 summarizes all experiments, showing that BADGE generally outperforms baselines. Matrices grouped by batch size and architecture in Appendix D show a similar trend.
165
+
166
+ Cumulative distribution functions of normalized errors. For each $( D , B , A , L )$ combination, we compute the average error for each algorithm $i$ as $\textstyle { \bar { e } } _ { i } = { \frac { 1 } { 5 } } \sum _ { l = 1 } ^ { 5 } e _ { i } ^ { l }$ . To ensure that the errors of the algorithms are on the same scale in all settings, we compute the normalized error of every algorithm $i$ $\mathrm { n e } _ { i } = \bar { e } _ { i } / \bar { e } _ { r }$ , where $r$ is the index of the RAND algorithm. By definition, the normalized errors of the RAND algorithm are identically 1 in all settings. Like with penalty matrices, for each $( D , B , A )$ combination, we only consider a subset of $L$ values from the set $\big \{ M + 2 ^ { m - 1 } B : m \in [ \lfloor \log ( ( n _ { 0 } - M ) / B ) \rfloor ] \big \}$ . We assign a weight proportional to $1 / n _ { D , B , A }$ to each $( D , B , A , L )$ combination, where there are ${ } ^ { n } D , B , A$ different $L$ values for this combination of $( D , B , A )$ . We then plot the cumulative distribution functions (CDFs) of the normalized errors of all algorithms: for a value of $x$ , the $y$ value is the total weight of settings where the algorithm has normalized error at most $x$ ; in general, an algorithm that has a higher CDF value has better performance.
167
+
168
+ We plot the generated CDFs in Figures 5, 22 and 23. We can see from Figure 5 that BADGE has the best overall performance. In addition, from Figures 22 and 23 in Appendix E, we can conclude that when batch size is small (100 or 1000) or when an MLP is used, both BADGE and MARG perform best. However, in the regime when the batch size is large (10000), MARG’s performance degrades, while BADGE, ALBL and CORESET are the best performing approaches.
169
+
170
+ # 5 RELATED WORK
171
+
172
+ Active learning is a been well-studied problem (Settles, 2010; Dasgupta, 2011; Hanneke, 2014). There are two major strategies for active learning—representative sampling and uncertainty sampling.
173
+
174
+ Representative sampling algorithms select batches of unlabeled examples that are representative of the unlabeled set to ask for labels. It is based on the intuition that the sets of representative examples chosen, once labeled, can act as a surrogate for the full dataset. Consequently, performing loss minimization on the surrogate suffices to ensure a low error with respect to the full dataset. In the context of deep learning, Sener and Savarese (2018); Geifman and El-Yaniv (2017) select representative examples based on core-set construction, a fundamental problem in computational geometry. Inspired by generative adversarial learning, Gissin and Shalev-Shwartz (2019) select samples that are maximally indistinguishable from the pool of unlabeled examples.
175
+
176
+ On the other hand, uncertainty sampling is based on a different principle—to select new samples that maximally reduce the uncertainty the algorithm has on the target classifier. In the context of linear classification, Tong and Koller (2001); Schohn and Cohn (2000); Tur et al. (2005) propose uncertainty sampling methods that query examples that lie closest to the current decision boundary. Some uncertainty sampling approaches have theoretical guarantees on statistical consistency (Hanneke, 2014; Balcan et al., 2006). Such methods have also been recently generalized to deep learning. For instance, Gal et al. (2017) use Dropout as an approximation of the posterior of the model parameters, and develop information-based uncertainty reduction criteria; inspired by recent advances on adversarial examples generation, Ducoffe and Precioso (2018) use the distance between an example and one of its adversarial examples as an approximation of its distance to the current decision boundary, and uses it as the criterion of label queries. An ensemble of classifiers could also be used to effectively estimate uncertainty (Beluch et al., 2018).
177
+
178
+ There are several existing approaches that support a hybrid of representative sampling and uncertainty sampling. For example, Baram et al. (2004); Hsu and Lin (2015) present meta-active learning algorithms that can combine the advantages of different active learning algorithms. Inspired by expected loss minimization, Huang et al. (2010) develop label query criteria that balances between the representativeness and informativeness of examples. Another method for this is Active Learning by Learning (Hsu and Lin, 2015), which can select whether to exercise a diversity based algorithm or an uncertainty based algorithm at each round of training as a sequential decision process.
179
+
180
+ There is also a large body of literature on batch mode active learning, where the learner is asked to select a batch of samples within each round (Guo and Schuurmans, 2008; Wang and Ye, 2015; Chen and Krause; Wei et al., 2015; Kirsch et al., 2019). In these works, batch selection is often formulated as an optimization problem with objectives based on (upper bounds of) average log-likelihood, average squared loss, etc.
181
+
182
+ A different query criterion based on expected gradient length (EGL) has been proposed in the as well (Settles et al., 2008). In recent work, Huang et al. (2016) show that the EGL criterion is related to the $T$ -optimality criterion in experimental design. They further demonstrate that the samples selected by EGL are very different from those by entropy-based uncertainty criterion. Zhang et al. (2017a) use the EGL criterion in active sentence and document classification with CNNs. These approaches differ most substantially from BADGE in that they do not take into account the diversity of the examples queried within each batch.
183
+
184
+ There is a wide array of theoretical articles that focus on the related problem of adaptive subsampling for fully-labeled datasets in regression settings (Han et al., 2016; Wang et al., 2018; Ting and Brochu, 2018). Empirical studies of batch stochastic gradient descent also employ adaptive sampling to “emphasize” hard or representative examples (Zhang et al., 2017b; Chang et al., 2017). These works aim at reducing computation costs or finding a better local optimal solution, as opposed to reducing label costs. Nevertheless, our work is inspired by their sampling criteria, which also emphasize samples that induce large updates to the model.
185
+
186
+ As mentioned earlier, our sampling criterion has resemblance to sampling from $k$ -determinantal point processes (Kulesza and Taskar, 2011). Note that in multiclass classification settings, our gradient-based embedding of an example can be viewed as the outer product of the original embedding in the penultimate layer and a probability score vector that encodes the uncertainty information on this example (see Section 3). In this view, the penultimate layer embedding characterizes the diversity of each example, whereas the probability score vector characterizes the quality of each example. The $k$ -DPP is also a natural probabilistic tool for sampling that trades off between quality and diversity (See Kulesza et al., 2012, Section 3.1). We remark that concurrent to our work, Bıyık et al. (2019) develops $k$ -DPP based active learning algorithms based on this principle by explicitly designing diversity and uncertainty measures.
187
+
188
+ # 6 DISCUSSION
189
+
190
+ We have established that BADGE is empirically an effective deep active learning algorithm across different architectures and batch sizes, performing similar to or better than other active learning algorithms. A fundamental remaining question is: "Why?" While deep learning is notoriously difficult to analyze theoretically, there are several intuitively appealing properties of BADGE:
191
+
192
+ 1. The definition of uncertainty (a lower bound on the gradient magnitude of the last layer) guarantees some update of parameters. 2. It optimizes for diversity as well as uncertainty, eliminating a failure mode of choosing many identical uncertain examples in a batch, and does so without requiring any hyperparameters. 3. The randomization associated with the $k { \mathrm { - M E A N S + + } }$ initialization sampler implies that, even for adversarially constructed datasets, it eventually converges to a good solution.
193
+
194
+ The combination of these properties appears to generate the robustness that we observe empirically.
195
+
196
+ # REFERENCES
197
+
198
+ David Cohn, Les Atlas, and Richard Ladner. Improving generalization with active learning. Machine learning, 1994.
199
+ Maria-Florina Balcan, Alina Beygelzimer, and John Langford. Agnostic active learning. In International Conference on Machine Learning, 2006.
200
+ Alina Beygelzimer, Daniel J Hsu, John Langford, and Tong Zhang. Agnostic active learning without constraints. In Neural Information Processing Systems, 2010.
201
+ Nicolo Cesa-Bianchi, Claudio Gentile, and Francesco Orabona. Robust bounds for classification via selective sampling. In International Conference on Machine Learning, 2009.
202
+ David Arthur and Sergei Vassilvitskii. k-means $^ { + + }$ : The advantages of careful seeding. In ACM-SIAM symposium on Discrete algorithms, 2007.
203
+ Alex Kulesza and Ben Taskar. k-dpps: Fixed-size determinantal point processes. In International Conference on Machine Learning, 2011.
204
+ Michał Derezinski and Manfred K Warmuth. Reverse iterative volume sampling for linear regression. ´ The Journal of Machine Learning Research, 19(1), 2018.
205
+ Byungkon Kang. Fast determinantal point process sampling with application to clustering. In Neural Information Processing Systems, 2013.
206
+
207
+ Nima Anari, Shayan Oveis Gharan, and Alireza Rezaei. Monte carlo markov chain algorithms for sampling strongly rayleigh distributions and determinantal point processes. In Conference on Learning Theory, 2016.
208
+
209
+ Michał Derezinski. Fast determinantal point processes via distortion-free intermediate sampling. ´ arXiv preprint, 2018.
210
+
211
+ Ozan Sener and Silvio Savarese. Active learning for convolutional neural networks: A core-set approach. In International Conference on Learning Representations, 2018.
212
+
213
+ Dan Wang and Yi Shang. A new active labeling method for deep learning. In 2014 International joint conference on neural networks, 2014.
214
+
215
+ Dan Roth and Kevin Small. Margin-based active learning for structured output spaces. In European Conference on Machine Learning, 2006.
216
+
217
+ Wei-Ning Hsu and Hsuan-Tien Lin. Active learning by learning. In Association for the advancement of artificial intelligence, 2015.
218
+
219
+ Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016.
220
+
221
+ Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint, 2014.
222
+
223
+ Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011.
224
+
225
+ Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009.
226
+
227
+ Yann LeCun, Léon Bottou, Yoshua Bengio, Patrick Haffner, et al. Gradient-based learning applied to document recognition. IEEE, 1998.
228
+
229
+ Jordan T Ash and Ryan P Adams. On the difficulty of warm-starting neural network training. arXiv preprint, 2019.
230
+
231
+ Yao-Yuan Yang, Shao-Chuan Lee, Yu-An Chung, Tung-En Wu, Si-An Chen, and Hsuan-Tien Lin. libact: Pool-based active learning in python. arXiv preprint, 2017.
232
+
233
+ Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017.
234
+
235
+ Burr Settles. Active learning literature survey. University of Wisconsin, Madison, 2010.
236
+
237
+ Sanjoy Dasgupta. Two faces of active learning. Theoretical computer science, 2011.
238
+
239
+ Steve Hanneke. Theory of disagreement-based active learning. Foundations and Trends in Machine Learning, 2014.
240
+
241
+ Yonatan Geifman and Ran El-Yaniv. Deep active learning over the long tail. arXiv preprint, 2017.
242
+
243
+ Daniel Gissin and Shai Shalev-Shwartz. Discriminative active learning. arXiv preprint, 2019.
244
+
245
+ Simon Tong and Daphne Koller. Support vector machine active learning with applications to text classification. Journal of machine learning research, 2001.
246
+
247
+ Greg Schohn and David Cohn. Less is more: Active learning with support vector machines. In International Conference on Machine Learning, 2000.
248
+
249
+ Gokhan Tur, Dilek Hakkani-Tür, and Robert E Schapire. Combining active and semi-supervised learning for spoken language understanding. Speech Communication, 2005.
250
+
251
+ Yarin Gal, Riashat Islam, and Zoubin Ghahramani. Deep bayesian active learning with image data. In International Conference on Machine Learning, 2017.
252
+
253
+ Melanie Ducoffe and Frederic Precioso. Adversarial active learning for deep networks: a margin based approach. arXiv preprint, 2018.
254
+
255
+ William H Beluch, Tim Genewein, Andreas Nürnberger, and Jan M Köhler. The power of ensembles for active learning in image classification. In IEEE Conference on Computer Vision and Pattern Recognition, 2018.
256
+
257
+ Yoram Baram, Ran El Yaniv, and Kobi Luz. Online choice of active learning algorithms. Journal of Machine Learning Research, 2004.
258
+
259
+ Sheng-Jun Huang, Rong Jin, and Zhi-Hua Zhou. Active learning by querying informative and representative examples. In Neural Information Processing Systems, 2010.
260
+
261
+ Yuhong Guo and Dale Schuurmans. Discriminative batch mode active learning. In Neural Information Processing Systems, 2008.
262
+
263
+ Zheng Wang and Jieping Ye. Querying discriminative and representative samples for batch mode active learning. Transactions on Knowledge Discovery from Data, 2015.
264
+
265
+ Yuxin Chen and Andreas Krause. Near-optimal batch mode active learning and adaptive submodular optimization. In International Conference on Machine Learning.
266
+
267
+ Kai Wei, Rishabh Iyer, and Jeff Bilmes. Submodularity in data subset selection and active learning. In International Conference on Machine Learning, 2015.
268
+
269
+ Andreas Kirsch, Joost van Amersfoort, and Yarin Gal. Batchbald: Efficient and diverse batch acquisition for deep bayesian active learning. In Neural Information Processing Systems 32, 2019.
270
+
271
+ Burr Settles, Mark Craven, and Soumya Ray. Multiple-instance active learning. In Neural Information Processing Systems, 2008.
272
+
273
+ Jiaji Huang, Rewon Child, and Vinay Rao. Active learning for speech recognition: the power of gradients. arXiv preprint, 2016.
274
+
275
+ Ye Zhang, Matthew Lease, and Byron C Wallace. Active discriminative text representation learning. In AAAI Conference on Artificial Intelligence, 2017a.
276
+
277
+ Lei Han, Kean Ming Tan, Ting Yang, and Tong Zhang. Local uncertainty sampling for large-scale multi-class logistic regression. arXiv preprint, 2016.
278
+
279
+ HaiYing Wang, Rong Zhu, and Ping Ma. Optimal subsampling for large sample logistic regression. Journal of the American Statistical Association, 2018.
280
+
281
+ Daniel Ting and Eric Brochu. Optimal subsampling with influence functions. In Neural Information Processing Systems, 2018.
282
+
283
+ Cheng Zhang, Hedvig Kjellstrom, and Stephan Mandt. Determinantal point processes for mini-batch diversification. Uncertainty in Artificial Intelligence, 2017b.
284
+
285
+ Haw-Shiuan Chang, Erik Learned-Miller, and Andrew McCallum. Active bias: Training more accurate neural networks by emphasizing high variance samples. In Neural Information Processing Systems, 2017.
286
+
287
+ Alex Kulesza, Ben Taskar, et al. Determinantal point processes for machine learning. Foundations and Trends in Machine Learning, 2012.
288
+
289
+ Erdem Bıyık, Kenneth Wang, Nima Anari, and Dorsa Sadigh. Batch active learning using determinantal point processes. arXiv preprint, 2019.
290
+
291
+ Stephen Mussmann and Percy S Liang. Uncertainty sampling is preconditioned stochastic gradient descent on zero-one loss. In Neural Information Processing Systems, 2018.
292
+
293
+ # A THE $k$ -MEA ${ . N S + + }$ SEEDING ALGORITHM
294
+
295
+ Here we briefly review the $k { \mathrm { - M E A N S + + } }$ seeding algorithm by (Arthur and Vassilvitskii, 2007). Its basic idea is to perform sequential sampling of $k$ centers, where each new center is sampled from the ground set with probability proportional to the squared distance to its nearest center. It is shown in (Arthur and Vassilvitskii, 2007) that the set of centers returned is guaranteed to approximate the $k$ -means objective function in expectation, thus ensuring diversity.
296
+
297
+ # Algorithm 2 The $k$ -MEANS++ seeding algorithm (Arthur and Vassilvitskii, 2007)
298
+
299
+ Require: Ground set $G \subset \mathbb { R } ^ { d }$ , target size $k$ .
300
+ Ensure: Center set $C$ of size $k$ . $C _ { 1 } \gets \{ c _ { 1 } \}$ , where $c _ { 1 }$ is sampled uniformly at random from $G$ . for $t = 2 , \ldots , k$ : do Define $D _ { t } ( x ) : = \mathrm { m i n } _ { c \in C _ { t - 1 } } \| x - c \| _ { 2 }$ . $c _ { t } \gets$ Sample $x$ from $G$ with probability $\frac { D _ { t } ( x ) ^ { 2 } } { \sum _ { x \in G } D _ { t } ( x ) ^ { 2 } }$ . $C _ { t } \gets C _ { t - 1 } \cup \{ c _ { t } \} _ { }$ . end for return $C _ { k }$ .
301
+
302
+ # B BADGE FOR BINARY LOGISTIC REGRESSION
303
+
304
+ We consider instantiating BADGE for binary logistic regression, where $\mathcal { V } = \{ - 1 , + 1 \}$ . Given a linear classifier $w$ , we define the predictive probability of $w$ on $x$ as $p _ { w } ( y | x , \theta ) = \sigma ( y w \cdot x )$ , where $\begin{array} { r } { \sigma ( z ) = \frac { 1 } { 1 + e ^ { - z } } } \end{array}$ is the sigmoid funciton.
305
+
306
+ Recall that ${ \hat { y } } = { \hat { y } } ( x )$ is the hallucinated label:
307
+
308
+ $$
309
+ \hat { y } ( x ) = \left\{ { \begin{array} { l l } { + 1 , } & { p _ { w } ( + 1 | x , \theta ) > 1 / 2 , } \\ { - 1 , } & { p _ { w } ( + 1 | x , \theta ) \leq 1 / 2 . } \end{array} } \right.
310
+ $$
311
+
312
+ The binary logistic loss of classifier $w$ on example $( x , y )$ is defined as:
313
+
314
+ $$
315
+ \ell ( w , ( x , y ) ) = \ln ( 1 + \exp ( - y w \cdot x ) ) .
316
+ $$
317
+
318
+ Now, given model $w$ and example $x$ , we define $\begin{array} { r } { \hat { g } _ { x } = \frac { \partial } { \partial w } \ell ( w , ( x , \hat { y } ) ) = ( 1 - p _ { w } ( \hat { y } | x , \theta ) ) \cdot ( - \hat { y } \cdot x ) } \end{array}$ as the loss gradient induced by the example with hallucinated label, and $\begin{array} { r } { \tilde { g } _ { x } = \frac { \partial } { \partial w } \ell ( w , ( x , y ) ) = ( 1 - p _ { w } ( y | x , \theta ) ) \cdot ( - y \cdot x ) } \end{array}$ as the loss gradient induced by the example with true label.
319
+
320
+ ![](images/eb67dcecb5e582087261eb4ed09d95f125d1a62a5adfb0b8d0f0f0be6bba3e0a.jpg)
321
+ Figure 6: Full learning curves for OpenML #6 with MLP.
322
+
323
+ ![](images/1c591f31c495cb4e2c3d089926a4a9dcc80732c6e0a95a3492a7a4b106da884d.jpg)
324
+ Figure 7: Full learning curves for OpenML #155 with MLP.
325
+
326
+ Suppose that BADGE only selects examples from region $S _ { w } = \{ x : w \cdot x = 0 \}$ , then as $p _ { w } ( + 1 | x , \theta ) =$ $\begin{array} { r } { p _ { w } \big ( - 1 | x , \theta \big ) = \frac { 1 } { 2 } } \end{array}$ , we have that for all $x$ in $S _ { w }$ , $\hat { g } _ { x } = s _ { x } \cdot g _ { x }$ for some $s _ { x } \in \{ \pm 1 \}$ . This implies that, sampling from a DPP induced by ${ \hat { g } } _ { x }$ ’s is equivalent to sampling from a DPP induced by $g _ { x }$ ’s. It is noted in Mussmann and Liang (2018) that uncertainty sampling (i.e. sampling from $D _ { | S _ { w } }$ ) implicitly performs preconditioned stochastic gradient descent on the expected 0-1 loss. In addition, it has been shown that DPP sampling over gradients may reduce the variance of the mini-batch stochastic gradient updates (Zhang et al., 2017b); this suggests that BADGE, when restricted its sampling over low-margin regions $( S _ { w } )$ , improves over uncertainty sampling by collecting examples that together induce lower-variance updates on the gradient direction of expected 0-1 loss.
327
+
328
+ # C ALL LEARNING CURVES
329
+
330
+ We plot all learning curves (test accuracy as a function of the number of labeled example queried) in Figures 6 to 12. In addition, we zoom into regions of the learning curves that discriminates the performance of all algorithms in Figures 13 to 19.
331
+
332
+ # D PAIRWISE COMPARISONS OF ALGORITHMS
333
+
334
+ In addition to Figure 4 in the main text, we also provide penalty matrices (Figures 20 and 21), where the results are aggregated by conditioning on a fixed batch size (100, 1000 and 10000) or on a fixed neural network model (MLP, ResNet and VGG). For each penalty matrix, the parenthesized number in its title is the total number of $( D , B , A )$ combinations aggregated; as discussed in Section 4, this is also an upper bound on all its entries. It can be seen that uncertainty-based methods (e.g. MARG) perform well only in small batch size regimes (100) or when using MLP models; representative sampling based methods (e.g. CORESET) only perform well in large batch size regimes (10000) or when using ResNet or VGG models. In contrast, BADGE’s performance is competitive across all batch sizes and neural network models.
335
+
336
+ ![](images/d9030f407149623b5e1e3c6e2181cca01dc0f054d2cc7ee5b9e65e37b788430f.jpg)
337
+ Figure 8: Full learning curves for OpenML #156 with MLP.
338
+
339
+ ![](images/0dc915ff317f4bdacdb7591b36b371084cd4cbb9f1f0d4f07c652c08e046f8dd.jpg)
340
+ Figure 9: Full learning curves for OpenML #184 with MLP.
341
+
342
+ ![](images/021581459787c3b3df4ed9065c4342a96367bf511bc9af442888620fe9489f66.jpg)
343
+ Figure 10: Full learning curves for SVHN with MLP, ResNet and VGG.
344
+
345
+ ![](images/e8fe0e3b347610236751383630edb45029111c672cb94ecfd283ffc78dca523d.jpg)
346
+ Figure 11: Full learning curves for MNIST with MLP.
347
+
348
+ ![](images/a4a03ba238975dad7d4d9706c2fc6f8bf6ace30f7ad25c97337a95b53ba674be.jpg)
349
+ Figure 12: Full learning curves for CIFAR10 with MLP, ResNet and VGG.
350
+
351
+ ![](images/990f157de5f16287b5cc2739568242f27ae18014df01472d1d1c4978f90a5d0a.jpg)
352
+ Figure 13: Zoomed-in learning curves for OpenML $\# 6$ with MLP.
353
+
354
+ ![](images/d654ac52f0e8e7b4de997ddc93ec4e0f4ce9c1df3e103a48670fd2e5bf5edd73.jpg)
355
+ Figure 14: Zoomed-in learning curves for OpenML #155 with MLP.
356
+
357
+ ![](images/0f700512626eabdd7ba390eaa418d36818628e85542d87e27533dd250077d27a.jpg)
358
+ Figure 15: Zoomed-in learning curves for OpenML #156 with MLP.
359
+
360
+ ![](images/f2afa1c87f4feaa6e3796baea1d6a22218fb040453bcdb82a250d55b4d0a9738.jpg)
361
+ Figure 16: Zoomed-in learning curves for OpenML #184 with MLP.
362
+
363
+ ![](images/f0c42a0c3e2d768cd833fa7d50e3800e2873b503e576998c7a448383e9630f34.jpg)
364
+ Figure 17: Zoomed-in learning curves for SVHN with MLP, ResNet and VGG.
365
+
366
+ ![](images/fbce56c22162e29e6d225aa0e5d67f5788bf75bd60797bed3ade2cebd28df0bb.jpg)
367
+ Figure 18: Zoomed-in learning curves for MNIST with MLP.
368
+
369
+ ![](images/1500a84f46227f17a6b03c0a03417a976729932c9d4bd0b0846c341096d3bce2.jpg)
370
+ Figure 19: Zoomed-in learning curves for CIFAR10 with MLP, ResNet and VGG.
371
+
372
+ ![](images/bcdf7607b2dfbb32a55c7026c517c34f609fe133885d1d155bef016d2d58a66c.jpg)
373
+ Figure 20: Pairwise penalty matrices of the algorithms, grouped by different batch sizes. The parenthesized number in the title is the total number of $( D , B , A )$ combinations aggregated, which is also an upper bound on all its entries. Element $( i , j )$ corresponds roughly to the number of times algorithm $i$ beats algorithm $j$ . Column-wise averages at the bottom show aggregate performance (lower is better). From left to right: batch size $= 1 0 0$ , 1000, 10000.
374
+
375
+ ![](images/8ec656b0d27579e17e5d426494b01e24c71753019e1725e0565a8cb78ab69c17.jpg)
376
+ Figure 21: Pairwise penalty matrices of the algorithms, grouped by different neural network models. The parenthesized number in the title is the total number of $( D , B , A )$ combinations aggregated, which is also an upper bound on all its entries. Element $( i , j )$ corresponds roughly to the number of times algorithm $i$ beats algorithm $j$ . Column-wise averages at the bottom show aggregate performance (lower is better). From left to right: MLP, ResNet and VGG.
377
+
378
+ ![](images/7dd5a955d88848c7fffd4e19963044529b8b5dd217cfd79f1fe6e676bf7c481e.jpg)
379
+ Figure 22: CDFs of normalized errors of the algorithms, group by different batch sizes. Higher CDF indicates better performance. From left to right: batch size $= 1 0 0$ , 1000, 10000.
380
+
381
+ ![](images/1e8686a7c69e02d8ee3ed0ecbbd8213345b8e48ed6000061e556cbde8724f18f.jpg)
382
+ Figure 23: CDFs of normalized errors of the algorithms, group by different neural network models. Higher CDF indicates better performance. From left to right: MLP, ResNet and VGG.
383
+
384
+ # E CDFS OF NORMALIZED ERRORS OF DIFFERENT ALGORITHMS
385
+
386
+ In addition to Figure 5 that aggregates over all settings, we show here the CDFs of normalized errors by conditioning on fixed batch sizes (100, 1000 and 10000) in Figure 22, and show the CDFs of normalized errors by conditioning on fixed neural network models (MLP, ResNet and VGG) in Figure 23.
387
+
388
+ # F BATCH UNCERTAINTY AND DIVERSITY
389
+
390
+ Figure 24 gives a comparison of sampling methods with gradient embedding in two settings (OpenML # 6, MLP, batchsize 100 and SVHN, ResNet, batchsize 1000), in terms of uncertainty and diversity of examples selected within batches. These two properties are measured by average $\ell _ { 2 }$ norm and determinant of the Gram matrix of gradient embedding, respectively. It can be seen that, $k { \mathrm { - M E A N S + + } }$ (BADGE) induces good batch diversity in both settings. CONF generally selects examples with high uncertainty, but in some iterations of OpenML #6, the batch diversity is relatively low, as evidenced by the corresponding log Gram determinant being $- \infty$ . These areas are indicated by gaps in the learning curve for CONF. Situations where there are many gaps in the CONF plot seem to correspond to situations in which CONF performs poorly in terms of accuracy (see Figure 13 for the corresponding learning curve). Both $k$ -DPP and FF- $k$ -CENTER (an algorithm that approximately minimizes $k$ -center objective) select batches that have lower diversity than $k$ -MEANS $^ { + + }$ (BADGE).
391
+
392
+ ![](images/06e0a6591dd6c4b5362a74a440c88b7e0461b3c1f9819bca861c53a4a12938ab.jpg)
393
+ Figure 24: A comparison of batch selection algorithms in gradient space. Plots a and b show the log determinants of the Gram matrices of gradient embeddings within batches as learning progresses. Plots c and $\mathbf { d }$ show the average embedding magnitude (a measurement of predictive uncertainty) in the selected batch. The $k$ -centers sampler finds points that are not as diverse or high-magnitude as other samplers. Notice also that $k { \mathrm { - M E A N S + + } }$ tends to actually select samples that are both more diverse and higher-magnitude than a $k$ -DPP, a potential pathology of the $k$ -DPP’s degree of stochastisity. Among all algorithms, CONF has the largest average norm of gradient embeddings within a batch; however, in OpenML #6, and the first few interations of SVHN, some batches have a log Gram determinant of $- \infty$ (shown as gaps in the curve), which shows that CONF sometimes selects batches that are inferior in diversity.
394
+
395
+ # G COMPARISON OF $k$ -MEANS $^ { + + }$ AND $k$ -DPP IN BATCH SELECTION
396
+
397
+ In Figures 25 to 31, we give running time and test accuracy comparisons between $k { \mathrm { - M E A N S + + } }$ and $k$ -DPP for selecting examples based on gradient embedding in batch mode active learning. We implement the $k$ -DPP sampling using the MCMC algorithm from (Kang, 2013), which has a time complexity of $O ( \tau \cdot ( k ^ { 2 } + k d ) )$
398
+
399
+ ![](images/68897bb6eb4bbcd2af8922a41897bb08fb0a8da3dee3dc4ea852ae1ac708751f.jpg)
400
+ Figure 25: Learning curves and running times for OpenML #6 with MLP.
401
+
402
+ ![](images/b1f42c320b083c071d89711fbe35a86eb10b8d1f0c2d817a99adf3ecf93c99a1.jpg)
403
+ Figure 26: Learning curves and running times for OpenML #155 with MLP.
404
+
405
+ and space complexity of $O ( k ^ { 2 } + k d )$ , where $\tau$ is the number of sampling steps. We set $\tau$ as $\lfloor 5 k \ln k \rfloor$ in our experiment. The comparisons for batch size 10000 are not shown here as the implementation of $k$ -DPP sampling runs out of memory.
406
+
407
+ It can be seen from the figures that, although $k$ -DPP and $k { \mathrm { - M E A N S + + } }$ are based on different sampling criteria, the classification accuracies of their induced active learning algorithm are similar. In addition, when large batch sizes are required (e.g. $k = 1 0 0 0$ ), the running times of $k$ -DPP sampling are generally much higher than those of $k$ -MEA $\mathrm { N S } { + } { + }$ .
408
+
409
+ ![](images/5d40d22c75721a059cbb0b806209efb76c254e0e8846d044ac3890ff3d1626ee.jpg)
410
+ Figure 27: Learning curves and running times for OpenML #156 with MLP.
411
+
412
+ ![](images/8fe1677b8a9ebbca89d82595804c40b53899f667292aace8887172757fda3d48.jpg)
413
+ Figure 28: Learning curves and running times for OpenML #184 with MLP.
414
+
415
+ ![](images/432ede9d567f05ff30cc84e24734b9684b3267b38f6ff82e344349767b470a38.jpg)
416
+ Figure 29: Learning curves and running times for SVHN with MLP and ResNet.
417
+
418
+ ![](images/76e18f8566dc277eb165ad2a542cf0aeb87cdf8690bfcf233cdf2a0caac590d4.jpg)
419
+ Figure 30: Learning curves and running times for MNIST with MLP.
420
+
421
+ ![](images/3398b065aad57ae31c9b307f82c2049a16bcf7ee25b9677c8a6caa71d142daf3.jpg)
422
+ Figure 31: Learning curves and running times for CIFAR10 with MLP and ResNet.
parse/train/ryghZJBKPS/ryghZJBKPS_content_list.json ADDED
@@ -0,0 +1,2203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ {
3
+ "type": "text",
4
+ "text": "DEEP BATCH ACTIVE LEARNING BY DIVERSE, UNCERTAIN GRADIENT LOWER BOUNDS ",
5
+ "text_level": 1,
6
+ "bbox": [
7
+ 148,
8
+ 116,
9
+ 763,
10
+ 164
11
+ ],
12
+ "page_idx": 0
13
+ },
14
+ {
15
+ "type": "text",
16
+ "text": "Jordan T. Ash Princeton University ",
17
+ "bbox": [
18
+ 156,
19
+ 189,
20
+ 294,
21
+ 218
22
+ ],
23
+ "page_idx": 0
24
+ },
25
+ {
26
+ "type": "text",
27
+ "text": "Chicheng Zhang University of Arizona ",
28
+ "bbox": [
29
+ 411,
30
+ 189,
31
+ 555,
32
+ 217
33
+ ],
34
+ "page_idx": 0
35
+ },
36
+ {
37
+ "type": "text",
38
+ "text": "Akshay Krishnamurthy Microsoft Research NYC ",
39
+ "bbox": [
40
+ 671,
41
+ 189,
42
+ 839,
43
+ 217
44
+ ],
45
+ "page_idx": 0
46
+ },
47
+ {
48
+ "type": "text",
49
+ "text": "John Langford Microsoft Research NYC ",
50
+ "bbox": [
51
+ 158,
52
+ 238,
53
+ 326,
54
+ 266
55
+ ],
56
+ "page_idx": 0
57
+ },
58
+ {
59
+ "type": "text",
60
+ "text": "Alekh Agarwal Microsoft Research Redmond ",
61
+ "bbox": [
62
+ 493,
63
+ 239,
64
+ 691,
65
+ 267
66
+ ],
67
+ "page_idx": 0
68
+ },
69
+ {
70
+ "type": "text",
71
+ "text": "ABSTRACT ",
72
+ "text_level": 1,
73
+ "bbox": [
74
+ 452,
75
+ 304,
76
+ 544,
77
+ 319
78
+ ],
79
+ "page_idx": 0
80
+ },
81
+ {
82
+ "type": "text",
83
+ "text": "We design a new algorithm for batch active learning with deep neural network models. Our algorithm, Batch Active learning by Diverse Gradient Embeddings (BADGE), samples groups of points that are disparate and high magnitude when represented in a hallucinated gradient space, a strategy designed to incorporate both predictive uncertainty and sample diversity into every selected batch. Crucially, BADGE trades off between uncertainty and diversity without requiring any hand-tuned hyperparameters. While other approaches sometimes succeed for particular batch sizes or architectures, BADGE consistently performs as well or better, making it a useful option for real world active learning problems. ",
84
+ "bbox": [
85
+ 207,
86
+ 334,
87
+ 792,
88
+ 446
89
+ ],
90
+ "page_idx": 0
91
+ },
92
+ {
93
+ "type": "text",
94
+ "text": "1 INTRODUCTION ",
95
+ "text_level": 1,
96
+ "bbox": [
97
+ 150,
98
+ 477,
99
+ 310,
100
+ 492
101
+ ],
102
+ "page_idx": 0
103
+ },
104
+ {
105
+ "type": "text",
106
+ "text": "In recent years, deep neural networks have produced state-of-the-art results on a variety of important supervised learning tasks. However, many of these successes have been limited to domains where large amounts of labeled data are available. A promising approach for minimizing labeling effort is active learning, a learning protocol where labels can be requested by the algorithm in a sequential, feedback-driven fashion. Active learning algorithms aim to identify and label only maximally-informative samples, so that a high-performing classifier can be trained with minimal labeling effort. As such, a robust active learning algorithm for deep neural networks may considerably expand the domains in which these models are applicable. ",
107
+ "bbox": [
108
+ 148,
109
+ 507,
110
+ 851,
111
+ 606
112
+ ],
113
+ "page_idx": 0
114
+ },
115
+ {
116
+ "type": "text",
117
+ "text": "How should we design a practical, general-purpose, label-efficient active learning algorithm for deep neural networks? Theory for active learning suggests a version-space-based approach (Cohn et al., 1994; Balcan et al., 2006), which explicitly or implicitly maintains a set of plausible models, and queries examples for which these models make different predictions. But when using highly expressive models like neural networks, these algorithms degenerate to querying every example. Further, the computational overhead of training deep neural networks precludes approaches that update the model to best fit data after each label query, as is often done (exactly or approximately) for linear methods (Beygelzimer et al., 2010; Cesa-Bianchi et al., 2009). Unfortunately, the theory provides little guidance for these models. ",
118
+ "bbox": [
119
+ 148,
120
+ 612,
121
+ 851,
122
+ 724
123
+ ],
124
+ "page_idx": 0
125
+ },
126
+ {
127
+ "type": "text",
128
+ "text": "One option is to use the network’s uncertainty to inform a query strategy, for example by labeling samples for which the model is least confident. In a batch setting, however, this creates a pathological scenario where data in the batch are nearly identical, a clear inefficiency. Remedying this issue, we could select samples to maximize batch diversity, but this might choose points that provide little new information to the model. ",
129
+ "bbox": [
130
+ 148,
131
+ 731,
132
+ 851,
133
+ 787
134
+ ],
135
+ "page_idx": 0
136
+ },
137
+ {
138
+ "type": "text",
139
+ "text": "For these reasons, methods that exploit just uncertainty or diversity do not consistently work well across model architectures, batch sizes, or datasets. An algorithm that performs well when using a ResNet, for example, might perform poorly when using a multilayer perceptron. A diversity-based approach might work well when the batch size is very large, but poorly when the batch size is small. Further, what even constitutes a “large” or “small” batch size is largely a function of the statistical properties of the data in question. These weaknesses pose a major problem for real, practical batch active learning situations, where data are unfamiliar and potentially unstructured. There is no way to know which active learning algorithm is best to use. ",
140
+ "bbox": [
141
+ 145,
142
+ 794,
143
+ 849,
144
+ 821
145
+ ],
146
+ "page_idx": 0
147
+ },
148
+ {
149
+ "type": "text",
150
+ "text": "",
151
+ "bbox": [
152
+ 148,
153
+ 119,
154
+ 851,
155
+ 190
156
+ ],
157
+ "page_idx": 1
158
+ },
159
+ {
160
+ "type": "text",
161
+ "text": "Moreover, in a real active learning scenario, every change of hyperparameters typically causes the algorithm to label examples not chosen under other hyperparameters, provoking substantial labeling inefficiency. That is, hyperparameter sweeps in active learning can be label expensive. As a result, active learning algorithms need to “just work”, given fixed hyperparameters, to a greater extent than is typical for supervised learning. ",
162
+ "bbox": [
163
+ 148,
164
+ 196,
165
+ 849,
166
+ 253
167
+ ],
168
+ "page_idx": 1
169
+ },
170
+ {
171
+ "type": "text",
172
+ "text": "Based on these observations, we design an approach which creates diverse batches of examples about which the current model is uncertain. We measure uncertainty as the gradient magnitude with respect to parameters in the final (output) layer, which is computed using the most likely label according to the model. To capture diversity, we collect a batch of examples where these gradients span a diverse set of directions. More specifically, we build up the batch of query points based on these hallucinated gradients using the $k { \\mathrm { - M E A N S + + } }$ initialization (Arthur and Vassilvitskii, 2007), which simultaneously captures both the magnitude of a candidate gradient and its distance from previously included points in the batch. We name the resulting approach Batch Active learning by Diverse Gradient Embeddings (BADGE). ",
173
+ "bbox": [
174
+ 147,
175
+ 260,
176
+ 851,
177
+ 372
178
+ ],
179
+ "page_idx": 1
180
+ },
181
+ {
182
+ "type": "text",
183
+ "text": "We show that BADGE is robust to architecture choice, batch size, and dataset, generally performing as well as or better than the best baseline across our experiments, which vary all of the aforementioned environmental conditions. We begin by introducing our notation and setting, followed by a description of the BADGE algorithm in Section 3 and experiments in Section 4. We defer our discussion of related work to Section 5. ",
184
+ "bbox": [
185
+ 148,
186
+ 378,
187
+ 849,
188
+ 434
189
+ ],
190
+ "page_idx": 1
191
+ },
192
+ {
193
+ "type": "text",
194
+ "text": "2 NOTATION AND SETTING ",
195
+ "text_level": 1,
196
+ "bbox": [
197
+ 150,
198
+ 455,
199
+ 385,
200
+ 470
201
+ ],
202
+ "page_idx": 1
203
+ },
204
+ {
205
+ "type": "text",
206
+ "text": "Define $[ K ] : = \\{ 1 , 2 , \\dots , K \\}$ . Denote by $\\mathcal { X }$ the instance space and by $\\mathcal { V }$ the label space. In this work we consider multiclass classification, so $\\mathcal { V } = [ K ]$ . Denote by $D$ the distribution from which examples are drawn, by $D _ { \\mathcal { X } }$ the unlabeled data distribution, and by $D _ { \\mathcal { V } | \\mathcal { X } }$ the conditional distribution over labels given examples. We consider the pool-based active learning setup, where the learner receives an unlabeled dataset $U$ sampled according to $D _ { \\mathcal { X } }$ and can request labels sampled according to $D _ { \\mathcal { Y } | \\mathcal { X } }$ for any $x \\in$ $U$ . We use $\\mathbb { E } _ { D }$ to denote expectation under the data distribution $D$ . Given a classifier $h \\ : \\ \\mathcal { X } \\ \\mathcal { Y }$ , which maps examples to labels, and a labeled example $( x , y )$ , we denote the $0 / 1$ error of $h$ on $( x , y )$ as $\\ell _ { 0 1 } ( h ( x ) , \\bar { y } ) = I ( \\bar { h } ( x ) \\neq y )$ . The performance of a classifier $h$ is measured by its expected $0 / 1$ error, i.e. $\\begin{array} { r } { \\mathbb { E } _ { D } [ \\ell _ { 0 1 } ( h ( x ) , y ) ] = \\operatorname* { P r } _ { ( x , y ) \\sim D } ( h ( x ) \\neq y ) } \\end{array}$ . The goal of pool-based active learning is to find a classifier with a small expected $0 / 1$ error using as few label queries as possible. Given a set $S$ of labeled examples $( x , y )$ , where each $x \\in S$ is picked from $U$ , followed by a label query, we use $\\mathbb { E } _ { S }$ as the sample averages over $S$ . ",
207
+ "bbox": [
208
+ 147,
209
+ 484,
210
+ 852,
211
+ 640
212
+ ],
213
+ "page_idx": 1
214
+ },
215
+ {
216
+ "type": "text",
217
+ "text": "In this paper, we consider classifiers $h$ parameterized by underlying neural networks $f$ of fixed architecture, with the weights in the network denoted by $\\theta$ . We abbreviate the classifier with parameters $\\theta$ as $h _ { \\theta }$ since the architectures are fixed in any given context, and our classifiers take the form $h _ { \\theta } ( x ) = \\operatorname { a r g m a x } _ { y \\in [ K ] } f ( x ; \\theta ) _ { y }$ , where $f ( x ; \\theta ) \\in \\mathbb { R } ^ { K }$ is a probability vector of scores assigned to candidate labels, given the example $x$ and parameters $\\theta$ . We optimize the parameters by minimizing the cross-entropy loss $\\mathbb { E } _ { S } [ \\ell _ { \\mathrm { C E } } ( f ( x ; \\theta ) , y ) ]$ over the labeled examples, where $\\begin{array} { r } { \\ell _ { \\mathrm { C E } } ( p , y ) = \\sum _ { i = 1 } ^ { K } I ( y = i ) \\ln 1 / p _ { i } = \\ln { 1 / p _ { y } } } \\end{array}$ . ",
218
+ "bbox": [
219
+ 147,
220
+ 647,
221
+ 852,
222
+ 739
223
+ ],
224
+ "page_idx": 1
225
+ },
226
+ {
227
+ "type": "text",
228
+ "text": "Algorithm 1 BADGE: Batch Active learning by Diverse Gradient Embeddings ",
229
+ "bbox": [
230
+ 150,
231
+ 119,
232
+ 671,
233
+ 135
234
+ ],
235
+ "page_idx": 2
236
+ },
237
+ {
238
+ "type": "text",
239
+ "text": "Require: Neural network $f ( x ; \\theta )$ , unlabeled pool of examples $U$ , initial number of examples $M$ , number of iterations $T$ , number of examples in a batch $B$ . ",
240
+ "bbox": [
241
+ 150,
242
+ 138,
243
+ 852,
244
+ 165
245
+ ],
246
+ "page_idx": 2
247
+ },
248
+ {
249
+ "type": "text",
250
+ "text": "1: Labeled dataset $S \\gets M$ examples drawn uniformly at random from $U$ together with queried labels. ",
251
+ "bbox": [
252
+ 156,
253
+ 166,
254
+ 841,
255
+ 179
256
+ ],
257
+ "page_idx": 2
258
+ },
259
+ {
260
+ "type": "text",
261
+ "text": "Train an initial model $\\theta _ { 1 }$ on $S$ by minimizing $\\mathbb { E } _ { S } [ \\dot { \\ell _ { \\mathrm { C E } } } ( f ( x ; \\theta ) , y ) ]$ . ",
262
+ "bbox": [
263
+ 174,
264
+ 181,
265
+ 622,
266
+ 194
267
+ ],
268
+ "page_idx": 2
269
+ },
270
+ {
271
+ "type": "text",
272
+ "text": "4: For all examples $x$ in $U \\backslash S$ ",
273
+ "bbox": [
274
+ 156,
275
+ 208,
276
+ 379,
277
+ 222
278
+ ],
279
+ "page_idx": 2
280
+ },
281
+ {
282
+ "type": "text",
283
+ "text": "1. Compute its hypothetical label $\\hat { y } ( x ) = h _ { \\theta _ { t } } ( x )$ . \n2. Compute gradient embedding $\\begin{array} { r } { g _ { x } = \\frac { \\partial } { \\partial \\theta _ { \\mathrm { o u t } } } \\ell _ { \\mathrm { C E } } ( f ( x ; \\theta ) , \\hat { y } ( x ) ) | _ { \\theta = \\theta _ { t } } } \\end{array}$ , where $\\theta _ { \\mathrm { o u t } }$ refers to parameters of the final (output) layer. \n5: Compute $S _ { t }$ , a random subset of $U \\backslash S$ , using the $k { \\mathrm { - M E A N S + + } }$ seeding algorithm on $\\{ g _ { x } : x \\in U \\setminus S \\}$ and query for their labels. \n6: $S \\gets S \\cup S _ { t }$ . \n7: Train a model $\\theta _ { t + 1 }$ on $S$ by minimizing $\\mathbb { E } _ { S } [ \\ell _ { \\mathrm { C E } } ( f ( x ; \\theta ) , y ) ]$ . ",
284
+ "bbox": [
285
+ 187,
286
+ 222,
287
+ 856,
288
+ 266
289
+ ],
290
+ "page_idx": 2
291
+ },
292
+ {
293
+ "type": "text",
294
+ "text": "",
295
+ "bbox": [
296
+ 147,
297
+ 266,
298
+ 854,
299
+ 321
300
+ ],
301
+ "page_idx": 2
302
+ },
303
+ {
304
+ "type": "text",
305
+ "text": "8: end for \n9: return Final model $\\theta _ { T + 1 }$ ",
306
+ "bbox": [
307
+ 153,
308
+ 321,
309
+ 349,
310
+ 349
311
+ ],
312
+ "page_idx": 2
313
+ },
314
+ {
315
+ "type": "text",
316
+ "text": "3 ALGORITHM ",
317
+ "text_level": 1,
318
+ "bbox": [
319
+ 148,
320
+ 381,
321
+ 284,
322
+ 396
323
+ ],
324
+ "page_idx": 2
325
+ },
326
+ {
327
+ "type": "text",
328
+ "text": "BADGE, described in Algorithm 1, starts by drawing an initial set of $M$ examples uniformly at random from $U$ and asking for their labels. It then proceeds iteratively, performing two main computations at each step $t$ : a gradient embedding computation and a sampling computation. Specifically, at each step $t$ , for every $x$ in the pool $U$ , we compute the label ${ \\hat { y } } ( x )$ preferred by the current model, and the gradient $g _ { x }$ of the loss on $( x , { \\hat { y } } ( x ) )$ with respect to the parameters of the last layer of the network. Given these gradient embedding vectors $\\{ g _ { x } : x \\in U \\}$ , BADGE selects a set of points by sampling via the $k$ -MEAN ${ \\hphantom { 0 } } _ { \\mathrm { S } + + }$ initialization scheme (Arthur and Vassilvitskii, 2007). The algorithm queries the labels of these examples, retrains the model, and repeats. ",
329
+ "bbox": [
330
+ 148,
331
+ 412,
332
+ 851,
333
+ 510
334
+ ],
335
+ "page_idx": 2
336
+ },
337
+ {
338
+ "type": "text",
339
+ "text": "We now describe the main computations — the embedding and sampling steps — in more detail. ",
340
+ "bbox": [
341
+ 148,
342
+ 517,
343
+ 779,
344
+ 531
345
+ ],
346
+ "page_idx": 2
347
+ },
348
+ {
349
+ "type": "text",
350
+ "text": "The gradient embedding. Since deep neural networks are optimized using gradient-based methods, we capture uncertainty about an example through the lens of gradients. In particular, we consider the model uncertain about an example if knowing the label induces a large gradient of the loss with respect to the model parameters and hence a large update to the model. A difficulty with this reasoning is that we need to know the label to compute the gradient. As a proxy, we compute the gradient as if the model’s current prediction on the example is the true label. We show in Proposition 1 that, assuming a common structure satisfied by most natural neural networks, the gradient norm with respect to the last layer using this label provides a lower bound on the gradient norm induced by any other label. In addition, under that assumption, the length of this hypothetical gradient vector captures the uncertainty of the model on the example: if the model is highly certain about the example’s label, then the example’s gradient embedding will have a small norm, and vice versa for samples where the model is uncertain (see example below). Thus, the gradient embedding conveys information both about the model’s uncertainty and potential update direction upon receiving a label at an example. ",
351
+ "bbox": [
352
+ 148,
353
+ 547,
354
+ 851,
355
+ 714
356
+ ],
357
+ "page_idx": 2
358
+ },
359
+ {
360
+ "type": "text",
361
+ "text": "The sampling step. We want the newly-acquired labeled samples to induce large and diverse changes to the model. To this end, we want the selection procedure to favor both sample magnitude and batch diversity. Specifically, we want to avoid the pathology of, for example, selecting a batch of $k$ similar samples where even just a single label could alleviate our uncertainty on all remaining $\\left( k - 1 \\right)$ samples. ",
362
+ "bbox": [
363
+ 148,
364
+ 731,
365
+ 851,
366
+ 787
367
+ ],
368
+ "page_idx": 2
369
+ },
370
+ {
371
+ "type": "text",
372
+ "text": "A natural way of making this selection without introducing additional hyperparameters is to sample from a $k$ -Determinantal Point Process ( $k$ -DPP; (Kulesza and Taskar, 2011)). That is, to select a batch of $k$ points with probability proportional to the determinant of their Gram matrix. Recently, Derezinski and Warmuth´ (2018) showed that in experimental design for least square linear regression settings, learning from samples drawn from a $k$ -DPP can have much smaller mean square prediction error than learning from iid samples. In this process, when the batch size is very low, the selection will naturally favor points with a large length, which corresponds to uncertainty in our space. When the batch size is large, the sampler focuses more on diversity because linear independence, which is more difficult to achieve for large $k$ , is required to make the Gram determinant non-zero. ",
373
+ "bbox": [
374
+ 145,
375
+ 794,
376
+ 848,
377
+ 821
378
+ ],
379
+ "page_idx": 2
380
+ },
381
+ {
382
+ "type": "image",
383
+ "img_path": "images/3fe9bade8f08ff05364a6d8e2a7baee936a987903dffc50b0cac6374c5710223.jpg",
384
+ "image_caption": [
385
+ "Figure 1: Left and center: Learning curves for $k { \\mathrm { - M E A N S + + } }$ and $k$ -DPP sampling with gradient embeddings for different scenarios. The performance of the two sampling approaches nearly perfectly overlaps. Right: A run time comparison (seconds) corresponding to the middle scenario. Each line is the average over five independent experiments. Standard errors are shown by shaded regions. "
386
+ ],
387
+ "image_footnote": [],
388
+ "bbox": [
389
+ 147,
390
+ 133,
391
+ 849,
392
+ 267
393
+ ],
394
+ "page_idx": 3
395
+ },
396
+ {
397
+ "type": "text",
398
+ "text": "",
399
+ "bbox": [
400
+ 147,
401
+ 342,
402
+ 852,
403
+ 439
404
+ ],
405
+ "page_idx": 3
406
+ },
407
+ {
408
+ "type": "text",
409
+ "text": "Unfortunately, sampling from a $k$ -DPP is not trivial. Many sampling algorithms (Kang, 2013; Anari et al., 2016) rely on MCMC, where mixing time poses a significant computational hurdle. The state-of-the-art algorithm of Derezinski (2018) has a high-order polynomial running time in the batch size and the embedding ´ dimension. To overcome this computational hurdle, we suggest instead sampling using the $k { \\mathrm { - M E A N S + + } }$ seeding algorithm (Arthur and Vassilvitskii, 2007), originally made to produce a good initialization for $k$ -means clustering. $k { \\mathrm { - M E A N S + + } }$ seeding selects centroids by iteratively sampling points in proportion to their squared distances from the nearest centroid that has already been chosen, which, like a $k$ -DPP, tends to select a diverse batch of high-magnitude samples. For completeness, we give a formal description of the $k$ -MEA $\\mathrm { J } S + +$ seeding algorithm in Appendix A. ",
410
+ "bbox": [
411
+ 147,
412
+ 445,
413
+ 852,
414
+ 573
415
+ ],
416
+ "page_idx": 3
417
+ },
418
+ {
419
+ "type": "text",
420
+ "text": "Example: multiclass classification with softmax activations. Consider a neural network $f$ where the last nonlinearity is a softmax, i.e. $\\sigma ( z ) _ { i } = e ^ { z _ { i } } / { \\sum _ { j = 1 } ^ { K } e ^ { z _ { j } } }$ . Specifically, $f$ is parametrized by $\\theta = ( W , V )$ , where $\\theta _ { \\mathrm { o u t } } = W = ( W _ { 1 } , \\ldots , W _ { K } ) ^ { \\top } \\in \\mathbb { R } ^ { K \\times d }$ are the weights of the last layer, and $V$ consists of weights of all previous layers. This means that $f ( x ; \\theta ) = \\sigma ( W \\cdot \\bar { z } ( x ; V ) )$ , where $z$ is the nonlinear function that maps an input $x$ to the output of the network’s penultimate layer. Let us fix an unlabeled sample $x$ and define $p _ { i } = f ( x ; \\theta ) _ { i }$ . With this notation, we have ",
421
+ "bbox": [
422
+ 147,
423
+ 585,
424
+ 852,
425
+ 672
426
+ ],
427
+ "page_idx": 3
428
+ },
429
+ {
430
+ "type": "equation",
431
+ "img_path": "images/c0a77f9cb45b53e1dbc20841a41ef19cb516cd593b6a7208b585f88a23eee329.jpg",
432
+ "text": "$$\n\\ell _ { \\mathrm { { C E } } } ( f ( x ; \\theta ) , y ) = \\ln \\left( \\sum _ { j = 1 } ^ { K } e ^ { W _ { j } \\cdot z ( x ; V ) } \\right) - W _ { y } \\cdot z ( x ; V ) .\n$$",
433
+ "text_format": "latex",
434
+ "bbox": [
435
+ 310,
436
+ 675,
437
+ 687,
438
+ 727
439
+ ],
440
+ "page_idx": 3
441
+ },
442
+ {
443
+ "type": "text",
444
+ "text": "Define $\\begin{array} { r } { g _ { x } ^ { y } = \\frac { \\partial } { \\partial W } \\ell _ { \\mathrm { C E } } ( f ( x ; \\theta ) , y ) } \\end{array}$ for a label $y$ and $g _ { x } = g _ { x } ^ { \\hat { y } }$ as the gradient embedding in our algorithm, where ${ \\hat { y } } = \\operatorname { a r g m a x } _ { i \\in [ K ] } p _ { i }$ . Then the $i$ -th block of $g _ { x }$ (i.e. the gradients corresponding to label $i$ ) is ",
445
+ "bbox": [
446
+ 145,
447
+ 737,
448
+ 849,
449
+ 768
450
+ ],
451
+ "page_idx": 3
452
+ },
453
+ {
454
+ "type": "equation",
455
+ "img_path": "images/9441310347a519c3bf0c4e0278a502b2a72f0f5cf89c8efe0a5342d05f3ee882.jpg",
456
+ "text": "$$\n( g _ { x } ) _ { i } = \\frac { \\partial } { \\partial W _ { i } } \\ell _ { \\mathrm { C E } } ( f ( x ; \\theta ) , \\hat { y } ) = ( p _ { i } - I ( \\hat { y } = i ) ) z ( x ; V ) .\n$$",
457
+ "text_format": "latex",
458
+ "bbox": [
459
+ 310,
460
+ 772,
461
+ 687,
462
+ 805
463
+ ],
464
+ "page_idx": 3
465
+ },
466
+ {
467
+ "type": "text",
468
+ "text": "Based on this expression, we can make the following observations: ",
469
+ "bbox": [
470
+ 147,
471
+ 808,
472
+ 586,
473
+ 823
474
+ ],
475
+ "page_idx": 3
476
+ },
477
+ {
478
+ "type": "text",
479
+ "text": "1. Each block of $g _ { x }$ is a scaling of $z ( x ; V )$ , which is the output of the penultimate layer of the network. In this respect, $g _ { x }$ captures $x$ ’s representation information similar to that of Sener and Savarese (2018). ",
480
+ "bbox": [
481
+ 184,
482
+ 119,
483
+ 852,
484
+ 162
485
+ ],
486
+ "page_idx": 4
487
+ },
488
+ {
489
+ "type": "text",
490
+ "text": "2. Proposition 1 below shows that the norm of $g _ { x }$ is a lower bound on the norm of the loss gradient induced by the example with true label $y$ with respect to the weights in the last layer, that is $\\| g _ { x } \\| \\leq \\| \\dot { g } _ { x } ^ { y } \\|$ . This suggests that the norm of $g _ { x }$ conservatively estimates the example’s influence on the current model. ",
491
+ "bbox": [
492
+ 186,
493
+ 166,
494
+ 852,
495
+ 222
496
+ ],
497
+ "page_idx": 4
498
+ },
499
+ {
500
+ "type": "text",
501
+ "text": "3. If the current model $\\theta$ is highly confident about $x$ , i.e. vector $p$ is skewed towards a standard basis vector $e _ { j }$ , then $\\hat { y } = j$ , and vector $( p _ { i } - I ( \\hat { y } = i ) ) _ { i = 1 } ^ { K }$ has a small length. Therefore, $g _ { x }$ has a small length as well. Such high-confidence examples tend to have gradient embeddings of small magnitude, which are unlikely to be repeatedly selected by $k { \\mathrm { - M E A N S + + } }$ at iteration $t$ . ",
502
+ "bbox": [
503
+ 186,
504
+ 227,
505
+ 851,
506
+ 284
507
+ ],
508
+ "page_idx": 4
509
+ },
510
+ {
511
+ "type": "text",
512
+ "text": "Proposition 1. For all $y \\in \\{ 1 , \\ldots , K \\}$ , let $\\begin{array} { r } { g _ { x } ^ { y } = \\frac { \\partial } { \\partial W } \\ell _ { \\mathrm { C E } } ( f ( x ; \\theta ) , y ) } \\end{array}$ . Then ",
513
+ "bbox": [
514
+ 148,
515
+ 285,
516
+ 643,
517
+ 304
518
+ ],
519
+ "page_idx": 4
520
+ },
521
+ {
522
+ "type": "equation",
523
+ "img_path": "images/1f627c49dffa6687b15a575a630b10f4186558a62c8cbad6574f787671935456.jpg",
524
+ "text": "$$\n\\| g _ { x } ^ { y } \\| ^ { 2 } = \\Big ( \\sum _ { i = 1 } ^ { K } p _ { i } ^ { 2 } + 1 - 2 p _ { y } \\Big ) \\| z ( x ; V ) \\| ^ { 2 } .\n$$",
525
+ "text_format": "latex",
526
+ "bbox": [
527
+ 357,
528
+ 309,
529
+ 638,
530
+ 352
531
+ ],
532
+ "page_idx": 4
533
+ },
534
+ {
535
+ "type": "text",
536
+ "text": "Consequently, ${ \\hat { y } } = \\operatorname { a r g m i n } _ { y \\in [ K ] } \\left\\| g _ { x } ^ { y } \\right\\|$ . ",
537
+ "bbox": [
538
+ 148,
539
+ 356,
540
+ 400,
541
+ 373
542
+ ],
543
+ "page_idx": 4
544
+ },
545
+ {
546
+ "type": "text",
547
+ "text": "Proof. Observe that by Equation (1), ",
548
+ "bbox": [
549
+ 148,
550
+ 386,
551
+ 390,
552
+ 401
553
+ ],
554
+ "page_idx": 4
555
+ },
556
+ {
557
+ "type": "equation",
558
+ "img_path": "images/186ef9f07fafdec057c5d4f7fa9b5bc24cf0fd602b6e46330071731b7cdd09b1.jpg",
559
+ "text": "$$\n\\| g _ { x } ^ { y } \\| ^ { 2 } = \\sum _ { i = 1 } ^ { K } \\left( p _ { i } - I ( y = i ) \\right) ^ { 2 } \\| z ( x ; V ) \\| ^ { 2 } = \\Big ( \\sum _ { i = 1 } ^ { K } p _ { i } ^ { 2 } + 1 - 2 p _ { y } \\Big ) \\| z ( x ; V ) \\| ^ { 2 } .\n$$",
560
+ "text_format": "latex",
561
+ "bbox": [
562
+ 241,
563
+ 406,
564
+ 756,
565
+ 449
566
+ ],
567
+ "page_idx": 4
568
+ },
569
+ {
570
+ "type": "text",
571
+ "text": "The second claim follows from the fact that yˆ = argmaxy∈[K] py. ",
572
+ "bbox": [
573
+ 147,
574
+ 454,
575
+ 578,
576
+ 469
577
+ ],
578
+ "page_idx": 4
579
+ },
580
+ {
581
+ "type": "text",
582
+ "text": "This simple sampler tends to produce diverse batches similar to a $k$ -DPP. As shown in Figure 1, switching between the two samplers does not affect the active learner’s statistical performance but greatly improves its computational performance. Appendix G compares run time and test accuracy for both $k$ -MEANS $^ { + + }$ and $k$ -DPP based sampling based on the gradient embeddings of the unlabeled examples. ",
583
+ "bbox": [
584
+ 147,
585
+ 474,
586
+ 852,
587
+ 531
588
+ ],
589
+ "page_idx": 4
590
+ },
591
+ {
592
+ "type": "text",
593
+ "text": "Figure 2 illustrates the batch diversity and average gradient magnitude per selected batch for a variety of sampling strategies. As expected, both $k$ -DPPs and $k { \\mathrm { - M E A N S + + } }$ tend to select samples that are diverse (as measured by the magnitude of their Gram determinant) and high magnitude. Other samplers, such as furthest-first traversal for $k$ -Center clustering (FF- $k$ -CENTER), do not seem to have this property. The FF- $k$ -CENTER algorithm is the sampling choice of the CORESET approach to active learning, which we describe in the proceeding section (Sener and Savarese, 2018). Appendix F discusses diversity with respect to uncertainty-based approaches. ",
594
+ "bbox": [
595
+ 147,
596
+ 536,
597
+ 851,
598
+ 635
599
+ ],
600
+ "page_idx": 4
601
+ },
602
+ {
603
+ "type": "text",
604
+ "text": "Appendix B provides further justification for why BADGE yields better updates than vanilla uncertainty sampling in the special case of binary logistic regression $K = 2$ and $z ( x ; V ) = x $ ). ",
605
+ "bbox": [
606
+ 145,
607
+ 641,
608
+ 849,
609
+ 670
610
+ ],
611
+ "page_idx": 4
612
+ },
613
+ {
614
+ "type": "text",
615
+ "text": "4 EXPERIMENTS ",
616
+ "text_level": 1,
617
+ "bbox": [
618
+ 148,
619
+ 683,
620
+ 300,
621
+ 699
622
+ ],
623
+ "page_idx": 4
624
+ },
625
+ {
626
+ "type": "text",
627
+ "text": "We evaluate the performance of BADGE against several algorithms from the literature. In our experiments, we seek to answer the following question: How robust are the learning algorithms to choices of neural network architecture, batch size, and dataset? ",
628
+ "bbox": [
629
+ 148,
630
+ 703,
631
+ 851,
632
+ 746
633
+ ],
634
+ "page_idx": 4
635
+ },
636
+ {
637
+ "type": "text",
638
+ "text": "To ensure a comprehensive comparison among all algorithms, we evaluate them in a batch-mode active learning setup with $M = 1 0 0$ being the number of initial random labeled examples and batch size $B$ varying from $\\{ 1 0 0 , 1 0 0 0 , 1 0 0 0 0 \\}$ . The following is a list of the baseline algorithms evaluated; the first performs representative sampling, the next three are uncertainty based, the fifth is a hybrid of representative and uncertainty-based approaches, and the last is traditional supervised learning. ",
639
+ "bbox": [
640
+ 148,
641
+ 752,
642
+ 851,
643
+ 823
644
+ ],
645
+ "page_idx": 4
646
+ },
647
+ {
648
+ "type": "image",
649
+ "img_path": "images/e9edd9bc4085eb347e0355361c980da855565eadfb3c1c4c32469cc726e95c60.jpg",
650
+ "image_caption": [
651
+ "Figure 2: A comparison of batch selection algorithms using our gradient embedding. Left and center: Plots showing the log determinant of the Gram matrix of the selected batch of gradient embeddings as learning progresses. Right: The average embedding magnitude (a measurement of predictive uncertainty) in the selected batch. The FF- $k$ -CENTER sampler finds points that are not as diverse or high-magnitude as other samplers. Notice also that $k { \\mathrm { - M E A N S + + } }$ tends to actually select samples that are both more diverse and higher-magnitude than a $k$ -DPP, a potential pathology of the $k$ -DPP’s degree of stochastisity. Standard errors are shown by shaded regions. "
652
+ ],
653
+ "image_footnote": [],
654
+ "bbox": [
655
+ 153,
656
+ 132,
657
+ 846,
658
+ 276
659
+ ],
660
+ "page_idx": 5
661
+ },
662
+ {
663
+ "type": "text",
664
+ "text": "1. CORESET: A diversity-based approach using coreset selection. The embedding of each example is computed by the network’s penultimate layer and the samples at each round are selected using a greedy furthest-first traversal conditioned on all labeled examples (Sener and Savarese, 2018). \n2. CONF (Confidence Sampling): An uncertainty-based active learning algorithm that selects $B$ examples with smallest predicted class probability, $\\operatorname* { m a x } _ { i = 1 } ^ { K } f ( x ; \\theta ) _ { i }$ (e.g. Wang and Shang, 2014). \n3. MARG (Margin Sampling): An uncertainty-based active learning algorithm that selects the bottom $B$ examples sorted according to the example’s multiclass margin, defined as $f ( x ; \\theta ) _ { \\hat { y } } - f ( x ; \\theta ) _ { y ^ { \\prime } }$ , where $\\hat { y }$ and $y ^ { \\prime }$ are the indices of the largest and second largest entries of $f ( x ; \\theta )$ (Roth and Small, 2006). \n4. ENTROPY: An uncertainty-based active learning algorithm that selects the top $B$ examples according to the entropy of the example’s predictive class probability distribution, defined as $H ( ( f ( x ; \\theta ) _ { y } ) _ { y = 1 } ^ { K } )$ , where $\\begin{array} { r } { H ( p ) = \\sum _ { i = 1 } ^ { K ^ { - } } p _ { i } \\ln ^ { - } \\Bigr / p _ { i } } \\end{array}$ (Wang and Shang, 2014). \n5. ALBL (Active Learning by Learning): A bandit-style meta-active learning algorithm that selects between CORESET and CONF at every round (Hsu and Lin, 2015). \n6. RAND: The naive baseline of randomly selecting $k$ examples to query at each round. ",
665
+ "bbox": [
666
+ 184,
667
+ 411,
668
+ 852,
669
+ 632
670
+ ],
671
+ "page_idx": 5
672
+ },
673
+ {
674
+ "type": "text",
675
+ "text": "We consider three neural network architectures: a two-layer Perceptron with ReLU activations (MLP), an 18-layer convolutional ResNet (He et al., 2016), and an 11-layer VGG network (Simonyan and Zisserman, 2014). We evaluate our algorithms using three image datasets, SVHN (Netzer et al., 2011), CIFAR10 (Krizhevsky, 2009) and MNIST (LeCun et al., 1998) 1, and four non-image datasets from the OpenML repository (#6, #155, #156, and #184). 2 We study each situation with 7 active learning algorithms, including BADGE, making for 231 total experiments. ",
676
+ "bbox": [
677
+ 147,
678
+ 641,
679
+ 852,
680
+ 726
681
+ ],
682
+ "page_idx": 5
683
+ },
684
+ {
685
+ "type": "text",
686
+ "text": "For the image datasets, the embedding dimensionality in the MLP is 256. For the OpenML datasets, the embedding dimensionality of the MLP is 1024, as more capacity helps the model fit training data. We fit models using cross-entropy loss and the Adam variant of SGD until training accuracy exceeds $9 9 \\%$ . We use a learning rate of 0.001 for image data and of 0.0001 for non-image data. We avoid warm starting and retrain models from scratch every time new samples are queried (Ash and Adams, 2019). All experiments are repeated five times. No learning rate schedules or data augmentation are used. Baselines use implementations from the libact library (Yang et al., 2017). All models are trained in PyTorch (Paszke et al., 2017). ",
687
+ "bbox": [
688
+ 148,
689
+ 732,
690
+ 848,
691
+ 761
692
+ ],
693
+ "page_idx": 5
694
+ },
695
+ {
696
+ "type": "image",
697
+ "img_path": "images/862b919b13024e0ae4ccf8ea1350510ffaca7bdbca2409f37db62423dba2128a.jpg",
698
+ "image_caption": [
699
+ "Figure 3: Active learning test accuracy versus the number of total labeled samples for a range of conditions. Standard errors are shown by shaded regions. "
700
+ ],
701
+ "image_footnote": [],
702
+ "bbox": [
703
+ 155,
704
+ 113,
705
+ 831,
706
+ 292
707
+ ],
708
+ "page_idx": 6
709
+ },
710
+ {
711
+ "type": "text",
712
+ "text": "",
713
+ "bbox": [
714
+ 148,
715
+ 345,
716
+ 851,
717
+ 415
718
+ ],
719
+ "page_idx": 6
720
+ },
721
+ {
722
+ "type": "text",
723
+ "text": "Learning curves. Here we show examples of learning curves that highlight some of the phenomena we observe related to the fragility of active learning algorithms with respect to batch size, architecture, and dataset. ",
724
+ "bbox": [
725
+ 143,
726
+ 425,
727
+ 852,
728
+ 454
729
+ ],
730
+ "page_idx": 6
731
+ },
732
+ {
733
+ "type": "text",
734
+ "text": "Often, we see that in early rounds of training, it is better to do diversity sampling, and later in training, it is better to do uncertainty sampling. This kind of event is demonstrated in Figure 3a, which shows CORESET outperforming confidence-based methods at first, but then doing worse than these methods later on. ",
735
+ "bbox": [
736
+ 148,
737
+ 460,
738
+ 851,
739
+ 502
740
+ ],
741
+ "page_idx": 6
742
+ },
743
+ {
744
+ "type": "text",
745
+ "text": "In this figure, BADGE performs as well as diversity sampling when that strategy does best, and as well as uncertainty sampling once those methods start outpacing CORESET. This suggests that BADGE is a good choice regardless of labeling budget. ",
746
+ "bbox": [
747
+ 148,
748
+ 510,
749
+ 485,
750
+ 579
751
+ ],
752
+ "page_idx": 6
753
+ },
754
+ {
755
+ "type": "text",
756
+ "text": "Separately, we notice that diversity sampling only seems to work well when either the model has good architectural priors (inductive biases) built in, or when the data are easy to learn. Otherwise, penultimate layer representations are not meaningful, and diverse sampling can be deleterious. For this reason, CORESET often performs worse than random on sufficiently complex data when not using a convolutional network (Figure 3b). That is, the diversity induced by unconditional random sampling can often yield a batch that better represents the data. Even when batch size is large and the model has helpful inductive biases, the uncertainty information in BADGE can give it an advantage over pure diversity approaches (Figure 3c). Comprehensive plots of this kind, spanning architecture, dataset, and batch size are in Appendix C. ",
757
+ "bbox": [
758
+ 148,
759
+ 587,
760
+ 485,
761
+ 823
762
+ ],
763
+ "page_idx": 6
764
+ },
765
+ {
766
+ "type": "image",
767
+ "img_path": "images/b6198f1f5a9453b9546972ece2536fc119869120e54d54025af727432c2cd297.jpg",
768
+ "image_caption": [
769
+ "Figure 4: A pairwise penalty matrix over all experiments. Element $P _ { i , j }$ corresponds roughly to the number of times algorithm $_ { i }$ outperforms algorithm $j$ . Column-wise averages at the bottom show overall performance (lower is better). "
770
+ ],
771
+ "image_footnote": [],
772
+ "bbox": [
773
+ 496,
774
+ 512,
775
+ 849,
776
+ 761
777
+ ],
778
+ "page_idx": 6
779
+ },
780
+ {
781
+ "type": "text",
782
+ "text": "Pairwise comparisons. We next show a comprehensive pairwise comparison of algorithms over all datasets $( D )$ , batch sizes $( B )$ , model architectures $( A )$ , and label budgets $( L )$ . From the learning curves, it can be observed that when label budgets are large enough, all algorithms eventually reach similar performance, making the comparison between them uninteresting in the large sample limit. For this reason, for each combination of $( D , B , { \\bar { A } } )$ , we select a set of labeling budgets $L$ where learning is still progressing. We experimented with three different batch sizes and eleven dataset-architecture pairs, making the total number of $( D , B , A )$ combinations $3 \\times 1 1 = 3 3$ . Specifically, we compute $n _ { 0 }$ , the smallest number of labels where RAND’s accuracy reaches $9 9 \\%$ of its final accuracy, and choose label budget $L$ from $\\big \\{ M + 2 ^ { m - 1 } B : m \\in [ \\lfloor \\log ( ( n _ { 0 } - \\dot { M } ) / B ) \\rfloor ] \\big \\} .$ . The calculation of scores in the penalty matrix $P$ follows the following protocol: For each $( D , B , A , L )$ combination and each pair of algorithms $( i , j )$ , we have 5 test errors (one for each repeated run), $\\big \\{ e _ { i } ^ { 1 } , \\ldots , e _ { i } ^ { 5 } \\big \\}$ and $\\big \\{ e _ { j } ^ { 1 } , \\ldots , e _ { j } ^ { 5 } \\big \\}$ respectively. We compute the $t$ -score as $\\begin{array} { c c l } { t } & { = } & { \\sqrt { 5 } \\hat { \\mu } / \\hat { \\sigma } } \\end{array}$ , where ",
783
+ "bbox": [
784
+ 147,
785
+ 119,
786
+ 852,
787
+ 277
788
+ ],
789
+ "page_idx": 7
790
+ },
791
+ {
792
+ "type": "equation",
793
+ "img_path": "images/32eeed035433770dcd2fc45f0a5eb44ee367692d933f0fc9411bc45e38f7149f.jpg",
794
+ "text": "$$\n\\hat { \\mu } = \\frac { 1 } { 5 } \\sum _ { l = 1 } ^ { 5 } ( e _ { i } ^ { l } - e _ { j } ^ { l } ) , ~ \\hat { \\sigma } = \\sqrt { \\frac { 1 } { 4 } \\sum _ { l = 1 } ^ { 5 } ( e _ { i } ^ { l } - e _ { j } ^ { l } - \\hat { \\mu } ) ^ { 2 } } .\n$$",
795
+ "text_format": "latex",
796
+ "bbox": [
797
+ 166,
798
+ 289,
799
+ 500,
800
+ 335
801
+ ],
802
+ "page_idx": 7
803
+ },
804
+ {
805
+ "type": "text",
806
+ "text": "We use the two-sided $t$ -test to compare pairs of algorithms: algorithm $i$ is said to beat algorithm $j$ in this setting if $t ~ > ~ 2 . 7 7 6$ (the critical point of $p$ -value being 0.05), and similarly algorithm $j$ beats algorithm $i$ if $t < - 2 . 7 7 6$ . For each $( D , B , A )$ combination, suppose there are ${ } ^ { n } D , B , A$ different values of $L$ . Then, for each $L$ , if algorithm $i$ beats algorithm $j$ , we accumulate a penalty of $1 / n _ { D , B , A }$ to $P _ { i , j }$ ; otherwise, if algorithm $j$ beats algorithm $i$ , we accumulate a penalty of $1 / n _ { D , B , A }$ to $P _ { j , i }$ The choice of the penalty value $1 / n _ { D , B , A }$ is to ensure that every $( D , B , A )$ combination is assigned equal influence in the aggregated matrix. Therefore, the largest entry of $P$ is at most 33, the total number of $( D , B , A )$ combinations. ",
807
+ "bbox": [
808
+ 148,
809
+ 344,
810
+ 521,
811
+ 525
812
+ ],
813
+ "page_idx": 7
814
+ },
815
+ {
816
+ "type": "image",
817
+ "img_path": "images/8aea56706be71d726b40aab86de0168f6950ac1a8c1af6affb837d9b574a0b9b.jpg",
818
+ "image_caption": [
819
+ "Figure 5: The cumulative distribution function of normalized errors for all acquisition functions. "
820
+ ],
821
+ "image_footnote": [],
822
+ "bbox": [
823
+ 539,
824
+ 290,
825
+ 846,
826
+ 462
827
+ ],
828
+ "page_idx": 7
829
+ },
830
+ {
831
+ "type": "text",
832
+ "text": "Intuitively, each row $i$ indicates the number of settings in which algorithm $i$ beats other algorithms and each column $j$ indicates the number of settings in which algorithm $j$ is beaten by another algorithm. ",
833
+ "bbox": [
834
+ 148,
835
+ 525,
836
+ 852,
837
+ 553
838
+ ],
839
+ "page_idx": 7
840
+ },
841
+ {
842
+ "type": "text",
843
+ "text": "The penalty matrix in Figure 4 summarizes all experiments, showing that BADGE generally outperforms baselines. Matrices grouped by batch size and architecture in Appendix D show a similar trend. ",
844
+ "bbox": [
845
+ 148,
846
+ 560,
847
+ 851,
848
+ 589
849
+ ],
850
+ "page_idx": 7
851
+ },
852
+ {
853
+ "type": "text",
854
+ "text": "Cumulative distribution functions of normalized errors. For each $( D , B , A , L )$ combination, we compute the average error for each algorithm $i$ as $\\textstyle { \\bar { e } } _ { i } = { \\frac { 1 } { 5 } } \\sum _ { l = 1 } ^ { 5 } e _ { i } ^ { l }$ . To ensure that the errors of the algorithms are on the same scale in all settings, we compute the normalized error of every algorithm $i$ $\\mathrm { n e } _ { i } = \\bar { e } _ { i } / \\bar { e } _ { r }$ , where $r$ is the index of the RAND algorithm. By definition, the normalized errors of the RAND algorithm are identically 1 in all settings. Like with penalty matrices, for each $( D , B , A )$ combination, we only consider a subset of $L$ values from the set $\\big \\{ M + 2 ^ { m - 1 } B : m \\in [ \\lfloor \\log ( ( n _ { 0 } - M ) / B ) \\rfloor ] \\big \\}$ . We assign a weight proportional to $1 / n _ { D , B , A }$ to each $( D , B , A , L )$ combination, where there are ${ } ^ { n } D , B , A$ different $L$ values for this combination of $( D , B , A )$ . We then plot the cumulative distribution functions (CDFs) of the normalized errors of all algorithms: for a value of $x$ , the $y$ value is the total weight of settings where the algorithm has normalized error at most $x$ ; in general, an algorithm that has a higher CDF value has better performance. ",
855
+ "bbox": [
856
+ 147,
857
+ 601,
858
+ 852,
859
+ 746
860
+ ],
861
+ "page_idx": 7
862
+ },
863
+ {
864
+ "type": "text",
865
+ "text": "We plot the generated CDFs in Figures 5, 22 and 23. We can see from Figure 5 that BADGE has the best overall performance. In addition, from Figures 22 and 23 in Appendix E, we can conclude that when batch size is small (100 or 1000) or when an MLP is used, both BADGE and MARG perform best. However, in the regime when the batch size is large (10000), MARG’s performance degrades, while BADGE, ALBL and CORESET are the best performing approaches. ",
866
+ "bbox": [
867
+ 148,
868
+ 752,
869
+ 851,
870
+ 823
871
+ ],
872
+ "page_idx": 7
873
+ },
874
+ {
875
+ "type": "text",
876
+ "text": "5 RELATED WORK ",
877
+ "text_level": 1,
878
+ "bbox": [
879
+ 148,
880
+ 118,
881
+ 313,
882
+ 135
883
+ ],
884
+ "page_idx": 8
885
+ },
886
+ {
887
+ "type": "text",
888
+ "text": "Active learning is a been well-studied problem (Settles, 2010; Dasgupta, 2011; Hanneke, 2014). There are two major strategies for active learning—representative sampling and uncertainty sampling. ",
889
+ "bbox": [
890
+ 150,
891
+ 166,
892
+ 851,
893
+ 195
894
+ ],
895
+ "page_idx": 8
896
+ },
897
+ {
898
+ "type": "text",
899
+ "text": "Representative sampling algorithms select batches of unlabeled examples that are representative of the unlabeled set to ask for labels. It is based on the intuition that the sets of representative examples chosen, once labeled, can act as a surrogate for the full dataset. Consequently, performing loss minimization on the surrogate suffices to ensure a low error with respect to the full dataset. In the context of deep learning, Sener and Savarese (2018); Geifman and El-Yaniv (2017) select representative examples based on core-set construction, a fundamental problem in computational geometry. Inspired by generative adversarial learning, Gissin and Shalev-Shwartz (2019) select samples that are maximally indistinguishable from the pool of unlabeled examples. ",
900
+ "bbox": [
901
+ 148,
902
+ 202,
903
+ 852,
904
+ 314
905
+ ],
906
+ "page_idx": 8
907
+ },
908
+ {
909
+ "type": "text",
910
+ "text": "On the other hand, uncertainty sampling is based on a different principle—to select new samples that maximally reduce the uncertainty the algorithm has on the target classifier. In the context of linear classification, Tong and Koller (2001); Schohn and Cohn (2000); Tur et al. (2005) propose uncertainty sampling methods that query examples that lie closest to the current decision boundary. Some uncertainty sampling approaches have theoretical guarantees on statistical consistency (Hanneke, 2014; Balcan et al., 2006). Such methods have also been recently generalized to deep learning. For instance, Gal et al. (2017) use Dropout as an approximation of the posterior of the model parameters, and develop information-based uncertainty reduction criteria; inspired by recent advances on adversarial examples generation, Ducoffe and Precioso (2018) use the distance between an example and one of its adversarial examples as an approximation of its distance to the current decision boundary, and uses it as the criterion of label queries. An ensemble of classifiers could also be used to effectively estimate uncertainty (Beluch et al., 2018). ",
911
+ "bbox": [
912
+ 148,
913
+ 320,
914
+ 851,
915
+ 473
916
+ ],
917
+ "page_idx": 8
918
+ },
919
+ {
920
+ "type": "text",
921
+ "text": "There are several existing approaches that support a hybrid of representative sampling and uncertainty sampling. For example, Baram et al. (2004); Hsu and Lin (2015) present meta-active learning algorithms that can combine the advantages of different active learning algorithms. Inspired by expected loss minimization, Huang et al. (2010) develop label query criteria that balances between the representativeness and informativeness of examples. Another method for this is Active Learning by Learning (Hsu and Lin, 2015), which can select whether to exercise a diversity based algorithm or an uncertainty based algorithm at each round of training as a sequential decision process. ",
922
+ "bbox": [
923
+ 148,
924
+ 481,
925
+ 852,
926
+ 578
927
+ ],
928
+ "page_idx": 8
929
+ },
930
+ {
931
+ "type": "text",
932
+ "text": "There is also a large body of literature on batch mode active learning, where the learner is asked to select a batch of samples within each round (Guo and Schuurmans, 2008; Wang and Ye, 2015; Chen and Krause; Wei et al., 2015; Kirsch et al., 2019). In these works, batch selection is often formulated as an optimization problem with objectives based on (upper bounds of) average log-likelihood, average squared loss, etc. ",
933
+ "bbox": [
934
+ 148,
935
+ 585,
936
+ 851,
937
+ 641
938
+ ],
939
+ "page_idx": 8
940
+ },
941
+ {
942
+ "type": "text",
943
+ "text": "A different query criterion based on expected gradient length (EGL) has been proposed in the as well (Settles et al., 2008). In recent work, Huang et al. (2016) show that the EGL criterion is related to the $T$ -optimality criterion in experimental design. They further demonstrate that the samples selected by EGL are very different from those by entropy-based uncertainty criterion. Zhang et al. (2017a) use the EGL criterion in active sentence and document classification with CNNs. These approaches differ most substantially from BADGE in that they do not take into account the diversity of the examples queried within each batch. ",
944
+ "bbox": [
945
+ 148,
946
+ 647,
947
+ 849,
948
+ 732
949
+ ],
950
+ "page_idx": 8
951
+ },
952
+ {
953
+ "type": "text",
954
+ "text": "There is a wide array of theoretical articles that focus on the related problem of adaptive subsampling for fully-labeled datasets in regression settings (Han et al., 2016; Wang et al., 2018; Ting and Brochu, 2018). Empirical studies of batch stochastic gradient descent also employ adaptive sampling to “emphasize” hard or representative examples (Zhang et al., 2017b; Chang et al., 2017). These works aim at reducing computation costs or finding a better local optimal solution, as opposed to reducing label costs. Nevertheless, our work is inspired by their sampling criteria, which also emphasize samples that induce large updates to the model. ",
955
+ "bbox": [
956
+ 148,
957
+ 738,
958
+ 851,
959
+ 821
960
+ ],
961
+ "page_idx": 8
962
+ },
963
+ {
964
+ "type": "text",
965
+ "text": "As mentioned earlier, our sampling criterion has resemblance to sampling from $k$ -determinantal point processes (Kulesza and Taskar, 2011). Note that in multiclass classification settings, our gradient-based embedding of an example can be viewed as the outer product of the original embedding in the penultimate layer and a probability score vector that encodes the uncertainty information on this example (see Section 3). In this view, the penultimate layer embedding characterizes the diversity of each example, whereas the probability score vector characterizes the quality of each example. The $k$ -DPP is also a natural probabilistic tool for sampling that trades off between quality and diversity (See Kulesza et al., 2012, Section 3.1). We remark that concurrent to our work, Bıyık et al. (2019) develops $k$ -DPP based active learning algorithms based on this principle by explicitly designing diversity and uncertainty measures. ",
966
+ "bbox": [
967
+ 148,
968
+ 119,
969
+ 851,
970
+ 246
971
+ ],
972
+ "page_idx": 9
973
+ },
974
+ {
975
+ "type": "text",
976
+ "text": "6 DISCUSSION ",
977
+ "text_level": 1,
978
+ "bbox": [
979
+ 148,
980
+ 266,
981
+ 284,
982
+ 282
983
+ ],
984
+ "page_idx": 9
985
+ },
986
+ {
987
+ "type": "text",
988
+ "text": "We have established that BADGE is empirically an effective deep active learning algorithm across different architectures and batch sizes, performing similar to or better than other active learning algorithms. A fundamental remaining question is: \"Why?\" While deep learning is notoriously difficult to analyze theoretically, there are several intuitively appealing properties of BADGE: ",
989
+ "bbox": [
990
+ 148,
991
+ 297,
992
+ 852,
993
+ 354
994
+ ],
995
+ "page_idx": 9
996
+ },
997
+ {
998
+ "type": "text",
999
+ "text": "1. The definition of uncertainty (a lower bound on the gradient magnitude of the last layer) guarantees some update of parameters. 2. It optimizes for diversity as well as uncertainty, eliminating a failure mode of choosing many identical uncertain examples in a batch, and does so without requiring any hyperparameters. 3. The randomization associated with the $k { \\mathrm { - M E A N S + + } }$ initialization sampler implies that, even for adversarially constructed datasets, it eventually converges to a good solution. ",
1000
+ "bbox": [
1001
+ 184,
1002
+ 366,
1003
+ 852,
1004
+ 460
1005
+ ],
1006
+ "page_idx": 9
1007
+ },
1008
+ {
1009
+ "type": "text",
1010
+ "text": "The combination of these properties appears to generate the robustness that we observe empirically. ",
1011
+ "bbox": [
1012
+ 155,
1013
+ 465,
1014
+ 802,
1015
+ 481
1016
+ ],
1017
+ "page_idx": 9
1018
+ },
1019
+ {
1020
+ "type": "text",
1021
+ "text": "REFERENCES ",
1022
+ "text_level": 1,
1023
+ "bbox": [
1024
+ 148,
1025
+ 501,
1026
+ 259,
1027
+ 516
1028
+ ],
1029
+ "page_idx": 9
1030
+ },
1031
+ {
1032
+ "type": "text",
1033
+ "text": "David Cohn, Les Atlas, and Richard Ladner. Improving generalization with active learning. Machine learning, 1994. \nMaria-Florina Balcan, Alina Beygelzimer, and John Langford. Agnostic active learning. In International Conference on Machine Learning, 2006. \nAlina Beygelzimer, Daniel J Hsu, John Langford, and Tong Zhang. Agnostic active learning without constraints. In Neural Information Processing Systems, 2010. \nNicolo Cesa-Bianchi, Claudio Gentile, and Francesco Orabona. Robust bounds for classification via selective sampling. In International Conference on Machine Learning, 2009. \nDavid Arthur and Sergei Vassilvitskii. k-means $^ { + + }$ : The advantages of careful seeding. In ACM-SIAM symposium on Discrete algorithms, 2007. \nAlex Kulesza and Ben Taskar. k-dpps: Fixed-size determinantal point processes. In International Conference on Machine Learning, 2011. \nMichał Derezinski and Manfred K Warmuth. Reverse iterative volume sampling for linear regression. ´ The Journal of Machine Learning Research, 19(1), 2018. \nByungkon Kang. Fast determinantal point process sampling with application to clustering. In Neural Information Processing Systems, 2013. ",
1034
+ "bbox": [
1035
+ 145,
1036
+ 523,
1037
+ 854,
1038
+ 824
1039
+ ],
1040
+ "page_idx": 9
1041
+ },
1042
+ {
1043
+ "type": "text",
1044
+ "text": "Nima Anari, Shayan Oveis Gharan, and Alireza Rezaei. Monte carlo markov chain algorithms for sampling strongly rayleigh distributions and determinantal point processes. In Conference on Learning Theory, 2016. ",
1045
+ "bbox": [
1046
+ 145,
1047
+ 119,
1048
+ 852,
1049
+ 150
1050
+ ],
1051
+ "page_idx": 10
1052
+ },
1053
+ {
1054
+ "type": "text",
1055
+ "text": "Michał Derezinski. Fast determinantal point processes via distortion-free intermediate sampling. ´ arXiv preprint, 2018. ",
1056
+ "bbox": [
1057
+ 148,
1058
+ 156,
1059
+ 848,
1060
+ 186
1061
+ ],
1062
+ "page_idx": 10
1063
+ },
1064
+ {
1065
+ "type": "text",
1066
+ "text": "Ozan Sener and Silvio Savarese. Active learning for convolutional neural networks: A core-set approach. In International Conference on Learning Representations, 2018. ",
1067
+ "bbox": [
1068
+ 148,
1069
+ 194,
1070
+ 848,
1071
+ 224
1072
+ ],
1073
+ "page_idx": 10
1074
+ },
1075
+ {
1076
+ "type": "text",
1077
+ "text": "Dan Wang and Yi Shang. A new active labeling method for deep learning. In 2014 International joint conference on neural networks, 2014. ",
1078
+ "bbox": [
1079
+ 147,
1080
+ 231,
1081
+ 849,
1082
+ 261
1083
+ ],
1084
+ "page_idx": 10
1085
+ },
1086
+ {
1087
+ "type": "text",
1088
+ "text": "Dan Roth and Kevin Small. Margin-based active learning for structured output spaces. In European Conference on Machine Learning, 2006. ",
1089
+ "bbox": [
1090
+ 145,
1091
+ 267,
1092
+ 849,
1093
+ 297
1094
+ ],
1095
+ "page_idx": 10
1096
+ },
1097
+ {
1098
+ "type": "text",
1099
+ "text": "Wei-Ning Hsu and Hsuan-Tien Lin. Active learning by learning. In Association for the advancement of artificial intelligence, 2015. ",
1100
+ "bbox": [
1101
+ 148,
1102
+ 305,
1103
+ 851,
1104
+ 335
1105
+ ],
1106
+ "page_idx": 10
1107
+ },
1108
+ {
1109
+ "type": "text",
1110
+ "text": "Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. Deep residual learning for image recognition. In Proceedings of the IEEE conference on computer vision and pattern recognition, pages 770–778, 2016. ",
1111
+ "bbox": [
1112
+ 147,
1113
+ 342,
1114
+ 851,
1115
+ 372
1116
+ ],
1117
+ "page_idx": 10
1118
+ },
1119
+ {
1120
+ "type": "text",
1121
+ "text": "Karen Simonyan and Andrew Zisserman. Very deep convolutional networks for large-scale image recognition. arXiv preprint, 2014. ",
1122
+ "bbox": [
1123
+ 147,
1124
+ 380,
1125
+ 851,
1126
+ 409
1127
+ ],
1128
+ "page_idx": 10
1129
+ },
1130
+ {
1131
+ "type": "text",
1132
+ "text": "Yuval Netzer, Tao Wang, Adam Coates, Alessandro Bissacco, Bo Wu, and Andrew Y Ng. Reading digits in natural images with unsupervised feature learning. 2011. ",
1133
+ "bbox": [
1134
+ 147,
1135
+ 416,
1136
+ 851,
1137
+ 446
1138
+ ],
1139
+ "page_idx": 10
1140
+ },
1141
+ {
1142
+ "type": "text",
1143
+ "text": "Alex Krizhevsky. Learning multiple layers of features from tiny images. Technical report, Citeseer, 2009. ",
1144
+ "bbox": [
1145
+ 148,
1146
+ 454,
1147
+ 843,
1148
+ 470
1149
+ ],
1150
+ "page_idx": 10
1151
+ },
1152
+ {
1153
+ "type": "text",
1154
+ "text": "Yann LeCun, Léon Bottou, Yoshua Bengio, Patrick Haffner, et al. Gradient-based learning applied to document recognition. IEEE, 1998. ",
1155
+ "bbox": [
1156
+ 143,
1157
+ 477,
1158
+ 849,
1159
+ 507
1160
+ ],
1161
+ "page_idx": 10
1162
+ },
1163
+ {
1164
+ "type": "text",
1165
+ "text": "Jordan T Ash and Ryan P Adams. On the difficulty of warm-starting neural network training. arXiv preprint, 2019. ",
1166
+ "bbox": [
1167
+ 145,
1168
+ 513,
1169
+ 852,
1170
+ 544
1171
+ ],
1172
+ "page_idx": 10
1173
+ },
1174
+ {
1175
+ "type": "text",
1176
+ "text": "Yao-Yuan Yang, Shao-Chuan Lee, Yu-An Chung, Tung-En Wu, Si-An Chen, and Hsuan-Tien Lin. libact: Pool-based active learning in python. arXiv preprint, 2017. ",
1177
+ "bbox": [
1178
+ 143,
1179
+ 551,
1180
+ 852,
1181
+ 582
1182
+ ],
1183
+ "page_idx": 10
1184
+ },
1185
+ {
1186
+ "type": "text",
1187
+ "text": "Adam Paszke, Sam Gross, Soumith Chintala, Gregory Chanan, Edward Yang, Zachary DeVito, Zeming Lin, Alban Desmaison, Luca Antiga, and Adam Lerer. Automatic differentiation in pytorch. 2017. ",
1188
+ "bbox": [
1189
+ 147,
1190
+ 588,
1191
+ 852,
1192
+ 618
1193
+ ],
1194
+ "page_idx": 10
1195
+ },
1196
+ {
1197
+ "type": "text",
1198
+ "text": "Burr Settles. Active learning literature survey. University of Wisconsin, Madison, 2010. ",
1199
+ "bbox": [
1200
+ 145,
1201
+ 626,
1202
+ 723,
1203
+ 642
1204
+ ],
1205
+ "page_idx": 10
1206
+ },
1207
+ {
1208
+ "type": "text",
1209
+ "text": "Sanjoy Dasgupta. Two faces of active learning. Theoretical computer science, 2011. ",
1210
+ "bbox": [
1211
+ 147,
1212
+ 648,
1213
+ 700,
1214
+ 665
1215
+ ],
1216
+ "page_idx": 10
1217
+ },
1218
+ {
1219
+ "type": "text",
1220
+ "text": "Steve Hanneke. Theory of disagreement-based active learning. Foundations and Trends in Machine Learning, 2014. ",
1221
+ "bbox": [
1222
+ 147,
1223
+ 672,
1224
+ 854,
1225
+ 702
1226
+ ],
1227
+ "page_idx": 10
1228
+ },
1229
+ {
1230
+ "type": "text",
1231
+ "text": "Yonatan Geifman and Ran El-Yaniv. Deep active learning over the long tail. arXiv preprint, 2017. ",
1232
+ "bbox": [
1233
+ 147,
1234
+ 709,
1235
+ 790,
1236
+ 726
1237
+ ],
1238
+ "page_idx": 10
1239
+ },
1240
+ {
1241
+ "type": "text",
1242
+ "text": "Daniel Gissin and Shai Shalev-Shwartz. Discriminative active learning. arXiv preprint, 2019. ",
1243
+ "bbox": [
1244
+ 147,
1245
+ 733,
1246
+ 763,
1247
+ 750
1248
+ ],
1249
+ "page_idx": 10
1250
+ },
1251
+ {
1252
+ "type": "text",
1253
+ "text": "Simon Tong and Daphne Koller. Support vector machine active learning with applications to text classification. Journal of machine learning research, 2001. ",
1254
+ "bbox": [
1255
+ 145,
1256
+ 756,
1257
+ 851,
1258
+ 786
1259
+ ],
1260
+ "page_idx": 10
1261
+ },
1262
+ {
1263
+ "type": "text",
1264
+ "text": "Greg Schohn and David Cohn. Less is more: Active learning with support vector machines. In International Conference on Machine Learning, 2000. ",
1265
+ "bbox": [
1266
+ 147,
1267
+ 794,
1268
+ 849,
1269
+ 823
1270
+ ],
1271
+ "page_idx": 10
1272
+ },
1273
+ {
1274
+ "type": "text",
1275
+ "text": "Gokhan Tur, Dilek Hakkani-Tür, and Robert E Schapire. Combining active and semi-supervised learning for spoken language understanding. Speech Communication, 2005. ",
1276
+ "bbox": [
1277
+ 143,
1278
+ 119,
1279
+ 852,
1280
+ 148
1281
+ ],
1282
+ "page_idx": 11
1283
+ },
1284
+ {
1285
+ "type": "text",
1286
+ "text": "Yarin Gal, Riashat Islam, and Zoubin Ghahramani. Deep bayesian active learning with image data. In International Conference on Machine Learning, 2017. ",
1287
+ "bbox": [
1288
+ 151,
1289
+ 159,
1290
+ 849,
1291
+ 188
1292
+ ],
1293
+ "page_idx": 11
1294
+ },
1295
+ {
1296
+ "type": "text",
1297
+ "text": "Melanie Ducoffe and Frederic Precioso. Adversarial active learning for deep networks: a margin based approach. arXiv preprint, 2018. ",
1298
+ "bbox": [
1299
+ 147,
1300
+ 196,
1301
+ 849,
1302
+ 227
1303
+ ],
1304
+ "page_idx": 11
1305
+ },
1306
+ {
1307
+ "type": "text",
1308
+ "text": "William H Beluch, Tim Genewein, Andreas Nürnberger, and Jan M Köhler. The power of ensembles for active learning in image classification. In IEEE Conference on Computer Vision and Pattern Recognition, 2018. ",
1309
+ "bbox": [
1310
+ 147,
1311
+ 236,
1312
+ 854,
1313
+ 279
1314
+ ],
1315
+ "page_idx": 11
1316
+ },
1317
+ {
1318
+ "type": "text",
1319
+ "text": "Yoram Baram, Ran El Yaniv, and Kobi Luz. Online choice of active learning algorithms. Journal of Machine Learning Research, 2004. ",
1320
+ "bbox": [
1321
+ 148,
1322
+ 289,
1323
+ 851,
1324
+ 318
1325
+ ],
1326
+ "page_idx": 11
1327
+ },
1328
+ {
1329
+ "type": "text",
1330
+ "text": "Sheng-Jun Huang, Rong Jin, and Zhi-Hua Zhou. Active learning by querying informative and representative examples. In Neural Information Processing Systems, 2010. ",
1331
+ "bbox": [
1332
+ 143,
1333
+ 327,
1334
+ 851,
1335
+ 357
1336
+ ],
1337
+ "page_idx": 11
1338
+ },
1339
+ {
1340
+ "type": "text",
1341
+ "text": "Yuhong Guo and Dale Schuurmans. Discriminative batch mode active learning. In Neural Information Processing Systems, 2008. ",
1342
+ "bbox": [
1343
+ 147,
1344
+ 366,
1345
+ 849,
1346
+ 395
1347
+ ],
1348
+ "page_idx": 11
1349
+ },
1350
+ {
1351
+ "type": "text",
1352
+ "text": "Zheng Wang and Jieping Ye. Querying discriminative and representative samples for batch mode active learning. Transactions on Knowledge Discovery from Data, 2015. ",
1353
+ "bbox": [
1354
+ 147,
1355
+ 405,
1356
+ 851,
1357
+ 435
1358
+ ],
1359
+ "page_idx": 11
1360
+ },
1361
+ {
1362
+ "type": "text",
1363
+ "text": "Yuxin Chen and Andreas Krause. Near-optimal batch mode active learning and adaptive submodular optimization. In International Conference on Machine Learning. ",
1364
+ "bbox": [
1365
+ 147,
1366
+ 444,
1367
+ 849,
1368
+ 474
1369
+ ],
1370
+ "page_idx": 11
1371
+ },
1372
+ {
1373
+ "type": "text",
1374
+ "text": "Kai Wei, Rishabh Iyer, and Jeff Bilmes. Submodularity in data subset selection and active learning. In International Conference on Machine Learning, 2015. ",
1375
+ "bbox": [
1376
+ 148,
1377
+ 483,
1378
+ 848,
1379
+ 512
1380
+ ],
1381
+ "page_idx": 11
1382
+ },
1383
+ {
1384
+ "type": "text",
1385
+ "text": "Andreas Kirsch, Joost van Amersfoort, and Yarin Gal. Batchbald: Efficient and diverse batch acquisition for deep bayesian active learning. In Neural Information Processing Systems 32, 2019. ",
1386
+ "bbox": [
1387
+ 145,
1388
+ 521,
1389
+ 848,
1390
+ 551
1391
+ ],
1392
+ "page_idx": 11
1393
+ },
1394
+ {
1395
+ "type": "text",
1396
+ "text": "Burr Settles, Mark Craven, and Soumya Ray. Multiple-instance active learning. In Neural Information Processing Systems, 2008. ",
1397
+ "bbox": [
1398
+ 148,
1399
+ 559,
1400
+ 848,
1401
+ 589
1402
+ ],
1403
+ "page_idx": 11
1404
+ },
1405
+ {
1406
+ "type": "text",
1407
+ "text": "Jiaji Huang, Rewon Child, and Vinay Rao. Active learning for speech recognition: the power of gradients. arXiv preprint, 2016. ",
1408
+ "bbox": [
1409
+ 143,
1410
+ 599,
1411
+ 849,
1412
+ 628
1413
+ ],
1414
+ "page_idx": 11
1415
+ },
1416
+ {
1417
+ "type": "text",
1418
+ "text": "Ye Zhang, Matthew Lease, and Byron C Wallace. Active discriminative text representation learning. In AAAI Conference on Artificial Intelligence, 2017a. ",
1419
+ "bbox": [
1420
+ 147,
1421
+ 637,
1422
+ 848,
1423
+ 667
1424
+ ],
1425
+ "page_idx": 11
1426
+ },
1427
+ {
1428
+ "type": "text",
1429
+ "text": "Lei Han, Kean Ming Tan, Ting Yang, and Tong Zhang. Local uncertainty sampling for large-scale multi-class logistic regression. arXiv preprint, 2016. ",
1430
+ "bbox": [
1431
+ 142,
1432
+ 676,
1433
+ 849,
1434
+ 707
1435
+ ],
1436
+ "page_idx": 11
1437
+ },
1438
+ {
1439
+ "type": "text",
1440
+ "text": "HaiYing Wang, Rong Zhu, and Ping Ma. Optimal subsampling for large sample logistic regression. Journal of the American Statistical Association, 2018. ",
1441
+ "bbox": [
1442
+ 142,
1443
+ 715,
1444
+ 851,
1445
+ 744
1446
+ ],
1447
+ "page_idx": 11
1448
+ },
1449
+ {
1450
+ "type": "text",
1451
+ "text": "Daniel Ting and Eric Brochu. Optimal subsampling with influence functions. In Neural Information Processing Systems, 2018. ",
1452
+ "bbox": [
1453
+ 145,
1454
+ 753,
1455
+ 849,
1456
+ 784
1457
+ ],
1458
+ "page_idx": 11
1459
+ },
1460
+ {
1461
+ "type": "text",
1462
+ "text": "Cheng Zhang, Hedvig Kjellstrom, and Stephan Mandt. Determinantal point processes for mini-batch diversification. Uncertainty in Artificial Intelligence, 2017b. ",
1463
+ "bbox": [
1464
+ 145,
1465
+ 794,
1466
+ 848,
1467
+ 823
1468
+ ],
1469
+ "page_idx": 11
1470
+ },
1471
+ {
1472
+ "type": "text",
1473
+ "text": "Haw-Shiuan Chang, Erik Learned-Miller, and Andrew McCallum. Active bias: Training more accurate neural networks by emphasizing high variance samples. In Neural Information Processing Systems, 2017. ",
1474
+ "bbox": [
1475
+ 145,
1476
+ 119,
1477
+ 851,
1478
+ 148
1479
+ ],
1480
+ "page_idx": 12
1481
+ },
1482
+ {
1483
+ "type": "text",
1484
+ "text": "Alex Kulesza, Ben Taskar, et al. Determinantal point processes for machine learning. Foundations and Trends in Machine Learning, 2012. ",
1485
+ "bbox": [
1486
+ 147,
1487
+ 156,
1488
+ 849,
1489
+ 185
1490
+ ],
1491
+ "page_idx": 12
1492
+ },
1493
+ {
1494
+ "type": "text",
1495
+ "text": "Erdem Bıyık, Kenneth Wang, Nima Anari, and Dorsa Sadigh. Batch active learning using determinantal point processes. arXiv preprint, 2019. ",
1496
+ "bbox": [
1497
+ 147,
1498
+ 193,
1499
+ 848,
1500
+ 222
1501
+ ],
1502
+ "page_idx": 12
1503
+ },
1504
+ {
1505
+ "type": "text",
1506
+ "text": "Stephen Mussmann and Percy S Liang. Uncertainty sampling is preconditioned stochastic gradient descent on zero-one loss. In Neural Information Processing Systems, 2018. ",
1507
+ "bbox": [
1508
+ 147,
1509
+ 228,
1510
+ 849,
1511
+ 258
1512
+ ],
1513
+ "page_idx": 12
1514
+ },
1515
+ {
1516
+ "type": "text",
1517
+ "text": "A THE $k$ -MEA ${ . N S + + }$ SEEDING ALGORITHM ",
1518
+ "text_level": 1,
1519
+ "bbox": [
1520
+ 148,
1521
+ 282,
1522
+ 513,
1523
+ 299
1524
+ ],
1525
+ "page_idx": 12
1526
+ },
1527
+ {
1528
+ "type": "text",
1529
+ "text": "Here we briefly review the $k { \\mathrm { - M E A N S + + } }$ seeding algorithm by (Arthur and Vassilvitskii, 2007). Its basic idea is to perform sequential sampling of $k$ centers, where each new center is sampled from the ground set with probability proportional to the squared distance to its nearest center. It is shown in (Arthur and Vassilvitskii, 2007) that the set of centers returned is guaranteed to approximate the $k$ -means objective function in expectation, thus ensuring diversity. ",
1530
+ "bbox": [
1531
+ 147,
1532
+ 313,
1533
+ 851,
1534
+ 383
1535
+ ],
1536
+ "page_idx": 12
1537
+ },
1538
+ {
1539
+ "type": "text",
1540
+ "text": "Algorithm 2 The $k$ -MEANS++ seeding algorithm (Arthur and Vassilvitskii, 2007) ",
1541
+ "text_level": 1,
1542
+ "bbox": [
1543
+ 147,
1544
+ 397,
1545
+ 683,
1546
+ 411
1547
+ ],
1548
+ "page_idx": 12
1549
+ },
1550
+ {
1551
+ "type": "text",
1552
+ "text": "Require: Ground set $G \\subset \\mathbb { R } ^ { d }$ , target size $k$ . \nEnsure: Center set $C$ of size $k$ . $C _ { 1 } \\gets \\{ c _ { 1 } \\}$ , where $c _ { 1 }$ is sampled uniformly at random from $G$ . for $t = 2 , \\ldots , k$ : do Define $D _ { t } ( x ) : = \\mathrm { m i n } _ { c \\in C _ { t - 1 } } \\| x - c \\| _ { 2 }$ . $c _ { t } \\gets$ Sample $x$ from $G$ with probability $\\frac { D _ { t } ( x ) ^ { 2 } } { \\sum _ { x \\in G } D _ { t } ( x ) ^ { 2 } }$ . $C _ { t } \\gets C _ { t - 1 } \\cup \\{ c _ { t } \\} _ { }$ . end for return $C _ { k }$ . ",
1553
+ "bbox": [
1554
+ 147,
1555
+ 415,
1556
+ 576,
1557
+ 555
1558
+ ],
1559
+ "page_idx": 12
1560
+ },
1561
+ {
1562
+ "type": "text",
1563
+ "text": "B BADGE FOR BINARY LOGISTIC REGRESSION ",
1564
+ "text_level": 1,
1565
+ "bbox": [
1566
+ 148,
1567
+ 582,
1568
+ 558,
1569
+ 598
1570
+ ],
1571
+ "page_idx": 12
1572
+ },
1573
+ {
1574
+ "type": "text",
1575
+ "text": "We consider instantiating BADGE for binary logistic regression, where $\\mathcal { V } = \\{ - 1 , + 1 \\}$ . Given a linear classifier $w$ , we define the predictive probability of $w$ on $x$ as $p _ { w } ( y | x , \\theta ) = \\sigma ( y w \\cdot x )$ , where $\\begin{array} { r } { \\sigma ( z ) = \\frac { 1 } { 1 + e ^ { - z } } } \\end{array}$ is the sigmoid funciton. ",
1576
+ "bbox": [
1577
+ 147,
1578
+ 612,
1579
+ 852,
1580
+ 656
1581
+ ],
1582
+ "page_idx": 12
1583
+ },
1584
+ {
1585
+ "type": "text",
1586
+ "text": "Recall that ${ \\hat { y } } = { \\hat { y } } ( x )$ is the hallucinated label: ",
1587
+ "bbox": [
1588
+ 147,
1589
+ 662,
1590
+ 447,
1591
+ 678
1592
+ ],
1593
+ "page_idx": 12
1594
+ },
1595
+ {
1596
+ "type": "equation",
1597
+ "img_path": "images/761d32e1fc0ea3a16b3cc392c02bb4a4bc88fb94d123a527dc896c44b63172ea.jpg",
1598
+ "text": "$$\n\\hat { y } ( x ) = \\left\\{ { \\begin{array} { l l } { + 1 , } & { p _ { w } ( + 1 | x , \\theta ) > 1 / 2 , } \\\\ { - 1 , } & { p _ { w } ( + 1 | x , \\theta ) \\leq 1 / 2 . } \\end{array} } \\right.\n$$",
1599
+ "text_format": "latex",
1600
+ "bbox": [
1601
+ 375,
1602
+ 683,
1603
+ 620,
1604
+ 718
1605
+ ],
1606
+ "page_idx": 12
1607
+ },
1608
+ {
1609
+ "type": "text",
1610
+ "text": "The binary logistic loss of classifier $w$ on example $( x , y )$ is defined as: ",
1611
+ "bbox": [
1612
+ 148,
1613
+ 729,
1614
+ 609,
1615
+ 744
1616
+ ],
1617
+ "page_idx": 12
1618
+ },
1619
+ {
1620
+ "type": "equation",
1621
+ "img_path": "images/e12959b2bd715346b53c680fd61135d51d59b955ba6bea4935589b7e90cd23d7.jpg",
1622
+ "text": "$$\n\\ell ( w , ( x , y ) ) = \\ln ( 1 + \\exp ( - y w \\cdot x ) ) .\n$$",
1623
+ "text_format": "latex",
1624
+ "bbox": [
1625
+ 372,
1626
+ 747,
1627
+ 622,
1628
+ 765
1629
+ ],
1630
+ "page_idx": 12
1631
+ },
1632
+ {
1633
+ "type": "text",
1634
+ "text": "Now, given model $w$ and example $x$ , we define $\\begin{array} { r } { \\hat { g } _ { x } = \\frac { \\partial } { \\partial w } \\ell ( w , ( x , \\hat { y } ) ) = ( 1 - p _ { w } ( \\hat { y } | x , \\theta ) ) \\cdot ( - \\hat { y } \\cdot x ) } \\end{array}$ as the loss gradient induced by the example with hallucinated label, and $\\begin{array} { r } { \\tilde { g } _ { x } = \\frac { \\partial } { \\partial w } \\ell ( w , ( x , y ) ) = ( 1 - p _ { w } ( y | x , \\theta ) ) \\cdot ( - y \\cdot x ) } \\end{array}$ as the loss gradient induced by the example with true label. ",
1635
+ "bbox": [
1636
+ 147,
1637
+ 776,
1638
+ 852,
1639
+ 823
1640
+ ],
1641
+ "page_idx": 12
1642
+ },
1643
+ {
1644
+ "type": "image",
1645
+ "img_path": "images/eb67dcecb5e582087261eb4ed09d95f125d1a62a5adfb0b8d0f0f0be6bba3e0a.jpg",
1646
+ "image_caption": [
1647
+ "Figure 6: Full learning curves for OpenML #6 with MLP. "
1648
+ ],
1649
+ "image_footnote": [],
1650
+ "bbox": [
1651
+ 145,
1652
+ 131,
1653
+ 849,
1654
+ 282
1655
+ ],
1656
+ "page_idx": 13
1657
+ },
1658
+ {
1659
+ "type": "image",
1660
+ "img_path": "images/1c591f31c495cb4e2c3d089926a4a9dcc80732c6e0a95a3492a7a4b106da884d.jpg",
1661
+ "image_caption": [
1662
+ "Figure 7: Full learning curves for OpenML #155 with MLP. "
1663
+ ],
1664
+ "image_footnote": [],
1665
+ "bbox": [
1666
+ 145,
1667
+ 335,
1668
+ 852,
1669
+ 486
1670
+ ],
1671
+ "page_idx": 13
1672
+ },
1673
+ {
1674
+ "type": "text",
1675
+ "text": "Suppose that BADGE only selects examples from region $S _ { w } = \\{ x : w \\cdot x = 0 \\}$ , then as $p _ { w } ( + 1 | x , \\theta ) =$ $\\begin{array} { r } { p _ { w } \\big ( - 1 | x , \\theta \\big ) = \\frac { 1 } { 2 } } \\end{array}$ , we have that for all $x$ in $S _ { w }$ , $\\hat { g } _ { x } = s _ { x } \\cdot g _ { x }$ for some $s _ { x } \\in \\{ \\pm 1 \\}$ . This implies that, sampling from a DPP induced by ${ \\hat { g } } _ { x }$ ’s is equivalent to sampling from a DPP induced by $g _ { x }$ ’s. It is noted in Mussmann and Liang (2018) that uncertainty sampling (i.e. sampling from $D _ { | S _ { w } }$ ) implicitly performs preconditioned stochastic gradient descent on the expected 0-1 loss. In addition, it has been shown that DPP sampling over gradients may reduce the variance of the mini-batch stochastic gradient updates (Zhang et al., 2017b); this suggests that BADGE, when restricted its sampling over low-margin regions $( S _ { w } )$ , improves over uncertainty sampling by collecting examples that together induce lower-variance updates on the gradient direction of expected 0-1 loss. ",
1676
+ "bbox": [
1677
+ 147,
1678
+ 518,
1679
+ 851,
1680
+ 643
1681
+ ],
1682
+ "page_idx": 13
1683
+ },
1684
+ {
1685
+ "type": "text",
1686
+ "text": "C ALL LEARNING CURVES ",
1687
+ "text_level": 1,
1688
+ "bbox": [
1689
+ 150,
1690
+ 671,
1691
+ 382,
1692
+ 686
1693
+ ],
1694
+ "page_idx": 13
1695
+ },
1696
+ {
1697
+ "type": "text",
1698
+ "text": "We plot all learning curves (test accuracy as a function of the number of labeled example queried) in Figures 6 to 12. In addition, we zoom into regions of the learning curves that discriminates the performance of all algorithms in Figures 13 to 19. ",
1699
+ "bbox": [
1700
+ 148,
1701
+ 694,
1702
+ 851,
1703
+ 736
1704
+ ],
1705
+ "page_idx": 13
1706
+ },
1707
+ {
1708
+ "type": "text",
1709
+ "text": "D PAIRWISE COMPARISONS OF ALGORITHMS ",
1710
+ "text_level": 1,
1711
+ "bbox": [
1712
+ 148,
1713
+ 758,
1714
+ 534,
1715
+ 773
1716
+ ],
1717
+ "page_idx": 13
1718
+ },
1719
+ {
1720
+ "type": "text",
1721
+ "text": "In addition to Figure 4 in the main text, we also provide penalty matrices (Figures 20 and 21), where the results are aggregated by conditioning on a fixed batch size (100, 1000 and 10000) or on a fixed neural network model (MLP, ResNet and VGG). For each penalty matrix, the parenthesized number in its title is the total number of $( D , B , A )$ combinations aggregated; as discussed in Section 4, this is also an upper bound on all its entries. It can be seen that uncertainty-based methods (e.g. MARG) perform well only in small batch size regimes (100) or when using MLP models; representative sampling based methods (e.g. CORESET) only perform well in large batch size regimes (10000) or when using ResNet or VGG models. In contrast, BADGE’s performance is competitive across all batch sizes and neural network models. ",
1722
+ "bbox": [
1723
+ 148,
1724
+ 780,
1725
+ 851,
1726
+ 821
1727
+ ],
1728
+ "page_idx": 13
1729
+ },
1730
+ {
1731
+ "type": "image",
1732
+ "img_path": "images/d9030f407149623b5e1e3c6e2181cca01dc0f054d2cc7ee5b9e65e37b788430f.jpg",
1733
+ "image_caption": [
1734
+ "Figure 8: Full learning curves for OpenML #156 with MLP. "
1735
+ ],
1736
+ "image_footnote": [],
1737
+ "bbox": [
1738
+ 143,
1739
+ 200,
1740
+ 849,
1741
+ 353
1742
+ ],
1743
+ "page_idx": 14
1744
+ },
1745
+ {
1746
+ "type": "image",
1747
+ "img_path": "images/0dc915ff317f4bdacdb7591b36b371084cd4cbb9f1f0d4f07c652c08e046f8dd.jpg",
1748
+ "image_caption": [
1749
+ "Figure 9: Full learning curves for OpenML #184 with MLP. "
1750
+ ],
1751
+ "image_footnote": [],
1752
+ "bbox": [
1753
+ 145,
1754
+ 555,
1755
+ 851,
1756
+ 708
1757
+ ],
1758
+ "page_idx": 14
1759
+ },
1760
+ {
1761
+ "type": "image",
1762
+ "img_path": "images/021581459787c3b3df4ed9065c4342a96367bf511bc9af442888620fe9489f66.jpg",
1763
+ "image_caption": [
1764
+ "Figure 10: Full learning curves for SVHN with MLP, ResNet and VGG. "
1765
+ ],
1766
+ "image_footnote": [],
1767
+ "bbox": [
1768
+ 142,
1769
+ 131,
1770
+ 854,
1771
+ 546
1772
+ ],
1773
+ "page_idx": 15
1774
+ },
1775
+ {
1776
+ "type": "image",
1777
+ "img_path": "images/e8fe0e3b347610236751383630edb45029111c672cb94ecfd283ffc78dca523d.jpg",
1778
+ "image_caption": [
1779
+ "Figure 11: Full learning curves for MNIST with MLP. "
1780
+ ],
1781
+ "image_footnote": [],
1782
+ "bbox": [
1783
+ 143,
1784
+ 617,
1785
+ 852,
1786
+ 771
1787
+ ],
1788
+ "page_idx": 15
1789
+ },
1790
+ {
1791
+ "type": "image",
1792
+ "img_path": "images/a4a03ba238975dad7d4d9706c2fc6f8bf6ace30f7ad25c97337a95b53ba674be.jpg",
1793
+ "image_caption": [
1794
+ "Figure 12: Full learning curves for CIFAR10 with MLP, ResNet and VGG. "
1795
+ ],
1796
+ "image_footnote": [],
1797
+ "bbox": [
1798
+ 142,
1799
+ 132,
1800
+ 852,
1801
+ 546
1802
+ ],
1803
+ "page_idx": 16
1804
+ },
1805
+ {
1806
+ "type": "image",
1807
+ "img_path": "images/990f157de5f16287b5cc2739568242f27ae18014df01472d1d1c4978f90a5d0a.jpg",
1808
+ "image_caption": [
1809
+ "Figure 13: Zoomed-in learning curves for OpenML $\\# 6$ with MLP. "
1810
+ ],
1811
+ "image_footnote": [],
1812
+ "bbox": [
1813
+ 143,
1814
+ 617,
1815
+ 852,
1816
+ 772
1817
+ ],
1818
+ "page_idx": 16
1819
+ },
1820
+ {
1821
+ "type": "image",
1822
+ "img_path": "images/d654ac52f0e8e7b4de997ddc93ec4e0f4ce9c1df3e103a48670fd2e5bf5edd73.jpg",
1823
+ "image_caption": [
1824
+ "Figure 14: Zoomed-in learning curves for OpenML #155 with MLP. "
1825
+ ],
1826
+ "image_footnote": [],
1827
+ "bbox": [
1828
+ 145,
1829
+ 141,
1830
+ 852,
1831
+ 294
1832
+ ],
1833
+ "page_idx": 17
1834
+ },
1835
+ {
1836
+ "type": "image",
1837
+ "img_path": "images/0f700512626eabdd7ba390eaa418d36818628e85542d87e27533dd250077d27a.jpg",
1838
+ "image_caption": [
1839
+ "Figure 15: Zoomed-in learning curves for OpenML #156 with MLP. "
1840
+ ],
1841
+ "image_footnote": [],
1842
+ "bbox": [
1843
+ 143,
1844
+ 376,
1845
+ 851,
1846
+ 531
1847
+ ],
1848
+ "page_idx": 17
1849
+ },
1850
+ {
1851
+ "type": "image",
1852
+ "img_path": "images/f2afa1c87f4feaa6e3796baea1d6a22218fb040453bcdb82a250d55b4d0a9738.jpg",
1853
+ "image_caption": [
1854
+ "Figure 16: Zoomed-in learning curves for OpenML #184 with MLP. "
1855
+ ],
1856
+ "image_footnote": [],
1857
+ "bbox": [
1858
+ 145,
1859
+ 611,
1860
+ 851,
1861
+ 766
1862
+ ],
1863
+ "page_idx": 17
1864
+ },
1865
+ {
1866
+ "type": "image",
1867
+ "img_path": "images/f0c42a0c3e2d768cd833fa7d50e3800e2873b503e576998c7a448383e9630f34.jpg",
1868
+ "image_caption": [
1869
+ "Figure 17: Zoomed-in learning curves for SVHN with MLP, ResNet and VGG. "
1870
+ ],
1871
+ "image_footnote": [],
1872
+ "bbox": [
1873
+ 142,
1874
+ 132,
1875
+ 854,
1876
+ 546
1877
+ ],
1878
+ "page_idx": 18
1879
+ },
1880
+ {
1881
+ "type": "image",
1882
+ "img_path": "images/fbce56c22162e29e6d225aa0e5d67f5788bf75bd60797bed3ade2cebd28df0bb.jpg",
1883
+ "image_caption": [
1884
+ "Figure 18: Zoomed-in learning curves for MNIST with MLP. "
1885
+ ],
1886
+ "image_footnote": [],
1887
+ "bbox": [
1888
+ 143,
1889
+ 617,
1890
+ 852,
1891
+ 772
1892
+ ],
1893
+ "page_idx": 18
1894
+ },
1895
+ {
1896
+ "type": "image",
1897
+ "img_path": "images/1500a84f46227f17a6b03c0a03417a976729932c9d4bd0b0846c341096d3bce2.jpg",
1898
+ "image_caption": [
1899
+ "Figure 19: Zoomed-in learning curves for CIFAR10 with MLP, ResNet and VGG. "
1900
+ ],
1901
+ "image_footnote": [],
1902
+ "bbox": [
1903
+ 142,
1904
+ 251,
1905
+ 851,
1906
+ 661
1907
+ ],
1908
+ "page_idx": 19
1909
+ },
1910
+ {
1911
+ "type": "image",
1912
+ "img_path": "images/bcdf7607b2dfbb32a55c7026c517c34f609fe133885d1d155bef016d2d58a66c.jpg",
1913
+ "image_caption": [
1914
+ "Figure 20: Pairwise penalty matrices of the algorithms, grouped by different batch sizes. The parenthesized number in the title is the total number of $( D , B , A )$ combinations aggregated, which is also an upper bound on all its entries. Element $( i , j )$ corresponds roughly to the number of times algorithm $i$ beats algorithm $j$ . Column-wise averages at the bottom show aggregate performance (lower is better). From left to right: batch size $= 1 0 0$ , 1000, 10000. "
1915
+ ],
1916
+ "image_footnote": [],
1917
+ "bbox": [
1918
+ 142,
1919
+ 125,
1920
+ 854,
1921
+ 291
1922
+ ],
1923
+ "page_idx": 20
1924
+ },
1925
+ {
1926
+ "type": "image",
1927
+ "img_path": "images/8ec656b0d27579e17e5d426494b01e24c71753019e1725e0565a8cb78ab69c17.jpg",
1928
+ "image_caption": [
1929
+ "Figure 21: Pairwise penalty matrices of the algorithms, grouped by different neural network models. The parenthesized number in the title is the total number of $( D , B , A )$ combinations aggregated, which is also an upper bound on all its entries. Element $( i , j )$ corresponds roughly to the number of times algorithm $i$ beats algorithm $j$ . Column-wise averages at the bottom show aggregate performance (lower is better). From left to right: MLP, ResNet and VGG. "
1930
+ ],
1931
+ "image_footnote": [],
1932
+ "bbox": [
1933
+ 143,
1934
+ 435,
1935
+ 854,
1936
+ 603
1937
+ ],
1938
+ "page_idx": 20
1939
+ },
1940
+ {
1941
+ "type": "text",
1942
+ "text": "",
1943
+ "bbox": [
1944
+ 147,
1945
+ 751,
1946
+ 852,
1947
+ 821
1948
+ ],
1949
+ "page_idx": 20
1950
+ },
1951
+ {
1952
+ "type": "image",
1953
+ "img_path": "images/7dd5a955d88848c7fffd4e19963044529b8b5dd217cfd79f1fe6e676bf7c481e.jpg",
1954
+ "image_caption": [
1955
+ "Figure 22: CDFs of normalized errors of the algorithms, group by different batch sizes. Higher CDF indicates better performance. From left to right: batch size $= 1 0 0$ , 1000, 10000. "
1956
+ ],
1957
+ "image_footnote": [],
1958
+ "bbox": [
1959
+ 148,
1960
+ 121,
1961
+ 849,
1962
+ 279
1963
+ ],
1964
+ "page_idx": 21
1965
+ },
1966
+ {
1967
+ "type": "image",
1968
+ "img_path": "images/1e8686a7c69e02d8ee3ed0ecbbd8213345b8e48ed6000061e556cbde8724f18f.jpg",
1969
+ "image_caption": [
1970
+ "Figure 23: CDFs of normalized errors of the algorithms, group by different neural network models. Higher CDF indicates better performance. From left to right: MLP, ResNet and VGG. "
1971
+ ],
1972
+ "image_footnote": [],
1973
+ "bbox": [
1974
+ 148,
1975
+ 353,
1976
+ 849,
1977
+ 511
1978
+ ],
1979
+ "page_idx": 21
1980
+ },
1981
+ {
1982
+ "type": "text",
1983
+ "text": "E CDFS OF NORMALIZED ERRORS OF DIFFERENT ALGORITHMS ",
1984
+ "text_level": 1,
1985
+ "bbox": [
1986
+ 147,
1987
+ 594,
1988
+ 687,
1989
+ 609
1990
+ ],
1991
+ "page_idx": 21
1992
+ },
1993
+ {
1994
+ "type": "text",
1995
+ "text": "In addition to Figure 5 that aggregates over all settings, we show here the CDFs of normalized errors by conditioning on fixed batch sizes (100, 1000 and 10000) in Figure 22, and show the CDFs of normalized errors by conditioning on fixed neural network models (MLP, ResNet and VGG) in Figure 23. ",
1996
+ "bbox": [
1997
+ 148,
1998
+ 626,
1999
+ 852,
2000
+ 669
2001
+ ],
2002
+ "page_idx": 21
2003
+ },
2004
+ {
2005
+ "type": "text",
2006
+ "text": "F BATCH UNCERTAINTY AND DIVERSITY ",
2007
+ "text_level": 1,
2008
+ "bbox": [
2009
+ 148,
2010
+ 693,
2011
+ 500,
2012
+ 708
2013
+ ],
2014
+ "page_idx": 21
2015
+ },
2016
+ {
2017
+ "type": "text",
2018
+ "text": "Figure 24 gives a comparison of sampling methods with gradient embedding in two settings (OpenML # 6, MLP, batchsize 100 and SVHN, ResNet, batchsize 1000), in terms of uncertainty and diversity of examples selected within batches. These two properties are measured by average $\\ell _ { 2 }$ norm and determinant of the Gram matrix of gradient embedding, respectively. It can be seen that, $k { \\mathrm { - M E A N S + + } }$ (BADGE) induces good batch diversity in both settings. CONF generally selects examples with high uncertainty, but in some iterations of OpenML #6, the batch diversity is relatively low, as evidenced by the corresponding log Gram determinant being $- \\infty$ . These areas are indicated by gaps in the learning curve for CONF. Situations where there are many gaps in the CONF plot seem to correspond to situations in which CONF performs poorly in terms of accuracy (see Figure 13 for the corresponding learning curve). Both $k$ -DPP and FF- $k$ -CENTER (an algorithm that approximately minimizes $k$ -center objective) select batches that have lower diversity than $k$ -MEANS $^ { + + }$ (BADGE). ",
2019
+ "bbox": [
2020
+ 147,
2021
+ 724,
2022
+ 851,
2023
+ 823
2024
+ ],
2025
+ "page_idx": 21
2026
+ },
2027
+ {
2028
+ "type": "image",
2029
+ "img_path": "images/06e0a6591dd6c4b5362a74a440c88b7e0461b3c1f9819bca861c53a4a12938ab.jpg",
2030
+ "image_caption": [
2031
+ "Figure 24: A comparison of batch selection algorithms in gradient space. Plots a and b show the log determinants of the Gram matrices of gradient embeddings within batches as learning progresses. Plots c and $\\mathbf { d }$ show the average embedding magnitude (a measurement of predictive uncertainty) in the selected batch. The $k$ -centers sampler finds points that are not as diverse or high-magnitude as other samplers. Notice also that $k { \\mathrm { - M E A N S + + } }$ tends to actually select samples that are both more diverse and higher-magnitude than a $k$ -DPP, a potential pathology of the $k$ -DPP’s degree of stochastisity. Among all algorithms, CONF has the largest average norm of gradient embeddings within a batch; however, in OpenML #6, and the first few interations of SVHN, some batches have a log Gram determinant of $- \\infty$ (shown as gaps in the curve), which shows that CONF sometimes selects batches that are inferior in diversity. "
2032
+ ],
2033
+ "image_footnote": [],
2034
+ "bbox": [
2035
+ 158,
2036
+ 126,
2037
+ 828,
2038
+ 492
2039
+ ],
2040
+ "page_idx": 22
2041
+ },
2042
+ {
2043
+ "type": "text",
2044
+ "text": "",
2045
+ "bbox": [
2046
+ 148,
2047
+ 672,
2048
+ 852,
2049
+ 728
2050
+ ],
2051
+ "page_idx": 22
2052
+ },
2053
+ {
2054
+ "type": "text",
2055
+ "text": "G COMPARISON OF $k$ -MEANS $^ { + + }$ AND $k$ -DPP IN BATCH SELECTION ",
2056
+ "text_level": 1,
2057
+ "bbox": [
2058
+ 145,
2059
+ 748,
2060
+ 717,
2061
+ 765
2062
+ ],
2063
+ "page_idx": 22
2064
+ },
2065
+ {
2066
+ "type": "text",
2067
+ "text": "In Figures 25 to 31, we give running time and test accuracy comparisons between $k { \\mathrm { - M E A N S + + } }$ and $k$ -DPP for selecting examples based on gradient embedding in batch mode active learning. We implement the $k$ -DPP sampling using the MCMC algorithm from (Kang, 2013), which has a time complexity of $O ( \\tau \\cdot ( k ^ { 2 } + k d ) )$ ",
2068
+ "bbox": [
2069
+ 148,
2070
+ 780,
2071
+ 852,
2072
+ 821
2073
+ ],
2074
+ "page_idx": 22
2075
+ },
2076
+ {
2077
+ "type": "image",
2078
+ "img_path": "images/68897bb6eb4bbcd2af8922a41897bb08fb0a8da3dee3dc4ea852ae1ac708751f.jpg",
2079
+ "image_caption": [
2080
+ "Figure 25: Learning curves and running times for OpenML #6 with MLP. "
2081
+ ],
2082
+ "image_footnote": [],
2083
+ "bbox": [
2084
+ 166,
2085
+ 118,
2086
+ 828,
2087
+ 244
2088
+ ],
2089
+ "page_idx": 23
2090
+ },
2091
+ {
2092
+ "type": "image",
2093
+ "img_path": "images/b1f42c320b083c071d89711fbe35a86eb10b8d1f0c2d817a99adf3ecf93c99a1.jpg",
2094
+ "image_caption": [
2095
+ "Figure 26: Learning curves and running times for OpenML #155 with MLP. "
2096
+ ],
2097
+ "image_footnote": [],
2098
+ "bbox": [
2099
+ 151,
2100
+ 304,
2101
+ 844,
2102
+ 434
2103
+ ],
2104
+ "page_idx": 23
2105
+ },
2106
+ {
2107
+ "type": "text",
2108
+ "text": "and space complexity of $O ( k ^ { 2 } + k d )$ , where $\\tau$ is the number of sampling steps. We set $\\tau$ as $\\lfloor 5 k \\ln k \\rfloor$ in our experiment. The comparisons for batch size 10000 are not shown here as the implementation of $k$ -DPP sampling runs out of memory. ",
2109
+ "bbox": [
2110
+ 147,
2111
+ 501,
2112
+ 852,
2113
+ 545
2114
+ ],
2115
+ "page_idx": 23
2116
+ },
2117
+ {
2118
+ "type": "text",
2119
+ "text": "It can be seen from the figures that, although $k$ -DPP and $k { \\mathrm { - M E A N S + + } }$ are based on different sampling criteria, the classification accuracies of their induced active learning algorithm are similar. In addition, when large batch sizes are required (e.g. $k = 1 0 0 0$ ), the running times of $k$ -DPP sampling are generally much higher than those of $k$ -MEA $\\mathrm { N S } { + } { + }$ . ",
2120
+ "bbox": [
2121
+ 147,
2122
+ 551,
2123
+ 851,
2124
+ 608
2125
+ ],
2126
+ "page_idx": 23
2127
+ },
2128
+ {
2129
+ "type": "image",
2130
+ "img_path": "images/5d40d22c75721a059cbb0b806209efb76c254e0e8846d044ac3890ff3d1626ee.jpg",
2131
+ "image_caption": [
2132
+ "Figure 27: Learning curves and running times for OpenML #156 with MLP. "
2133
+ ],
2134
+ "image_footnote": [],
2135
+ "bbox": [
2136
+ 151,
2137
+ 646,
2138
+ 844,
2139
+ 776
2140
+ ],
2141
+ "page_idx": 23
2142
+ },
2143
+ {
2144
+ "type": "image",
2145
+ "img_path": "images/8fe1677b8a9ebbca89d82595804c40b53899f667292aace8887172757fda3d48.jpg",
2146
+ "image_caption": [
2147
+ "Figure 28: Learning curves and running times for OpenML #184 with MLP. "
2148
+ ],
2149
+ "image_footnote": [],
2150
+ "bbox": [
2151
+ 151,
2152
+ 131,
2153
+ 843,
2154
+ 261
2155
+ ],
2156
+ "page_idx": 24
2157
+ },
2158
+ {
2159
+ "type": "image",
2160
+ "img_path": "images/432ede9d567f05ff30cc84e24734b9684b3267b38f6ff82e344349767b470a38.jpg",
2161
+ "image_caption": [
2162
+ "Figure 29: Learning curves and running times for SVHN with MLP and ResNet. "
2163
+ ],
2164
+ "image_footnote": [],
2165
+ "bbox": [
2166
+ 151,
2167
+ 337,
2168
+ 844,
2169
+ 556
2170
+ ],
2171
+ "page_idx": 24
2172
+ },
2173
+ {
2174
+ "type": "image",
2175
+ "img_path": "images/76e18f8566dc277eb165ad2a542cf0aeb87cdf8690bfcf233cdf2a0caac590d4.jpg",
2176
+ "image_caption": [
2177
+ "Figure 30: Learning curves and running times for MNIST with MLP. "
2178
+ ],
2179
+ "image_footnote": [],
2180
+ "bbox": [
2181
+ 151,
2182
+ 633,
2183
+ 844,
2184
+ 763
2185
+ ],
2186
+ "page_idx": 24
2187
+ },
2188
+ {
2189
+ "type": "image",
2190
+ "img_path": "images/3398b065aad57ae31c9b307f82c2049a16bcf7ee25b9677c8a6caa71d142daf3.jpg",
2191
+ "image_caption": [
2192
+ "Figure 31: Learning curves and running times for CIFAR10 with MLP and ResNet. "
2193
+ ],
2194
+ "image_footnote": [],
2195
+ "bbox": [
2196
+ 151,
2197
+ 337,
2198
+ 843,
2199
+ 556
2200
+ ],
2201
+ "page_idx": 25
2202
+ }
2203
+ ]
parse/train/ryghZJBKPS/ryghZJBKPS_middle.json ADDED
The diff for this file is too large to render. See raw diff
 
parse/train/ryghZJBKPS/ryghZJBKPS_model.json ADDED
The diff for this file is too large to render. See raw diff