Title: Getting ViT in Shape: Scaling Laws for Compute-Optimal Model Design
Venue: NeurIPS 2023
Accepted: yes
Keywords: Vision transformer

scaling laws

compute-optimal model design

vision
Abstract: Scaling laws have been recently employed to derive compute-optimal model size (number of parameters) for a given compute duration. We advance and refine such methods to infer compute-optimal model shapes, such as width and depth, and successfully implement this in vision transformers. Our shape-optimized vision transformer, SoViT, achieves results competitive with models that exceed twice its size, despite being pre-trained with an equivalent amount of  compute. For example, SoViT-400m/14 achieves 90.3% fine-tuning accuracy on ILSRCV2012, surpassing the much larger ViT-g/14 and approaching ViT-G/14 under identical settings, with also less than half the inference cost. We conduct a thorough evaluation across multiple tasks, such as image classification, captioning, VQA and zero-shot transfer, demonstrating the effectiveness of our model across a broad range of domains and identifying limitations. Overall, our findings challenge the prevailing approach of blindly scaling up vision models and pave a path for a more informed scaling.

Getting ViT in Shape:

Abstract

Scaling laws have been recently employed to derive compute-optimal model size (number of parameters) for a given compute duration. We advance and refine such methods to infer compute-optimal model shapes , such as width and depth, and successfully implement this in vision transformers. Our shape-optimized vision transformer, SoViT, achieves results competitive with models that exceed twice its size, despite being pre-trained with an equivalent amount of compute. For example, SoViT-400m/14 achieves 90.3% fine-tuning accuracy on ILSRCV2012, surpassing the much larger ViT-g/14 and approaching ViT-G/14 under identical settings, with also less than half the inference cost. We conduct a thorough evaluation across multiple tasks, such as image classification, captioning, VQA and zero-shot transfer, demonstrating the effectiveness of our model across a broad range of domains and identifying limitations. Overall, our findings challenge the prevailing approach of blindly scaling up vision models and pave a path for a more informed scaling.

1 Introduction

The de-facto approach for improving performance of vision and language models today is scale: large models are trained on more data for longer [64, 43, 24, 19, 80, 23, 13, 16]. Empirically, it has been observed that the benefit of scale often follows a predictable power law in which the performance f ( x ) (e.g. error rate or log-perplexity) satisfies f ( x ) ∼ βx -c + ε ∞ for some β, c > 0 as one varies the scaling dimension x (e.g. data or model size), if the remaining dimensions are not bottlenecks [34, 39, 27, 26, 3, 1]. Here, ε ∞ is the irreducible loss.

However, the simple power-law relation becomes more complicated when compute is considered. In this case, power laws are observed only along the compute-optimal frontier. Otherwise, scaling up the model size for a fixed compute budget can deteriorate performance (see [39, 35] and Figure 4). Since one often has a fixed compute budget in mind (e.g. available hardware and time), one should pick the model size that maximizes performance subject to the compute budget constraint, which may imply not training until convergence. Indeed, this approach was used successfully in the recent Chinchilla [35] that outperformed its predecessor Gopher [55] despite being 4 × smaller in size.

Unfortunately, in both [39] and [35] among others, the 'size' of a model is equated with its parameter count, with no special consideration for model 'shape dimensions', such as 'depth' or 'width'. The rationale behind this choice follows from the surprising observation that the transformer shape had little impact on its scaling behavior in language modeling (LM) when performance is measured upstream (e.g. using log-perplexity) [39, 32, 33]. Nevertheless, follow-up analysis suggests that shape plays a pivotal role in other domains, such as in machine translation [47] and also in language modeling for downstream performance [66], with recent works even advocating for extreme aspect ratios, such as a single wide attention layer [12].

500

1000

1500

2000

×1.5

100T

10

20

30

40

50

60

Depth

×2.0

1T

10T

100T

Pre-training compute in GFLOPs

0

5k

10k

15k

MLP dimension

×2.6

1T

10T

100T

100M

1B

Parameters

×6.4

Scaling law

B/16

H/16

g/14

G/14

e/14

In vision, in particular, much earlier works using convolutional neural networks (CNNs) pointed out that the parameter count is indeed a poor predictor of performance. For example, scaling all dimensions [64, 43, 5] in ResNets [29] is more effective than scaling a single dimension such as depth alone. In addition, scaling width [79] is often more effective than depth, especially for small models [36, 58, 75]. Hence, optimizing the 'shape' of transformers seems worthwhile.

In this work, we present SoViT : a s hapeo ptimized vi sion t ransformer [24] that matches the performance of much larger models despite being pre-trained with equal compute. It is derived from a recipe we introduce for optimizing the shape of neural architectures, such as their depth and width. A principled approach for scaling multiple dimensions is advantageous because although one can scale dimensions via brute-force search, this requires extensive computation and often remains sub-optimal [64]. Our recipe allows us to extrapolate without having to conduct an extensive set of experiments. For example, after only 115 experments, we identify a scaling strategy in ViT for all three dimensions: width (internal representation), depth, and MLP size. For comparison, [35] requires over 400 experiments to optimize a single dimension (the parameter count) alone.

One major finding is that small vision models can perform on par with larger ones with the same compute if we optimize their shape. In language, recent works have demonstrated the value of scaled-down architectures, such as the Chinchilla model [35] discussed earlier - a 70B parameter model that outperforms the 280B-parameter Gopher [55] and 175B-parameter GPT3 [13] - as well as LLaMA with its 13B parameter variant outperforming GPT3 on most benchmarks [69]. By introducing SoViT, we establish this phenomenon in vision as well.

Figure 1 summarizes how the various shape dimensions are scaled in SoViT (see Section 3 for derivation). The MLP dimension is scaled faster than depth, which in turn is scaled faster than width. When summarized by their parameter count (rightmost plot), compute-optimal ViTs are smaller than was previously used. With this scaling strategy, we find the shape of a ViT for the computeequivalent of ViT-g/14 [80] pretrained on 16B JFT images [63]. We call this 2 . 5 × smaller model SoViT-400m/14. It achieves 90.3% fine-tuning accuracy on ILSRCV2012 [22] and 82.2% zero-shot accuracy in the locked-image text tuning (LiT) setup [81]. We further evaluate SoViT-400m/14 on captioning, VQA and panoptic segmentation and highlight some results in Figure 2.

Statement of Contribution. In summary, our contribution is to:

Introduce a new method for optimizing the shape of neural networks, such as their depth and width. Our technique expands and improves previous methods by optimizing multiple shape dimensions jointly while requiring significantly fewer experiments.

Demonstrate the effectiveness of scaled-down architectures in vision. We optimize ViT for the compute-equivalent of ViT-g/14, leading to a smaller, faster model of equal quality.

Present new qualitative insights for scaling vision transformers, such as on how to scale individual shape dimensions and how optimal ViT shapes vary across domains.

Conduct extensive evaluation across tasks like image classification, image captioning, VQA, zero-shot classification and panoptic segmentation, identifying both gains and limitations.

MAE-WSP  CoSwinH

ViT-g

SwinV2-G

SoViT

ViT-G

89

90

91

89.7

90.1

90.2

90.2

90.3

90.4

INet-top@1

ViT-L

SoViT

ViT-g

79

81

83

INet-0-shot

ViT-L

SoViT

ViT-g

63

66

69

72

ObjectNet

ViT-L

SoViT

ViT-g

120

123

126

129

COCO-CIDEr

0

400

800

ViT-L

SoViT

ViT-g

# Params (M)

0

200

400

ViT-L

SoViT

ViT-g

GFLOPs / Img

0

500

1000

ViT-L

SoViT

ViT-g

# Imgs / core / s

2 Related Work

Optimizing training for compute has received a significant amount of attention in recent years, partly due to the financial and environmental costs of training large models [52, 55]. However, conflicting results are sometimes reported. For example, in language modeling, [39] argues that the model size should be scaled faster than the data size, implying it is compute optimal to 'undertrain' large models. Similar conclusions are found in [47]. On the other hand, [35] argues that the model size should be scaled uniformly with the data size, and highlights that transformers were not trained long enough, leading to some recent efforts [69] 'overtraining' their models instead. Our analysis for ViT in Section 4 agrees partially with the latter result.

Scaling the size of vision transformers has led to remarkable results achieving, for instance, 90.4% top-1 accuracy on ImageNet (ILSRCV2012) with 2 billion parameters [80] and 90.9% top-1 accuracy with 4 billion parameters [15]. When scaled to 22 billion parameters, ViT exhibits state-of-the-art alignment to human visual perception in terms of shape/texture bias, among other findings [21].

Despite the clear benefit of scale, there has been little investigation into optimally scaling the shape of ViTs. [66] suggest preferentially increasing depth before scaling other dimensions uniformly. For ViT, however, they only consider small ViT-S and ViT-B models and the reported accuracy improvement comes with an increase in FLOPs of up to × 4 , making it difficult to draw conclusions about the suggested shape's quality. In contrast [12] recommend scaling width over depth, but the authors do not observe any improvement when applying their strategy to ViT.

Our analysis draws inspiration from 'compound scaling' in MobileNet [36] and EfficientNet [64], while differing in significant ways. EfficientNet uses an exhaustive grid search to determine the optimal architecture for a fixed increase in compute (e.g. × 2 ). Afterwards, each dimension is scaled up by the same ratio with every subsequent increase in compute. In contrast, we expand scaling laws to simultaneously account for model size and compute beyond the efficient frontier and leverage them to derive the optimal scaling exponents for each dimension separately, as outlined in Section 3.

Throughout our analysis, we use downstream metrics, e.g. ImageNet 10-shot error, when measuring performance instead of upstream metrics. This follows recent reports arguing that upstream performance may not reflect downstream performance in language and vision [65, 80].

We use GFLOPs as a proxy for compute since it is hardware-agnostic and correlates well with actual wall-clock core-hours (see Figure 4). However, GFLOPs can have limitations [5, 20] and may not be a perfect predictor for the metric of interest (e.g. core hours) in all model and hardware types. Note that we focus on scaling the shape of the architecture, not on improving its training protocol, which can be similarly beneficial [5, 67, 62, 68].

3 Scaling Strategy

Notation. We begin with a formal description of the problem. We represent a neural architecture as a tuple x = ( x 1 , x 2 , . . . , x D ) ∈ N D containing D shape dimensions, such as width, depth and MLP size. We denote compute such as GFLOPs by t . We designate f : N D × R + → R a performance metric of interest, such as downstream ImageNet 10-shot error rate. Specifically, f ( x , t ) results from (pre)-training an architecture x for a fixed compute budget t . We always assume that f corresponds to a loss, meaning lower values are better.

/

/

/

˜

/

/

/

/

∮⊗˜√∖⌋(∖√[}√(〉√√}√

/

/

/

˜

/

/

/

∮⊗˜√∖⌋(∖√[}√(〉√√}√

/

/

/

˜

/

/

/

/

∮⊗˜√∖⌋(∖√[}√(〉√√}√

/

/

˜

/

/

/

/

}⌉√√√˜({⊔˜⌈}√√}

}⌉√√√˜({⊔˜⌈}√√}

}⌉√√√˜({⊔˜⌈}√√}

√˜√∐˜˜(∑˜√√⌈˜glyph[arrowtp]]√glyph[arrowbt]

/

}⌉√√√˜({⊔˜⌈}√√}

The goal of optimizing shape for fixed compute t is to identify x glyph[star] (depending on t ) such that:

for some small tolerance glyph[epsilon1] > 0 . Due to modeling assumptions, approximations, and the finite possible number of experiments conducted, we cannot hope for glyph[epsilon1] = 0 and have to tolerate a small excess loss.

Single Dimension. As demonstrated in Figure 3, the shape of a pretrained vision transformer has an impact on its downstream performance. To determine an optimal shape scaling strategy, we begin by considering both compute t and a single shape dimension x k for k ∈ [ D ] , such as depth. In prior works, optimizing a single dimension x k for compute involves running a large number of experiments in order to identify the Pareto optimal frontier, from which power laws on x k or t are derived [39, 35]. Since this is expensive, we propose the following joint functional form instead:

glyph[negationslash]

where α k , a k , β k , b k , c, ξ k , ε k > 0 . Here, f k focuses on the dimension k alone and assumes that all other shape dimensions j = k are sufficiently large such that they do not constitute a bottleneck. We also assume that data is unlimited so that there is no risk of overfitting. We estimate the parameters in (2) by minimizing the relative error. In (2), a k are scaling exponents when varying the corresponding shape dimension in the compute-unbounded regime, c is the data scaling exponent, while b k relates to the impact of the model shape on compute.

Our argument for this particular functional form is six-fold:

If compute is unbounded, we recover the familiar power law relation on model size f k ( x k ) ∼ α k x -a k k + ε k [34, 2, 38, 39]. In addition, increasing the model size x k while keep the data size fixed does not imply that f k ( x k , t ) → ε k because x b k can increase faster than t c in (2).

For any fixed model size, the relation above reduces to the power law f k ( t ) ∼ A t -c + B , where A = β k x b k k + ξ k and B = α k x -a k k + ε k . Since the model size is fixed, t is proportional to the size of the data. Such data scaling laws have been demonstrated extensively in various domains [1-3, 27, 34, 39, 59, 80].

For fixed compute, the relation w.r.t. x k is non-monotone, quasiconvex (see Appendix A), in agreement with empirical measurements [39, 35]. See IsoFlop curves in Figure 4.

Arguments for power law behavior using space partitioning suggest that the exponent c is independent of the shape dimension. In particular, c = Θ(1 /d ) , where d is the intrinsic dimension of the data manifold [2, 38, 59]. From this, we conclude that assuming the functional form in (2) for every shape dimension separately cannot lead to any contradictions since this assumption is satisfied by the decomposable loss:

for some constants ξ, ε ∞ > 0 .

V. When optimizing the shape dimension x k for fixed compute t , the optimal value x glyph[star] k is:

Recall that the scaling exponent s k in (4) is positive because a k , b k , c > 0 . Using the relation (4), we rearrange the terms in Eq. (2), and obtain the scaling law for model performance along the compute-optimal frontier (Appendix A):

for some constants F and G , which is a sum of power law terms involving the model size and compute. Indeed, this decomposition has been demonstrated to hold within the compute-optimal frontier by [39] and [35].

VI. Eq. (2) fits empirical measurements and extrapolates accurately as well, see Figure 4.

Multiple Dimensions. Next, we expand upon the previous approach by incorporating multiple dimensions. To reiterate, our method involves both a functional form (2) and a novel procedure. Our procedure significantly decreases the number of large-scale experiments required to identify compute-optimal architectures, by an order of magnitude compared to prior work [35].

Star Sweep - Conducting a brute-force grid search to estimate scaling parameters across all dimensions is expensive, since it requires O (2 D ) experiments to cover the search space. Instead, we demonstrate that a 'star sweep' is sufficient: (1) starting from a large model x ( c ) (the star center), we vary a single dimension k ∈ [ D ] at a time in an exponentially-spaced grid, such that all values are much smaller than x ( c ) k . In our experiments, for instance, we optimize three shape parameters: width , depth , and MLP dim (see Section 4 for a brief definition of each dimension). Our star center is x ( c ) = (1968 , 40 , 6144) ; i.e. has width 1968, depth 40, and MLP dim 6144. When varying MLP dim in the star sweep, we use the grid (1088 , 1360 , 1728 , 2160 , 2592 , 3072) , corresponding to about 20% increase in each step, while fixing width to 1968 and depth to 40. We do this to ensure that other dimensions do not form a bottleneck when estimating the parameters in (2). This gives us the scaling exponents s k in (4).

Grid Sweep - The second stage is a grid sweep for small models trained for short compute. Depending on the number of shape dimensions involved, the cost of running this grid sweep can be negligible. Its goal is to identify a single architecture x (0) that lies in the Pareto optimal frontier for small compute as illustrated in Figure 3. This is important since a suboptimal x (0) can significantly skew results [5]. Our grid sweep identifies x (0) to be (608 , 10 , 928) , the blue star in Figure 3. The advantage of this step is to absorb the leading coefficients in x glyph[star] k = O ( t s k ) in (4) so that the star sweep focuses on estimating the exponents s k alone. We demonstrate in Figure 5 that the scaling exponents s k are robust to the choice of the evaluation metric f . In Appendix B.3, we discuss important considerations that were taken into account during this analysis.

Scaling. Finally, we scale all dimensions jointly. Starting from the small compute-optimal architecture x (0) and the amount of compute t (0) it is optimal for, suppose we increase compute by a factor τ > 1 (i.e. the new compute is τ t (0) ). By treating this increment τ as a sequence of D smaller increments of size τ w k each with ∑ k w k = 1 , an increase in compute by a factor of τ is accompanied by an increase in every shape dimension k by a factor of τ w k , respectively. In this work, the adopt the simplest strategy of setting w k = 1 /D , but acknowledge that more sophisticated approaches might lead to better results.

4 Shape-optimized ViT

We implement the scaling strategy in Section 3 in vision transformers [24] pretrained on JFT-3B, a proprietary dataset with about 30k classes and around 3 billion examples [80], using the Adam optimizer [41]. As mentioned in Section 3, we focus on optimizing three shape dimensions: width (size of internal representation), depth (number of encoder blocks) and MLP dim (hidden dimension). Following [43, 24, 80], we remove near-duplicate examples between upstream JFT-3B data and all the downstream train and test sets. Appendix B contains the full set of hyper-parameters used in the

0.2

0.5

0.8

0.2

0.5

0.8

Actual

INet-1k 10-shot Accuracy

500

1000

1500

2000

0.45

0.50

0.55

0.60

0.65

INet-1k 10-shot Error

IsoFLOP Curves

1.0 × 10

12

1.5 × 10

12

2.0 × 10

12

10 10

10 11

10 3

10 4

TPU Core Hours

Compute Comparison

Predicted width

GFLOPs

5-shot

10-shot

25-shot

0.0

1.0

2.0

width

5-shot

10-shot

25-shot

0.3

0.6

0.9

depth

5-shot

10-shot

25-shot

0.0

0.7

1.4

MLP

exponent

a

b

c

s

experiments, including full details about the star and grid sweeps described in Section 3. We fix the patch size in our analysis to 14 × 14 , but study 'flexifying' to arbitrary sequence lengths following [7] in Section 5.5.

As an evaluation metric f , we consider two domains: (1) image classification, with ImageNet linear 10-shot error rate as the metric, and (2) image-to-text LiT-decoding following [8]. In the latter case, the evaluation metric f is an average of four perplexity scores: COCO captioning, optical character recognition (OCR), and question answering (VQAv2 and GQA). Refer to [8] for details about the LiT-decoder setup. By considering such distinct domains, our goal is to identify similarities and differences (if any) in how to optimally scale the shape of vision transformers (ViT).

4.1 Image Classification

We use the aforementioned star center x ( c ) = (1968 , 40 , 6144) as our starting point. To estimate the scaling exponents s k in (4) for each dimension separately, we vary width in the grid (608 , 768 , 928 , 1088 , 1328 , 1648) , depth in the grid (8 , 10 , 12 , 16 , 20 , 24) , and MLP dim in the grid (1088 , 1360 , 1728 , 2160 , 2592 , 3072) . As discussed in Section 3, we use an exponential spacing with all values being much smaller than in the star center x ( c ) . Following [24], we evaluate quality using few-shot linear transfer by using pre-trained models to extract features and fitting a linear regression head mapping them to the one-hot encoding of the target labels.

The individual scaling exponents we find are s depth ≈ 0 . 45 , s width ≈ 0 . 22 , and s MLP ≈ 0 . 6 . Importantly, these exponents are quite robust to the choice of the metric. As shown in Figure 5, changing the metric from ImageNet 10-shot to either 5-shot or 25-shot can change the best-fit estimate of the other exponents a k , b k , c k in (2) but the scaling exponent s k is relatively unchanged, since it is formed as a ratio over other exponents. In addition, the data scaling exponent c appears to be independent of the choice of the shape dimension. As mentioned earlier, this is consistent with space partitioning arguments for power law scaling [2, 38, 59].

The estimated scaling exponents s k point to the following picture:

I. MLP dimension should be scaled faster than depth, and depth faster than width.

B/14

B-150m

SoViT-150m

76

77

78

79

80

INet-1k 10-shot Accuracy

76.6

77.9

78.5

33%<

33%>

200%>

76

77

78

79

80

76.4

78.5

78.1

76.7

width

33%<

33%>

200%>

76

77

78

79

80

76.5

78.5

78.8

78.9

depth

33%<

33%>

200%>

76

77

78

79

80

77.1

78.5

78.3

78.6

MLP

The size of ViT, as quantified by its parameter count, is scaled more slowly than the allocated compute. More precisely, for every increment in compute by a factor of 10 , the parameter count of the optimized model shape increases by a factor of ≈ 2 . 5 .

As demonstrated in Figure 1, small ViT models can match the performance of much larger ones when their shape and training duration are jointly optimized for the available compute.

We validate these predictions by optimizing the shape of ViT for the compute-equivalent of ViT-g/14 when the latter is pretrained on 16 billion JFT-3B examples as done in [80]. The resulting model, SoViT-400m/14, is significantly smaller and faster, yet equally competitive. It has a width of 1152, depth 27, and MLP dim 4304. Fine-tuning it on ImageNet results in a 90.3% top-1 accuracy, see Figure 2. Section 5 presents various other evaluations.

In Figure 6, we also optimize the shape of ViT for the compute-equivalent of ViT-B/14 pretrained on 4 billion examples of JFT-3B using Imagenet 10-shot error rate as an evaluation metric, resulting in SoViT-150m/14. It has a width of 880, depth 18, and MLP dim 2320. As shown in Figure 6, optimizing the shape of ViT leads to a significant improvement in performance, from 76.6% in ViT-B/14 to 78.5% in SoViT-150m/14 when both are trained for the same amount of compute. We also vary the optimized shape by decreasing/increasing one dimension at a time and retraining the corresponding model while keeping the total compute fixed. As shown in Figure 6, small deviations from the predicted optimal shape can lead to a notable drop in performance, especially for width since it has the smallest scaling exponent (see Figure 5). We also include in Figure 6 (LEFT) a comparison with a model, denoted B-150m, which has the same shape as ViT-B/14 but the same size as SoViT-150m/14. This confirms that while optimizing the model size improves performance, optimizing the shape improves it even further.

Importantly, the model shapes in Figure 6 bear no resemblance to those observed during the star or grid sweeps. To recall, the star sweep is centered around an architecture x ( c ) whose shape dimensions are significantly larger than in ViT-B/14, whereas the grid sweep pretrains models that are substantially smaller and for only 600M examples. The ability of our strategy to accurately identify a near-optimal model shape within this context underscores its robust extrapolation capability.

4.2 Multitask Decoder

Besides image classification, there has been a significant interest in multimodal applications, mostly fueled by the convergence across language and vision on the transformer architecture [72, 24]. In particular, an encoder-decoder transformer with an autoregressive decoder is a popular choice because it allows reusing pretrained image encoders. We repeat the analysis conducted in Section 4.1 to optimize the shape of the image encoder, while fixing the decoder architecture to two layers as was used in [8]. Further details are provided in Appendix C. As an evaluation metric f , we use the average of four perplexity scores: COCO captioning [48, 14], OCR [50], VQAv2 [28] and GQA [37], without normalization since they share a similar scale. For the learning rate and weight decay hyper-parameters, we conduct a sweep where we vary the learning rate in { 10 -3 , 3 × 10 -4 , 10 -4 } and the weight decay in { 3 × 10 -4 , 10 -4 , 3 × 10 -5 } . We pick the largest learning rate and the corresponding weight decay that result in a stable training run (i.e. smooth training loss curve and gradient norms) for both the largest and smallest image encoder architectures. From this, a learning rate of 3 × 10 -4 and a weight decay of 10 -4 are selected.

Using this analysis, the derived scaling exponents are approximately 0 . 25 , 0 . 49 and 0 . 62 for width , depth and MLP size , respectively. Hence, whereas the optimal shape dimensions in small architectures can be quite different between image classification and multitask decoding, as shown in Figure 3, the scaling exponents are nearly identical, so the same scaling recipe is used in both domains.

5 Evaluations

Overview. We now evaluate SoViT-400M in various contexts to verify whether it broadly matches ViT-g/14's performance, or only in the ILSRCV2012 10-shot metric it was optimized for. The settings we cover are few-shot, frozen linear probes on ImageNet, zero-shot transfer, image-language multitasking including captioning, OCR, and question answering, as well as panoptic segmentation. In each of these settings, we compare SoViT-400m/14 to ViT-L/16 and a ViT-g/14, all trained on the

Compute. Experiments are executed on Tensor Processing Units (TPU). SoViT-400m/14 is pretrained on 40 billion examples, which amounts to 9T GFLOPs and 230K TPUv3 core-hours. ViT-g/14 was pretrained on 16 billion examples, corresponding to 9T GFLOPs and 210K TPUv3 core-hours.

5.1 Image Classification

We verify classification performance in three common and widely useful setups: full fine-tuning, linear probes on the frozen model, and few-shot linear classification.

Fine-tuning on ImageNet. Pre-trained image encoders are most commonly [18] evaluated by finetuning them on the ILSVRC2012 classification task. The detailed fine-tuning settings are provided in Appendix E. One important aspect is to increase image resolution [70] as a way of further increasing the capacity of the pre-trained model during fine-tuning [43]. Table 1 shows the performance of SoViT-400m/14 in comparison with ViT-L/16, ViT-g/14 fine-tuned at various resolutions, along with a few more representative models from the literature. The results confirm that SoViT-400m/14 achieves the goal of matching ViT-g/14 while being significantly smaller.

Linear probing on ImageNet. The quality of the pretrained representation learned by the model is often more directly assessed by performing linear probes , meaning learning a linear classifier on top of unmodified, frozen output features from the model. We present results of this evaluation on the full ImageNet-1k [57] dataset in Table 2, including robustness evaluations of the learned

probe according to ReaL [6], ImageNet-v2 [56], ImageNet-

Renditions [30], ImageNet-Adversarial [31], and Object-

Net [4] testsets. SoViT-400m/14 is generally on par with ViT-g/14 despite its smaller output width.

Broad few-shot linear transfer. We follow [24, 80] and evaluate a closed-form linear regression probe for 10-shot classification across a wide range of classification tasks in Table 3. Again, SoViT400m/14 performs on-par with ViT-g/14 across the board.

5.2 Contrastive image-text tuning

Next, we follow the locked-image text tuning (LiT) recipe [81] on the WebLI dataset [15] to add zero-shot classification abilities to the pre-trained ViT-L/16, SoViT-400m/14 and ViT-g/14 image encoders. In this setup, a new text encoder is trained using the contrastive image-text matching objective [54]. See Appendix D for details. Table 4 (second column) shows that SoViT-400m/14 is competitive with ViT-g/14, and substantially better than ViT-L/16.

5.3 Multitask Decoding

We also evaluate the three pretrained ViT models in multitask decoding as described in Section 4.2, where we follow the setup studied in [8]. We fix the decoder architecture to two layers since it was found to perform well [8]. For evaluation, we report COCO CIDEr [48, 14, 73], OCR [50], VQAv2 [28] and GQA [37] accuracy and log-perplexity. In brief, the CIDEr score measures the similarity between a generated caption and reference captions, considering n -gram statistics, OCR evaluates optical character recognition, whereas both VQAv2 and GQA are question-answering evaluations. Results are summarized in Table 4. SoViT-400M performs on par with ViT-g/14.

5.4 Panoptic Segmentation

Additionally, we evaluate SoViT-400m/14 on panoptic segmentation [42], which is a challenging dense scene understating task by closely following the setup in UViM [44]. At a high level, UViM panoptic segmentation model consists of a visual image encoder and a decoder which maps the image representation to an intermediate code. The code is later decoded to the panoptic segmentation mask using a fixed VQVAE [71] model, which was pretrained on panoptic masks [44]. In our experiments we initialize UViM's image encoder with ViT-L/16, SoViT-400m/14 and ViT-g/14.

Following [44], we train the UViM model using the COCO panoptic dataset (with 512 × 512 input resolution) and report the PQ metric. We achieve 43.5, 43.7 and 44.8 PQ points for ViT-L/16, SoViT-400m/14 and ViT-g/14 respectively. Our results indicate that dense segmentation tasks can be a limitation of the proposed optimal model shape, and a different model shape might be derived in this domain. We leave this investigation for future work.

5.5 Flexifying SoViT-400M

Finally, since we do not include the patch size (sequence length) as part of the shape optimization, we verify that this is not a limitation by flexifying [7] SoViT-400m/14 on ILSVRC2012 for 300 epochs. The performance of the resulting FlexiSoViT-400m is shown in Fig 7 as green

7²

10² 12²14²

16²

17² 21²  24²

32² 37²

Sequence length (at inference)

85%

90%

ImageNet top-1 accuracy

B/32@384px

So/14@224px

B/16@384px

L/16@384px

curve when varying the patch-size at inference time. A

few reference ViT models from Table 1 and [80] are added, confirming that SoViT-400m maintains a clear advantage. It is worth noting that flexifying does not rule out that other patch sizes could be compute-optimal. It merely demonstrates that SoViT-400M continues to perform quite well for other patch sizes when it is flexified.

6 Conclusion

In conclusion, we introduce an efficient method for optimizing the shape of neural architectures and successfully apply it to vision transformers. Our analysis demonstrates that smaller models, trained at their optimal architecture shape for the right amount of compute, can match much larger models.

Acknowledgments and Disclosure of Funding

We thank Mostafa Dehghani, Andreas Steiner, Daniel Keysers, Neil Houlsby, Sam Smith, David Schneider-Joseph, Rodolphe Jenatton and the anonymous reviewers for their valuable feedback and discussions. We also thank the Google DeepMind unit at large for providing a supportive research environment. We use the big_vision codebase [10, 9] for conducting experiments in this project.

References

Alabdulmohsin, I., Neyshabur, B., and Zhai, X. (2022). Revisiting neural scaling laws in language and vision. In Advances in neural information processing systems (NeurIPS) . 1, 4

Bahri, Y., Dyer, E., Kaplan, J., Lee, J., and Sharma, U. (2021). Explaining neural scaling laws. arXiv preprint arXiv:2102.06701 . 4, 6

Bansal, Y., Ghorbani, B., Garg, A., Zhang, B., Krikun, M., Cherry, C., Neyshabur, B., and Firat, O. (2022). Data scaling laws in NMT: The effect of noise and architecture. arXiv preprint arXiv:2202.01994 . 1, 4

Barbu, A., Mayo, D., Alverio, J., Luo, W., Wang, C., Gutfreund, D., Tenenbaum, J., and Katz, B. (2019). Objectnet: A large-scale bias-controlled dataset for pushing the limits of object recognition models. Advances in neural information processing systems , 32. 9

Bello, I., Fedus, W., Du, X., Cubuk, E. D., Srinivas, A., Lin, T.-Y ., Shlens, J., and Zoph, B. (2021). Revisiting resnets: Improved training and scaling strategies. Advances in neural information processing systems (NeurIPS) . 2, 3, 5

Beyer, L., Hénaff, O. J., Kolesnikov, A., Zhai, X., and van den Oord, A. (2020). Are we done with imagenet? CoRR , abs/2006.07159. 8, 9, 19, 20

Beyer, L., Izmailov, P., Kolesnikov, A., Caron, M., Kornblith, S., Zhai, X., Minderer, M., Tschannen, M., Alabdulmohsin, I., and Pavetic, F. (2023a). Flexivit: One model for all patch sizes. In CVPR . 6, 9

Beyer, L., Wan, B., Madan, G., Pavetic, F., Steiner, A., Kolesnikov, A., Pinto, A. S., Bugliarello, E., Wang, X., Yu, Q., Chen, L.-C., and Zhai, X. (2023b). A study of autoregressive decoders for multi-tasking in computer vision. 6, 7, 9, 17

Beyer, L., Zhai, X., and Kolesnikov, A. (2022a). Better plain vit baselines for imagenet-1k. 10

Beyer, L., Zhai, X., and Kolesnikov, A. (2022b). Big vision. https://github.com/ google-research/big_vision . 10

Boyd, S. P. and Vandenberghe, L. (2004). Convex optimization . Cambridge university press. 15

Brown, J. R., Zhao, Y., Shumailov, I., and Mullins, R. D. (2022). Wide attention is the way forward for transformers. arXiv preprint arXiv:2210.00640 . 1, 3

Brown, T., Mann, B., Ryder, N., Subbiah, M., Kaplan, J. D., Dhariwal, P., Neelakantan, A., Shyam, P., Sastry, G., Askell, A., et al. (2020). Language models are few-shot learners. Advances in neural information processing systems (NeurIPS) . 1, 2

Chen, X., Fang, H., Lin, T.-Y., Vedantam, R., Gupta, S., Dollár, P., and Zitnick, C. L. (2015). Microsoft coco captions: Data collection and evaluation server. arXiv preprint arXiv:1504.00325 . 7, 9, 10

Chen, X., Wang, X., Changpinyo, S., Piergiovanni, A., Padlewski, P., Salz, D., Goodman, S., Grycner, A., Mustafa, B., Beyer, L., Kolesnikov, A., Puigcerver, J., Ding, N., Rong, K., Akbari, H., Mishra, G., Xue, L., Thapliyal, A., Bradbury, J., Kuo, W., Seyedhosseini, M., Jia, C., Ayan, B. K., Riquelme, C., Steiner, A., Angelova, A., Zhai, X., Houlsby, N., and Soricut, R. (2022). Pali: A jointly-scaled multilingual language-image model. 3, 9

Chowdhery, A., Narang, S., Devlin, J., Bosma, M., Mishra, G., Roberts, A., Barham, P., Chung, H. W., Sutton, C., Gehrmann, S., et al. (2022). Palm: Scaling language modeling with pathways. arXiv preprint arXiv:2204.02311 . 1

Cimpoi, M., Maji, S., Kokkinos, I., Mohamed, S., and Vedaldi, A. (2014). Describing textures in the wild. In Proceedings of the IEEE Conf. on Computer Vision and Pattern Recognition (CVPR) . 9

Code, P. W. (2023). Papers With Code: ImageNet Benchmark. https://paperswithcode. com/sota/image-classification-on-imagenet . [Online; accessed 16-May-2023]. 8

Dai, Z., Liu, H., Le, Q. V ., and Tan, M. (2021). Coatnet: Marrying convolution and attention for all data sizes. Advances in neural information processing systems (NeurIPS) . 1, 8

Dehghani, M., Arnab, A., Beyer, L., Vaswani, A., and Tay, Y. (2022). The efficiency misnomer. In ICLR . 3

Dehghani, M., Djolonga, J., Mustafa, B., Padlewski, P., Heek, J., Gilmer, J., Steiner, A., Caron, M., Geirhos, R., Alabdulmohsin, I., Jenatton, R., Beyer, L., Tschannen, M., Arnab, A., Wang, X., Riquelme, C., Minderer, M., Puigcerver, J., Evci, U., Kumar, M., van Steenkiste, S., Elsayed, G. F., Mahendran, A., Yu, F., Oliver, A., Huot, F., Bastings, J., Collier, M. P., Gritsenko, A., Birodkar, V ., Vasconcelos, C., Tay, Y., Mensink, T., Kolesnikov, A., Paveti´ c, F., Tran, D., Kipf, T., Luˇ ci´ c, M., Zhai, X., Keysers, D., Harmsen, J., and Houlsby, N. (2023). Scaling vision transformers to 22 billion parameters. 3

Deng, J., Dong, W., Socher, R., Li, L.-J., Li, K., and Fei-Fei, L. (2009). Imagenet: A large-scale hierarchical image database. In Conference on Computer Vision and Pattern Recognition (CVPR) . 2, 9

Devlin, J., Chang, M.-W., Lee, K., and Toutanova, K. (2018). Bert: Pre-training of deep bidirectional transformers for language understanding. arXiv preprint arXiv:1810.04805 . 1

Dosovitskiy, A., Beyer, L., Kolesnikov, A., Weissenborn, D., Zhai, X., Unterthiner, T., Dehghani, M., Minderer, M., Heigold, G., Gelly, S., et al. (2020). An image is worth 16x16 words: Transformers for image recognition at scale. International Conference on Representation Learning (ICLR) . 1, 2, 5, 6, 7, 9

Fei-Fei, L., Fergus, R., and Perona, P. (2004). Learning generative visual models from few training examples: An incremental bayesian approach tested on 101 object categories. Conference on Computer Vision and Pattern Recognition (CVPR) Workshops . 9

Ghorbani, B., Firat, O., Freitag, M., Bapna, A., Krikun, M., Garcia, X., Chelba, C., and Cherry, C. (2021). Scaling laws for neural machine translation. arXiv preprint arXiv:2109.07740 . 1

Gordon, M. A., Duh, K., and Kaplan, J. (2021). Data and parameter scaling laws for neural machine translation. In Conference on Empirical Methods in Natural Language Processing . 1, 4

Goyal, Y., Khot, T., Summers-Stay, D., Batra, D., and Parikh, D. (2017). Making the v in vqa matter: Elevating the role of image understanding in visual question answering. In CVPR . 7, 9, 10

He, K., Zhang, X., Ren, S., and Sun, J. (2016). Deep residual learning for image recognition. In Conference on Computer Vision and Pattern Recognition (CVPR) . 2

Hendrycks, D., Basart, S., Mu, N., Kadavath, S., Wang, F., Dorundo, E., Desai, R., Zhu, T., Parajuli, S., Guo, M., Song, D., Steinhardt, J., and Gilmer, J. (2021a). The many faces of robustness: A critical analysis of out-of-distribution generalization. ICCV . 9

Hendrycks, D., Zhao, K., Basart, S., Steinhardt, J., and Song, D. (2021b). Natural adversarial examples. CVPR . 9

Henighan, T., Kaplan, J., Katz, M., Chen, M., Hesse, C., Jackson, J., Jun, H., Brown, T. B., Dhariwal, P., Gray, S., et al. (2020). Scaling laws for autoregressive generative modeling. arXiv preprint arXiv:2010.14701 . 1

Hernandez, D., Kaplan, J., Henighan, T., and McCandlish, S. (2021). Scaling laws for transfer. arXiv preprint arXiv:2102.01293 . 1

Hestness, J., Narang, S., Ardalani, N., Diamos, G., Jun, H., Kianinejad, H., Patwary, M., Ali, M., Yang, Y., and Zhou, Y. (2017). Deep learning scaling is predictable, empirically. arXiv preprint arXiv:1712.00409 . 1, 4

Hoffmann, J., Borgeaud, S., Mensch, A., Buchatskaya, E., Cai, T., Rutherford, E., Casas, D. d. L., Hendricks, L. A., Welbl, J., Clark, A., et al. (2022). Training compute-optimal large language models. In Advances in neural information processing systems (NeurIPS) . 1, 2, 3, 4, 5

Howard, A. G., Zhu, M., Chen, B., Kalenichenko, D., Wang, W., Weyand, T., Andreetto, M., and Adam, H. (2017). MobileNets: Efficient convolutional neural networks for mobile vision applications. arXiv preprint arXiv:1704.04861 . 2, 3

Hudson, D. A. and Manning, C. D. (2019). GQA: a new dataset for compositional question answering over real-world images. arXiv preprint arXiv:1902.09506 . 7, 9, 10

Hutter, M. (2021). Learning curve theory. arXiv preprint arXiv:2102.04074 . 4, 6

Kaplan, J., McCandlish, S., Henighan, T., Brown, T. B., Chess, B., Child, R., Gray, S., Radford, A., Wu, J., and Amodei, D. (2020). Scaling laws for neural language models. arXiv preprint arXiv:2001.08361 . 1, 3, 4, 5

Kather, J. N., Weis, C.-A., Bianconi, F., Melchers, S. M., Schad, L. R., Gaiser, T., Marx, A., and Z"ollner, F. G. (2016). Multi-class texture analysis in colorectal cancer histology. Scientific reports , 6:27988. 9

Kingma, D. P. and Ba, J. (2014). Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980 . 5

Kirillov, A., He, K., Girshick, R., Rother, C., and Dollar, P. (2019). Panoptic segmentation. In Conference on Computer Vision and Pattern Recognition (CVPR) . 9

Kolesnikov, A., Beyer, L., Zhai, X., Puigcerver, J., Yung, J., Gelly, S., and Houlsby, N. (2020). Big transfer (BiT): General visual representation learning. In European Conference on Computer Vision (ECCV) . 1, 2, 5, 8

Kolesnikov, A., Susano Pinto, A., Beyer, L., Zhai, X., Harmsen, J., and Houlsby, N. (2022). UViM: A unified modeling approach for vision with learned guiding codes. Advances in neural information processing systems (NeurIPS) . 9

Krause, J., Stark, M., Deng, J., and Fei-Fei, L. (2013). 3d object representations for fine-grained categorization. In 4th International IEEE Workshop on 3D Representation and Recognition (3dRR-13) , Sydney, Australia. 9

Krizhevsky, A. (2009). Learning multiple layers of features from tiny images. Technical report. 9

Li, Z., Wallace, E., Shen, S., Lin, K., Keutzer, K., Klein, D., and Gonzalez, J. (2020). Train big, then compress: Rethinking model size for efficient training and inference of transformers. In International Conference on Machine Learning (ICML) . 1, 3

Lin, T.-Y., Maire, M., Belongie, S., Hays, J., Perona, P., Ramanan, D., Dollár, P., and Zitnick, C. L. (2014). Microsoft coco: Common objects in context. In ECCV . 7, 9

Liu, Z., Hu, H., Lin, Y., Yao, Z., Xie, Z., Wei, Y ., Ning, J., Cao, Y ., Zhang, Z., Dong, L., et al. (2022). Swin transformer v2: Scaling up capacity and resolution. In Proceedings of the IEEE/CVF conference on computer vision and pattern recognition , pages 12009-12019. 3, 8

Mishra, A., Shekhar, S., Singh, A. K., and Chakraborty, A. (2019). OCR-VQA: Visual question answering by reading text in images. In ICDAR . 7, 9, 10

Parkhi, O. M., Vedaldi, A., Zisserman, A., and Jawahar, C. V. (2012). Cats and dogs. In IEEE Conference on Computer Vision and Pattern Recognition . 9

Patterson, D., Gonzalez, J., Le, Q., Liang, C., Munguia, L.-M., Rothchild, D., So, D., Texier, M., and Dean, J. (2021). Carbon emissions and large neural network training. arXiv preprint arXiv:2104.10350 . 3

Pham, H., Dai, Z., Ghiasi, G., Kawaguchi, K., Liu, H., Yu, A. W., Yu, J., Chen, Y.-T., Luong, M.-T., Wu, Y., et al. (2021). Combined scaling for zero-shot transfer learning. arXiv preprint arXiv:2111.10050 . 18

Radford, A., Kim, J. W., Hallacy, C., Ramesh, A., Goh, G., Agarwal, S., Sastry, G., Askell, A., Mishkin, P., Clark, J., et al. (2021). Learning transferable visual models from natural language supervision. In ICML . 9

Rae, J. W., Borgeaud, S., Cai, T., Millican, K., Hoffmann, J., Song, F., Aslanides, J., Henderson, S., Ring, R., Young, S., et al. (2021). Scaling language models: Methods, analysis & insights from training gopher. arXiv preprint arXiv:2112.11446 . 1, 2, 3

Recht, B., Roelofs, R., Schmidt, L., and Shankar, V. (2019). Do imagenet classifiers generalize to imagenet? CoRR , abs/1902.10811. 8, 9

Russakovsky, O., Deng, J., Su, H., Krause, J., Satheesh, S., Ma, S., Huang, Z., Karpathy, A., Khosla, A., Bernstein, M. S., Berg, A. C., and Fei-Fei, L. (2014). Imagenet large scale visual recognition challenge. CoRR , abs/1409.0575. 8

Sandler, M., Howard, A., Zhu, M., Zhmoginov, A., and Chen, L.-C. (2018). MobileNetV2: Inverted residuals and linear bottlenecks. In Conference on Computer Vision and Pattern Recognition (CVPR) . 2

Sharma, U. and Kaplan, J. (2022). Scaling laws from the data manifold dimension. Journal of Machine Learning Research , 23. 4, 6

Shazeer, N. and Stern, M. (2018). Adafactor: Adaptive learning rates with sublinear memory cost. In International Conference on Machine Learning (ICML) . 16, 17, 18

Singh, M., Duval, Q., Alwala, K. V., Fan, H., Aggarwal, V., Adcock, A., Joulin, A., Dollár, P., Feichtenhofer, C., Girshick, R., et al. (2023). The effectiveness of mae pre-pretraining for billion-scale pretraining. arXiv preprint arXiv:2303.13496 . 3, 8

Steiner, A. P., Kolesnikov, A., Zhai, X., Wightman, R., Uszkoreit, J., and Beyer, L. (2022). How to train your vit? data, augmentation, and regularization in vision transformers. Transactions on Machine Learning Research . 3

Sun, C., Shrivastava, A., Singh, S., and Gupta, A. (2017). Revisiting unreasonable effectiveness of data in deep learning era. In International Conference on Computer Vision (ICCV) . 2

Tan, M. and Le, Q. (2019). EfficientNet: Rethinking model scaling for convolutional neural networks. In International Conference on Machine Learning (ICML) . 1, 2, 3

Tay, Y., Dehghani, M., Abnar, S., Chung, H. W., Fedus, W., Rao, J., Narang, S., Tran, V. Q., Yogatama, D., and Metzler, D. (2022a). Scaling laws vs model architectures: How does inductive bias influence scaling? arXiv preprint arXiv:2207.10551 . 3

Tay, Y., Dehghani, M., Rao, J., Fedus, W., Abnar, S., Chung, H. W., Narang, S., Yogatama, D., Vaswani, A., and Metzler, D. (2022b). Scale efficiently: Insights from pre-training and fine-tuning transformers. In International Conference on Representation Learning (ICLR) . 1, 3

Touvron, H., Cord, M., Douze, M., Massa, F., Sablayrolles, A., and Jégou, H. (2021). Training data-efficient image transformers & distillation through attention. In International Conference on Machine Learning (ICML) . 3

Touvron, H., Cord, M., and Jégou, H. (2022). DeiT III: Revenge of the ViT. In Computer VisionECCV 2022: 17th European Conference, Tel Aviv, Israel, October 23-27, 2022, Proceedings, Part XXIV , pages 516-533. Springer. 3

Touvron, H., Lavril, T., Izacard, G., Martinet, X., Lachaux, M.-A., Lacroix, T., Rozière, B., Goyal, N., Hambro, E., Azhar, F., Rodriguez, A., Joulin, A., Grave, E., and Lample, G. (2023). Llama: Open and efficient foundation language models. 2, 3

Touvron, H., Vedaldi, A., Douze, M., and Jégou, H. (2019). Fixing the train-test resolution discrepancy. Advances in neural information processing systems , 32. 8

Van Den Oord, A., Vinyals, O., et al. (2017). Neural discrete representation learning. Advances in neural information processing systems (NeurIPS) . 9

Vaswani, A., Shazeer, N., Parmar, N., Uszkoreit, J., Jones, L., Gomez, A. N., Kaiser, Ł., and Polosukhin, I. (2017). Attention is all you need. Advances in neural information processing systems (NeurIPS) . 7

Vedantam, R., Lawrence Zitnick, C., and Parikh, D. (2015). Cider: Consensus-based image description evaluation. In CVPR . 9

Welinder, P., Branson, S., Mita, T., Wah, C., Schroff, F., Belongie, S., and Perona, P. (2010). Caltech-UCSD Birds 200. Technical Report CNS-TR-2010-001, California Institute of Technology. 9

Wu, Z., Shen, C., and Van Den Hengel, A. (2019). Wider or deeper: Revisiting the resnet model for visual recognition. Pattern Recognition . 2

Yang, Y. and Newsam, S. (2010). Bag-of-visual-words and spatial extensions for land-use classification. In ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (ACM GIS) . 9

Yu, J., Wang, Z., Vasudevan, V., Yeung, L., Seyedhosseini, M., and Wu, Y. (2022). CoCa: Contrastive captioners are image-text foundation models. arXiv preprint arXiv:2205.01917 . 8

Yuan, L., Chen, D., Chen, Y.-L., Codella, N., Dai, X., Gao, J., Hu, H., Huang, X., Li, B., Li, C., et al. (2021). Florence: A new foundation model for computer vision. arXiv preprint arXiv:2111.11432 . 3

Zagoruyko, S. and Komodakis, N. (2016). Wide residual networks. arXiv preprint arXiv:1605.07146 . 2

Zhai, X., Kolesnikov, A., Houlsby, N., and Beyer, L. (2022a). Scaling vision transformers. In Conference on Computer Vision and Pattern Recognition (CVPR) . 1, 2, 3, 4, 5, 7, 8, 9, 10

Zhai, X., Wang, X., Mustafa, B., Steiner, A., Keysers, D., Kolesnikov, A., and Beyer, L. (2022b). LiT: Zero-shot transfer with locked-image text tuning. In CVPR , pages 18123-18133. 2, 9

A Scaling Laws Analysis

In this appendix, we present proofs of two claims in the paper. First, we show that (2) is quasiconvex on its first argument x k . Second, we derive (5).

A.1 Quasiconvexity Proof

We assume throughout the proof that a k , b k are strictly positive, otherwise f k ( x k , t ) is a monotone function on its first argument and the statement holds trivially.

To establish the quasiconvexity of f k ( x k , t ) in (2), we observe that:

Setting the derivative to zero gives the unique solution in R + :

.

At the limit x k →∞ , the term involving x -a k k vanishes and we have the asymptotic relation:

which is an increasing function since b k > 0 . Since ˆ x is the only point in R + where ∂f k /∂ x k = 0 , we conclude that f ( x k , t ) is monotone increasing for all x k ≥ ˆ x .

Similarly, when x k → 0 + , we have:

From this and (2), we obtain:

where we plugged in the last expression. Simplifying yields (5) for some constants F, G ≥ 0 .

which is monotone decreasing. Therefore, f ′ ( x k , t ) ≤ 0 for all x k ≤ ˆ x . Combining both results implies that f k ( x, t ) is monotone decreasing in the domain x ∈ (0 , ˆ x ) and is monotone increasing in the domain x ∈ (ˆ x, ∞ ) .

A function f ( y ) is said to be quasi-convex if for any y 1 and y 2 in its domain and any λ ∈ [0 , 1] , one has [11]:

Suppose for the purpose of obtaining a contradiction that f k ( x k , t ) is not quasiconvex on its first argument. Then, there exists two points y 1 , y 2 ∈ R + and λ ∈ [0 , 1] such that the above condition is violated. Let ˆ y = λy 1 +(1 -λ ) y 2 . But, then, by the mean-value theorem, there must exist two points c 1 ∈ [ y 1 , ˆ y ] and c 2 ∈ [ˆ y, y 2 ] where:

with c 2 > c 1 . This implies that c 1 ≥ ˆ x and c 2 ≤ ˆ x , which is a contradiction. Therefore, f k ( x k , t ) is quasi-convex on its first argument.

A.2 Derivation of (5)

Rearranging the expression in (4), we have:

B Shape Optimization

B.1 Hyper-parameters

Table 5 provides the set of hyperparameters used in the star and grid sweeps. We use a small batch size of 128 here in order to train multiple models in parallel on small hardware topologies.

B.2 Star Sweep

In the star sweep, we use the center x ( c ) = (1968 , 40 , 6144) as our starting point. To estimate the scaling exponents s k in (4) for each dimension separately, we vary width in the grid (608 , 768 , 928 , 1088 , 1328 , 1648) , depth in the grid (8 , 10 , 12 , 16 , 20 , 24) , and MLP dim in the grid (1088 , 1360 , 1728 , 2160 , 2592 , 3072) . We train each model on 500K, 1M, and 2M steps. We always fix the patch size to 14 × 14 and the number of attention heads to 16.

B.3 Grid Sweep

In the grid sweep, we pretrain each architecture on 600M examples. We use the cross-product of:

width :

416 , 512 , 608 , 768

depth : 6 , 8 , 10 , 12

MLP Size : 768 , 928 , 1088 , 1360

Some important considerations to be taken into account include:

When designing the grid sweep, we made sure that the compute-optimal model selected lies strictly in the interior of the grid, not on its boundary. This is because if it lies at the boundary (e.g. its depth is the maximum depth used in the grid), one cannot determine if it is compute-optimal or if increasing that dimension will yield even better models. This can be an iterative process, in which additional grid points are added to the sweep if necessary.

When identifying the model, we ensured that it is compute-optimal for a good range of compute (not only at some isolated point). Since the model is now compute-optimal for a range of compute budgets, we select as a starting point in our recipe the least compute it is optimal for. For example, if a model is compute-optimal for computes ranging from 1 TFLOPs to 2 TFLOPs, we use 1 TFLOPS in our recipe. In other words, we err on the side of caution, giving preference to larger models as we scale up the vision transformer (ViT).

Generally, the grid sweep should be tightly packed; e.g. with increments of 20% only in each dimension. By contrast, increments in the star sweep should be large in order to identify the scaling exponents reliably.

Even though the goal in the grid sweep is to identify a 'small' architecture that is computeoptimal for a 'small' amount of compute, the amount of compute used in the analysis should be large enough for results to be reliable and for power laws to take effect. That is why in our experiments, we use > 100M training examples in the grid sweep as opposed, for instance, to using only a few million examples.

C Multitask Decoding Setup

Table 6 summarizes the hyperparameter settings for the multitask decoding setup in Section 4.2 and Section 5.3. We always fix the decoder to 2 layers since it generally performs well [8].

D LiT Training Setup

Table 7 summarizes the hyperparameter settings for the locked-image text turning (LiT) setup, which is used to report zero-shot classification accuracy in Table 4. We use a large batch size of 32K in this setup because it improves the performance of contrastive training [53].

E Transfer to ImageNet-1k

E.1 Full model fine-tuning

Table 8 lists the settings for the ImageNet-1k fine-tuning results presented in Table 1 in the main paper. The only three settings which differ across resolutions are learningrate decay, random augment and mixup strenghts. We did explore various learningrates, training durations (mostly shorter) as well as Polyak averaging, although the same setting shown in the table appears to be best across the board. Finally, we list various other settings which we did not explore. We simply used good default values from experience.

E.2 Linear probe on frozen encoder

We take the image representation at the pre-logits, i.e. the 1152-dimensional vector that comes out of the MAP-head and feeds right into the linear classification layer. For each of ViT-L/16, SoViT-400m/14 and ViT-g/14, we perform a grid-search over the following settings, and select the best-performing model on minival (2% of train) to be reported in Table 2: Augmentation : resize(256)|random_crop(224) vs. inception_crop(224) , learning rate : 0.001 , 0.0003 , 0.0001 , epochs : 1 , 3 , 10 , weight decay : 0.0001 , None . It should be noted that we keep various other settings to 'known good defaults' based on prior explorations with similar models (i.e. plain ViTs). Table 9 summarizes key settings.

Peer reviews:
{"IS_META_REVIEW": false, "comments": "SUMMARY:\nScaling laws in LLMs have typically been used to derive compute optimal model sizes. In fact one of the initial scaling laws papers in language modeling has indicated that as long as the model size is kept constant, the model shape (corresponding to embedding dim, mlp ratio, number of heads, depth) are not as important for performance. This paper on the contrary discovers that in the case of a Vision Transformer, given an equivalent amount of compute it is indeed feasible to design parameter and inference cost optimal models. These models are competitive with the larger models or outperform them on different tasks. Based on these observations the paper presents qualitative insights for scaling individual shape dimensions of a vision transformer across domains. Further the models derived based on these insights are evaluated on several computer vision tasks.\n\nSTRENGTHS:\nThe paper empirically investigates the effect of optimizing shapes of vision transformers to yield competitive models at a fraction of parameter size. Given the parameter and inference cost efficiency this finding is quite impactful towards designing hardware aware vision transformers. \nFurthermore, though the empirical investigation is expensive it is at a cost of significantly fewer experiments in comparison to previous scaling laws studies. The paper is very well written and clear in most parts.\n\nWEAKNESSES:\nThe insights derived in the paper are very important and impactful. However since this is more of an empirical investigation to derive scaling behaviours I find the paper lacks originality. Also the scaling methodology and behaviour would very likely change for different vision applications which also use transformers eg: superresolution, self-supervised learning. Scaling behaviors might also change for different transformer types (swin, deit etc). Deriving scaling laws for every application would mean repeating the analysis, which would incur significant computational cost. Furthermore since the JFT dataset and the code of the paper is not open-sourced the analysis and observations derived are not reproducible. For Zero shot transfer, Linear probes only and imgnet finetuning ViT-G/14 still seems to dominate in most cases, hence I am not very convinced if the representations learned by the SoViT-400m are indeed comparably or more effective than the ones learnt by ViT-G/14.\n\nQUESTIONS:\n1. For given parameter size, does optimizing shape i.e trading-off dimensions while parameter size is held constant help? This was not found to not be helpful in [Kaplan et-al](https://arxiv.org/abs/2001.08361) and it would be interesting to know the observations in this study. \n2. How closely are the laws derived tied to the size of the pre-training dataset, would the observations be similar if the laws were studied on imagenet for example?\n3. Could the authors report the total TPU-hours/cost of analysis?\n4. Minor:  Should scaling “vision transformations” be scaling “vision transformers”? Line 70\n5. How does this analysis compare to NAS methods (eg: [AutoFormer ](https://openaccess.thecvf.com/content/ICCV2021/papers/Chen_AutoFormer_Searching_Transformers_for_Visual_Recognition_ICCV_2021_paper.pdf)) which automatically derive optimal shapes? What are the advantages and disadvantages between these? \n7. How hyper-parameters are set for different shapes is unclear to me. Could you please clarify this?\n8. What do the question marks in Table 1 indicate?\n9. ViT-g/14 seems to work better for multitask decoding in table-3. Do the authors have an intuition of why that could be? \n\nIf all my concerns and questions are addressed appropriately I am willing to increase my score for the paper.\n\nLIMITATIONS:\nThe limitations of the work are not adequately discussed:\n1. The compute cost of the analysis?\n2. Reproducibility of the experiments?\n3. Are there any implicit assumptions which may effect the laws derived empirically in the paper?\n\nI encourage the authors to discuss these limitations in the paper.", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2023-07-06"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThe authors study the recent empirical insight that test performance follows a predictable power-law structure in terms of (optimally-allocated) compute and extend this notion to take into account the “shape” parameters of underlying model such as width, depth etc. They demonstrate that power-law behaviour can indeed be leveraged to design a strategy to explore the shape space, enabling a significant decrease in the amount of computation needed, compared to a naive grid search. The authors focus on the class of vision transformers and show that their discovered shape-optimal models match or outperform larger models (trained with same compute) while at the same time offering more efficient inference.\n\nSTRENGTHS:\n1. The idea to leverage the (predictable) powerlaw behaviour of test performance to determine the ideal shape of a network is very well founded, and it’s very surprising that nothing similar has been done before. The results show that is indeed worthwile to optimize for the shape of vision transformers, as one can apparently achieve similar performance with a significantly smaller model.\n2. An important quality of this work which in my opinion goes beyond most previous work on scaling behaviour is that the predictability is actively leveraged to reduce the search space of compute optimal models. By devising the so-called star-sweep strategy, the amount of compute needed is strongly reduced (albeit still very large).\n3. The experimental setup is very extensive and the discovered architecture is evaluated on a broad range of tasks, ensuring that its optimality is not just an artifact of optimizing for ImageNet downstream accuracy.\n\nWEAKNESSES:\nThe definitions of some terms in this paper are sometimes unclear or never really stated. The most prominent and important one is compute **t**. Its definition seems to switch from context to context, which makes it difficult to follow. As far as I understood, compute **t** refers to the total compute, i.e. how many samples/tokens, training epochs and FLOPs per forward pass are needed. In other parts of the text compute seems to be referred as the number of samples solely, e.g. in line 127, compute unbounded seems to mean infinite sample size. Similarly in line 133, how can compute be fixed if the model size can be scaled arbitrarily (and compute is a function of model size)? In general I find it confusing that equation (2) depends both on compute **t** and shape parameter x_k, while **t** iself is actually also dependent on $x_k$, i.e.  $t(x_k)$. Wouldn’t it be cleaner to simply replace compute **t** by the number of samples? I would appreciate if the authors could elaborate on this. I don’t think this has any major implications for the results but a clarification would certainly enhance readability. \n\nSimilarly, a quick definition of width, MLP dimension and depth could be helpful for readers less familiar with the details of vision transformers.\n\nQUESTIONS:\n1. How does each shape parameter (i.e. width, MLP dim and depth) contribute to the total number of FLOPs for say, a single forward pass? Is it for instance “cheaper” to make a ViT wider compared to adding another layer?  What about wall-clock time and memory? It would be nice to at least have an approximate understanding of how the FLOP count is affected by these shape dimensions.\n2. Something that is maybe clear and I missed it, but were the ViTs that you compare against, i.e. VIT-G/14 and ViT-g/14, considered “compute-optimal” before this work, and thus a “valid baseline”?\n3. How does flexifying the architecture rule out that other patch sizes could be shape-optimal? The corresponding section is very short unfortunately (for space reasons I assume) but it would be great if the authors could expand on this.\n\nLIMITATIONS:\nThe authors have addressed the limitations of their work.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2023-07-06"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper proposes a novel and empirical take on the design of large vision transformers (ViTs), in the continuity of a previous paper aiming at optimizing the training of transformers.\nWhereas the previous paper was aiming to optimize a single parameter (optimal model size) given a fixed training budget, this paper goes one step further and attempts to discover the optimal ViT architecture (that is 3 parameters: token dimension, depth, MLP size) given a fixed training budget. \nThe paper empirically solves this question via numerous experiments, while answering related questions and distilling interesting insights on the way.\n\nSTRENGTHS:\n### Writing\n- The introduction is well written and clear\n- quite complex and unclear at times\n\n### Method \n- The optimization method is novel and an improvement w.r.t. the \"optimal model size\" paper, as it can deal with multiple hyper-parameters while requiring much less experiments.\n- The insights about the choice of the joint functional form (eq. (2)) are interesting and well-grounded\n- Definitely a valuable paper for the community, even though some aspects could be improved\n\n### Experiments\n- multiple experiments on several benchmarks support the initial claim that a smaller-but-optimal architecture achieves as well as vanilla SotA architectures\n- Experimental findings are useful and valuable (Section 4.1)\n- it is nice to see that other tasks than image classification are being experimented with, and that the findings hold for a wide variety of downstream tasks\n\nWEAKNESSES:\n### Exposition\n- line 57: \"Figure 1: The MLP dimension is scaled faster than depth, which in turn is scaled faster than width.\" --> I do not find this to be clear, looking at Figure 1\n\n### Method\n- The scaling parameters defined in eq (4) seems central in the analysis. Unfortunately, I'm not sure to understand exactly what it is and where it comes from. In particular, I don't understand why it should be invariant to the choice of the shape dimension (see Figure 5)\n- About the difference between small and large models\n  - it is claimed that \"in small models, an optimal shape in one domain is not necessarily optimal in others.\" (Figure 3)\n  - How are \"small\" and \"large\" models exactly defined? This seems like a very convenient subjective definition.\n  - Why does the model size matter so much when it comes to the optimal architecture across application domains?\n\n### Experiments\n- Figure 6: \n  - \"while keeping compute fixed.\" --> how exactly? Does this mean other model hyper-parameters are decreased to keep the same model complexity? Or does this mean the training is short/longer?\n  - the supposedly optimal model is clearly not optimal, since increasing the depth or MLP size results in (slightly) better performance. Since there experiments are on a relatively \"small\" model, according to the paper, does this mean the claims do not hold anymore? (see above)\n\nQUESTIONS:\nI'm ready to upgrade my rating if the authors clarify some of the points mentioned above.\n\nLIMITATIONS:\nyes", "TITLE": "Official Review", "RECOMMENDATION": 6, "REVIEWER_CONFIDENCE": 5, "SOUNDNESS_CORRECTNESS": 4, "DATE": "2023-07-06"}

{"IS_META_REVIEW": false, "comments": "SUMMARY:\nThis paper introduces an efficient approach to investigate the scaling laws for compute-optimal model shapes, such as model width and depth. It proposes a shape-optimized vision transformer called SoViT. \nA comprehensive evaluation across various tasks highlights the effectiveness of the proposed architecture. SoViT-400m/14 achieves 90.3% fine-tuning accuracy on ILSRCV2012, surpassing  ViT-g/14 with a larger model size. This study makes a valuable contribution to the design of vision transformers and is expected to have a certain degree of impact in this era.\n\nSTRENGTHS:\n1. The paper is well-written, with well-defined formulas and sufficient supporting materials.\n2. The three shape parameters are analyzed well. The paper proposes star sweep and grid sweep strategies to investigate the scaling laws avoiding the expensive search cost.\n3. Extensive experiments are implemented to validate the method, including image classification,  multitask decoding, and segmentation tasks.\n\nWEAKNESSES:\n1. Figure 3. is challenging to understand, and it may benefit from more elaborate annotations and explanations to clarify the significance of certain data points within the figure.\n2. For the experiments, SoViT-400m/14 can surpass ViT-g/14 for the image classification task. However, SoViT-400m/14 does not show a significant advantage over ViT-g/14 and ViT-L/16 in other tasks, such as the OCR and VQA. The detail of metrics such as Log-PPL and CIDEr in Table 4. should be explained in the paper.\n3. A few typos in the paper, such as x_{k} in A.1 Quasiconvexity Proof.\n\nQUESTIONS:\n1. Figure 6. indicates that deviating from the optimal depth/MLP configuration does not lead to performance degradation. Furthermore, the evidence supporting the superiority of the optimal shape is limited, and it seems that only three experiments (33%<, 33%>, 200%) were conducted, as shown in the Figure.\n2. The compute-optimal model shape is different among tasks. How to search for an optimal model which can be applied to various downstream tasks?\n\nLIMITATIONS:\nAs above.", "TITLE": "Official Review", "RECOMMENDATION": 7, "REVIEWER_CONFIDENCE": 4, "SOUNDNESS_CORRECTNESS": 3, "DATE": "2023-07-08"}