diff --git a/parse/train/FrIDgjDOH1u/FrIDgjDOH1u_content_list.json b/parse/train/FrIDgjDOH1u/FrIDgjDOH1u_content_list.json new file mode 100644 index 0000000000000000000000000000000000000000..963e99f6db71fb3d003ef2f8354707497c6c10d9 --- /dev/null +++ b/parse/train/FrIDgjDOH1u/FrIDgjDOH1u_content_list.json @@ -0,0 +1,1257 @@ +[ + { + "type": "text", + "text": "Scaling Vision with Sparse Mixture of Experts ", + "text_level": 1, + "bbox": [ + 217, + 122, + 779, + 147 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Carlos Riquelme ∗ Google Brain ", + "bbox": [ + 207, + 200, + 334, + 229 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Joan Puigcerver \\* Google Brain ", + "bbox": [ + 364, + 202, + 490, + 229 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Basil Mustafa \\* Google Brain ", + "bbox": [ + 526, + 200, + 635, + 228 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Maxim Neumann Google Brain ", + "bbox": [ + 671, + 202, + 795, + 229 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Rodolphe Jenatton Google Brain ", + "bbox": [ + 204, + 251, + 339, + 279 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "André Susano Pinto Google Brain ", + "bbox": [ + 375, + 250, + 517, + 279 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Daniel Keysers Google Brain ", + "bbox": [ + 553, + 251, + 663, + 279 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Neil Houlsby Google Brain ", + "bbox": [ + 699, + 250, + 792, + 279 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Abstract ", + "text_level": 1, + "bbox": [ + 462, + 314, + 535, + 330 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Sparsely-gated Mixture of Experts networks (MoEs) have demonstrated excellent scalability in Natural Language Processing. In Computer Vision, however, almost all performant networks are “dense”, that is, every input is processed by every parameter. We present a Vision MoE (V-MoE), a sparse version of the Vision Transformer, that is scalable and competitive with the largest dense networks. When applied to image recognition, V-MoE matches the performance of state-ofthe-art networks, while requiring as little as half of the compute at inference time. Further, we propose an extension to the routing algorithm that can prioritize subsets of each input across the entire batch, leading to adaptive per-image compute. This allows V-MoE to trade-off performance and compute smoothly at test-time. Finally, we demonstrate the potential of V-MoE to scale vision models, and train a 15B parameter model that attains $9 0 . 3 5 \\%$ on ImageNet. ", + "bbox": [ + 232, + 345, + 766, + 511 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "1 Introduction ", + "text_level": 1, + "bbox": [ + 174, + 535, + 310, + 553 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "Deep learning historically shows that increasing network capacity and dataset size generally improves performance. In computer vision, large models pre-trained on large datasets often achieve the state of the art [57, 50, 36, 20, 3]. This approach has had even more success in Natural Language Processing (NLP), where large pre-trained models are ubiquitous, and perform very well on many tasks [48, 18]. Text Transformers [61] are the largest models to date, some with over 100B parameters [9]. However, training and serving such models is expensive [56, 46]. This is partially because these deep networks are typically “dense”– every example is processed using every parameter –thus, scale comes at high computational cost. In contrast, conditional computation [5] aims to increase model capacity while keeping the training and inference cost roughly constant by applying only a subset of parameters to each example. In NLP, sparse Mixture of Experts (MoEs) are gaining popularity [54, 39, 22], enabling training and inference with fewer resources while unlocking trillion parameter models. ", + "bbox": [ + 174, + 568, + 825, + 719 + ], + "page_idx": 0 + }, + { + "type": "text", + "text": "In this work, we explore conditional computation for vision at scale. We introduce the Vision MoE (V-MoE), a sparse variant of the recent Vision Transformer (ViT) architecture [20] for image classification. The V-MoE replaces a subset of the dense feedforward layers in ViT with sparse MoE layers, where each image patch is “routed” to a subset of “experts” (MLPs). Due to unique failure modes and non-differentiability, routing in deep sparse models is challenging. We explore various design choices, and present an effective recipe for the pre-training and transfer of V-MoE, notably outperforming their dense counterparts. We further show that V-MoE models are remarkably flexible. The performance vs. inference-cost trade-off of already trained models can be smoothly adjusted during inference by modulating the sparsity level with respect to the input and/or the model weights. Also, we open-source our implementation and a number of V-MoE models trained on ImageNet-21k.2 ", + "bbox": [ + 174, + 724, + 825, + 863 + ], + "page_idx": 0 + }, + { + "type": "image", + "img_path": "images/248567e4274ec5c9f1a7fffd719389cf4c09bbe4388e9bb269069f3eda3ebd0c.jpg", + "image_caption": [ + "Figure 1: Overview of the architecture. V-MoE is composed of $L$ ViT blocks. In some, we replace the MLP with a sparsely activated mixture of MLPs. Each MLP (the expert) is stored on a separate device, and processes a fixed number of tokens. The communication of these tokens between devices = expert uses a capacity ratio C = 43 : the sparse MoE layer receives 12 tokens per device, but each is shown in this example, which depicts the case when $k = 1$ expert is selected per token. Here each expert has capacity for 16 ( $\\textstyle \\frac { 1 6 \\cdot 1 } { 1 2 } = \\frac { 4 } { 3 }$ ; see Section 2.4). Non-expert components of V-MoE such as routers, attention layers and normal MLP blocks are replicated identically across devices. " + ], + "image_footnote": [], + "bbox": [ + 173, + 88, + 823, + 289 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "With V-MoE, we can scale to model sizes of 15B parameters, the largest vision models to date. We match the performance of state-of-the-art dense models, while requiring fewer time to train. Alternatively, V-MoE can match the cost of ViT while achieving better performance. To help control this tradeoff, we propose Batch Prioritized Routing, a routing algorithm that repurposes model sparsity to skip the computation of some patches, reducing compute on uninformative image regions. ", + "bbox": [ + 173, + 428, + 826, + 497 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "We summarize our main contributions as follows: ", + "bbox": [ + 176, + 503, + 496, + 517 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "Vision models at scale. We present the Vision Mixture of Experts, a distributed sparsely-activated Transformer model for vision. We train models with up to $2 4 \\mathrm { M o E }$ layers, 32 experts per layer, and almost 15B parameters. We show that these models can be stably trained, seamlessly used for transfer, and successfully fine-tuned with as few as 1 000 datapoints. Moreover, our largest model achieves $9 0 . 3 5 \\%$ test accuracy on ImageNet when fine-tuned. ", + "bbox": [ + 174, + 518, + 825, + 587 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "Performance and inference. We show V-MoEs strongly outperform their dense counterparts on upstream, few-shot and full fine-tuning metrics in absolute terms. Moreover, at inference time, the V-MoE models can be adjusted to either (i) match the largest dense model’s performance while using as little as half the compute, or actual runtime, or (ii) significantly outperform it at the same cost. ", + "bbox": [ + 174, + 587, + 825, + 642 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "Batch Prioritized Routing. We propose a new priority-based routing algorithm that allows V-MoEs to discard the least useful patches. Thus, we devote less compute to each image. In particular, we show V-MoEs match the performance of the dense models while saving $20 \\%$ of the training FLOPs. Analysis. We provide some visualization of the routing decisions, revealing patterns and conclusions which helped motivate design decisions and may further improve understanding in the field. ", + "bbox": [ + 174, + 642, + 825, + 712 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "2 The Vision Mixture of Experts ", + "text_level": 1, + "bbox": [ + 174, + 731, + 460, + 748 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "We first describe MoEs and sparse MoEs. We then present how we apply this methodology to vision, before explaining our design choices for the routing algorithm and the implementation of V-MoEs. ", + "bbox": [ + 174, + 762, + 826, + 791 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "2.1 Conditional Computation with MoEs ", + "text_level": 1, + "bbox": [ + 174, + 808, + 472, + 823 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "Conditional computation aims at activating different subsets of a network for different inputs [5]. A mixture-of-experts model is a specific instantiation whereby different model “experts” are responsible for different regions of the input space [31]. ", + "bbox": [ + 176, + 833, + 825, + 876 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "We follow the setting of [54], who present for deep learning a mixture of experts layer with $E$ experts as $\\begin{array} { r } { \\mathrm { M o E } ( \\mathbf { x } ) = \\sum _ { i = 1 } ^ { E } g ( \\mathbf { x } ) _ { i } e _ { i } ( \\mathbf { x } ) } \\end{array}$ where $\\mathbf { x } \\in \\mathbb { R } ^ { D }$ is the input to the layer, $\\boldsymbol { e } _ { i } : \\mathbb { R } ^ { \\boldsymbol { \\bar { D } } } \\mapsto \\mathbb { R } ^ { D }$ the function computed by expert $i$ , and $g : \\mathbb { R } ^ { D } \\mapsto \\mathbb { R } ^ { E }$ is the “routing” function which prescribes the input-conditioned weight for the experts. Both $e _ { i }$ and $g$ are parameterized by neural networks. As defined, this is still a dense network. However, if $g$ is sparse, i.e., restricted to assign only $k \\ll E$ non-zero weights, then unused experts need not be computed. This unlocks super-linear scaling of the number of model parameters with respect to inference and training compute. ", + "bbox": [ + 174, + 881, + 821, + 912 + ], + "page_idx": 1 + }, + { + "type": "text", + "text": "", + "bbox": [ + 174, + 89, + 825, + 161 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "2.2 MoEs for Vision ", + "text_level": 1, + "bbox": [ + 174, + 179, + 326, + 193 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "We explore the application of sparsity to vision in the context of the Vision Transformer (ViT) [20]. ViT has been shown to scale well in the transfer learning setting, attaining better accuracies than CNNs with less pre-training compute. ViT processes images as a sequence of patches. An input image is first divided into a grid of equal-sized patches. These are linearly projected to the Transformer’s [61] hidden size. After adding positional embeddings, the patch embeddings (tokens) are processed by a Transformer, which consists predominately of alternating self-attention and MLP layers. ", + "bbox": [ + 174, + 204, + 825, + 289 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "The MLPs have two layers and a GeLU [29] non-linearity: $\\mathrm { M L P } ( \\mathbf { x } ) = \\mathbf { W } _ { \\mathrm { 2 } } \\ \\sigma _ { \\mathrm { g e l u } } ( \\mathbf { W } _ { \\mathrm { 1 } } \\mathbf { x } )$ . For Vision MoE, we replace a subset of these with MoE layers, where each expert is an MLP; see Figure 1. The experts have the same architecture $e _ { i } ( { \\bf x } ) = \\mathrm { M L P } _ { \\theta _ { i } } ( { \\bf x } )$ but with different weights $\\theta _ { i } = \\left( \\mathbf { W } _ { 1 } ^ { i } , \\mathbf { W } _ { 2 } ^ { i } \\right)$ . =This follows a similar design pattern as the M4 machine translation model [39]. ", + "bbox": [ + 174, + 295, + 825, + 351 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "2.3 Routing ", + "text_level": 1, + "bbox": [ + 173, + 368, + 269, + 383 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "For each MoE layer in V-MoE, we use the routing function $g ( \\mathbf { x } ) \\mathbf { \\Psi } = \\mathrm { T O P } _ { k }$ softmax $\\left( \\mathbf { W } \\mathbf { x } + \\epsilon \\right)$ , where $\\mathrm { T O P } _ { k }$ is an operation that sets all elements of the vector to zero except the elements with the largest $k$ values, and $\\epsilon$ is sampled independently $\\epsilon \\sim \\mathcal { N } ( 0 , \\frac { 1 } { E ^ { 2 } } )$ entry-wise. In practice, we use $k = 1$ or $k = 2$ . In the context of the Vision Transformer, $\\mathbf { x }$ =is a representation of an image token at some =layer of the network. Therefore, V-MoE routes patch representations, not entire images. ", + "bbox": [ + 174, + 395, + 825, + 465 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "The difference between previous formulations [54] is that we apply $\\mathrm { T O P } _ { k }$ after the softmax over experts weights [39], instead of before. This allows us to train with $k = 1$ (otherwise gradients with respect to routings are zero almost everywhere) and also performs better for $k > 1$ (see Appendix A). ", + "bbox": [ + 174, + 470, + 825, + 513 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "Finally, we add a small amount of noise with standard deviation $\\frac { 1 } { E }$ to the activations $\\mathbf { W } \\mathbf { x }$ . We empirically found this performed well but that the setup was robust to this parameter. The noise typically altered routing decisions ${ \\sim } 1 5 \\%$ of the time in earlier layers, and ${ \\sim } 2 { - } 3 \\%$ in deeper layers. ", + "bbox": [ + 174, + 518, + 825, + 561 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "2.4 Expert’s Buffer Capacity ", + "text_level": 1, + "bbox": [ + 174, + 579, + 387, + 594 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "During training, sparse models may favor only a small set of experts [26, 52]. This common failure mode can cause two problems. First, statistical inefficiency: in the limit of collapse to a single expert, the model is no more powerful than a dense model. Second, computational inefficiency: imbalanced assignment of items to experts may lead to a poor hardware utilization. ", + "bbox": [ + 174, + 606, + 825, + 661 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "To combat imbalance and simplify our implementation, we fix the buffer capacity of each expert (i.e. the number of tokens that each expert processes), and train our model with auxiliary losses that encourage load balancing. This is essentially the same approach as followed by [54, 39, 22]. In our case, we use slight variants of two of the auxiliary losses proposed in [54], as described in Appendix A. ", + "bbox": [ + 174, + 667, + 825, + 724 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "We define the buffer capacity of an expert $( B _ { e } )$ as a function of the number of images in the batch number of experts $( N )$ , the number of tokens per image $( E )$ , and the capacity ratio $( P )$ , the number of selected experts per token $( C )$ : $B _ { e } =$ round $\\textstyle \\left( { \\frac { k N P C } { E } } \\right)$ . $( k )$ , the total ", + "bbox": [ + 174, + 729, + 825, + 775 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "If the router assigns more than $B _ { e }$ tokens to a given expert, only $B _ { e }$ of them are processed. The remaining tokens are not entirely ‘lost’ as their information is preserved by residual connections (the top diagram of Figure 1). Also, if $k > 1$ , several experts try to process each token. Tokens are never >fully discarded. If an expert is assigned fewer than $B _ { e }$ tokens, the rest of its buffer is zero-padded. ", + "bbox": [ + 174, + 779, + 825, + 835 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "We use the capacity ratio to adjust the capacity of the experts. With $C > 1$ , a slack capacity is added to account for a potential routing imbalance. This is typically useful for fine-tuning when the new data might come from a very different distribution than during upstream training. With $C < 1$ , the router is forced to ignore some assignments. In Section 4 we propose a new algorithm that takes advantage of setting $C \\ll 1$ to discard the least useful tokens and save compute during inference. ", + "bbox": [ + 174, + 842, + 825, + 911 + ], + "page_idx": 2 + }, + { + "type": "text", + "text": "3 Transfer Learning ", + "text_level": 1, + "bbox": [ + 174, + 89, + 359, + 107 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "In this section, we first present training different variants of V-MoE on a large dataset (Section 3.2) in order to be used for Transfer Learning afterwards. The ability to easily adapt our massive models to new tasks, using a small amount of data from the new task, is extremely valuable: it allows to amortize the cost of pre-training across multiple tasks. We consider two different approaches to Transfer Learning: linear few-shot learning on fixed representations and full fine-tuning of the model. ", + "bbox": [ + 174, + 121, + 825, + 190 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "3.1 Models ", + "text_level": 1, + "bbox": [ + 174, + 207, + 264, + 222 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "We build V-MoE on different variants of ViT [20]: ViT-S(mall), ViT-B(ase), ViT-L(arge) and ViTH(uge), the hyperparameters of which are described in Appendix B.5. There are three additional major design decisions that affect the cost (and potentially the quality) of our model: ", + "bbox": [ + 174, + 233, + 825, + 275 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "Number of MoE layers. Following [39], we place the MoEs on every other layer (we refer to these as V-MoE Every-2). In addition, we experimented with using fewer MoE layers, by placing them on the last- $\\boldsymbol { n }$ even blocks (thus we dub these V-MoE Last-n). In Appendix E.1 we observe that, although using fewer MoE layers decreases the number of parameters of the model, it has typically little impact on quality and can speed-up the models significantly, since less communication overhead is incurred. ", + "bbox": [ + 174, + 281, + 825, + 352 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "Number of selected experts $k$ : The cost of our model does not depend on the total number of experts but the number of selected ones per token. Concurrent works in NLP fix $k = 1$ [22] or $k = 2$ [54, 39]. In our case, we use by default $k = 2$ (see Figure 10 in Appendix B for the exploration of different values of $k$ ), while we found the total number of experts $E = 3 2$ to be the sweet spot in our setting. ", + "bbox": [ + 174, + 358, + 825, + 412 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "Buffer capacity $C$ : As mentioned in Section 2.4, we use a fixed buffer capacity. While this is typically regarded as a downside or engineering difficulty to implement these models, we can adjust the capacity ratio to control different trade-offs. We can intentionally set it to a low ratio to save compute, using Batch Prioritized Routing (see Section 4). During upstream training, we set $C = 1 . 0 5$ by default to give a small amount of slack without increasing the cost noticeably. ", + "bbox": [ + 174, + 419, + 825, + 489 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "Note that for a given trained model, the latter two— $k$ and $C$ —can be adjusted without further training, whereas the positioning and quantity of expert layers is effectively fixed to match pre-training. ", + "bbox": [ + 176, + 494, + 823, + 523 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "3.2 Data ", + "text_level": 1, + "bbox": [ + 174, + 540, + 246, + 555 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "We pre-train our models on JFT-300M [57], a semi-automatically noisy-labeled dataset. It has $\\sim 3 0 5 \\mathrm { M }$ training and 50 000 validation images, organised in a hierarchy of 18 291 classes (average 1.89 labels per image). We deduplicate it with respect to all our validation/test sets as in previous efforts [36].3 ", + "bbox": [ + 176, + 566, + 823, + 608 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "Our few-shot experiments on ImageNet (i.e. ILSVRC2012) use only 1, 5, or 10 shots per class to adapt the upstream model, evaluating the resulting model on the validation set. ", + "bbox": [ + 173, + 614, + 821, + 643 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "We also fine-tuned the pre-trained models on the full training set (ca. 1M images). We report performance in a similar regime for four other datasets in Appendix B.5. Lastly, we explore the ability to fine-tune our large models in the low-data regime by evaluating them on the Visual Task Adaptation Benchmark (VTAB) [69], a diverse suite of 19 tasks with only 1 000 data points per task. As well as natural image classification, VTAB includes specialized tasks (e.g. medical or satellite imagery) and structured tasks (e.g. counting or assessing rotation/distance). ", + "bbox": [ + 174, + 650, + 825, + 733 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "3.3 Upstream results ", + "text_level": 1, + "bbox": [ + 174, + 750, + 331, + 765 + ], + "page_idx": 3 + }, + { + "type": "text", + "text": "JFT is a multilabel dataset, so we measure model performance via precision $@ 1$ (see Appendix B.6 for details). Note that as in previous works [20], hyperparameters were tuned for transfer performance, and JFT precision could be improved at the expense of downstream tasks e.g. by reducing weight decay. Figure 2a shows the quality of different V-MoE and ViT variants with respect to total training compute and time. It shows models that select $k = 2$ experts and place MoEs in the last $n$ even blocks $\\hslash = 5$ for V-MoE-H, $n = 2$ otherwise), but the best results are achieved by V-MoE-H/14 Every-2 (see Table 2, 14 is the patch size). L/16’s are trained for 7 or 14 epochs. See Appendix B.5 for all results. ", + "bbox": [ + 173, + 775, + 825, + 872 + ], + "page_idx": 3 + }, + { + "type": "image", + "img_path": "images/c9583ef8573f88b5ab52bb6cdc466f3a72778204fe31d121cb2429ff9c12592a.jpg", + "image_caption": [ + "Figure 2: JFT-300M Precision $@ 1$ and ImageNet 5-shot accuracy. Colors represent different ViT variants, markers represent either standard ViT or V-MoEs on the last $n$ even blocks. The lines represent the Pareto frontier of ViT (dashed) and V-MoE (solid) variants. " + ], + "image_footnote": [], + "bbox": [ + 184, + 88, + 812, + 290 + ], + "page_idx": 4 + }, + { + "type": "image", + "img_path": "images/40e9744cbeb03d4891d930be558dc399a68ae80031ccc224b2837d477dced43f.jpg", + "image_caption": [ + "Figure 3: ImageNet Fine-Tuning Accuracy. Colors represent different VIT variants, markers represent either standard ViT or V-MoEs on the last $n$ even blocks. Lines show the Pareto frontier of VIT (dashed) and V-MoE (solid). " + ], + "image_footnote": [], + "bbox": [ + 178, + 359, + 485, + 542 + ], + "page_idx": 4 + }, + { + "type": "table", + "img_path": "images/f4640af04c8dd45ba58858379b5fca7caf4214ec75ce47e59bac0305765ba3b4.jpg", + "table_caption": [ + "Table 1: VTAB. Scores and $9 5 \\%$ confidence intervals for ViT and V-MoE. " + ], + "table_footnote": [], + "table_body": "
ViTV-MoE
L/16 76.3±0.577.2±0.4
H/14 77.6±0.277.8±0.4
", + "bbox": [ + 503, + 445, + 676, + 503 + ], + "page_idx": 4 + }, + { + "type": "text", + "text": "Expert models provide notable gains across all model sizes, for only a mild increase in FLOPs, establishing a new Pareto frontier (gray lines). Alternatively, we can match or improve performance of ViT models at lower cost (e.g. V-MoE-L/16 improves upon ViT-H/14). Similar conclusions hold for training time, which includes communication overhead of dispatching data across devices. ", + "bbox": [ + 173, + 570, + 826, + 626 + ], + "page_idx": 4 + }, + { + "type": "text", + "text": "3.4 Linear few-shot results ", + "text_level": 1, + "bbox": [ + 174, + 642, + 372, + 656 + ], + "page_idx": 4 + }, + { + "type": "text", + "text": "We evaluate the quality of the representations learned using few-shot linear transfer. Given training examples from the new dataset $\\{ ( X , Y ) _ { i } \\}$ , we use the pre-trained model $\\mathcal { M }$ to extract a fixed representation $\\mathcal { M } ( x _ { i } )$ of each image. We fit a linear regression model mapping $\\mathcal { M } ( x _ { i } )$ to the one-hot encoding of the target labels $Y _ { i }$ , following [20] (see [27, Chapter 5] for background). ", + "bbox": [ + 174, + 667, + 825, + 724 + ], + "page_idx": 4 + }, + { + "type": "text", + "text": "Figure 2b shows that the upstream gains are preserved under 5-shot ImageNet evaluation, considering both compute and time; in other words, the quality of the representations learned by V-MoE also outperforms ViT models when looking at a new task. Table 2 further shows the results on $\\{ 1 , 1 0 \\}$ -shot for some selected models, and the full detailed results are available in Appendix B.5. ", + "bbox": [ + 174, + 729, + 825, + 786 + ], + "page_idx": 4 + }, + { + "type": "text", + "text": "3.5 Full fine-tuning results ", + "text_level": 1, + "bbox": [ + 174, + 803, + 370, + 818 + ], + "page_idx": 4 + }, + { + "type": "text", + "text": "The typically most performant approach for Transfer Learning [19] consists of replacing the upstream classification head with a new task-specific one and fine-tuning the whole model. Though one may expect that massive models like V-MoEs require special handling for fine-tuning, we broadly follow the standard fine-tuning protocol for Vision Transformers. We use the auxiliary loss during fine-tuning as well, although we observe that it is often not needed in this step, as the router is already well trained. We explore the two sets of tasks considered therein: ", + "bbox": [ + 174, + 827, + 823, + 911 + ], + "page_idx": 4 + }, + { + "type": "image", + "img_path": "images/50ec35f7ecf28e9c0130e04ba518b414285354dcdb6207d834c1ac8587a7979a.jpg", + "image_caption": [ + "Figure 4: White patches are discarded tokens in the first layer of experts, for different capacities, using Batch Prioritized Routing (Section 4.1) with a V-MoE-H/14. See Appendix D for more examples. " + ], + "image_footnote": [], + "bbox": [ + 176, + 111, + 825, + 325 + ], + "page_idx": 5 + }, + { + "type": "text", + "text": "Full data. We follow the setup of [20], except that we apply a dropout rate of 0.1 on the expert MLPs (as done in [22]), and we halve the number of fine-tuning steps for all datasets other than ImageNet. Figure 3 shows the results on ImageNet (averaged over three runs). Here, V-MoE also performs better than dense counterparts, though we suspect the fine-tuning protocol could be further improved and tailored to the sparse models. See Table 8 for all details, including results on other datasets. ", + "bbox": [ + 174, + 390, + 825, + 459 + ], + "page_idx": 5 + }, + { + "type": "text", + "text": "Low-data regime. On the VTAB benchmark, we use a similar setup and hyperparameter budget as [20] (but fine-tune with half the schedule length). Table 1 shows that, while performance is similar for V-MoE-H/14, experts provide significant gains at the ViT-L/16 level, indicating that despite the large size of these models, they can still be fine-tuned with small amounts of data and no further tricks. ", + "bbox": [ + 174, + 465, + 825, + 522 + ], + "page_idx": 5 + }, + { + "type": "text", + "text": "3.6 Scaling up V-MoE ", + "text_level": 1, + "bbox": [ + 174, + 537, + 339, + 553 + ], + "page_idx": 5 + }, + { + "type": "text", + "text": "Finally, we test how well V-MoE can scale vision models to a very large number of parameters, while continuing to improve performance. For this, we increase the size of the model and use a larger pre-training dataset: JFT-3B is a larger version of JFT-300M, it contains almost 3B images and is noisily annotated with 30k classes. Inspired by [68], we apply the changes detailed in Appendix B.3, and train a 48-block V-MoE model, with every-2 expert placement (32 experts and $k = 2$ ), resulting in a model with 14.7B parameters, which we denote by V-MoE-15B. ", + "bbox": [ + 174, + 563, + 825, + 646 + ], + "page_idx": 5 + }, + { + "type": "text", + "text": "We successfully train V-MoE-15B, which is, as far as we are aware, the largest vision model to date. It has an impressive $8 2 . 7 8 \\%$ accuracy on 5-shot ImageNet and $9 0 . 3 5 \\%$ when fully fine-tuned, as shown in Appendix B.5, which also includes more details about the model. Training this model required $1 6 . 8 \\mathrm { k }$ TPUv3-core-days. To contextualize this result, the current state of the art on ImageNet is Meta Pseudo-Labelling (MPL) [49]. MPL trains an EfficientNet-based model on unlabelled JFT-300M using ImageNet pseudo-labelling, achieving $9 0 . 2 \\%$ while requiring $2 2 . 5 \\mathrm { k }$ TPUv3-core-days. ", + "bbox": [ + 174, + 652, + 825, + 736 + ], + "page_idx": 5 + }, + { + "type": "text", + "text": "4 Skipping Tokens with Batch Prioritized Routing ", + "text_level": 1, + "bbox": [ + 174, + 753, + 607, + 772 + ], + "page_idx": 5 + }, + { + "type": "text", + "text": "We present a new routing algorithm that allows the model to prioritize important tokens (corresp. patches). By simultaneously reducing the capacity of each expert, we can discard the least useful tokens. Intuitively, not every patch is equally important to classify a given image, e.g., most background patches can be dropped to let the model only focus on the ones with the relevant entities. ", + "bbox": [ + 174, + 786, + 826, + 842 + ], + "page_idx": 5 + }, + { + "type": "text", + "text": "4.1 From Vanilla Routing to Batch Prioritized Routing ", + "text_level": 1, + "bbox": [ + 173, + 857, + 566, + 872 + ], + "page_idx": 5 + }, + { + "type": "text", + "text": "With the notation from Section 2, the routing function $\\mathbf { X } \\in \\mathbb { R } ^ { N \\cdot P \\times D }$ . A batch contains $N$ images composed of $P$ $g$ is applied row-wise to a batch of inputs tokens each; each row of $\\mathbf { X }$ corresponds to the $D$ -dimensional representation of a particular token of an image. Accordingly, $g ( \\mathbf { X } ) _ { t , i } \\in \\mathbb { R }$ denotes the routing weight for the $t$ -th token and the $i$ -th expert. ", + "bbox": [ + 173, + 883, + 821, + 911 + ], + "page_idx": 5 + }, + { + "type": "image", + "img_path": "images/29e4a2dc24e77688a20381ca0a9a9204e095cf85146fd91910e17ceb4adf02f7.jpg", + "image_caption": [ + "Figure 5: Reducing compute with priority routing. Performance vs. inference FLOPs for large models. V-MoEs with the original vanilla routing are represented by $\\bullet$ , while $\\mid$ shows V-MoEs where BPR and a mix of $C \\in \\{ 0 . 6 , 0 . 7 , 0 . 8 \\}$ and $k \\in \\{ 1 , 2 \\}$ are used to reduce compute. ViT models shown as $\\mathbf { x }$ . " + ], + "image_footnote": [], + "bbox": [ + 178, + 93, + 482, + 297 + ], + "page_idx": 6 + }, + { + "type": "image", + "img_path": "images/a7de5765086bcdc5f0b366171e8b6331b7af94a05b53a7eba6ce847b523b20bc.jpg", + "image_caption": [ + "Figure 6: Priority routing works where vanilla fails. Performance vs. inference capacity ratio for a V-MoE-H/14 model with $k = 2$ . Even for large $C$ ’s BPR outperforms vanilla; at low $C$ the difference is stark. BPR is competitive with dense by processing only $1 5 { - } 3 0 \\%$ of the tokens. " + ], + "image_footnote": [], + "bbox": [ + 503, + 93, + 828, + 309 + ], + "page_idx": 6 + }, + { + "type": "text", + "text": "", + "bbox": [ + 174, + 421, + 823, + 449 + ], + "page_idx": 6 + }, + { + "type": "text", + "text": "In all routing algorithms considered, for $i < j$ , every TOP- $i$ assignment has priority over any TOP- $j$